Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Meta Engineering 8 min read Case study easyNovice

Design Once, Deploy at Scale: Building a Template-Driven ML Ecosystem

Meta standardized its fragmented ads ranking model fleet into a small set of Standard Model Templates (SMT). These are opinionated, composable bundles of architecture, feature logic, training settings and hardware-aware serving configs, so that new techniques are tuned once on representative models and propagated to every model on a template. Multi-model optimization weighs aggregate gain against regression rate, then validates on held-out models before a technique enters the next template version. Over two years this cut per-model engineering time by 92%, shipped 80 techniques across 5000+ technique-model combinations, and delivered 0.63% average offline quality gain at neutral serving capacity plus 0.86% cumulative online lift. The templates also give AI agents a bounded search space for automated model improvement.

Related posts

  • How Meta Uses AI Agents to Scale ML Innovations Across Ads Ranking Models

    Meta Engineering easyNovice

    Meta uses AI agents to propagate proven ranking-model techniques (e.g. Wukong layers, Interformer, training optimizations) across a large, heterogeneous fleet of ads ranking models, where a technique rarely transfers without adaptation. Agents handle discovery (ranking technique-model candidates by expected transferability), generalization (template-level and bespoke per-model adaptation learned from engineers), and adoption (launching multi-day training runs, narrowing hyperparameter searches, diagnosing failures, reallocating GPU capacity). Each stage is evaluated separately: precision/recall for discovery, scaled-down screening then NE and guardrails for generalization, and human-intervention counts for adoption. Agents now drive over 60% of propagation, with reported 3x engineer productivity, a median 4x training-compute reduction on select combinations, and an estimated $45M+ in compute savings.

  • Meta Adaptive Ranking Model: Bending the Inference Scaling Curve to Serve LLM-Scale Models for Ads

    Meta Engineering hardMaster

    Meta Adaptive Ranking Model serves LLM-scale ads ranking models (O(10 GFLOPs) per token, O(1T) parameters) at O(100 ms) latency by routing each request to an appropriately complex model and computing user signals once per request instead of once per ad candidate. Key techniques include in-kernel broadcast of request-level embeddings, the Wukong Turbo architecture refinements, GPU-offloaded feature preprocessing, selective FP8 post-training quantization, operator fusion with grouped GEMM, and multi-GPU embedding sharding, reaching 35% MFU across heterogeneous hardware. Launched on Instagram in Q4 2025, it delivered +3% ad conversions and +5% CTR for targeted users.

  • Meta’s Generative Ads Model (GEM): The Central Brain Accelerating Ads Recommendation AI Innovation

    Meta Engineering hardMaster

    GEM is Meta's LLM-scale foundation model for ads recommendation, trained on thousands of GPUs and used as a teacher to improve hundreds of downstream vertical ranking models; it lifted ad conversions 5% on Instagram and 3% on Facebook Feed. The architecture handles non-sequence features with an extended Wukong design (stackable factorization machines), long user-behavior sequences with a pyramid-parallel structure, and cross-feature learning with InterFormer, plus multi-domain learning across surfaces, for 4x the efficiency of earlier ranking models. Knowledge reaches downstream models through direct and hierarchical transfer that combines distillation with a Student Adapter for stale supervision, representation learning and parameter sharing, which Meta reports as 2x as effective as standard distillation. A rebuilt training stack (HSDP for dense layers, 2D sharding of embedding tables, jagged-sequence kernels, FP8 activations, SM-free NCCLX collectives, compile caching) delivered 23x effective FLOPs with 1.43x MFU on 16x more GPUs.

  • From User Sequences to Scaling Laws: A Multi-Stage Architecture for Meta’s Ads Ranking

    Meta Engineering hardMaster

    Meta scales sequence learning for ads ranking by splitting it into two stages: an offline transformer user model processes thousands of user events asynchronously and caches user-level embeddings, and a lightweight online ranking model combines those embeddings with fresh signals and ad candidates under strict latency budgets. Dense tokenization folds sparse features into a single vocabulary, and target-aware multi-head attention weighs past behavior against the ad being scored, so feature interactions are learned rather than hand-engineered. The system shows LLM-style log-linear scaling of normalized entropy with compute. Scaling works best when depth, width and sequence length grow together, and diverse action-type sequences beat homogeneous ones. Together with other model work it contributed to 6% more conversions on Instagram and 3% on Facebook.

  • Ranking Engineer Agent (REA): The Autonomous AI Agent Accelerating Meta’s Ads Ranking Innovation

    Meta Engineering easyNovice

    Meta's Ranking Engineer Agent (REA) runs ads ranking ML experiments end to end with little human involvement. It generates hypotheses, launches training jobs, debugs failures and iterates. A hibernate-and-wake mechanism lets it persist across multi-week training runs, and it draws hypotheses from a historical experiment insights database and a deep ML research agent. Engineers approve a GPU budget up front for a three-phase plan (validation, combination, exploitation), and a runbook of common failure patterns lets REA handle out-of-memory errors, loss explosions and infrastructure errors without escalating them. In its first rollout REA doubled average model accuracy over baseline across six models, and three engineers delivered launch proposals for eight models, work that previously took two engineers per model.

The quest for software engineering knowledge.

Look:
Layout: