# Search-native pretraining: QueryLM learns to search while it learns language

A new EPFL and University of Toronto paper trains small language models to issue search queries and read the answers during pretraining itself. A 1.4B QueryLM matches or beats a FLOP-matched 3.3B baseline on knowledge tasks, and the gains survive fine-tuning.

Most language models learn to use a search tool late. [Pretraining](/articles/self-supervised-learning-masked-next-token-pretraining) teaches them to predict static text, and search behaviour is bolted on afterwards with supervised fine-tuning or reinforcement learning. A paper posted to arXiv on 19 November 2026 asks a simple question: what if the model sees search calls from the very first training step?

The answer, according to the authors, is a model family they call QueryLM. They rewrite ordinary pretraining documents so that, at points where a writer might need to look something up, a web-search query appears, followed by retrieved evidence, followed by the rest of the original text. Models from 360M to 3.3B parameters trained this way answer knowledge questions better when given search, follow retrieved evidence more closely, and keep that advantage after the usual fine-tuning. This matters for anyone building [retrieval-augmented systems](/articles/rag-basics-retrieve-then-generate-pipeline) on [small models](/tools/small-language-models), because it suggests that "learn to use search" is partly a pretraining property, not only a post-training one.

## What happened

### Search From the Start: Search-Native Pretraining for Language Models (19 November 2026, EPFL and University of Toronto)

Kaustubh Ponkshe and Gyung Hyun Je (equal contribution), with Stefan Taga, Colin Raffel and Martin Jaggi, posted arXiv paper 2611.26809 on 19 November 2026. The listed institutions are EPFL and the University of Toronto. The paper introduces Search-Native Pretraining and trains QueryLM models on two corpora: Wikipedia (a 360M model) and DCLM-Edu (400M, 1.4B and 3.3B models built with nanochat configurations, Andrej Karpathy's minimal LLM training harness). Each QueryLM has a standard twin with the same architecture, trained on plain text with roughly matched compute.

The headline claims in the abstract are three. First, a 1.4B QueryLM "consistently beats or matches" a FLOP-matched 3.3B standard model on all knowledge-intensive tasks tested. Second, the gains persist after supervised fine-tuning, which the authors read as evidence that post-training does not fully recover what pretraining builds. Third, a 400M QueryLM with search exceeds SmolLM3-3B without search on average QA, at about 6,700 times less pretraining compute. The authors released 16 checkpoints (QueryLM and standard twins, base and fine-tuned), the query annotator as a [LoRA](/ai-simulations/lora) adapter for Gemma 4 E4B, and the pretraining and search fine-tuning data on Hugging Face.

## How search-native pretraining works

Think of a student reading a textbook with a librarian at their elbow. Normally the student reads straight through. In search-native pretraining, the textbook has been annotated: at the spots where a careful reader would pause to check a fact, there is a note saying "I looked up X", followed by what the librarian found, followed by the original sentence. The student learns both the subject and the habit of asking.

The pipeline has four parts.

**1. Decide where a query belongs.** An annotator model M scores every token position in a document with the probability that a query token comes next:

p(i) = Pr( WEB-QUERY token | document prefix up to position i )

Positions with p(i) above a threshold τ are candidates. The authors use τ = 0.05 for the initial filter. The annotator only sees the left context, so a query is written the way a model at inference time would write it: without knowing what comes next.

**2. Write the query.** The annotator is Gemma 4 E4B, fine-tuned on a seed set of 10,000 Wikipedia documents that a larger model (GLM-5.2) annotated with queries. The seed annotations use a 1,600-character window of left context.

**3. Retrieve and condense the evidence.** Queries go to [BM25](/tools/bm25) over Sphere, a corpus of 134M web documents. The top 10 passages are kept, and the sentences with the most keyword-stem overlap with the query are stitched into a response. The default response length is 600 characters. A second filter keeps a query only if its response actually overlaps the text that follows (ROUGE-1 F1 between the response and the continuation), so the model mostly sees searches that helped.

**4. Mask the evidence from the loss.** The augmented document is: original text, query token and query, response token and retrieved response, original text again. The loss is computed on the original document tokens and the queries. The retrieved response and its marker token are masked. The model is trained to ask good questions and to predict the next real words given the evidence, but never to memorise or generate search results.

That last choice is the key design decision. The model pays compute to read the evidence (those tokens go through every layer) but receives no gradient for predicting it. In effect it learns "when I see evidence like this, the next real sentence becomes easier to predict", which is exactly the skill retrieval-augmented generation needs.

### The cost of reading evidence

Because responses are read but not scored, a large share of the training tokens are augmentation. The paper's setup section gives the totals; the shares below are computed from them.

| Run | Total tokens | Original document tokens | Augmentation tokens | Augmentation share |
|---|---|---|---|---|
| Wikipedia 360M, per epoch (4 epochs) | 8.34B | 4.01B | 4.33B | 51.9% |
| DCLM-Edu 400M | 10.6B | 6.8B | 3.8B | 35.8% |
| DCLM-Edu 1.4B | 44.0B | 28.2B | 15.8B | 35.9% |
| DCLM-Edu 3.3B | 99.8B | 64.0B | 35.8B | 35.9% |

The worked arithmetic for the 1.4B run: 44.0B minus 28.2B leaves 15.8B augmentation tokens, and 15.8 divided by 44.0 is 0.359, so about 36 of every 100 training tokens are queries, markers or evidence. The standard twins were trained with approximately matched FLOPs, counting those retrieved tokens, so the comparison is fair on compute but not on the number of original-text tokens seen.

You can reproduce the shares with a few lines of Python:

```python
runs = {
    "Wikipedia 360M (per epoch)": (4.01 + 4.33, 4.01),
    "DCLM-Edu 400M": (10.6, 6.8),
    "DCLM-Edu 1.4B": (44.0, 28.2),
    "DCLM-Edu 3.3B": (99.8, 64.0),
}
for name, (total, original) in runs.items():
    aug = total - original
    print(f"{name:28s} augmentation={aug:5.2f}B share={aug/total:6.1%}")
```

## What the paper measured

The evaluation covers four groups: factual QA (TriviaQA, NQ-Open, PopQA, WebQuestions), multi-hop QA (HotpotQA, 2WikiMultiHopQA, MuSiQue, Bamboogle), factual grounding (FreshQA, HaluEval, RAGTruth) and general language understanding and commonsense benchmarks. QA scores are answer-containment accuracy.

### Wikipedia, 360M

The first table compares the 360M models on held-out perplexity and on QA with search. Compute is relative to the standard model.

| Model | Compute | PPL, no context | PPL, original | PPL, live | Open-domain QA | Multi-hop QA | General |
|---|---|---|---|---|---|---|---|
| Standard | 1.00 | 7.57 | 10.01 | 9.70 | 3.2 (closed-book) | 0.2 (closed-book) | 35.1 |
| QueryLM | 1.04 | 7.96 | 7.44 | 7.78 | 12.2 | 5.7 | 33.7 |

Two readings. When evidence is present, QueryLM's perplexity drops (7.44 against 10.01 for the standard model in the "original" setting), which means it actually uses the inserted text. When evidence is absent, QueryLM is slightly worse (7.96 against 7.57), and its general benchmark average dips from 35.1 to 33.7. Some of the capacity spent learning to read evidence comes out of plain language modelling.

### DCLM-Edu, 400M to 3.3B

The appendix reports average knowledge-intensive QA for base models (four-shot) and for models after supervised fine-tuning (zero-shot, LLM-judged), with the QueryLMs using Tavily web search at evaluation time.

```chart
{"type": "bar", "title": "Knowledge-intensive QA average, base models (four-shot)", "x": ["400M", "1.4B", "3.3B"], "series": [{"name": "Standard", "data": [7.5, 18.6, 23.9]}, {"name": "QueryLM", "data": [24.8, 30.3, 32.0]}], "xlabel": "model size (DCLM-Edu)", "ylabel": "average accuracy", "unit": "%", "note": "Source: Ponkshe et al., arXiv 2611.26809, appendix Table 9"}
```

The base-model gaps are large: +17.3 points at 400M, +11.7 at 1.4B and +8.1 at 3.3B. The 1.4B QueryLM (30.3) sits above the 3.3B standard model (23.9), which is the comparison behind the abstract's FLOP-matched claim.

After supervised fine-tuning, the standard models catch up a lot, because the fine-tuning data teaches them to use search too. But they do not close the gap.

```chart
{"type": "line", "title": "QueryLM lead over the standard twin, before and after fine-tuning", "x": ["400M", "1.4B", "3.3B"], "series": [{"name": "Base model gap", "data": [17.3, 11.7, 8.1]}, {"name": "After SFT gap", "data": [3.8, 2.9, 2.5]}], "xlabel": "model size (DCLM-Edu)", "ylabel": "accuracy points", "note": "Computed from appendix Tables 9 and 10 of arXiv 2611.26809 (QueryLM minus Standard)"}
```

After fine-tuning, the averages are 22.4 against 26.2 at 400M, 33.1 against 36.0 at 1.4B and 36.9 against 39.4 at 3.3B. The lead shrinks as models grow, from 3.8 to 2.5 points, which is worth remembering before extrapolating to 70B-class models.

Multi-hop QA shows a subtler effect. Appendix Table 7 reports accuracy when the model may do one lookup versus up to two. For fine-tuned standard models, the second lookup adds +0.10, +0.67 and +0.18 points at 400M, 1.4B and 3.3B. For fine-tuned QueryLMs it adds +1.51, +1.66 and +1.49. In other words, QueryLM benefits from asking a follow-up question; the standard model mostly does not.

### The SmolLM3 comparison

Appendix Table 8 places the QueryLMs next to SmolLM3-3B-Base, which Hugging Face trained on about 11.2T tokens. Without search, SmolLM3-3B averages 23.6 across the eight QA tasks, far above the 400M QueryLM without search (8.8). With Tavily search, the 400M QueryLM reaches 24.8, and the 1.4B reaches 30.3. A rough check with the usual 6 × parameters × tokens rule (see the [scaling laws simulation](/ai-simulations/train-scaling-laws)) gives 6 × 3e9 × 11.2e12 divided by 6 × 0.4e9 × 10.6e9, about 7,900 times. The authors' figure is about 6,700; the difference comes from the exact parameter counts they use, so treat both as orders of magnitude. The comparison is also not like for like: one model has a search engine and the other does not.

### Steerability toward evidence

The authors test whether a model follows the evidence it is given, including counterfactual evidence that contradicts what it learned. They measure the log-probability margin

margin = log P(original answer) − log P(counterfactual answer)

when a counterfactual passage is in context. A model that trusts its context shifts this margin further toward the counterfactual. The paper reports that QueryLM shows a stronger preference for the supplied evidence than the standard model; the exact values are in a figure rather than the text.

## Ablations: how much search is enough

The augmentation is expensive, so the authors test cheaper versions on the 360M Wikipedia setting.

| Augmentation | Search blocks per document | Compute | Open-domain QA | Multi-hop QA | General |
|---|---|---|---|---|---|
| QueryLM default (600-character responses) | 8.2 | 1.04 | 12.2 | 5.7 | 33.7 |
| 50-character responses | 3.8 | 0.55 | 8.2 | 0.9 | 33.8 |
| Top-2 queries per document | 2.0 | 0.57 | 5.6 | 1.2 | 33.5 |

Cutting responses to 50 characters or keeping only the two best queries per document roughly halves the compute but costs most of the multi-hop gain. At 3.3B, the authors report that the Top-2 variant lands between QueryLM and the standard model on knowledge QA after both kinds of fine-tuning, while general capability matches the standard model within confidence intervals. A second finding: at 360M, queries written by QueryLM itself beat queries written by a Qwen model, but at 3.3B this reverses, which the authors suggest may reflect the larger model's stronger parametric knowledge.

## Use cases and examples

**A team shipping a small on-device assistant with search.** A product team needs a model under 1.5B parameters that calls a search API. Using the released `querylm-dclm-1.4b-sft-search` checkpoint as the starting point instead of a plain 1.4B model, the paper's numbers suggest roughly 36.0 against 33.1 average accuracy on the eight QA tasks after the same fine-tuning, a 2.9-point head start before any task-specific tuning.

**A research group studying retrieval habits.** Because each QueryLM has a standard twin at matched compute, a group can isolate the effect of search-native pretraining on hallucination or citation behaviour. For example, they can run both 400M twins on RAGTruth-style prompts with the same retrieved passages and compare how often each copies unsupported claims.

**A company pretraining its own domain model.** A legal-tech firm with 30B tokens of statutes and case law could apply the same recipe with its own BM25 index. At the paper's 36% augmentation share, budgeting 30B original tokens means about 30 / (1 − 0.36) ≈ 46.9B total tokens, so around 56% more compute than plain pretraining on the same documents. The firm would need to decide whether that is cheaper than training a model twice the size.

**A multi-hop question-answering service.** Systems that chain lookups, such as an [agentic RAG](/articles/agentic-rag-retrieval-decisions-deep-research) analyst agent answering "which supplier of company X was acquired in 2025", depend on the second query. The Table 7 result (about +1.5 points from a second lookup for QueryLM against near zero for the standard model) is the relevant signal for such pipelines.

## What it means in practice

The practical lesson is that retrieval skill is not only a fine-tuning problem. Most teams today take a general base model and teach it tool use with a few thousand examples. This paper suggests that a base model that has seen search calls millions of times during pretraining is a better starting point, and that fine-tuning alone does not make up the difference at these scales.

It also reframes the trade-off between parameters and retrieval. If a 1.4B model with native search behaviour beats a 3.3B model on knowledge tasks, then for knowledge-heavy products, spending compute on the habit of looking things up can beat spending it on storing more facts in weights. This links naturally to the [long context versus retrieval](/articles/long-context-vs-rag-caching-break-even) debate: the model does not need to memorise what it can cheaply fetch.

The caveats are real. The largest model is 3.3B, the lead shrinks with scale after fine-tuning, and plain-text perplexity and general benchmarks dip slightly. Nobody has yet shown the effect at 30B or 70B, where models already know far more.

## What to do now

1. **Download a twin pair and test on your own data.** Run the released QueryLM and standard checkpoints at the same size on a sample of your real questions with your own retriever, and compare accuracy, not just perplexity.
2. **Separate retrieval skill from model size in evaluations.** When comparing models for a RAG product, report both closed-book and with-search scores; QueryLM is weak closed-book (8.8 average at 400M) but strong with search.
3. **Measure the value of a second lookup.** Add a one-lookup versus two-lookup condition to your multi-hop evaluation; it is cheap and showed the clearest qualitative difference in this paper.
4. **Mask retrieved text in your own training.** If you fine-tune on [tool-calling](/tools/function-calling) transcripts, compute the loss on the model's own queries and answers and mask tool outputs, as the paper does, so the model does not learn to invent search results.
5. **Budget augmentation honestly.** Expect around a third of tokens to be evidence at the paper's settings, and decide whether a cheaper Top-2 variant is acceptable for your quality bar.
6. **Test counterfactual robustness.** A model that follows its context more closely also follows wrong context more closely; include deliberately incorrect passages in your test set.
7. **Check general ability, not only QA.** Track a general benchmark as well, since the 360M QueryLM lost 1.4 points there.
8. **Watch for replications at larger scale.** Treat the result as strong for small models and open for large ones until someone repeats it beyond 3.3B.

## Risks and open questions

**Scale is the main unknown.** The gains after fine-tuning shrink from 3.8 to 2.5 points between 400M and 3.3B, and the query-quality advantage reverses at 3.3B. It is possible the effect fades for frontier-size models.

**Following evidence cuts both ways.** Stronger steerability toward supplied evidence, including counterfactual evidence, is good when retrieval is clean and risky when it is poisoned. Search-native models may need stronger [defences against prompt injection](/tools/prompt-injection-defense) in retrieved pages.

**The retrieval setting is fixed during training.** The model learns from BM25 over one 134M-document corpus. The authors note that some response variants generalise poorly to a different retrieval setting, so a model trained on one engine may not transfer perfectly to another.

**Comparisons mix conditions.** The SmolLM3 comparison pits a model with search against one without, and the compute ratio is an estimate. Read it as evidence that retrieval substitutes for size, not as a head-to-head ranking.

**Watch next:** whether a lab with a larger budget applies search-native data to a 7B or larger pretraining run, whether the released annotator gets reused to build bigger augmented corpora, and whether agent benchmarks show the same second-lookup advantage seen here in multi-hop QA.

## Frequently asked questions

### What is search-native pretraining?

It is pretraining on documents that have been rewritten to include web-search queries and the retrieved evidence at points where a writer might look something up. The model learns to issue queries and to use evidence while it learns language, instead of learning search only during fine-tuning.

### Does QueryLM learn to generate fake search results?

No, by design. The loss is computed on the original document tokens and on the queries, while the retrieved responses and their marker token are masked. The model reads the evidence but is never trained to produce it.

### How big are the QueryLM models?

The paper trains a 360M model on Wikipedia and 400M, 1.4B and 3.3B models on DCLM-Edu. All checkpoints, with standard twins and fine-tuned search variants, are released on Hugging Face.

### Is the 1.4B model really better than a 3.3B model?

On the knowledge-intensive tasks tested and with search available, yes: the authors report that the 1.4B QueryLM matches or beats a FLOP-matched 3.3B standard model. In the base-model averages, it scores 30.3 against 23.9. It is not better on everything; closed-book and general benchmarks are a different story.

### Can I apply this to my own pretraining data?

In principle, yes. The released annotator adapter, data and pipeline description cover the steps: score query positions, generate queries, retrieve with BM25, condense to about 600 characters and mask the evidence. Expect roughly a third of training tokens to be evidence, which raises compute accordingly.

## Summary

Search From the Start, from EPFL and the University of Toronto, shows that teaching small language models to search can begin in pretraining. By inserting queries and BM25-retrieved evidence into Wikipedia and DCLM-Edu text, and masking that evidence from the loss, the authors train QueryLMs from 360M to 3.3B parameters that beat compute-matched standard twins on knowledge-intensive QA, by 8 to 17 points as base models and 2.5 to 3.8 points after fine-tuning. A 1.4B QueryLM tops a 3.3B baseline, and a second lookup helps QueryLM far more than its twin. The costs are about a third more tokens spent on evidence, a small dip in plain language modelling, and an open question about whether the advantage holds at much larger scales.

## Sources

- [arXiv: Search From the Start: Search-Native Pretraining for Language Models (abstract)](https://arxiv.org/abs/2611.26809)
- [arXiv: Search From the Start, full HTML paper with tables](https://arxiv.org/html/2611.26809v1)
- [Hugging Face: Search-native pretraining checkpoints and data collection](https://huggingface.co/collections/Kausp11/search-native-pretraining)
- [Hugging Face: Weekly papers, week 48 of 2026](https://huggingface.co/papers/week/2026-W48)
- [Hugging Face: SmolLM3, smol, multilingual, long-context reasoner](https://huggingface.co/blog/smollm3)
- [GitHub: karpathy/nanochat](https://github.com/karpathy/nanochat)
- [Tavily: Search endpoint API reference](https://docs.tavily.com/documentation/api-reference/endpoint/search)
