ReadingResearchRadarInvestment framework
Sign in / Sign up
← Back to reading
NewsMaterial3 min readDisconfirmAI Editorial

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.

2026-12-05 02:56 GMT+8

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.

Sign in / Sign up
ReadingResearchRadarInvestment framework

One design choice distinguishes this from naive retrieval. Recent behavior tends to repeat itself, so the closest matches to a request are often near-copies of the same recent interest. These matches are highly relevant but add little new information, and they can crowd out the older signals that motivated including a longer history in the first place. Meta addresses this with Maximal Marginal Relevance (MMR): each candidate is scored both on how well it fits the current decision—measured against the person's interests and the ad being ranked—and on how different it is from what has already been selected. A candidate that closely duplicates something already in the set is penalized even if it is relevant on its own. The result is that a recent interest, a recurring one, and a longer consideration cycle can all be represented rather than one interest repeated many times.

On the infrastructure side, the system must rank a large number of candidate ads per request within a tight latency budget. Four design choices keep retrieval feasible: time-based chunking groups consecutive days into coarser weekly units to reduce what must be stored and searched; learned representations are quantized into compact numeric formats to cut memory and bandwidth; history is indexed in a vector database so retrieval finds strong matches quickly instead of scanning full histories; and indexing and preparation occur asynchronously before a request arrives, keeping that work off the latency-critical path.

The system has two applications that share a common pipeline. At inference time, retrieved historical embeddings serve as added features for ranking models—a recurring interest can inform a relevant ranking decision months later while the decision remains grounded in the current request. At training time, older training examples are retrieved and replayed in a second pass to counter catastrophic forgetting, teaching models when longer-horizon signals matter.

Meta reports that the system has been in production for major ads ranking models since 2025, delivering a 1% click-through rate lift on Facebook Feed and Reels and a 1.2% conversion rate lift, while being 5-10x more efficient on compute than linear history scaling. These figures are vendor self-reported and lack independent verification or detailed baseline comparison disclosures. The architectural reasoning, however, is clearly laid out and transferable: for any system where history grows faster than models can absorb it, selective retrieval with diversity constraints offers a middle path between truncation and brute-force scaling.

Sources

  • engineering.fb.comEngineering at Meta↗
Continue researching →