betaFeedback

WorksComputer Science

Search From the Start: Search-Native Pretraining for Language Models

Abstract

Modern language models (LMs) are increasingly deployed with access to search tools at inference. Yet pretraining remains predominantly focused on predicting static text, with search capabilities typically introduced during post-training. We propose Search-Native Pretraining as a practical route to teach search capability during pretraining from ordinary text corpora. Specifically, we augment pretraining corpus at scale with web-search queries and retrieve web response using a local index. Training on this augmented corpus teaches models to generate search calls and incorporate retrieved evidence during language modeling. Across Wikipedia and DCLM-Edu corpora and 360M to 3.3B parameter scales, search-pretrained models ("QueryLM") show improved performance on knowledge-intensive tasks and higher steerability toward the retrieved evidence. Crucially, their advantage persists after supervised fine-tuning of both search-pretrained and conventionally pretrained models, indicating that the tested post-training procedures do not fully recover the capabilities developed during pretraining. Throughout our experiments, we find that a 1.4B QueryLM consistently beats or matches the performance of a FLOP-matched 3.3B baseline model across all knowledge intensive tasks. These results establish search-pretraining as a practical way to develop foundational search capabilities during pretraining. We release the training artifacts, including model checkpoints and data.

Figure 2. Search-Native Pretraining pipeline overview. (1) We augment training documents with inline search queries and corresponding search results, intended to contain useful knowledge for predicting original document continuation. (2) We train on (1), computing loss only on original document tokens and search queries (green), while search results are masked (gray). (3) During inference, QueryLM generates search queries to retrieve relevant information from an external knowledge base.

Introduction

Language models (LMs) have finite capacity to store factual knowledge in their parameters [23] (Morris et al. 2025), which can limit their performance on knowledge-intensive tasks. This poses a particular challenge for smaller models, as facts that cannot be inferred from general patterns must be memorized during pretraining [4]. Even when successfully encoded, knowledge in weights can become outdated as real-world facts change (Vu et al., 2023). Teaching an LM to search address these limitations by allowing factual knowledge to remain externally retrievable, with sources that can be updated without retraining the model. Prior work has explored several ways to incorporate retrieved knowledge at inference time [5, 25] (Lazaridou et al. 2022; Nakano et al. 2022; Parisi et al. 2022; Shuster et al. 2022; Schick et al. 2023; Yao et al. 2023). These capabilities are typically introduced during post-training [12, 28] (OpenAI et al. 2025), after the model has been pretrained to predict the next token without access to search.

However, recent work demonstrates the benefits of early exposure to capability-relevant data during pretraining Zhang et al. (2025); ); Baek et al. [6]; ); Minder et al. (2026). Yet scaling such data to develop new capability during pretraining remains challenging, often requiring practitioners to rely on limited or synthetically generated data [20] (); Shao et al. 2024). We therefore ask:

“Can ordinary pretraining documents be augmented at scale to teach a downstream capability such as search, while preserving the original next-token prediction objective?”

In particular, we want an LM to use search to access diverse and evolving knowledge sources, such as the internet. To teach the search ability during pretraining, we augment the training corpus with inline web-search tool calls and corresponding web-retrieved evidence that help predict the original document continuation. These augmentations demonstrate when to seek information beyond the available text, what to search for, and how to use the returned evidence to predict the continuation. Together, they form our Search-Native Pretraining approach.

We construct search-augmented pretraining corpora from the knowledge-rich Wikipedia corpus and DCLM-Edu, which represents a realistic pretraining setting. The augmented DCLM-Edu corpus contains over 100B tokens of document text, search queries, and retrieved responses. Using these corpora, we train QueryLM models from scratch at scales from 360M to 3.3B parameters. When search is available, QueryLM improves on knowledge-intensive tasks compared with FLOP-matched baselines (Section 5.1). Our 400M model with search also exceeds the average QA performance of SmolLM3-3B evaluated without search, despite using approximately 6,700 times less pretraining compute (Figure 1). The advantage over FLOP-matched baselines persists after both models undergo search-augmented fine-tuning, showing that the tested post-training recipe does not fully recover the benefit of learning search during pretraining (Section 5.1). Beyond answering more questions correctly, QueryLM more readily adjusts its predictions to supplied evidence, including evidence that contradicts facts seen during training (Section 5.2). General capabilities remain broadly comparable after search fine-tuning (Section 5.3), while our ablations examine how retrieval quality, response length, and insertion frequency affect performance and training cost (Section 6). These results support Search-Native Pretraining as a scalable approach to teaching models to search for and use external information from the start of training.

Related Work

LM knowledge retention. Prior work has explored the limits of factual knowledge acquisition in language model parameters [27] (Morris et al. 2025), highlighting challenges due to task feature interference [23], reduced model plasticity [29] (Springer et al. 2025), and forgetting (Liao et al., 2024; Luo et al., 2025). These challenges persists when the acquired knowledge becomes outdated and requires post-hoc editing [19] (Lazaridou et al. 2021). Proposed mitigation includes data selection to prioritize learnable facts (Mindermann et al., 2022; Ye et al., 2026), modified parameter updates for reduced interference and easier editing [16] (Wang et al. 2023), increasing model plasticity [10], and complementing parametric knowledge with externally retrieved information (discussed below). Building on these efforts, we address the limitation of parametric knowledge by pretraining an LM to fill in the knowledge gap through search and ground its generation on retrieved passages.

External knowledge base. Prior work improves LMs on knowledge-intensive tasks by equipping them with external knowledge or tools. Inference-time or post-training approaches provide access to API-based tools or search engine during generation [5, 25] (Lazaridou et al. 2022; Nakano et al. 2022; Parisi et al. 2022; Shuster et al. 2022; Schick et al. 2023; Yao et al. 2023). Among these work, Toolformer (Schick et al., 2023) is particularly relevant to our approach, as it injects tool call demonstrations inline and fine-tunes an LM to issue relevant tool calls. Pretraining-focused efforts have explored jointly trained retrievers [21] or a specialized layer to attend to retrieved information [9]. More recent approaches, such as LMLM (Zhao et al., 2025) and Co-LMLM [13], build an explicit entity-based key-value stores from training or downstream task data and trains an LM to query these stores. Unlike past methods, QueryLM learns to issue flexible search queries during pretraining from scratch, without architectural modification or an explicit entity-based key-value store.

Pretraining data augmentation. Previous studies have shown the benefits of introducing downstream capability-relevant data earlier during pretraining [2] (Zhou et al. 2026), encoding desired behavior such as instruction-following ability [11], reduced toxicity (Maini et al., 2025), higher steerability [14], improved reasoning [1] (Ruan et al. 2025), knowledge synthesis [24]. We similarly find that early exposure to search demonstrations in Search-Native Pretraining yields benefits that persist through post-training.

Search-Native Pretraining

Search-Native Pretraining trains a language model to issue search queries and incorporate retrieved evidence into subsequent generation. We construct demonstrations of these interactions by augmenting the training documents with search queries and externally retrieved evidence, while preserving the original document text.

When and What to Search

For each document, we identify a set of search query insertion points A={a1,…,ak}\mathcal{A} = \{a_1, \ldots, a_k\}, each aia_i separating a prefix pip_i, which sets the context motivating a search, from a suffix sis_i, the original document continuation. A good insertion point follows the prefix pip_i that naturally motivates a search query qiq_i, containing specific and relevant keywords from pip_i to retrieve useful context rir_i (Figure 3). We denote the collections of queries and retrieved responses as Q={qi}i=1kQ = \{q_i\}_{i=1}^{k} and R={ri}i=1kR = \{r_i\}_{i=1}^{k}, respectively.

Figure 3. Document annotation example with inline search queries and retrieved documents.

Extending prior work (Zhao et al., 2025), which places insertion points before an entity’s associated value (e.g., between “Dante Alighieri was born in” and “May 1265”), we consider more general insertion locations, such as immediately after a specific term mention without a linked value (e.g., placed after “Dante Alighieri ”) or positions where relevant information depends on distant context (e.g., between “Dante Alighieri, [...], originally titled his masterwork” and “La Commedia”). We use an LM to identify suitable insertion points and generate corresponding search queries. To efficiently annotate the pretraining corpus at scale, we first fine-tune a small annotator model (MϕM_{\phi}) and then use the trained annotator to augment the full corpus.

Annotator model. We create a small search-augmented dataset (Dseed\mathcal{D}_{\mathrm{seed}}) from an initial pool of 10,000 Wikipedia documents, annotated using GLM-5.2 (GLM-5-Team et al., [17]) as the teacher model. We prompt the teacher to identify insertion points before specific facts that could benefit from external retrieval, such as names, dates, and quantities.

The teacher first identifies candidate insertion locations using the entire document but subsequently generates a search query given only the corresponding left context. Query generation therefore uses the same available text as at inference. To remove insertions with failed or empty search result, we retrieve and clean search responses for each search query (process detailed in § 3.2). Finally, we fine-tune Gemma 4 E4B (Gemma Team et al., [15]) on Dseed\mathcal{D}_{\mathrm{seed}} to produce the search query annotator, MϕM_{\phi}. Further details on annotator training are given in Section A.1.

Annotating pretraining corpus. For efficient search query insertion at pretraining scale, we process each sequence xx of length TT with MϕM_{\phi}, the fine-tuned annotator model, in a single causal forward pass and compute query insertion scores following each ii-th sequence token xix_i as

πi(x)=Pr⁡(<|WEB-QUERY|>∣x1:i),i=1,…,T,\pi_i(x) = \Pr\left(\texttt{<|WEB-QUERY|>} \mid x_{1:i}\right), \quad i = 1, \ldots, T,

where πi(x)\pi_i(x) is the probability of inserting a search query immediately after token xix_i. Positions with πi(x)\pi_i(x) exceeding a threshold τ∈[0,1]\tau\in[0,1] form the final insertion set A={i∈{1,…,T}∣πi(x)≥τ}={a1,…,ak}\mathcal{A} = \{i \in\{1,\ldots,T\} \mid\pi_i(x) \geq\tau\} = \{a_1,\ldots,a_k\}. Candidate insertion positions can therefore be searched in parallel within each document. Our approach for sampling search insertion points refer to augmentation strategy in Schick et al. (2023). Finally, MϕM_{\phi} generates a query qiq_i for each aia_i given corresponding prefix pip_i until the closing delimiter. These queries are then passed to the search response retrieval pipeline (§ 3.2).

Insertion filtering. For pretraining corpus, we use τ=0.05\tau= 0.05 as an initial filtering method to restrict the number of search queries inserted per document and drop low-quality search queries. We then do additional filtering using ROUGE-1 F1 overlap between the retrieved response rir_i and the original continuation sis_i, using lexical overlap as a proxy for relevance. The filtering threshold values and the filtering protocol are given in Section A.1.

Simulating Web Response During Pretraining

To simulate a realistic and cost-efficient web-response, we use BM25 index over Sphere (Piktus et al., 2022), a public dataset containing a broad collection of 134M web documents. We consider candidate indexes over different corpus based on retrieval coverage and storage requirements, detailed in Section 6.2 and Section A.1.

For each search query qiq_i, we retrieve the top-10 scoring raw passages and select sentences with the most keyword stem overlap with the query, producing the web response rir_i used in training corpus annotation. The choice of how much retrieved information to retain introduces a trade-off: shorter search response reduces training overhead but may remove relevant information, and cleaning the raw passage using an LLM may help select more query-relevant information but incurs higher data preparation cost. We evaluate the impact of training with web-response of different lengths and cleaning approach in Section 6.3 and Section 6.4.

Pretraining Objective

We train language models autoregressively on the annotated pretraining corpus. Given an annotated sequence x~\tilde{x} of length T~=∣x~∣\tilde{T} = |\tilde{x}| and indices IR⊆{1,…,T~}\mathcal{I}_{R} \subseteq\{1,\ldots,\tilde{T}\} for web-response tokens (i.e., rir_i and <|WEB-RESPONSE|> tokens), the training objective is

L(θ)=−∑t=1T~1[t∉IR]log⁡pθ(x~t∣x~<t).\mathcal{L}(\theta) = - \sum_{t=1}^{\tilde{T}} \mathbb{1}[t \notin\mathcal{I}_{R}] \log p_{\theta}(\tilde{x}_t \mid\tilde{x}_{<t}).

The model therefore is trained with a next-token prediction objective on the original document text, search queries qiq_i, and the special token <|WEB-QUERY|>, while masking the loss on web response tokens rir_i. This allows the model to condition the original document continuation on the web-response but avoids explicitly training it to reproduce the web response.

Experimental Setup

Pretraining Setup

Pretraining corpora. We pretrain models using Search-Native Pretraining on two corpora: Wikipedia and DCLM-Edu [3]. Wikipedia provides a compact, knowledge-rich setting for controlled experiments. DCLM-Edu extends the study to more diverse web text, testing whether the benefits persist beyond encyclopedic documents. Both corpora use the annotation pipeline described in § 3, with the same annotation model. See Appendix Section A.2 for data preprocessing details.

Baselines. For each of QueryLM across varying scales, we pretrain a baseline model with the same architecture on original document text without search augmentation. We approximately match each baseline’s pretraining FLOPs to the corresponding QueryLM, including computation on retrieved response tokens despite their exclusion from the loss during Search-Native Pretraining (see Section A.2 for detail). We include LMLM (360M) and Co-LMLM (400M) models off-the-shelf as our baselines. Our 360M-QueryLM trained on Wikipedia provides the closest comparison with LMLM, and our 400M-QueryLM (overtrained) on DCLM-Edu is compared with Co-LMLM trained on FineWeb.

Model architectures and training budgets. For Wikipedia, we train decoder-only Transformers from scratch with 360M parameters using the SmolLM2 configuration [3], to have the closest match to LMLM baseline. Wikipedia QueryLM is trained on 33.4B tokens total over four epochs, with 4.01B tokens from original document tokens and 4.33B from search augmentation per epoch.

For DCLM-Edu, we train nanochat configurations from scratch at 400M, 1.4B, and 3.3B parameters, excluding value embeddings. The 400M, 1.4B and 3.3B QueryLMs are trained on 10.6B, 44.0B, and 99.8B tokens, 6.8B, 28.2B and 64.0B tokens from original document tokens (approx. 20 per parameter). We include a deliberately over-trained 400M DCLM-Edu QueryLM (65.1B document tokens, 101.5B processed) to support comparison with Co-LMLM trained on FineWeb. Further architecture details, optimization settings, and training budgets are given in Section A.2.

Supervised Fine-Tuning

After pretraining, we fine-tune both QueryLM and the FLOP-matched baselines to develop user-assistant conversation behavior. We use two different supervised fine-tuning (SFT) mixtures to answer different questions. First, we perform standard SFT on a subsample of the Dolci dataset, which includes a search mixture, following the SFT setup of Olmo 3 (Olmo et al., 2026). Since many of the search traces in Dolci exceed our context length, we add our own search traces on SmolTalk conversations in an equal ratio. This setup tests whether QueryLM retains its advantage in the typical pipeline, where search is only introduced in post-training. Second, we introduce Search SFT, which uses a much higher proportion of search-augmented data. The Search SFT mixture contains 52,806 conversations from SmolTalk [3] and SmolTalk2, covering general chat skills and tool calling. We additionally augment selected SmolTalk conversations with search interactions generated by our annotation model. The main goal is to evaluate whether the advantages Search-Native Pretraining can be fully recovered in post-training with a search-heavy data distribution. Further training details are provided in Section A.3.

Evaluation

Tasks. We consider TriviaQA [26], NQ-Open [30], PopQA (Mallen et al., 2023), and WebQuestions [8] as factual knowledge probing tasks (“Factual QA”), as well as HotpotQA (Yang et al., 2018), 2WikiMultiHopQA [22], MuSiQue (Trivedi et al., 2022), and Bamboogle (Press et al., 2023) for multi-hop question answering (“Multi-hop”) using the Search-R1 evaluation suite [25]. To assess factual grounding, we use on FreshQA (Vu et al., 2023) for time-sensitive factual question answering, and HaluEval (Li et al., 2023) and RAGTruth (Niu et al., 2024) for faithfulness to supplied evidence in hallucination-prone settings. Lastly, we evaluate QueryLM∘^{\circ} on general language understanding and commonsense reasoning benchmarks. Task details are included in Section A.4.1.

Prompting. The base models are given four-shot search demonstration for all QA tasks. LMLM and Co-LMLM emit their own search queries to retrieve relevant values, and our FLOP-matched baseline uses its corresponding QueryLM∘^{\circ}’s search queries and retrieved results. After Search SFT, both QueryLM∘^{\circ} and FLOP-matched baselines are evaluated zero-shot and use their own search queries. Search is triggered for both base and SFT models with an injected <|WEB-QUERY> in the beginning of model generation. Both base and SFT models are given budget of 1 look-up for factual QA and 2 look-ups for multi-hop QA. We report % correct answer is contained given the 24-token generation budget for base models, and LLM-judged accuracy with 64 token generation budget for SFT models. Prompt examples are included in Section A.4.3. For each metric, we report the 95% confidence intervals with bootstrap over questions.

Retrieval source. For fair comparison with LMLM, which indexes its Wikipedia training corpus as the external knowledge base, our Wikipedia-trained QueryLM∘^{\circ} (360M) uses BM25 index over Wikipedia. Similarly, our DCLM-Edu-trained QueryLM∘^{\circ} (400M) uses BM25 index over Fineweb-Edu and Wikipedia to match Co-LMLM’s retrieval corpus. However, QueryLM∘^{\circ} can flexibly switch to a web-like retrieval source, we report our main results including retrievals from Tavily, an API-based search engine. In Section 6.2, we demonstrate that switching to a more realistic retrieval source like Tavily improves the model performance for both QueryLM∘^{\circ} and the FLOP-matched baselines.

Results

Search pretraining has advantage in knowledge intensive tasks

Base models. We evaluate QueryLM∘^{\circ} on the eight knowledge-intensive QA tasks and report the average performance compared against our baselines.

QueryLM∘^{\circ} outperforms both LMLM and Co-LMLM when using Tavily as retrieval source (Figure 4). With matched retrieval sources, DCLM-Edu-trained QueryLM∘^{\circ} matches the performance of Co-LMLM. Wikipedia-trained QueryLM∘^{\circ} slightly underperforms LMLM, despite outperforming on six of eight tasks, with exception being PopQA and WebQs. The structural similarity and potential factual overlap between PopQA, constructed from Wikidata knowledge triples, and LMLM’s Wikipedia-derived knowledge store may partially explain its strong performance on PopQA. Across model scales and pretraining corpora, QueryLM∘^{\circ} consistently outperforms the FLOP-matched baseline (Figure 5, left). Full results comparing open-weight base models and QueryLM® from Figure 1-(a) are reported in Appendix, Table 8.

QueryLM performance on base QA, after Standard SFT, and with counterfactual evidence

Figure 1. QueryLM is better at searching for and using evidence. (a) After Search-Native Pretraining, QueryLM with search outperforms the compute-matched baseline and the largest open-weight base models (SmolLM3-3B, Qwen2.5-3B) without search, despite their orders of magnitude more pretraining compute. (b) QueryLM keeps higher accuracy on eight knowledge-intensive QA tasks after Standard SFT of both models. (c) After Search SFT, QueryLM more often follows counterfactual evidence that contradicts established facts (LLM-judged answers on the same eight tasks).

Figure 4. Base model performance on knowledge-intensive QA (avg. over eight tasks). 360M and 400M (overtrained) base QueryLM∘^{\circ} with LMLM and Co-LMLM.

Figure 5. Base and SFT model performance on knowledge-intensive QA (avg. over eight tasks) across scale and training corpus. Left: base models. Middle: after Search SFT. Right: after standard SFT (Dolci mixture). Per-task scores in Appendix Table 9, Table 10.

ScaleModelTriviaQANQPopQAWebQsHotpotQA2WikiMuSiQueBamboogleAvg.
Wikipedia pretraining
360MStandard(BM25)6.4±1.16.4 \pm1.13.3±0.83.3 \pm0.83.3±0.83.3 \pm0.83.7±0.83.7 \pm0.81.5±0.51.5 \pm0.514.7±1.614.7 \pm1.61.0±0.61.0 \pm0.60.8±2.20.8 \pm2.24.3±0.44.3 \pm0.4
LMLM (382M)14.1±1.514.1 \pm1.55.1±1.05.1 \pm1.025.6±1.925.6 \pm1.98.2±1.28.2 \pm1.21.1±0.51.1 \pm0.50.6±0.40.6 \pm0.40.5±0.40.5 \pm0.40±1.50 \pm1.56.9±0.46.9 \pm0.4
QueryLM°(BM25)10.7±1.410.7 \pm1.44.2±0.94.2 \pm0.95.1±1.05.1 \pm1.02.2±0.62.2 \pm0.65.4±1.05.4 \pm1.015.4±1.615.4 \pm1.61.5±0.71.5 \pm0.70.8±2.20.8 \pm2.25.7±0.45.7 \pm0.4; +1.4+1.4
QueryLM°(Tavily)15.3±1.615.3 \pm1.69.2±1.39.2 \pm1.36.0±1.06.0 \pm1.03.1±0.83.1 \pm0.85.6±1.05.6 \pm1.014.5±1.514.5 \pm1.50.9±0.50.9 \pm0.51.7±2.71.7 \pm2.77.0±0.57.0 \pm0.5
DCLM-Edα 400M, over-trained (full annotated corpus, ≈10×\approx10 \times compute)
400MStandard24.9±1.924.9 \pm1.98.7±1.68.7 \pm1.68.7±1.68.7 \pm1.69.7±1.39.7 \pm1.39.6±1.39.6 \pm1.316.8±1.616.8 \pm1.61.3±0.61.3 \pm0.65.8±4.35.8 \pm4.310.4±0.710.4 \pm0.7
Co-MLLM (360M)51.7±2.251.7 \pm2.218.3±1.718.3 \pm1.730.4±2.030.4 \pm2.025.2±1.925.2 \pm1.98.4±1.28.4 \pm1.211.4±1.411.4 \pm1.43.5±1.03.5 \pm1.04.1±3.84.1 \pm3.819.1±0.719.1 \pm0.7
QueryLM°(BM25)53.0±2.253.0 \pm2.217.7±1.717.7 \pm1.718.3±1.718.3 \pm1.719.7±1.719.7 \pm1.718.2±1.718.2 \pm1.721.4±1.821.4 \pm1.83.6±1.03.6 \pm1.06.6±4.66.6 \pm4.619.8±0.819.8 \pm0.8; +9.4+9.4
QueryLM°(Tavily)66.1±2.166.1 \pm2.130.0±2.030.0 \pm2.035.3±2.135.3 \pm2.127.3±2.027.3 \pm2.024.1±1.924.1 \pm1.922.3±1.822.3 \pm1.86.7±1.46.7 \pm1.49.9±5.49.9 \pm5.427.7±0.927.7 \pm0.9; +17.3+17.3
DCLM-Edα pretraining (QueryLM° searches the open web using Tavily)
400MStandard21.9±1.921.9 \pm1.99.8±1.89.8 \pm1.85.5±1.05.5 \pm1.07.3±1.17.3 \pm1.12.6±0.72.6 \pm0.712.2±1.412.2 \pm1.40.7±0.50.7 \pm0.50.0±1.50.0 \pm1.57.5±0.47.5 \pm0.4
QueryLM°59.2±2.259.2 \pm2.225.9±1.925.9 \pm1.937.3±2.137.3 \pm2.125.0±1.925.0 \pm1.919.9±1.719.9 \pm1.720.3±1.820.3 \pm1.83.8±1.13.8 \pm1.16.6±4.66.6 \pm4.624.8±0.824.8 \pm0.8; +17.3+17.3
1.4BStandard47.9±2.247.9 \pm2.223.3±1.723.3 \pm1.723.9±1.923.9 \pm1.95.7±1.05.7 \pm1.016.1±1.616.1 \pm1.618.5±1.718.5 \pm1.76.0±1.36.0 \pm1.37.4±4.87.4 \pm4.818.6±0.818.6 \pm0.8
QueryLM°72.7±2.072.7 \pm2.033.7±2.133.7 \pm2.139.1±2.139.1 \pm2.134.2±2.134.2 \pm2.124.1±1.924.1 \pm1.922.2±1.822.2 \pm1.86.7±1.46.7 \pm1.49.9±5.49.9 \pm5.430.3±0.930.3 \pm0.9; +11.7+11.7
3.3BStandard58.1±2.258.1 \pm2.224.1±1.824.1 \pm1.833.3±2.133.3 \pm2.122.3±1.522.3 \pm1.519.8±1.719.8 \pm1.720.9±1.820.9 \pm1.85.7±1.35.7 \pm1.37.4±4.87.4 \pm4.823.9±0.923.9 \pm0.9
QueryLM°74.5±1.974.5 \pm1.937.9±2.137.9 \pm2.142.8±2.242.8 \pm2.235.4±2.135.4 \pm2.125.4±1.925.4 \pm1.921.8±1.821.8 \pm1.87.9±1.57.9 \pm1.510.7±5.610.7 \pm5.632.0±0.932.0 \pm0.9; +8.1+8.1

Table 9. Base model knowledge-intensive QA evaluation (four-shot, answer-contained scores (%)). Deltas are average gains over the FLOP-matched baseline.

SFT models. Since our method can be replicated in post-training, we evaluate the advantage of search-pretraining by fine-tuning QueryLM® and FLOP-matched baselines on search-augmented data. With standard SFT, QueryLM® retains much of its base performance (Figure 5, right). Even under the Search SFT recipe, with a high proportion of search demonstrations, fine-tuned baselines do not fully recover the benefit of search pretraining, especially at smaller model scales (Figure 5, middle). We hypothesize that Search-Native Pretraining is particularly beneficial for smaller models, as learning to search and ground its predictions on retrieved results compensates for their limited parametric knowledge. We further analyze the performance gap attributable to context grounding ability (§ 5.2) and search query writing quality (Section 6.1).

QueryLM uses retrieved context to update its answers

To investigate whether QueryLM® grounds its predictions on retrieved evidence than on facts stored in its parameters, we measure its sensitivity to supplied evidence in a controlled setting, then evaluate whether the increased sensitivity translates to improvement on downstream tasks.

Updating knowledge based on counterfactual context. We first sample 1000 stated facts in DCLM-Edu training documents and measure the model preference between ground-truth and plausible-but-wrong (“counterfactual”) values, under retrievals supporting either options. For instance, we test if the counterfactual retrieval that falsely identifies Albert Einstein’s birth-year as 1889 (correct: 1879) increases the model’s preference for 1889. We use GPT-oss-120B (OpenAI et al., 2025) to edit the original ground-truth relevant evidence to instead support the counterfactual values. Model preference is measured using the log-probability difference between the original and counterfactual values, log⁡P(original)−log⁡P(counterfactual)\log P(\text{original}) - \log P(\text{counterfactual}).

We find that both supporting and counterfactual evidence increase QueryLM®’s preference for the corresponding values more strongly than for the baseline models (Figure 6a). See Section A.5.2 for detailed setup and discussion.

Model preference and model accuracy under no evidence, original evidence, and counterfactual evidence

Figure 6. DCLM-Edu-trained SFT QueryLM°’s fact preference under no evidence, supporting evidence, and counterfactual evidence settings. No evidence: higher y-axis value indicates preference for original ground-truth facts. Original evidence and Counterfactual evidence: higher y-axis value indicates preference for facts supported by the evidence.

Generation grounded on relevant evidence. We further evaluate QueryLM®’s context-following ability across the eight QA tasks using either the original ground-truth supporting and the edited counterfactual context (Figure 6b). To assess context following ability independently of query generation ability, we hold search queries fixed across QueryLM® and FLOP-matched baselines. Retrieval uses BM25 over Sphere. Details of setting are discussed in Section A.5.2.

QueryLM® performs worse in closed-book setting, but is better at predicting the answer supported by supplied evidence, especially under counterfactual contexts. These results suggest that QueryLM® relies more strongly on retrieved evidence. Additional evaluations on factual-groundedness benchmarks, including FreshQA, HaluEval, and RAGTruth, show similar trends (Appendix, Section A.5).

General capabilities

For completeness, we evaluate QueryLM° on general language understanding and commonsense reasoning in closed-book setting (Appendix Section A.5.3, Table 13). QueryLM° base model slightly underperforms the FLOP-matched baselines, whereas the two are comparable after SFT, with mixed results across tasks. Search pretraining preserves general capabilities, but its advantage on search-based tasks does not translate into consistent improvements in closed-book reasoning.

ScaleModelARC-EARC-CHellaSwagPIQAWinoG.OBQACSQALAMBADAAvg.
Base models
400MStandard56.7 ± 2.030.7 ± 2.645.7 ± 1.069.3 ± 2.152.9 ± 2.734.0 ± 4.119.8 ± 2.241.4 ± 1.343.8 ± 0.9
QueryLM∘^{\circ}53.2 ± 2.029.2 ± 2.643.3 ± 1.068.4 ± 2.152.2 ± 2.731.8 ± 4.118.8 ± 2.238.4 ± 1.341.9 ± 0.9
1.4BStandard66.6 ± 1.938.7 ± 2.860.2 ± 1.074.3 ± 2.059.7 ± 2.739.2 ± 4.318.9 ± 2.253.9 ± 1.451.4 ± 0.9
QueryLM∘^{\circ}67.8 ± 1.936.4 ± 2.858.0 ± 1.072.6 ± 2.059.4 ± 2.736.6 ± 4.219.7 ± 2.251.7 ± 1.450.3 ± 0.9
3.3BStandard73.8 ± 1.844.2 ± 2.865.5 ± 0.976.6 ± 1.965.0 ± 2.642.8 ± 4.321.0 ± 2.359.0 ± 1.356.0 ± 0.9
QueryLM∘^{\circ}70.2 ± 1.841.1 ± 2.862.2 ± 0.975.2 ± 2.062.6 ± 2.741.4 ± 4.319.7 ± 2.255.9 ± 1.453.5 ± 0.9
QueryLMTop−2∘^{\circ}_{\mathrm{Top-2}}75.2 ± 1.744.5 ± 2.865.8 ± 0.976.3 ± 1.964.0 ± 2.643.2 ± 4.319.5 ± 2.258.5 ± 1.355.9 ± 0.9
After Search SFT
400MStandard49.8 ± 2.031.0 ± 2.646.5 ± 1.068.8 ± 2.152.3 ± 2.736.4 ± 4.219.7 ± 2.244.4 ± 1.443.6 ± 0.9
QueryLM∘^{\circ}48.4 ± 2.030.6 ± 2.643.8 ± 1.067.6 ± 2.152.6 ± 2.732.0 ± 4.121.9 ± 2.341.0 ± 1.342.2 ± 0.9
1.4BStandard52.5 ± 2.036.6 ± 2.860.2 ± 1.072.5 ± 2.059.4 ± 2.741.8 ± 4.318.3 ± 2.251.8 ± 1.449.1 ± 0.9
QueryLM∘^{\circ}56.4 ± 2.036.5 ± 2.858.9 ± 1.072.0 ± 2.159.8 ± 2.740.6 ± 4.320.3 ± 2.352.5 ± 1.449.6 ± 0.9
3.3BStandard58.6 ± 2.041.7 ± 2.865.1 ± 0.974.3 ± 2.064.6 ± 2.644.2 ± 4.322.4 ± 2.359.2 ± 1.353.8 ± 0.9
QueryLM∘^{\circ}64.6 ± 1.941.0 ± 2.862.7 ± 0.974.6 ± 2.063.0 ± 2.743.4 ± 4.320.2 ± 2.355.4 ± 1.453.1 ± 0.9
QueryLMTop−2∘^{\circ}_{\mathrm{Top-2}}64.7 ± 1.942.8 ± 2.865.3 ± 0.975.8 ± 2.064.7 ± 2.643.0 ± 4.321.3 ± 2.356.1 ± 1.454.2 ± 0.9
After standard SFT (Dolci mixture)
400MStandard54.8 ± 2.031.2 ± 2.646.2 ± 1.068.6 ± 2.154.3 ± 2.736.0 ± 4.220.5 ± 2.346.1 ± 1.444.7 ± 0.9
QueryLM∘^{\circ}52.1 ± 2.029.8 ± 2.644.1 ± 1.067.0 ± 2.153.5 ± 2.732.2 ± 4.121.2 ± 2.343.1 ± 1.442.9 ± 0.9
1.4BStandard65.8 ± 1.940.3 ± 2.860.7 ± 1.074.1 ± 2.060.6 ± 2.740.4 ± 4.319.2 ± 2.256.5 ± 1.452.2 ± 0.9
QueryLM∘^{\circ}64.3 ± 1.937.0 ± 2.858.0 ± 1.072.9 ± 2.060.9 ± 2.743.4 ± 4.320.1 ± 2.255.3 ± 1.451.5 ± 0.9
3.3BStandard71.3 ± 1.846.8 ± 2.966.1 ± 0.975.1 ± 2.067.0 ± 2.643.8 ± 4.321.8 ± 2.359.3 ± 1.356.4 ± 0.9
QueryLM∘^{\circ}70.2 ± 1.842.7 ± 2.862.5 ± 0.974.7 ± 2.063.4 ± 2.642.4 ± 4.320.4 ± 2.357.3 ± 1.354.2 ± 0.9
QueryLMTop−2∘^{\circ}_{\mathrm{Top-2}}71.5 ± 1.844.6 ± 2.866.2 ± 0.975.8 ± 2.065.9 ± 2.644.0 ± 4.321.5 ± 2.360.2 ± 1.356.2 ± 0.9

Table 13. General capabilities without search, DCLM-Edu (accuracy, %), for base models, after Search SFT, and after standard SFT (Dolci mixture). QueryLMTop−2∘^{\circ}_{\mathrm{Top-2}}: compute-matched 3.3B QueryLM∘^{\circ} pretrained with the Top-2 augmentation (Section 6.4). Bold marks the better of QueryLM∘^{\circ} and Standard.

Discussion

How effective are QueryLM°’s search queries?

We assess QueryLM° and FLOP-matched baselines’ search query generation ability by comparing their downstream task performances using their own queries after Search SFT versus queries generated by a stronger model, Qwen3-30B-A3B-Instruct-2507 (Team (2025)). This allows us to assess the effectiveness of self-generated queries, and whether stronger query generation can narrow the performance gap between QueryLM° and baselines. Both settings use BM25 over Sphere for retrieval.

Across model scales, replacing self-generated queries with Qwen-generated queries results in smaller performance gains for QueryLM° than for the FLOP-matched baselines (Figure 7), suggesting that QueryLM° generates more effective search queries. When the query source is fixed, QueryLM° also outperforms the baselines at both 400M and 1.4B scales. However, this trend reverses at the 3.3B scale, potentially due to stronger parametric knowledge and in-context reasoning ability at a larger scales.

Figure 7. Effect of query strength on SFT models QA performance (avg. LLM-judged acc. (%)).

How does retrieval source affect QueryLM° performance?

Using model-generated queries, we compare retrieval using BM25 over Wikipedia, BM25 over Sphere, and open-web search through Tavily. These settings vary in corpus coverage and retrieval backend, allowing us to assess how the choice of search source affects downstream accuracy. Tavily gives the highest accuracy in this comparison, motivating its use for downstream evaluation. For pretraining data annotation, however, API costs accumulate over millions of documents. We therefore use local BM25 retrieval over Sphere during annotation. Raw values and trends for SFT models are in Appendix Section A.5.4.

How does training-time search context affect performance?

We construct two search response variants for training data augmentation using an LM summarizer (Gemma 4 E4B): summaries of raw retrieved documents (“LM-summarized”) and summaries of the training documents themselves, which contain explicit ground-truth value asked for by the search query (“oracle”). The former tests the benefit of cleaner retrieval context, while the latter examines the effect of training on highly relevant evidence and model’s generalization beyond this controlled setting. We compare both against the original Wikipedia-trained 360M QueryLM and a FLOP-matched baseline (“Standard”).

Without search context (“No context”), Oracle exhibits the highest perplexity on 400 held-out documents’ original tokens, followed by QueryLM and LM-summarized (Table 1). Perplexity drops slightly across all variants with the models’ inference-time queries and context (“Live”). With the original search annotations (“Orig.”), both Oracle and LM-summarized perplexity drops below QueryLM’s, indicating greater reliance on the retrieved context. However, their stronger context reliance does not translate to improved performance on downstream QA (“QA with search”) and general benchmark (“General”), suggesting limited generalization to a different retrieval setting (BM25 retrieval over Sphere).

Pretraining contextComputeNo contextOrig.LiveOpen-domainMulti-hopGeneral
Standard (none)1.007.5710.019.703.2†0.2†35.1
QueryLM∘^{\circ} (default)1.047.967.447.7812.25.733.7
LM-summarized0.797.607.097.478.30.534.9
Oracle1.0410.175.0310.079.74.031.8

Table 1. Effect of the pretraining context (Wikipedia, 360M; same documents and queries, only the response text differs). †baseline evaluated closed book.

Can we reduce training-time search response length and query frequency?

Longer responses and more frequent searches increase the amount of retrieved information available during pretraining, but also increase training cost. We examine two ways to reduce this overhead: shortening the retrieved context and limiting the number of query insertions.

In the first variant, we limit the response length from 600 (our default) to 50 characters, which reduces the added sequence length and may also remove information useful for predicting the continuation. In the second variant, we retain only the two insertions per document with the highest response-continuation overlap. We find that both variants substantially reduce the amount of search augmentation while still retaining reasonable search capability useful for downstream performance (Table 2). These results suggest that context length and insertion frequency offer ways to trade performance for lower training cost.

AugmentationBlocks/docComputeNo contextGoldLiveOpen-domainMulti-hopGeneral
Standard (none)–1.007.5710.019.703.2†0.2†35.1
QueryLM∘^{\circ} (default)8.21.047.967.447.7812.25.733.7
50-char responses3.80.557.907.857.958.20.933.8
Top-2 queries/doc2.00.577.947.737.905.61.233.5

Table 2. Effect of context length and query frequency (Wikipedia, 360M). Blocks/doc: inserted query–response blocks per held-out document. Compute: pretraining FLOPs relative to the compute-matched baseline. Other columns as in Table 1. †baseline evaluated closed-book.

As the Top-2 variant is the most practical and cost-effective alternative to our default augmentation, we test the approach at scale by training a FLOP-matched 3.3B QueryLMTop-2∘^{\circ}_{\text{Top-2}}. On knowledge-intensive QA, QueryLMTop-2∘^{\circ}_{\text{Top-2}} performance falls between QueryLM∘^{\circ} and Standard after both Search SFT and standard SFT (Table 10), while on general capabilities it matches Standard within the confidence intervals (Table 13). QueryLMTop-2∘^{\circ}_{\text{Top-2}} therefore offers a reasonable trade-off between downstream performance and annotation cost.

ScaleModelTriviaQANQPopQAWebQsHotpotQA2WikiMuSiQueBamboogleAvg.
360MStandard12.6±1.55.0±1.011.6±1.48.6±1.26.8±1.17.6±1.21.8±0.84.1±3.87.3±0.6
QueryLM∘^{\circ}37.1±2.118.6±1.728.8±2.023.5±1.919.6±1.715.9±1.64.9±1.26.6±4.619.4±0.8
+12.1
400MStandard39.2±2.122.1±1.830.8±2.032.7±2.119.0±1.720.0±1.86.9±1.48.3±5.022.4±0.9
QueryLM∘^{\circ}41.8±2.227.5±2.037.5±2.137.3±2.121.9±1.823.5±1.97.6±1.512.4±5.926.2±1.0
+3.8
1.4BStandard64.9±2.137.0±2.137.4±2.148.9±2.229.8±2.025.1±1.910.4±1.711.6±5.733.1±1.0
QueryLM∘^{\circ}70.0±2.041.9±2.240.7±2.250.7±2.231.3±2.028.1±2.011.9±1.813.2±6.036.0±1.0
+2.9
3.3BStandard70.2±2.040.5±2.139.3±2.152.0±2.232.1±2.024.4±1.912.6±1.824.0±7.536.9±1.2
QueryLM∘^{\circ}74.4±1.946.3±2.240.8±2.254.0±2.234.3±2.129.3±2.014.1±1.922.3±7.439.4±1.2
+2.5
QueryLM∘^{\circ} Top-266.8±2.140.7±2.242.6±2.250.4±2.232.2±2.031.2±2.012.7±1.826.4±7.837.9±1.2
+1.0
400MStandard30.2±2.015.2±1.621.6±1.825.7±1.913.4±1.516.2±1.64.0±1.15.9±4.416.5±0.8
QueryLM∘^{\circ}39.5±2.127.0±1.933.9±2.133.2±2.115.1±1.618.8±1.75.3±1.35.1±4.222.2±0.8
+5.7
1.4BStandard42.9±2.221.1±1.820.4±1.832.8±2.115.8±1.618.8±1.74.4±1.16.6±4.620.4±0.8
QueryLM∘^{\circ}55.0±2.232.0±2.035.1±2.142.1±2.223.2±1.820.3±1.86.7±1.48.3±5.027.8±0.9
+7.4
3.3BStandard52.4±2.227.4±2.030.3±2.039.3±2.123.2±1.823.7±1.97.9±1.515.7±6.527.5±1.0
QueryLM∘^{\circ}61.8±2.139.5±2.139.5±2.146.9±2.227.9±2.022.9±1.88.7±1.622.3±7.433.7±1.1
+6.2
QueryLM∘^{\circ} Top-258.9±2.237.3±2.138.1±2.149.5±2.228.6±2.026.1±1.98.5±1.613.2±6.032.5±1.0
+5.0

Table 10. SFT models knowledge-intensive QA evaluation (zero-shot, LLM-judged accuracy). Multihop QA allows up to two searches. Unless marked as standard SFT, models are trained with Search SFT. QueryLM∘^{\circ} Top-2: compute-matched 3.3B QueryLM∘^{\circ}, pretrained with only the two highest-overlap search insertions per document (Section 6.4); Deltas are average gains over the FLOP-matched baseline.

What is the cost of Search-Native Pretraining?

The annotation phase scans the training corpus of size DD and adds AA-many queries of length ℓq\ell_q, adding AℓA\ell more tokens to training corpus, where ℓ\ell is the size of query and response tokens. The data preparation is done once per corpus and can be reused across models. During inference, cost scales linearly with the number of search-calls, adding kℓk\ell for kk rounds of search and retrievals. Number of search queries (AA), tokens per query (ℓ\ell), and the number of queries at inference (kk) are hyperparameters that can be tweaked to reduce cost, whose impact is discussed in Section 6.3 and Section 6.4. See Table 14 in Appendix Section A.5.5 for a summary table.

MethodData preparation (once per corpus)TrainingInference (kk lookups)
Annotator tokensRetrievalsTokensTokensRetrievals
Standard––DDTT–
QueryLM∘^{\circ}D+AℓaD + A\ell_aAAD+AℓD + A\ellT+kℓT + k\ellkk

Table 14. Cost of standard pretraining and Search-Native Pretraining across data preparation, training and evaluation, in tokens processed and retrieval calls. DD: original training corpus tokens; AA: number of search queries; ℓ\ell: tokens added per search (search query, response, delimiters); ℓa\ell_a: annotator tokens computed per generated query; TT: inference tokens; kk: searches made at inference.

Conclusion

Search-Native Pretraining aims to teach LMs two complementary skills during pretraining: what to search for and how to use retrieved evidence to continue generation, alongside the standard language modelling objective. Our results show that QueryLM∘^{\circ} acquires these capabilities, achieving higher performance on knowledge-intensive tasks with search and grounding its predictions more effectively in supplied evidence. The difference in the closed-book evaluations shows that the models are also successful in reframing much of the memorization in pretraining through the search objective. Together, these findings suggest that integrating search into pretraining can complement smaller models’ parametric memory by training them to access and use external knowledge effectively.

Acknowledgments

We acknowledge support by the Swiss AI Initiative visiting PhD fellowships, as well as by armasuisse S+T research contract AR-CYD-C-033.

Appendix

Data Annotation

Creating the seed data. We construct Dseed\mathcal{D}_{\mathrm{seed}} from the first 10,000 English Wikipedia articles in the November 2023 snapshot that contain between 2,000 and 9,000 characters. GLM-5.2 annotates each document in two passes. It first reads the full document and marks where a search could help predict an upcoming fact, such as a name, date, or quantity. It then generates a search query at each position using only the preceding 1,600 characters (referred to as pip_i in the main text). This separates the choice of where to search from query generation, reducing the risk of including the answer in the query.

For each query, we retrieve passages with BM25 over FineWeb-Edu. We remove duplicate passages and passages for which at least 35% of word trigrams also occur in the source article. We keep the five highest-ranked remaining passages, truncated to approximately 900 characters each. Gemma-4-E4B-it compresses them into one to three sentences. This seed-data pipeline uses LLM compression over FineWeb-Edu; the later pretraining corpus annotation uses simple CPU-based cleaning over Sphere for scalability.

We apply no additional relevance filter for queries: preliminary experiments showed that heavily filtering Dseed\mathcal{D}_{\mathrm{seed}} decreased the search query emission rate of the annotator. The final set contains approximately 20 search queries per document. We split train and validation data into 9:1 ratio for MϕM_{\phi} fine-tuning.

Annotator model training setup. We fine-tune Gemma 4 E4B-it [15] on the training split of Dseed\mathcal{D}_{\mathrm{seed}} using LoRA with rank 16, α=32\alpha= 32, and dropout 0.05. Adapters are applied to the text decoder’s attention and feed-forward projections. We train for three epochs using AdamW, a peak learning rate of 2×10−42 \times10^{-4}, 3% warmup, cosine decay, and an effective batch size of 32 sequences. Each training sequence is one annotated document, preceded by an instruction describing when and how to search. Sequences are truncated on the right at 4,096 tokens.

During tokenization, we map Dseed\mathcal{D}_{\mathrm{seed}}’s query and response tags to Gemma’s native tool tokens: <|tool_call> and <|tool_call|> for queries, and <|tool_response> and <|tool_response|> for responses. Fine-tuning supervises the document text, queries, all four boundary tokens, and the end-of-turn marker, whereas the instruction prefix and retrieved response text are masked from the loss. Supervising the document text teaches the annotator to continue without searching where no call is present. We use the final checkpoint after three epochs to annotate the pretraining corpora and search-SFT data. The same instruction prefix is used during annotation.

Annotating pretraining corpus. We run MϕM_{\phi} over the entire training corpus to identify query insertion points. We keep candidate positions with insertion probability τ≥0.05\tau\ge0.05, enforcing a minimum separation of 40 characters. Queries are generated using greedy decoding with a limit of 24 tokens. The same τ\tau and query-generation budget are used for both Wikipedia and DCLM-EdU. After retrieving and compressing

CorpusWikipediaDCLM-Edu
Model size360M400M1.4B3.3B
Layers32142432
Hidden width9601,2802,0482,816
Feed-forward width2,5605,1208,19211,264
Query / key-value heads15 / 510 / 1016 / 1622 / 22
Head dimension64128128128
Reported parameters (M)361.8401.21,409.63,322.3
Value embeddings (M)–441.01,209.52,217.5
Total stored parameters (M)361.8842.22,619.15,539.7

caption: Pretraining model architectures, shared by QueryLM and Standard within each comparison.

:::

query responses, we measure their overlap with the first 260 characters of the original document continuation (referred to as sis_i in the main text) using ROUGE-1 F1. We retain insertions with a score of at least 0.1.

Choice of retrieval index. We first evaluate the 100B and 1T-token subsets of FineWeb-Edu as retrieval corpora. Although scaling to 1T tokens improves the query response rate, the 100B-token subset already returns results for 90% of search queries covered by 1T-token subset. We further find that Sphere ((Piktus et al., 2022)) retrieves more relevant results than the 100B-token FineWeb-Edu subset, as measured by the increase in log-likelihood of the original document continuation immediately following the retrieved results.

Training Setup

Datasets and preprocessing. For Wikipedia, we annotate the 6,083,581 English articles in the November 2023 snapshot (20231101.en). We restrict the corpus to the articles also present in LMLM’s Wikipedia set and remove those without accepted search insertion. The final training corpus contains 4.01B original-document tokens and 8.43B tokens after search annotation. We reserve 1% of training corpus as a held-out set.

For DCLM-Edu, we retain a subset of complete files from HuggingFaceTB/dclm-edu, retaining documents with educational scores of 2–5 without further score-based filtering. We remove documents shorter than 200 characters and exact duplicates within each file. The resulting corpus contains 65.13B original-document tokens and 101.54B tokens after search annotations. We reserve 1% of training corpus as a held-out set.

Gathering retrieved responses for search annotation, we cap response length to approximately 400 characters for Wikipedia and 800 for DCLM-Edu. We pack documents into 4,096-token blocks using best-fit-decreasing packing, with a supervised end-of-text token after each document. Padding and retrieved responses are excluded from the loss; document text and queries are supervised.

Model architectures. The Wikipedia models use the SmolLM2-360M configuration, with grouped-query attention, a SiLU feed-forward network, and tied input and output embeddings. The DCLM-Edu models use nanochat configurations with full multi-head attention, query/key normalization, squared-ReLU feed-forward networks, and untied input and output embeddings. They add gated value embeddings on alternating layers and cap output logits at 15. Wikipedia uses RMSNorm with ϵ=10−5\epsilon= 10^{-5}; DCLM uses parameter-free RMSNorm. All configurations use rotary position embeddings with base 100,000 and omit biases. tbl:3 gives the dimensions and parameter counts. The DCLM model sizes used throughout the paper exclude value embeddings; the table also reports total stored parameters.

All models use the SmolLM2 tokenizer extended with four search tokens, giving a vocabulary of 49,156 tokens. Nanochat pads the vocabulary dimension to 49,216. For the Wikipedia models, the four new embedding rows are initialized to the mean of the other rows.

Optimization. Table 4 summarizes the common settings. We use a global batch size of 256 sequences, each containing 4,096 tokens. The Wikipedia trainer processes all 4,096 positions per block; nanochat uses 4,095 input positions to predict the following tokens. Wikipedia runs use fused AdamW with FlashAttention-2 without gradient checkpointing. DCLM runs use Muon for matrix weights and AdamW for input embeddings, value embeddings, and the output head, with bf16 computation and fp32 master weights.

SettingWikipediaDCLM-Edu
OptimizerAdamWMuon + AdamW
Tokens per update1,048,5761,048,320
Peak learning rate5×10−45 \times10^{-4}0.02828 (Muon); AdamW rates in text
Warmup2% of steps40 steps, first segment only
Learning-rate decayCosine to zeroLinear to 5% of peak
AdamW ϵ\epsilon10−810^{-8}10−1010^{-10}
Weight decay0.1Per optimizer/group; see text
AdamW (β1,β2)(\beta_1, \beta_2)(0.9, 0.95)Per parameter group; see text
Gradient-norm clipping1.0None
Precisionbf16bf16 compute, fp32 master weights

Table 4. Pretraining optimization settings. DCLM decay durations vary by run as specified in the text; all rates apply to pretraining, before supervised fine-tuning.

For Muon, the effective peak learning rate is 0.028. Nesterov momentum increases from 0.85 to 0.97 over the first 400 steps, then decreases to 0.90 during learning-rate decay. We use five Polar Express iterations and weight decay 0.0096, annealed to zero with a cosine schedule during decay. For AdamW, the base learning rates are 0.3 for input embeddings and 0.008 for the output head, both scaled by 2(d/768)−1/2\sqrt{2}(d/768)^{-1/2} for hidden width dd. Value embeddings use half the input-embedding learning rate. The AdamW coefficients (β1,β2)(\beta_1, \beta_2) are (0.8, 0.995) for input embeddings and (0.8, 0.96) for the output head. Weight decay is 0.001 for input embeddings and 0.01 for value embeddings and the output head.

The learning rate remains constant after warmup until the final decay phase. Decay occupies the last 20% of steps for both over-trained 400M models. The non-overtrained 400M QueryLM and baseline pair branches from these runs at step 9,000, during the constant-learning-rate phase, and and decay over their final 1,100 steps (10.9%). For the 1.4B models, decay spans 10.8% and 6.8% of training for the search and baseline models; and 3.5% and 3.2% for the 3.3B models respectively. These schedules therefore differ slightly within the larger compute-matched pairs.

Training budgets and compute matching. Table 5 reports the final pretraining runs. “Processed tokens” include all input positions processed throughout training, including search queries and masked search responses. “Document tokens” count the original document tokens, also including repeated passes.

CorpusSizeConditionStepsTokens (B) DocumentTokens (B) ProcessedFLOPs (102010^{20})
Wikipedia360MQueryLM°31,86016.033.40.631
Standard30,60032.132.10.606
DCLM-Edu400MQueryLM°10,1006.810.60.309
Standard10,10010.610.60.309
1.4BQueryLM°41,93628.244.04.51
Standard41,93644.044.04.51
3.3BQueryLM°95,17264.099.823.5
Standard95,17299.899.823.5
DCLM-Edu400M, over-trainedQueryLM°96,85865.1101.52.96
Standard96,925101.6101.62.96

Table 5. Pretraining budgets before supervised fine-tuning.

The Wikipedia QueryLM trains for four epochs and is compared with an eight-epoch baseline, using approximately 4% more compute. The DCLM-Edu-trained QueryLM at 400M, 1.4B, and 3.3B scales use 6.8B, 28.2B, and 64.0B document tokens, and their compute-matched baselines are trained on more document tokens to run for the same number of steps. Matching compute requires the 3.3B baseline to repeat approximately 34.6B document tokens; the 400M and 1.4B baselines do not repeat documents. The over-trained 400M search model uses the full annotated corpus; its baseline runs 67 additional steps (0.07%) and repeats approximately 36.5B document tokens.

Resources. Across QueryLM and baseline model training, pretraining used approximately 316 GPU-hours on NVIDIA Hopper GPUs for Wikipedia (16×H200) and 2,240 GPU-hours on NVIDIA Blackwell GPUs for DCLM-Edu (16×B200). These totals exclude annotation, ablations, and the four-epoch Wikipedia reference. GPU-hours sum training time across all devices.

Search Fine-Tuning

Data mixture. QueryLM° and Standard are both fine-tuned on approximately 53,000 user-assistant conversations. Of these, about 64% of data split consist of smol-rewrite, smol-summarize, smol-constraints, and everyday-conversations subsets of SmolTalk ([3]), teaching general chat skills and are not augmented with search annotation. Another 15% of data is Hermes function-calling and xLAM subsets of SmolTalk2 ([3]), demonstrating tool calling behavior. The remaining 21% (11,237 conversations) consist of the Magpie, OpenHermes, and SystemChats subsets of SmolTalk and are augmented with search insertions.

We remove conversations for which web search is unlikely to be useful, such as fiction, mathematical calculations, code generation, or questions answerable from the prompt. We use the base Llama-3.1-8B model ([18]), prompted with labeled examples, as a binary classifier to make this decision.

Search annotation. We annotate conversations with the same annotator, pipeline, and thresholds as for DCLM-Edu pretraining (Section A.1), restricting search augmentation to assistant turns. Search responses are retrieved with BM25 over Sphere and compressed using an 800-character budget. After the initial annotation, we move all inserted search blocks to the start of the sentences in which they were originally placed, retaining at most one block per sentence. This enforces the behavior that an assistant searches before writing a claim rather than in the middle of it. Also, this setup matches our evaluation where search is triggered at the start of the assistant turn. The final data contain 38,436 search blocks across 9,713 conversations. The 1,524 conversations left without a block are kept as ordinary chat.

Format and loss masking. Conversations are rendered as plain text, with System:, User:, and Assistant: role prefixes, with turns separated by blank lines. We add no additional chat tokens. Search blocks use the same query and response tokens as pretraining (§ 3.3). We compute the loss on assistant text, search-query blocks, and end-of-sequence token, while masking and the loss on User turn, system prompts, retrieved responses, and padding. The loss on role prefixes are masked as well, except for the User: to signal end of assistant turn.

We pack conversations into 4,096-token sequences using best-fit-decreasing packing, truncating longer conversations. Attention is not masked between conversations in the same sequence. This gives 8,601 sequences with 35.2M tokens, 44% of which carry loss. We reserve 1% split consisting of 87 sequences as a held-out set.

Optimization. Each corpus is fine-tuned for one epoch with its pretraining trainer (Table 6). For DCLM-Edu models, we follow nanochat’s fine-tuning recipe. Training resumes from the final pretraining checkpoint together with its optimizer state, including Muon momentum and AdamW moments; only the step counter and data position are reset. All learning rates are 0.8 times their pretraining peaks, and Muon

SettingWikipediaDCLM-Edu
InitializationPretrained weightsPretrained weights and optimizer state
OptimizerAdamWMuon + AdamW
Training length1 epoch, 134 updates1 epoch, 33 updates
Sequences per update64256
Tokens per update262,1441,048,320
Peak learning rate2×10−52 \times10^{-5}0.8×0.8 \times pretraining peaks (Muon 0.0226)
Warmup3% of stepsNone
Learning-rate decayCosine to zeroConstant for the first half, then linear to zero
Weight decay0.10 (Muon); pretraining values (AdamW)

caption: Search fine-tuning settings. Within each corpus, QueryLM and Standard use identical data and settings. Settings not listed follow Table 4.

:::

momentum decreases from 0.97 to 0.90 as the learning rate decays. For Wikipedia models, we start a fresh AdamW optimizer. Within each corpus, QueryLM and Standard use the same settings and number of updates.

Evaluation

Tasks

We evaluate QueryLM and baselines on eight open-ended question-answering tasks that probe world knowledge. Four tasks primarily assess factual recall: TriviaQA covers broad factual knowledge through trivia questions; Natural Questions (NQ-Open) pairs Google search questions with short answers; PopQA tests knowledge derived from Wikipedia knowledge-triplets; and WebQuestions contains question-answer pairs derived from web search queries.

The other four tasks assess multi-hop reasoning, requiring models to connect multiple pieces of evidence. HotpotQA requires combining evidence across Wikipedia articles, while 2Wiki emphasizes explicit reasoning chains across Wikipedia facts. MuSiQue constructs questions requiring two to four reasoning steps by composing single-hop questions; we only consider two-hop questions from MuSiQue. Bamboogle contains challenging two-hop questions whose answers are supported by Wikipedia articles.

In addition, we use FreshQA to test whether retrieval helps modeles answer questions about current facts. Finally, HaluEval and RAGTruth assess model’s groundedness in supplied evidence in settings involving hallucinated or unsupported content.

Evaluation budget

In the search-enabled setting, a model makes one search query per question on the four factual QA tasks and up to two queries per question on the four multi-hop QA tasks. The first query is forced in both settings. Further search queries are suppressed for factual QA, while the second query is optional for multi-hop QA. We use greedy decoding for both base and SFT models, with a maximum of 24 tokens per search query. Answer generation is limited to 24 tokens for base models and 64 tokens for SFT models.

For each query, we retrieve the top-3 search results using either BM25 over the selected retrieval corpus or Tavily. We extract up to eight relevant sentences from the combined results, using a budget of approximately 1,200 characters that preserves complete sentences.

Prompting

For base model evaluation, we use four-shot demonstrations of question and answer pairs sampled from the corresponding task. Closed-book evaluation contains regular question and answer pairs, whereas search-enabled demonstrations include search and retrieval steps in each model’s native format: explicit search query and result blocks for QueryLM, fact blocks for Co-LMLM, and entity–relation look-ups for LMLM. For multi-hop tasks, the four-shot demonstrations include both one-search and two-search examples. SFT models are evaluated zero-shot, using “User:/Assistant:” format to be consistent with their training data. In the search-enable setting, the search query token is inserted at the start of the assistant response. Example prompts are shown in Figure 9.

Prompt formats for base and SFT models

Figure 9. Prompt formats for base and SFT models.

QueryLM°: four-shot base model

Question: What is the capital of Alaska?
<WEB-QUERY>capital of Alaska</WEB-QUERY>
<WEB-RESPONSE>[...] Juneau is the capital city in Alaska.
[...]</WEB-RESPONSE>
Answer: Juneau

Co-LMLM: four-shot base model

Question: What is the capital of Alaska?
Answer: <FACT>Juneau</FACT> Juneau

LMLM: four-shot base model

Question: What is the capital of Alaska?
Answer: <|db_entity|> Alaska<|db_relationship|> Capital
<|db_return|> Juneau<|db_end|> Juneau

QueryLM°: zero-shot SFT model

User: Question: What is the capital of Alaska?
Assistant: <WEB-QUERY>capital of Alaska</WEB-QUERY>
<WEB-RESPONSE>[...] Juneau is the capital city in Alaska.
[...]</WEB-RESPONSE>
Juneau

Impact of Multiple Look-ups on Knowledge-Intensive Task

We find that allowing more than one search improves the model prediction accuracy for multi-hop questions. The benefits are greater for the SFT models (Table 7).

ScaleModelBase (four-shot) 1 lookupBase (four-shot) ≤ 2 lookupsBase (four-shot) ΔSFT (zero-shot) 1 lookupSFT (zero-shot) ≤ 2 lookupsSFT (zero-shot) Δ
360MStandard3.643.640.006.596.54−0.05
360MQueryLM°6.576.45−0.1310.8411.24+0.40
400MStandard7.447.43−0.0112.4112.51+0.10
400MQueryLM°11.7711.98+0.2115.3116.82+1.51
1.4BStandard10.2710.20−0.0618.3118.98+0.67
1.4BQueryLM°13.0513.10+0.0518.5620.22+1.66
3.3BStandard11.2211.17−0.0521.5021.68+0.18
3.3BQueryLM°14.9614.94−0.0220.2121.69+1.49

Table 7. Multi-hop QA for four-shot base and zero-shot SFT models using BM25 retrieval over Sphere. Values are answer-containment accuracy (%), averaged over Multi-hop QAs.

Complete Results

This section gives the full tables and setup behind the figures in § 5, following its subsections.

Knowledge-Intensive QA

In Table 8, we compare per-task performance and approximated pretraining FLOPs of open-weight models, SmolLM2 and 3 ([3, 7]) and Qwen2.5 (Qwen et al., 2025) base, with QueryLM without and with search. Search-enabled QueryLM uses its own queries with Tavily open-web retrieval. The prompting strategy and generation budget follows the setup outlined in Section A.4.

ModelPretraining FLOPsTriviaQANQPopQAWebQsHotpotQA2WikiMuSiQueBamboogleAvg.
Open-weight base models: no search
SmolLM2-360M8.69×10218.69 \times10^{21}26.9±1.926.9 \pm1.98.7±1.28.7 \pm1.211.2±1.411.2 \pm1.417.4±1.717.4 \pm1.712.4±1.412.4 \pm1.421.6±1.821.6 \pm1.82.7±0.92.7 \pm0.95.8±4.35.8 \pm4.313.3±0.713.3 \pm0.7
SmolLM2-1.7B1.13×10231.13 \times10^{23}37.6±2.137.6 \pm2.117.2±1.717.2 \pm1.718.8±1.718.8 \pm1.725.4±1.925.4 \pm1.916.9±1.616.9 \pm1.622.4±1.822.4 \pm1.83.9±1.13.9 \pm1.19.9±5.49.9 \pm5.419.0±0.919.0 \pm0.9
SmolLM3-3B-Base2.07×10232.07 \times10^{23}56.5±2.256.5 \pm2.223.2±1.823.2 \pm1.820.3±1.820.3 \pm1.827.2±1.927.2 \pm1.920.6±1.820.6 \pm1.825.3±1.925.3 \pm1.95.6±1.35.6 \pm1.39.9±5.49.9 \pm5.423.6±0.923.6 \pm0.9
Qwen2.5-0.5B5.29×10225.29 \times10^{22}20.4±1.820.4 \pm1.88.1±1.28.1 \pm1.211.8±1.411.8 \pm1.414.6±1.514.6 \pm1.514.2±1.514.2 \pm1.523.9±1.923.9 \pm1.92.5±0.92.5 \pm0.95.0±4.15.0 \pm4.112.5±0.712.5 \pm0.7
Qwen2.5-1.5B1.66×10231.66 \times10^{23}38.4±2.138.4 \pm2.117.4±1.717.4 \pm1.714.8±1.614.8 \pm1.627.8±2.027.8 \pm2.018.1±1.718.1 \pm1.725.6±1.925.6 \pm1.93.9±1.13.9 \pm1.17.4±4.87.4 \pm4.819.2±0.819.2 \pm0.8
Qwen2.5-3B3.34×10233.34 \times10^{23}44.3±2.244.3 \pm2.221.1±1.821.1 \pm1.817.0±1.617.0 \pm1.634.6±2.134.6 \pm2.121.6±1.821.6 \pm1.825.9±1.925.9 \pm1.96.0±1.36.0 \pm1.313.2±6.013.2 \pm6.023.0±1.023.0 \pm1.0
QueryLM: no search
QueryLM 400M3.09×10193.09 \times10^{19}12.2±1.412.2 \pm1.44.3±0.94.3 \pm0.98.2±1.28.2 \pm1.27.8±1.27.8 \pm1.29.2±1.39.2 \pm1.325.2±1.925.2 \pm1.90.6±0.50.6 \pm0.52.5±3.12.5 \pm3.18.8±0.58.8 \pm0.5
QueryLM 1.4B4.51×10204.51 \times10^{20}25.9±1.925.9 \pm1.99.5±1.39.5 \pm1.311.9±1.411.9 \pm1.418.9±1.718.9 \pm1.712.2±1.412.2 \pm1.420.9±1.820.9 \pm1.82.2±0.82.2 \pm0.86.6±4.66.6 \pm4.613.5±0.713.5 \pm0.7
QueryLM 3.3B2.35×10212.35 \times10^{21}31.3±2.031.3 \pm2.010.8±1.410.8 \pm1.412.2±1.412.2 \pm1.419.9±1.719.9 \pm1.712.6±1.512.6 \pm1.520.1±1.820.1 \pm1.83.0±1.03.0 \pm1.06.6±4.66.6 \pm4.614.6±0.814.6 \pm0.8
QueryLM: own-query open-web search via Tavily
QueryLM 400M3.09×10193.09 \times10^{19}59.2±2.259.2 \pm2.225.9±1.925.9 \pm1.937.3±2.137.3 \pm2.125.0±1.925.0 \pm1.919.9±1.719.9 \pm1.720.3±1.820.3 \pm1.83.8±1.13.8 \pm1.16.6±4.66.6 \pm4.624.8±0.824.8 \pm0.8
QueryLM 1.4B4.51×10204.51 \times10^{20}72.7±2.072.7 \pm2.033.7±2.133.7 \pm2.139.1±2.139.1 \pm2.134.2±2.134.2 \pm2.124.1±1.924.1 \pm1.922.2±1.822.2 \pm1.86.7±1.46.7 \pm1.49.9±5.49.9 \pm5.430.3±0.930.3 \pm0.9
QueryLM 3.3B2.35×10212.35 \times10^{21}74.5±1.974.5 \pm1.937.9±2.137.9 \pm2.142.8±2.242.8 \pm2.235.4±2.135.4 \pm2.125.4±1.925.4 \pm1.921.8±1.821.8 \pm1.87.9±1.57.9 \pm1.510.7±5.610.7 \pm5.632.0±0.932.0 \pm0.9

Table 8. Knowledge-intensive QA performance and approx. pretraining compute of open-weight base models. (four-shot prompts, answer-contained accuracy (%)).

Tables 9 and 10 give the per-task scores behind Figure 5.

Use of Retrieved Context

Counterfactual Context. To compare QueryLM∘^{\circ} and the baseline’s ability to follow counterfactual evidence, we consider Search SFT-trained models as they are both trained with inline search demonstrations.

For model preference shift evaluation, we sample 1000 sequences from DCLM-Edu training documents that QueryLM∘^{\circ} was trained on with search annotations, with search query and retrieval that support the original continuation. We filter for search insertions that are immediately followed by a concrete fact. We then measure the log-probability difference of the ground-truth and counterfactual values at the same continuation position under three conditions: no evidence, cleaned original evidence, and counterfactual evidence.

For counterfactual QA evaluation, we use Qwen3-30B-A3B-Instruct-2507 model generated search queries to use the same retrieval source for both QueryLM∘^{\circ} and baseline models. We use BM25 index over Sphere for reproducible retrieval. The model performance is judged by GPT-oss-120B, following the same SFT performance evaluation protocol.

Table 11 gives the values behind Figure 6, for both the base and SFT models. Since Standard models have not seen the search query annotations during training, we also assess the preference shift by placing the retrieved context at the start of the input sequence, instead of right before the factual value (“context first”).

Model Groundedness. We evaluate QueryLM∘^{\circ} and Standard models on FreshQA, HaluEval, and RAGTruth for groundedness evaluation.

We evaluate factual accuracy on FreshQA using the 500 test questions from the 21 April 2026 snapshot. The benchmark covers facts with varying rates of change (“Fact type”) and questions with false premises (“Premise”), which tests access to current knowledge and the ability to reject incorrect assumptions. Before SFT, we compare search-enabled QueryLM° with the closed-book Standard model; after Search SFT, both models are evaluated with search enabled. Table 12 shows QueryLM° substantially improves over the closed-book baseline before SFT. After search SFT, the two models perform similarly at every scale.

ScaleModelNo searchNever-changingSlow-changingFast-changingFalseValidAvg.
Base models
400MStandard5.8±2.15.8 \pm2.19.0±4.19.0 \pm4.12.2±2.32.2 \pm2.36.1±4.26.1 \pm4.20.0±1.50.0 \pm1.57.7±2.77.7 \pm2.75.8±2.15.8 \pm2.1
QueryLM°6.0±2.16.0 \pm2.134.6±6.734.6 \pm6.717.8±5.617.8 \pm5.69.1±5.09.1 \pm5.06.5±4.56.5 \pm4.526.9±4.526.9 \pm4.521.8±3.621.8 \pm3.6 (+16.0)
1.4BStandard10.2±2.710.2 \pm2.717.6±5.417.6 \pm5.46.1±3.66.1 \pm3.65.3±4.05.3 \pm4.00.0±1.50.0 \pm1.513.6±3.513.6 \pm3.510.2±2.710.2 \pm2.7
QueryLM°8.4±2.48.4 \pm2.442.6±7.042.6 \pm7.022.2±6.022.2 \pm6.09.1±5.09.1 \pm5.04.8±3.94.8 \pm3.933.5±4.733.5 \pm4.726.4±3.926.4 \pm3.9 (+16.2)
3.3BStandard13.2±3.013.2 \pm3.023.9±6.123.9 \pm6.18.3±4.18.3 \pm4.14.5±3.74.5 \pm3.74.0±3.74.0 \pm3.716.2±3.716.2 \pm3.713.2±3.013.2 \pm3.0
QueryLM°8.8±2.58.8 \pm2.542.6±7.042.6 \pm7.024.4±6.224.4 \pm6.213.6±5.913.6 \pm5.93.2±3.43.2 \pm3.436.7±4.836.7 \pm4.828.4±3.928.4 \pm3.9 (+15.2)
After Search SFT
400MStandard2.4±1.42.4 \pm1.428.7±6.428.7 \pm6.418.9±5.718.9 \pm5.76.1±4.26.1 \pm4.26.5±4.56.5 \pm4.523.4±4.323.4 \pm4.319.2±3.419.2 \pm3.4
QueryLM°4.6±1.94.6 \pm1.929.8±6.529.8 \pm6.518.9±5.718.9 \pm5.79.8±5.19.8 \pm5.13.2±3.43.2 \pm3.426.3±4.426.3 \pm4.420.6±3.520.6 \pm3.5 (+1.4)
1.4BStandard8.0±2.48.0 \pm2.444.7±7.044.7 \pm7.022.8±6.122.8 \pm6.18.3±4.88.3 \pm4.86.5±4.56.5 \pm4.534.0±4.834.0 \pm4.827.2±3.927.2 \pm3.9
QueryLM°3.6±1.73.6 \pm1.741.5±7.041.5 \pm7.020.0±5.820.0 \pm5.812.9±5.712.9 \pm5.72.4±3.02.4 \pm3.034.0±4.834.0 \pm4.826.2±3.826.2 \pm3.8 (-1.0)
3.3BStandard4.8±1.94.8 \pm1.939.9±6.939.9 \pm6.919.4±5.819.4 \pm5.88.3±4.88.3 \pm4.85.6±4.25.6 \pm4.230.3±4.630.3 \pm4.624.2±3.724.2 \pm3.7
QueryLM°5.6±2.05.6 \pm2.039.9±6.939.9 \pm6.921.7±6.021.7 \pm6.09.8±5.19.8 \pm5.13.2±3.43.2 \pm3.432.7±4.732.7 \pm4.725.4±3.825.4 \pm3.8 (+1.2)

Table 12. SFT model evaluation on FreshQA by fact type and premise (LLM-judged accuracy, %; 21 April 2026 snapshot, 500 test questions; zero-shot). Avg.: accuracy across all 500 questions. No search: both models without search.

No evidenceOriginal evidenceCounterfactual evidence
Model400M1.4B3.3B400M1.4B3.3B400M1.4B3.3B
Base models
Standard0.20±0.120.20 \pm0.120.38±0.190.38 \pm0.190.49±0.180.49 \pm0.180.35±0.140.35 \pm0.140.43±0.180.43 \pm0.180.48±0.170.48 \pm0.17−1.20±0.13-1.20 \pm0.13−0.89±0.17-0.89 \pm0.17−1.00±0.16-1.00 \pm0.16
Standard (context first)0.20±0.120.20 \pm0.120.38±0.190.38 \pm0.190.49±0.190.49 \pm0.190.67±0.130.67 \pm0.130.79±0.200.79 \pm0.200.89±0.190.89 \pm0.19−1.29±0.13-1.29 \pm0.13−0.99±0.19-0.99 \pm0.19−0.91±0.20-0.91 \pm0.20
QueryLM°0.15±0.110.15 \pm0.110.33±0.190.33 \pm0.190.40±0.190.40 \pm0.190.66±0.130.66 \pm0.130.81±0.200.81 \pm0.200.89±0.200.89 \pm0.20−1.27±0.14-1.27 \pm0.14−0.91±0.20-0.91 \pm0.20−0.75±0.20-0.75 \pm0.20
After Search SFT
Standard0.17±0.140.17 \pm0.140.25±0.180.25 \pm0.180.38±0.190.38 \pm0.190.25±0.190.25 \pm0.190.35±0.170.35 \pm0.170.46±0.170.46 \pm0.17−1.07±0.19-1.07 \pm0.19−0.82±0.17-0.82 \pm0.17−0.57±0.17-0.57 \pm0.17
QueryLM°0.12±0.130.12 \pm0.130.21±0.170.21 \pm0.170.30±0.170.30 \pm0.170.63±0.150.63 \pm0.150.82±0.180.82 \pm0.180.78±0.180.78 \pm0.18−1.46±0.15-1.46 \pm0.15−1.47±0.20-1.47 \pm0.20−0.93±0.18-0.93 \pm0.18

Table 11. Controlled context probe on 1000 held-out DCLM-Edu facts.

HaluEval provides supported and hallucinated answer pairs; for RAGTruth, we construct analogous pairs from responses to the same question and retrieved evidence using the hallucination annotations. We measure the fraction of examples in which the model assigns higher mean-token log probability to the supported answer than to the hallucinated answer (“prefer-right”) when no context, irrelevant context, and relevant context is provided. We place the contexts as plain text in the user message.

QueryLM° favors supported statements on both HaluEval and RAGTruth benchmarks (Figure 10c) with relevant context at every scale. The gap in QueryLM° and baseline performance is smaller without context or with irrelevant context, suggesting that the lift in performance primarily comes from using relevant evidence to guide predictions.

HaluEval QA and RAGTruth evaluation after Search SFT

Figure 10. HaluEval QA and RAGTruth evaluation after Search SFT, prefer-right %. a) and b) visualize the values in (c).

General Model Capability

Under a fixed training budget, Search-Native Pretraining allocates part of its compute to processing additional tokens introduced by search annotations. To assess the effect on general capabilities, we evaluate

QueryLM{sup}° and the FLOP-matched Standard zero-shot on the held-out evaluation splits of eight benchmarks. For multiple-choice tasks, we rank answer options using conditional log-likelihood with length normalization and report per-task accuracy in Table 13.

Switching Retrieval Source

We evaluate the impact of switching the retrieval source on knowledge-intensive task accuracy. Retrieval-enabled conditions use one search query per question, including for multi-hop tasks. Standard models use QueryLM{sup}°’s queries and retrieved evidence; SFT models each generate their own queries. Tavily is restricted to Wikipedia for Wiki 360M models and searches the open web for DCLM models. Figure 11a shows the raw number used to plot Figure 8, and Figure 11b shows additional evaluation result on SFT models.

Figure 8. Effect of retrieval source on base model QA performance (avg. answer-contained score).

Effect of retrieval source on QA performance
ContextWiki 360M StandardWiki 360M QueryLM°DCLM 400M (over-trained) StandardDCLM 400M (over-trained) QueryLM°DCLM 1.4B StandardDCLM 1.4B QueryLM°DCLM 3.3B StandardDCLM 3.3B QueryLM°
Closed book3.7±0.43.7 \pm0.43.8±0.43.8 \pm0.411.5±0.611.5 \pm0.610.9±0.610.9 \pm0.615.2±0.815.2 \pm0.813.5±0.713.5 \pm0.716.7±0.816.7 \pm0.814.6±0.814.6 \pm0.8
BM25 Wiki4.2±0.34.2 \pm0.35.7±0.45.7 \pm0.48.6±0.58.6 \pm0.517.0±0.717.0 \pm0.711.9±0.611.9 \pm0.620.4±0.820.4 \pm0.815.5±0.715.5 \pm0.722.0±0.922.0 \pm0.9
BM25 Sphere6.1±0.56.1 \pm0.57.5±0.57.5 \pm0.510.7±0.610.7 \pm0.620.5±0.720.5 \pm0.713.8±0.713.8 \pm0.723.8±0.823.8 \pm0.818.3±0.818.3 \pm0.825.5±0.925.5 \pm0.9
Tavily5.4±0.45.4 \pm0.47.0±0.57.0 \pm0.514.5±0.714.5 \pm0.726.7±0.926.7 \pm0.918.6±0.818.6 \pm0.830.3±0.930.3 \pm0.923.9±0.823.9 \pm0.832.0±0.932.0 \pm0.9

(a) Base models (four-shot).

ContextWiki 360M StandardWiki 360M QueryLM°DCLM 400M (over-trained) StandardDCLM 400M (over-trained) QueryLM°DCLM 1.4B StandardDCLM 1.4B QueryLM°DCLM 3.3B StandardDCLM 3.3B QueryLM°
Closed book9.1±0.69.1 \pm0.67.0±0.57.0 \pm0.513.8±0.613.8 \pm0.68.9±0.68.9 \pm0.617.7±0.717.7 \pm0.78.1±0.58.1 \pm0.515.4±0.715.4 \pm0.75.0±0.45.0 \pm0.4
BM25 Wiki7.9±0.57.9 \pm0.515.1±0.615.1 \pm0.616.6±0.816.6 \pm0.821.7±0.921.7 \pm0.925.1±0.825.1 \pm0.825.5±0.925.5 \pm0.928.4±1.028.4 \pm1.027.5±0.927.5 \pm0.9
BM25 Sphere8.4±0.58.4 \pm0.517.7±0.717.7 \pm0.717.4±0.717.4 \pm0.724.5±0.824.5 \pm0.827.6±0.927.6 \pm0.927.9±0.927.9 \pm0.930.6±1.030.6 \pm1.030.3±0.930.3 \pm0.9
Tavily9.5±0.59.5 \pm0.521.4±0.921.4 \pm0.925.4±0.925.4 \pm0.930.2±0.930.2 \pm0.933.6±1.033.6 \pm1.035.4±1.035.4 \pm1.036.8±1.136.8 \pm1.136.9±1.036.9 \pm1.0

(b) SFT models (zero-shot).

Figure 11. Effect of retrieval source on QA performance, Averaged answer-contained accuracy (%) across all eight QA tasks.

Cost of Search-Native Pretraining

Table 14 summarizes the cost of Search-Native Pretraining in terms of added tokens and retrievals.

References

  1. [1]Syeda Nahida Akter, Shrimai Prabhumoye, John Kamalu, Sanjeev Satheesh, Eric Nyberg, Mostofa Patwary, Mohammad Shoeybi, and Bryan Catanzaro. Mind: Math informed synthetic dialogues for pre-training llms, 2025a. URL https://arxiv.org/abs/2410.12881.
  2. [2]Syeda Nahida Akter, Shrimai Prabhumoye, Eric Nyberg, Mostofa Patwary, Mohammad Shoeybi, Yejin Choi, and Bryan Catanzaro. Front-loading reasoning: The synergy between pretraining and post-training data, 2025b. URL https://arxiv.org/abs/2510.03264.
  3. [3]Loubna Ben Allal, Anton Lozhkov, Elie Bakouch, Gabriel Martín Blázquez, Guilherme Penedo, Lewis Tunstall, Andrés Marafioti, Hynek Kydlíček, Agustín Piqueres Lajarín, Vaibhav Srivastav, et al. Smollm2: When smol goes big – data-centric training of a small language model, 2025. URL https://arxiv.org/abs/2502.02737.
  4. [4]Zeyuan Allen-Zhu and Yuanzhi Li. Physics of language models: Part 3.3, knowledge capacity scaling laws, 2024. URL https://arxiv.org/abs/2404.05405.
  5. [5]Akari Asai, Zeqiu Wu, Yizhong Wang, Avirup Sil, and Hannaneh Hajishirzi. Self-rag: Learning to retrieve, generate, and critique through self-reflection, 2023. URL https://arxiv.org/abs/2310.11511.
  6. [6]Christina Baek, Ricardo Pio Monti, David Schwab, Amro Abbas, Rishabh Adiga, Cody Blakeney, Maximilian Böther, Paul Burstein, Aldo Gael Carranza, Alvin Deng, et al. The finetuner’s fallacy: When to pretrain with your finetuning data. arXiv preprint arXiv:2603.16177, 2026.arxiv.org/abs/2603.16177
  7. [7]Elie Bakouch, Loubna Ben Allal, Anton Lozhkov, Nouamane Tazi, Lewis Tunstall, Carlos Miguel Patiño, Edward Beeching, Aymeric Roucher, Aksel Jonas Reedi, Quentin Gallouédec, Kashif Rasul, Nathan Habib, Clémentine Fourrier, Hynek Kydlícek, Guilherme Penedo, Hugo Larcher, Mathieu Morlon, Vaibhav Srivastav, Joshua Lochner, Xuan-Son Nguyen, Colin Raffel, Leandro von Werra, and Thomas Wolf. SmolLM3: smol, multilingual, long-context reasoner. https://huggingface.co/blog/smollm3, 2025.
  8. [8]Jonathan Berant, Andrew Chou, Roy Frostig, and Percy Liang. Semantic parsing on freebase from question-answer pairs. In Proceedings of the 2013 Conference on Empirical Methods in Natural Language Processing, 2013.DOI
  9. [9]Sebastian Bergeaud, Arthur Mensch, Jordan Hoffmann, Trevor Cai, Eliza Rutherford, Katie Millican, George van den Driessche, Jean-Baptiste Lespiau, Bogdan Damoc, Aidan Clark, et al. Improving language models by retrieving from trillions of tokens, 2022. URL https://arxiv.org/abs/2112.04426.
  10. [10]Yihong Chen, Kelly Marchisio, Roberta Raileanu, David Ifeoluwa Adelani, Pontus Stenetorp, Sebastian Riedel, and Mikel Artetxe. Improving language plasticity via pretraining with active forgetting, 2024. URL https://arxiv.org/abs/2307.01163.
  11. [11]Daixuan Cheng, Yuxian Gu, Shaohan Huang, Junyu Bi, Minlie Huang, and Furu Wei. Instruction pre-training: Language models are supervised multitask learners, 2024. URL https://arxiv.org/abs/2406.14491.
  12. [12]Guanting Dong, Junting Lu, Junjie Huang, Wanjun Zhong, Longxiang Liu, Shijue Huang, Zhenyu Li, Yang Zhao, Xiaoshuai Song, Xiaoxi Li, et al. Agent-world: Scaling real-world environment synthesis for evolving general agent intelligence. arXiv preprint arXiv:2604.18292, 2026.arxiv.org/abs/2604.18292
  13. [13]Yair Feldman, Linxi Zhao, Nathan Godey, Dongyoung Go, Yilun Hua, Kilian Q. Weinberger, Jennifer J. Sun, and Yoav Artzi. Co-lmm: Continuous-query limited memory language models, 2026. URL https://arxiv.org/abs/2607.07707.
  14. [14]Tianyu Gao, Alexander Wettig, Luxi He, Yihe Dong, Sadhika Malladi, and Danqi Chen. Metadata conditioning accelerates language model pre-training, 2025. URL https://arxiv.org/abs/2501.01956.
  15. [15]Gemma Team, Sherif El Abd, Vaibhav Aggarwal, Robin Alqavres, Alek Andreev, Olivier Bachem, Ian Ballantyne, Cormac Brick, Victor Čárbune, Michelle Casbon, et al. Gemma 4 technical report, 2026. URL https://arxiv.org/abs/2607.02770.
  16. [16]Gaurav R. Ghosal, Pratyush Maini, and Aditi Raghunathan. Memorization sinks: Isolating memorization during llm training, 2025. URL https://arxiv.org/abs/2507.09937.
  17. [17]GLM-5-Team, Aohan Zeng, Xin Lv, Zhenyu Hou, Zhengxiao Du, Qinkai Zheng, Bin Chen, Da Yin, Chendi Ge, Chenghua Huang, et al. Glm-5: from vibe coding to agentic engineering, 2026. URL https://arxiv.org/abs/2602.15763.
  18. [18]Aaron Grattafiori, Abhimanyu Dubey, Abhinav Jauhri, Abhinav Pandey, Abhishek Kadian, Ahmad Al-Dahle, Aiesha Letman, Akhil Matur, Alan Schelten, Alex Vaughan, et al. The llama 3 herd of models, 2024. URL https://arxiv.org/abs/2407.21783.
  19. [19]Jia-Chen Gu, Hao-Xiang Xu, Jun-Yu Ma, Pan Lu, Zhen-Hua Ling, Kai-Wei Chang, and Nanyun Peng. Model editing harms general abilities of large language models: Regularization to the rescue. In Yaser Al-Onaizan, Mohit Bansal, and Yun-Nung Chen (eds.), Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing, pp. 16801–16819, Miami, Florida, USA, November 2024. Association for Computational Linguistics. doi: 10.18653/v1/2024.emnlp-main.934. URL https://aclanthology.org/2024.emnlp-main.934/.
  20. [20]Suriya Gunasekar, Yi Zhang, Jyoti Aneja, Caio César Teodoro Mendes, Allie Del Giorno, Sivakanth Gopi, Mojan Javaheripi, Piero Kauffmann, Gustavo de Rosa, Olli Saarikivi, et al. Textbooks are all you need, 2023. URL https://arxiv.org/abs/2306.11644.
  21. [21]Kelvin Guu, Kenton Lee, Zora Tung, Panupong Pasupat, and Ming-Wei Chang. Realm: Retrieval-augmented language model pre-training, 2020. URL https://arxiv.org/abs/2002.08909.
  22. [22]Xanh Ho, Anh-Khoa Duong Nguyen, Saku Sugawara, and Akiko Aizawa. Constructing a multi-hop qa dataset for comprehensive evaluation of reasoning steps, 2020. URL https://arxiv.org/abs/2011.01060.
  23. [23]Jing Huang, Daniel Wurgafl, Rachit Bansal, Laura Ruis, Naomi Saphra, David Alvarez-Melis, Andrew Kyle Lampinen, Christopher Potts, and Ekdeep Singh Lubana. Why larger models learn more: Effects of capacity, interference, and rare-task retention, 2026a. URL https://arxiv.org/abs/2605.29548.
  24. [24]Yukun Huang, Sanxing Chen, Jian Pei, Manzil Zaheer, and Bhuvan Dhingra. Cite pretrain: Retrieval-free knowledge attribution for large language models, 2026b. URL https://arxiv.org/abs/2506.17585.
  25. [25]Bowen Jin, Hansi Zeng, Zhenrui Yue, Jinsung Yoon, Sercan Arik, Dong Wang, Hamed Zamani, and Jiawei Han. Search-r1: Training llms to reason and leverage search engines with reinforcement learning, 2025. URL https://arxiv.org/abs/2503.09516.
  26. [26]Mandar Joshi, Eunsol Choi, Daniel S. Weld, and Luke Zettlemoyer. Triviaqa: A large scale distantly supervised challenge dataset for reading comprehension. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics, 2017.
  27. [27]Nikhil Kandpal, Haikang Deng, Adam Roberts, Eric Wallace, and Colin Raffel. Large language models struggle to learn long-tail knowledge, 2023. URL https://arxiv.org/abs/2211.08411.
  28. [28]Hangoo Kang, Tarun Suresh, Jon Saad-Falcon, and Azalia Mirhoseini. Trace: Capability-targeted agentic training. arXiv preprint arXiv:2604.05336, 2026.arxiv.org/abs/2604.05336
  29. [29]Jiyeon Kim, Hyunji Lee, Hyowon Cho, Joel Jang, Hyeonbin Hwang, Seungpil Won, Youbin Ahn, Dohaeng Lee, and Minjoon Seo. Knowledge entropy decay during language model pretraining hinders new knowledge acquisition, 2025. URL https://arxiv.org/abs/2410.01380.
  30. [30]Tom Kwiatkowski, Jennimaria Palomaki, Olivia Redfield, Michael Collins, Ankur Parikh, Chris Alberti, Danielle Epstein, Illia Polosukhin, Jacob Devlin, Kenton Lee, et al. Natural questions: A benchmark for question answering research. Transactions of the Association for Computational Linguistics, 2019.

Paper details

vlnc:W_xegmta7z
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 9

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Computer Science

Not recorded for this paper

View statement
Looking for related papers…
Contents