Research map / Large language models / Language, safety and interpretability
Scaling Retrieval-Based Language Models with a Trillion-Token Datastore
Read the paperCheck your idea against 108,967 papers
AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.
Builds MassiveDS, a 1.4-trillion-token open datastore, and an efficient subsampling pipeline to study how inference-time datastore scale improves retrieval-in-context LMs on language modeling and QA/reasoning tasks.
Problem
Scaling laws usually consider only training data and parameters; it is unknown how the size of an inference-time retrieval datastore affects retrieval-based LMs across broad tasks, since prior trillion-token datastores were proprietary or evaluated narrowly.
Approach
Treat inference-time datastore size as a scaling dimension: construct an open, multi-domain 1.4T-token datastore and reorder the pipeline (index and retrieve top-K once, then subsample, dedup, decontaminate and rerank per variant) so that datastore scaling studies are ~10x cheaper while equivalent to the naive pipeline with high probability.
Key results
- Datastore scaling monotonically reduces perplexity without saturation, and Llama-2 7B with retrieval from MassiveDS outperforms the LM-only Llama-2 13B on language modeling.
- On knowledge-intensive QA, a Llama-2 7B retrieving from under 100B tokens outperforms the LM-only Llama-3 8B on TriviaQA and NQ.
- Under equal training compute, retrieval-based Pythia and OLMo models achieve better compute-optimal performance than LM-only models; the pipeline reduces datastore construction compute by more than an order of magnitude.
Measured effects reported in the paper
| What was changed | Where | Measured | Effect |
|---|---|---|---|
| Scale up the datastore | Retrieval-based LMs · Language modeling on general web and scientific papers | perplexity | Helped |
| Scale up the datastore | Retrieval-based LMs · TQA and NQ | accuracy | Helped |
| Scale up the datastore | Retrieval-based LMs · MMLU | accuracy | Helped |
| Scale up the datastore | Retrieval-based LMs · MedQA | accuracy | Mixed |
| Use retrieval from a large datastore instead of LM-only inference | Llama-2 7B · Language modeling | perplexity | Helped |
| Use retrieval-based models rather than LM-only models at the same training compute | Pythia and OLMo · Downstream tasks | performance | Helped |
| Use a broad, multi-domain datastore instead of single-domain datastores (ablation) | Llama-2 7B retrieval-based LM · TQA, MMLU, RedPajama, and S2ORC | performance: TQA: 72.9 -> 77.0; MMLU: 48.3 -> 49.3; RedPajama PPL: 3.87 -> 3.50; S2ORC PPL: 6.64 -> 6.57 | Helped |
| Use a broad, multi-domain datastore instead of the best single-domain datastore (ablation) | Llama-2 7B retrieval-based LM · NQ and MedQA | accuracy: NQ: 34.6 -> 34.6; MedQA: 39.8 -> 39.4 | No clear effect |
| Add a cross-encoder reranker (ablation) | Llama-2 7B retrieval-based LM · TQA and NQ | accuracy | Helped |
| Use a lexical oracle reranker (ablation) | Llama-2 7B retrieval-based LM · TQA and NQ | accuracy | Helped |
| Use more aggressive decontamination (ablation) | Llama-2 7B retrieval-based LM · Language modeling | perplexity | Hurt |
| Vary decontamination level (ablation) | Llama-2 7B retrieval-based LM · NQ | accuracy | Mixed |
Surprising findings
- Retrieval-based Pythia models benefit on TriviaQA and NQ but show no meaningful gain on MMLU and MedQA, which stay near random even at 12B.
- Llama-3 8B underperforms Llama-2 7B on RedPajama perplexity.
Limitations
- Compute-optimal analysis relies on intermediate checkpoints of Pythia and OLMo as proxies for models trained on different token counts.
- Only a single retriever (Contriever-MSMARCO) was used for the full scaling study, since changing it requires re-indexing.
- MassiveDS lacks high-quality reasoning-heavy and in-domain data, so gains on MMLU and MedQA are limited; evaluation covers mostly QA tasks.
Experimental setup
Datasets: MassiveDS (RedPajama Books, peS2o, RPJ ArXiv, Wikipedia, StackExchange, GitHub, OpenWebMath, NaturalProofs, PubMed, Comm RedPajama S2ORC TriviaQA Natural Questions MMLU MedQA
Benchmarks: TriviaQA Natural Questions MMLU MedQA RedPajama perplexity S2ORC perplexity
Metrics: accuracy perplexity
Baselines: LM-only models RETRO Sphere single-domain datastores (Wikipedia, PubMed, peS2o, RedPajama subsets) cross-encoder reranker (MiniLM-L12)
Builds on: RETRO RALM (retrieval-in-context) Contriever Pythia scaling suite OLMo
Closest papers by meaning
- Data Engineering for Scaling Language Models to 128K Context (ICML 2024 · similarity 0.89)
- Scaling Laws Meet Model Architecture: Toward Inference-Efficient LLMs (ICLR 2026 · similarity 0.89)
- LLMs on the Line: Data Determines Loss-to-Loss Scaling Laws (ICML 2025 · similarity 0.89)
- Scaling Laws with Vocabulary: Larger Models Deserve Larger Vocabularies (NeurIPS 2024 · similarity 0.88)
- Inference Scaling for Long-Context Retrieval Augmented Generation (ICLR 2025 · similarity 0.88)
- Scaling Inference-Efficient Language Models (ICML 2025 · similarity 0.88)
Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.
