← Technology, Science & Infrastructure ▣ Distilled locally

Meta Long Memory Search Modeling: How Meta Is Scaling Extended History Context for Ads Recommendation Modeling

Engineering at Meta
December 4, 2026  ·  Engineering at Meta ↗

Meta continues to scale the AI behind its ads recommendation system, from sequence learning to foundation models such as GEM trained at LLM scale. This model scaling helps people discover businesses they care about and advertisers reach the right customers.

Although larger models can learn more complex relationships between people and ads, they’re limited by how much data history they can use. Long-term patterns, such as seasonal shopping habits and evolving interests, carry signals that short history windows miss. The default approach to history, LastN, keeps only the last N events or days for use in ads recommendations. LastN is simple and filters noise, but it discards relevant history and applies the same cutoff to every person.

Scaling history beyond LastN poses three interrelated challenges:

Meta Long Memory Search Modeling is Meta’s approach to treating history scaling as a retrieval problem. Similar to retrieval-augmented generation (RAG) for LLMs, it treats engagement history as a document corpus and each ad request as a query, then retrieves a subset of relevant and diverse past signals. This allows Meta’s ads recommendation systems to leverage important long-history context while staying within tight constraints, resulting in better ads for people on our platforms and stronger value to our advertisers.

The Solution: Meta Long Memory Search Modeling

Meta Long Memory Search Modeling: How Meta Is Scaling Extended History Context for Ads Recommendation Modeling
Figure 1: Meta Long Memory Search Modeling ingests long user history to improve ads ranking models.

Design Approach

Meta Long Memory Search Modeling adapts the four parts of a RAG pipeline (query, index, retrieval, and augmentation) to extended user history. In RAG for LLMs, someone’s question is the query, a text corpus is the document store, a retriever selects relevant passages, and those passages are added to the model’s context. Meta Long Memory Search Modeling mirrors each step:

Meta Long Memory Search — Model

Meta Long Memory Search Modeling: How Meta Is Scaling Extended History Context for Ads Recommendation Modeling
Figure 2: Indexed history is retrieved using a RAG-like design.

Retrieval quality depends on more than finding the strongest matches. 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 also crowd out older signals that motivated including a longer history in the first place.

To balance relevance with diversity, Meta Long Memory Search Modeling uses Maximal Marginal Relevance (MMR). Each candidate is scored on how well it fits the current decision, measured against both the person’s current interests and the ad being ranked, and 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’s relevant on its own.

Balancing relevance with diversity lets us cover more history. A recent interest, a recurring one, and a longer consideration cycle can all be represented, rather than one interest repeated many times. For advertisers, this results in broader coverage of intent because our systems draw on the different reasons a person might be interested in an ad, not just the most recent one.

Meta Long Memory Search — Infrastructure

Meta’s ads systems rank a large number of candidate ads for every request within a tight latency budget. All data preprocessing, including Long Memory search and summarization, has to fit inside this budget while being efficient enough to extend across ranking models rather than serve a single model.

A few design choices allow Meta Long Memory Search Modeling to function within these constraints:

Each of these is a separate lever — for index cost, storage and transport, or latency — and together have kept Meta Long Memory Search Modeling retrieval with minimal overhead.

Applications

Meta Long Memory Search Modeling has multiple applications that share a common pipeline but target different stages of ads ranking. At inference time, we can retrieve historical embeddings that ranking models use as added features. At training time, we can retrieve older training examples and replay them in a second training pass to counter forgetting.

Meta Long Memory Search Modeling: How Meta Is Scaling Extended History Context for Ads Recommendation Modeling

Meta Long Memory Search Modeling: How Meta Is Scaling Extended History Context for Ads Recommendation Modeling
Figure 3: Online ranking improvements via retrieval of historical representations.

For embeddings, a recurring interest can inform a relevant ranking decision months later, while the decision remains grounded in the current request. For advertisers, this helps ad opportunities align with consideration cycles that don’t fit a recent window. For training data, ranking models can leverage useful older patterns instead of forgetting them, and learn when longer-horizon signals should matter. And they do it without reprocessing the entire user history.

Meta Long Memory Search Modeling: How Meta Is Scaling Extended History Context for Ads Recommendation Modeling

The embeddings and training data applications reinforce each other. Training data teaches models when longer-horizon signals are useful, and online retrieval then makes those signals available within a ranking request. Because both applications share infrastructure, improvements made for one can benefit the other.

Impact and Future Work

Meta Long Memory Search Modeling has been deployed into production for major ads ranking models since 2025. In production, selective long-horizon learning delivered a 1% click-through rate lift for ads on Facebook Feed and Reels. Compared with linear history scaling, Meta Long Memory Search Modeling achieves better NE in CTR and CVR models, and combined with system improvements, delivers 5-10x better modeling ROI while adding minimal end-to-end serving overhead. 

Meta Long Memory Search Modeling: How Meta Is Scaling Extended History Context for Ads Recommendation Modeling
Figure 5: Long-history context, with improved resource efficiency vs. linear scaling. NE refers to Normalized Entropy, an offline metric for model performance, where lower NE is better.

For the RecSys community, this work illustrates another axis for scaling recommendation quality, as we demonstrate that larger models and longer raw sequences aren’t the only options. Our work enables data scaling to be achieved while being selective about long-history context.

Looking ahead, we’ll advance Meta Long Memory Search Modeling on multiple fronts. Beyond embedding and training data applications, we’ll bring long history directly into user sequence models. To perform this, we can condense long histories into fixed-length sequences at both raw-event and learned latent-representations levels, which will help user sequence models leverage both fine-grained details and broad patterns. We’ll also improve the model-infrastructure co-design, scale to even longer histories, and capture seasonal patterns that recur year over year. This future work will further improve our systems to deliver the best ads for people on our platforms and strong value to our advertisers.

Acknowledgments

We would like to thank Nafis Abrar, Shuo Chen, Victor Chen, Xian Chen, Jieming Di, Suofei Feng, Bin Gao, Edison Gao, Tina Jiang, Atul Katiyar, Santanu Kolay, Can Koyuncu, Lilly Kumari, Ling Leng, Chao Li, Kungang Li, Shiyi Li, Ericka Liu, Xiaoran Liu, Yu Lu, Anuj Madan, Zubair Mughal, Sean O’Byrne, Sandeep Pandey, Duo Qu, Aakanksha Ronald Sanctis, Ketan Singh, Shivendra Pratap Singh, Matt Steiner, Dorothy Sun, Viral Vimawala, Tianshi Wang, Shuxing Xiao, Junwei Xiong, Yiwen Xu, Tak Yan, Qiao Yang, Kevin Yin, Abdul Zainul-Abedin, Yuan Zhang, Carolina Zheng, Yangxin Zhong, and Wankun Zhu for their help in making Meta Long Memory Search Modeling successful.

The post Meta Long Memory Search Modeling: How Meta Is Scaling Extended History Context for Ads Recommendation Modeling appeared first on Engineering at Meta.

Originally published by Engineering at Meta ↗ · rebuilt here from its own full-text RSS feed · all rights remain with the publisher, please read and support them there.