Meta's engineering team details how they adapted Retrieval-Augmented Generation (RAG) principles to ads recommendation systems, overcoming the computational limits of linear history scaling through vector indexing, time-based chunking, and Maximal Marginal Relevance.
Read original on Meta EngineeringTraditional recommendation models typically rely on a short-term window of user interactions (LastN) to filter noise and maintain low inference latency. However, discarding long-term user history leads to catastrophic forgetting of seasonal preferences and evolving user interests. Scaling history linearly introduces severe bottlenecks in storage, compute, and real-time serving costs.
To solve the scalability and relevance challenges, Meta adapted the four core components of a Retrieval-Augmented Generation pipeline to manage user history as a retrievable document store rather than a continuous sequence.
Ranking systems must operate within strict millisecond latency budgets. Meta achieved minimal serving overhead through specific infrastructure choices, including asynchronous index preparation before requests arrive, quantization of learned representations into compact numeric formats, and nearest-neighbor search over a vector index.
Dual Application Architecture
The long-memory architecture serves both online inference (providing historical embeddings as ranking features) and offline training (replaying older training examples to counter catastrophic forgetting).
Want the fundamentals behind stories like this? Take the free System Design Academy course with certificate.