Meta Long Memory Search: How RAG Principles Solve the Long-History Problem in Ad Ranking
Meta's engineering team describes how they adapted retrieval-augmented generation techniques—normally used for text—to solve the problem of long user engagement history in ads recommendation. By indexing each person's past interactions as retrievable units and using Maximal Marginal Relevance to balance relevance with diversity, the system selects a compact set of historically relevant signals per ad request instead of feeding an ever-growing sequence into the ranking model. The post details infrastructure choices (time-based chunking, quantized representations, vector databases, asynchronous preparation) that keep retrieval within real-time latency budgets, and reports a 1% click-through rate lift on Facebook Feed and Reels.
Meta's ads recommendation systems face a tension that is easy to state and hard to resolve: larger models can learn more complex relationships, but they are limited by how much user history they can process. The default solution—keeping only the last N events or days—filters noise and stays within budget, but it discards relevant history and applies the same cutoff to every person regardless of how long their actual consideration cycle is.
Meta's engineering team now describes a different approach in a blog post published on December 4, 2026. They call it Meta Long Memory Search Modeling, and its core idea is straightforward: treat the history-scaling problem as a retrieval problem rather than a sequence-length problem. Each ad request generates a query encoding signals like recency, user cohort, ad category, and interest topics. A person's eligible engagement history is organized into retrievable units across time and topic—similar to document chunks in text-based RAG. A retrieval model scores those units against the query, and the selected entries become additional context for the ranking model.
The analogy to RAG for large language models is deliberate and structural. In text-based RAG, someone's question is the query, a corpus is the document store, a retriever selects relevant passages, and those passages augment the model's context. Meta mirrors each step: the ad request is the query, engagement history is the corpus, the retrieval model selects relevant past signals, and those signals augment the ranking model as embeddings, training examples, or events for user sequence models.