Foundation Model for Ads Recommendation at Scale

meta · Tech · 2025 · source Agentic: no · promotional bias: med · source-backed · extracted with prompt 0.5.6 (schema v2)

Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.

Problem

Domain: large-scale ads recommendation and personalization

Meta needed an LLM-scale foundation model for ads recommendation that could learn from sparse, multimodal, cross-surface user-ad interactions, improve hundreds of latency-sensitive vertical models, and train efficiently across thousands of GPUs.

Constraints:

Architecture

GEM is Meta's LLM-scale ads recommendation foundation model. It learns from ad content plus organic and ads engagement, separates sequence and non-sequence features, applies customized attention and cross-feature learning, uses Wukong-style stackable factorization machines, pyramid-parallel sequence processing, InterFormer cross-feature learning, and multi-domain optimization. Post-training, GEM transfers knowledge into hundreds of vertical models through direct and hierarchical distillation, student adapters, representation learning, and parameter sharing, all backed by a re-engineered distributed training stack.

Diagram confidence: reconstructed (reconstructed from prose).

flowchart LR
  ad-and-engagement-data[Ad and engagement data]
  feature-derivation-pipeline[Feature derivation pipeline]
  sequence-modeling-stack[Sequence modeling stack]
  non-sequence-interaction-stack[Non-sequence interaction stack]
  cross-feature-learning-layer[Cross-feature learning layer]
  gem-foundation-model[GEM foundation model]
  knowledge-transfer-layer[Knowledge transfer layer]
  vertical-ads-models[Vertical ads models]
  training-infrastructure[Training infrastructure]
  ad-and-engagement-data --> feature-derivation-pipeline
  feature-derivation-pipeline --> sequence-modeling-stack
  feature-derivation-pipeline --> non-sequence-interaction-stack
  sequence-modeling-stack --> cross-feature-learning-layer
  non-sequence-interaction-stack --> cross-feature-learning-layer
  cross-feature-learning-layer --> gem-foundation-model
  gem-foundation-model --> knowledge-transfer-layer
  gem-foundation-model --> training-infrastructure
  knowledge-transfer-layer --> vertical-ads-models
  knowledge-transfer-layer --> gem-foundation-model
  training-infrastructure --> gem-foundation-model
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
Ad and engagement data Provides ad content, user engagement, organic interactions, advertiser goals, creative formats, and measurement signals. Feature derivation pipeline
Feature derivation pipeline Separates sequence features such as activity history from non-sequence features such as user attributes and ad format. Sequence modeling stack, Non-sequence interaction stack
Non-sequence interaction stack Uses enhanced Wukong stackable factorization machines and cross-layer attention to model user-ad feature interactions. Cross-feature learning layer
Sequence modeling stack Uses pyramid-parallel modules and offline feature infrastructure to process long user behavior histories. Cross-feature learning layer
Cross-feature learning layer Uses InterFormer-style parallel summarization and interleaving to preserve sequence information while learning interactions across features. GEM foundation model
GEM foundation model LLM-scale ads recommendation model that learns cross-surface representations and generates knowledge for downstream ads models. Knowledge transfer layer, Training infrastructure
Knowledge transfer layer Transfers GEM knowledge to vertical models through direct transfer, hierarchical transfer, distillation, representation learning, student adapters, and parameter sharing. Vertical ads models, GEM foundation model
Vertical ads models Latency-sensitive user-facing models for specific surfaces and objectives that consume transferred GEM knowledge. Knowledge transfer layer
Training infrastructure Provides multi-dimensional parallelism, custom GPU kernels, memory optimizations, PyTorch compilation, NCCLX communication, and online refresh training. GEM foundation model

Data flow

Ad and organic engagement data are converted into sequence features such as user activity history and non-sequence features such as user attributes, ad format, and creative representation. GEM models these paths with customized attention, Wukong blocks, pyramid-parallel sequence modules, and InterFormer cross-feature learning. Its foundation-model outputs are then transferred into vertical production models using distillation, representation learning, parameter sharing, and student adapters that refresh teacher outputs with recent ground truth.

3 supporting quotes
“GEM is trained on ad content and user engagement data from both ads and organic interactions.”article, stated
“Customized attention mechanisms are applied to each group independently, while also enabling cross-feature learning.”article, stated
“To translate the performance of the GEM foundation model (FM) into measurable gains for user-facing VMs, we employ both direct and hierarchical knowledge transfer strategies.”article, stated

Why this architecture

Meta built GEM as a foundation model because ads recommendation had become too sparse, multimodal, and cross-surface for isolated ranking models to capture efficiently. The architecture preserves long user histories, enables cross-feature and cross-domain learning, and then transfers foundation-model knowledge into smaller vertical models so production serving can benefit without paying full foundation-model inference cost.

3 supporting quotes
“Every day, billions of user-ad interactions occur across our platforms, but meaningful signals — such as clicks and conversions — are very sparse.”article, stated
“GEM solves this through learning from cross-surface user interactions while ensuring predictions remain tailored to each surface’s unique characteristics.”article, stated
“This lets smaller, latency-sensitive VMs leverage the rich representations and pre-learned patterns of FMs without incurring their full computational cost.”article, stated

Models used: GEM · Wukong architecture · InterFormer · domain-specific foundation models · vertical models · Student Adapter

Scale

Alternatives considered (roads not taken)

train recommendation surfaces in isolation

Rejected because: Isolated surface models miss valuable cross-platform signals from Meta's broader ecosystem.

“treating surfaces either in isolation (thus missing valuable cross-platform insights) or identically (ignoring platform-specific behaviors).”article, stated

treat all Meta surfaces identically

Rejected because: Facebook, Instagram, and Business Messaging have distinct objectives and behavior patterns that need domain-specific optimization.

“Different Meta surfaces like Facebook, Instagram, and Business Messaging each have unique user behaviors and interaction patterns.”article, stated

compress user behavior sequences into compact vectors before downstream modeling

Rejected because: Compression can lose engagement signals, so GEM preserves full sequence information while still enabling cross-feature learning.

“Existing approaches compress user behavior sequences into compact vectors for downstream tasks, which risks losing critical engagement signals.”article, stated

use standard knowledge distillation alone

Rejected because: Meta uses direct and hierarchical transfer plus additional techniques to achieve better transfer effectiveness across the ads model fleet.

“Together, these approaches use a suite of techniques, including knowledge distillation, representation learning, and parameter sharing to maximize transfer efficiency”article, stated

serve full foundation-model computation in every latency-sensitive vertical model

Rejected because: Parameter sharing lets smaller vertical models reuse foundation-model representations without paying the full compute cost.

“This lets smaller, latency-sensitive VMs leverage the rich representations and pre-learned patterns of FMs without incurring their full computational cost.”article, stated

Patterns

retrieval-ranking (ranking-personalization)

GEM is a foundation model for ads ranking and recommendation, using user-ad histories and cross-surface signals to improve ad relevance and conversion predictions.

“GEM introduces architectural innovations that unlock efficient scaling laws, delivering performance gains that scale cost-effectively with data and compute.”article, stated
“GEM has driven a paradigm shift in ads RecSys, transforming ad performance across the funnel — awareness, engagement, and conversion”article, stated

fine-tuning-adaptation (model-adaptation)

Meta uses post-training, continuous online refresh, student adapters, representation learning, and parameter sharing to adapt GEM's knowledge into downstream production models.

“Post-training, GEM applies advanced knowledge transfer techniques to amplify the performance of downstream models across the entire ads stack”article, stated
“Unlike in large language models, we also perform continuous online training to refresh the FMs.”article, stated

eval-driven-development (model-quality)

GEM's production loop uses recent ground-truth outcomes to correct stale or mismatched teacher signals before supervising vertical models.

“VMs often suffer from stale supervision caused by delays in FM training and evaluation as well as domain mismatches between GEM or FM predictions”article, stated
“It learns a transformation that better aligns teacher predictions with observed outcomes, ensuring that student models receive more up-to-date and domain-relevant supervision”article, stated

Tradeoffs

Use a unified foundation model with domain-specific optimization.

Chose cross-surface learning with tailored predictions per surface over isolated per-surface models or one identical treatment for all surfaces.

Rationale: GEM captures shared cross-platform insights while still optimizing each surface for its own behavior and objective.

“GEM solves this through learning from cross-surface user interactions while ensuring predictions remain tailored to each surface’s unique characteristics.”article, stated

Preserve full sequence information during cross-feature learning.

Chose InterFormer parallel summarization and interleaving over compressing user behavior sequences into compact vectors.

Rationale: Preserving sequence structure avoids losing critical behavioral signals while still enabling efficient interaction learning.

“This allows progressively refining its sequence understanding while maintaining access to the complete user journey.”article, stated

Transfer foundation-model knowledge into smaller vertical models.

Chose direct and hierarchical transfer plus parameter sharing over serving the full foundation model everywhere.

Rationale: Latency-sensitive vertical models can use GEM's representations without full foundation-model compute.

“This lets smaller, latency-sensitive VMs leverage the rich representations and pre-learned patterns of FMs without incurring their full computational cost.”article, stated

Use lightweight variants during exploration.

Chose lower-cost model variants for over half of experiments over running every experiment on full-sized GEM.

Rationale: Smaller variants accelerate idea validation and reduce resource overhead before large-scale training.

“In the exploration phase, we accelerate iteration using lightweight model variants at a much lower cost compared to full-sized models.”article, stated
“These variants support over half of all experiments, enabling faster idea validation with minimal resource overhead.”article, stated

Gotchas (what bit them)

Ads recommendation signals are extremely sparse despite massive interaction volume.

Root cause: Clicks and conversions are rare relative to billions of impressions, creating class imbalance and noisy learning conditions.

Resolution: Train a foundation model over large-scale cross-surface data and architecture designed to generalize across diverse users and behaviors.

“Every day, billions of user-ad interactions occur across our platforms, but meaningful signals — such as clicks and conversions — are very sparse.”article, stated

Long user behavior sequences are hard for traditional recommender architectures.

Root cause: Thousands of clicks, views, and interactions create computational and storage pressure.

Resolution: Use pyramid-parallel sequence modeling and scalable offline feature infrastructure for long histories.

“traditional architectures struggle to process such long sequences efficiently. GEM overcomes this challenge with a pyramid-parallel structure”article, stated

Compressed sequence vectors lose important engagement signals.

Root cause: Downstream compact representations can discard details from the full user journey.

Resolution: Use InterFormer to preserve full sequence information while learning cross-feature interactions.

“GEM takes a different approach that preserves full sequence information while enabling efficient cross-feature learning.”article, stated

Teacher signals can become stale or misaligned for vertical models.

Root cause: Foundation-model training and evaluation lag behind current outcomes, and surfaces have distinct objectives.

Resolution: Use a Student Adapter to refine teacher outputs with recent ground-truth data.

“These outdated or misaligned signals between the VMs (students) and GEM (the teacher) can degrade the accuracy and adaptability of student models over time.”article, stated
“To address this, we use a Student Adapter during training, a lightweight component that refines the teacher’s outputs using the most recent ground-truth data.”article, stated

Scaling recommender foundation models can waste GPU capacity without system-level optimization.

Root cause: Dense and sparse components create different communication, memory, and synchronization bottlenecks at thousands-of-GPU scale.

Resolution: Use HSDP for dense parameters, two-dimensional sparse parallelism for embeddings, custom kernels, compilation, memory compression, and NCCLX collectives.

“Training large models, like GEM, requires carefully orchestrated parallelism strategies across both dense and sparse components.”article, stated

Evaluation

Meta evaluates GEM through online conversion lift, ad-performance gain per data/compute, transfer effectiveness to vertical models, training FLOPS and MFU efficiency, startup/compilation time, and scaling behavior as data, compute, and surfaces increase.

Metrics: 5% Instagram ad conversion increase and 3% Facebook Feed conversion increase in Q2 · 4x efficiency improvement over original ads ranking models · 2x effectiveness of standard knowledge distillation · 23x effective training FLOPS, 1.43x MFU, and 16x more GPUs · 5x reduced job startup time · 7x reduced PyTorch 2.0 compilation time · over half of experiments supported by lightweight model variants

3 supporting quotes
“GEM’s launch across Facebook and Instagram has delivered a 5% increase in ad conversions on Instagram and a 3% increase in ad conversions on Facebook Feed in Q2.”article, stated
“delivers a 23x increase in effective training FLOPs using 16x more GPUs while also improving efficiency.”article, stated
“We reduced job startup time by 5x through optimizing trainer init, data reader setup, checkpointing, and PyTorch 2.0 compilation time”article, stated

Outcomes

The system runs at LLM scale for ads recommendation, learning from billions of user-ad interactions, training across thousands of GPUs, transferring to hundreds of vertical models, and processing sequences of up to thousands of user events.

3 supporting quotes
“GEM is already driving significant increases in ad conversions across Instagram and Facebook.”article, stated
“This will enable us to continue scaling up the amount of training capacity we use on GEM at an attractive ROI.”article, stated
“These learnings from GEM will be extended to cover all major surfaces across Facebook and Instagram.”article, stated