Skip to content

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

Meta Engineering 10 min read Case study mediumAdept

Turning Opportunistic AI Inference Capacity Into Better Ads Recommendations

Meta aggregates locally idle inference capacity, stranded by peak provisioning, delivery timing, resource-ratio and accelerator-type mismatches, into a preemptible opportunistic pool used to improve ads recommendations. Two elasticity levers consume it: Rank More Ads (RMA) raises the number of candidates through the ranking stages and needs both CPU and accelerator surplus, while Serve Better Models (SBM) routes a larger share of requests to a more powerful model and needs only accelerator surplus. Baseline serving is protected by physical isolation for SBM and a logical global budget for RMA. A PID controller driven by tail latency sets RMA candidate volume, and an explore/exploit router picks SBM requests by request value. Because the central loops act on the order of minutes, millisecond-level value-aware load shedding on both servers and clients removes low-value optional work when capacity is suddenly reclaimed.

Related posts

  • Intelligent Delivery: Making Every Unit of Compute Serve Better Ads

    Meta Engineering mediumAdept

    Meta's Intelligent Delivery is an ML-driven layer that allocates serving compute across requests, models, hardware fleets and ranking stages by predicting the marginal utility of each unit of compute, adding about 10% ads ranking performance since 2017. A shared Resource Core Model (6B sparse, 20M dense parameters) runs before retrieval and is fine-tuned into predictors of outcome, compute cost and latency, improving identification of high-impact requests by about 20% offline. A hierarchy of decision engines then routes traffic between regions, matches workloads to CPU/GPU/MTIA SKUs, and solves per-host constrained optimization under tail-latency SLOs. AI agents now propose and run about 20% of optimizations, cutting tuning cycles from months to weeks, with engineers approving every change.

  • Taming the tail utilization of ads inference at Meta scale

    Meta Engineering hardMaster

    Meta tightened the server utilization distribution of its ads inference fleet, letting it absorb 35% more load with no added capacity, cut timeout errors by two-thirds and halve p99 latency. Routing-side fixes used power-of-two-choices with polled rather than piggybacked load to avoid staleness, and tuned Shard Manager placement bands and thresholds. Deeper system changes treated memory bandwidth as a placement resource, since memory latency climbs sharply above roughly 65-70% utilization. Other changes included a per-model 'outstanding examples CPU' load counter to fix multi-tenant imbalance, budgets that gate snapshot transitions on utilization, a feedback controller balancing traffic across hardware tiers, and predictive replica scaling up to two hours ahead. CPU utilization proved a poor load signal because it is time-aggregated and misses I/O-bound work.

  • 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.

  • 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.

  • 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: