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

F3 Lightning: How Meta Accelerates Ads ML Features to Production at Scale

F3 Lightning decouples feature releases from shared execution in Meta's ads ML feature framework, so each of 20,000+ features is compiled, validated, deployed and rolled back independently instead of shipping as one all-or-nothing merged DAG. To recover the CPU efficiency lost when features stopped sharing computation, it uses content-derived stable node identifiers, a single startup-built execution plan flattened into an ordered list, one shared per-request memory buffer with a separate readiness vector, and dense integer slot indexing in place of hash lookups. Features reach production about 3.6x faster with no added compute cost. The broader lessons are to separate release boundaries from execution boundaries, to move request-invariant work to startup, and to treat memory layout and duplicate copies as costing as much CPU as redundant computation.

Assumes: directed acyclic graphsML feature servingCPU cache localitytopological sort

Related posts

  • 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): Scaling the Central Model and Compute Engine for Frontier Ads AI

    Meta Engineering hardMaster

    Meta's 2026 GEM replaces per-surface ads ranking models with a single central recommendation foundation model trained across Facebook, Instagram, Reels and deep-funnel conversion objectives, reporting 18.9% conversion and 12% CTR gains. Its new Kunlun architecture uses block-sparse attention, a GDPA kernel that unifies attention-like ops, MoE-style cross interaction with expert parallelism, component skipping (43% fewer FLOPs) and unified user sequences. Together these support 2.5x model complexity and an LLM-like scaling law, with prediction quality following a power law in sequence length. Intelligence reaches latency-bound vertical models through LoopFM precomputed structured representations, which double transfer effectiveness over plain distillation, and through Solaris speculative precomputation of user-ad embeddings with hierarchical fallback. Custom low-precision kernels and 5D parallelism reach 20-25% MFU at 4x the training FLOPs.

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

  • Sequence learning: A paradigm shift for personalized ads recommendations

    Meta Engineering hardMaster

    Meta replaced its DLRM ads ranking models, which depended on thousands of hand-engineered aggregated sparse features, with sequence learning over event-based features (EBFs). These features preserve the order and fine-grained attributes of a person's engagement and conversion events. An event model compresses per-attribute embeddings and adds timestamp encodings, and a transformer-based sequence model uses multi-headed attention pooling keyed by the candidate ad, cutting attention cost from O(N²) to O(M·N). Variable-length sequences are made production-viable through jagged tensor support in PyTorch, GPU kernels, Jagged Flash Attention, quantization and vector quantization. The result was a 2-4% conversion lift on select segments, with plans to scale sequences 100x and explore linear attention and state space models.

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

The quest for software engineering knowledge.

Look:
Layout: