Jeffrey Gordon · Read the paper (PDF)
Abstract. We use terms in a question to select passages from a document before inference. When the selection rule finds weak or dispersed evidence, it retains the full document. Across four model families answering the same 320 questions, selection reduced estimated floating-point operations (FLOPs) in the model’s matrix calculations by 50.7% to 59.7% per answer. We estimated the work from each model’s architecture and the number of tokens it processed. On H100 GPUs, requests took 35.7% less time on average (95% CI 33.1% to 38.1%). Answer F1, a measure of overlap with a reference answer, rose by 2.1 points (95% CI 0.5 to 3.6). On 100 new questions, time fell by 37.0% (95% CI 32.7% to 40.9%) and F1 rose by 3.0 points (95% CI 0.1 to 6.0). BM25, which ranks passages by how well their words match the question, took about as long at the same token budget. Averaged across the four models, our selector scored 2.5 F1 points higher on the new questions (95% CI 0.1 to 5.0). The difference on the original 320 was uncertain.
One question in our test asks which Melbourne suburb hosted the 1956 Night Series Cup games. The answer is two words, “Albert Park.” With the whole source attached, the prompt was 4,472 tokens long for Llama 70B. Before Llama could produce the first word of its answer, it had to process all 4,472 tokens. This first pass is called prefill. Each token goes through the feed-forward layers, and full causal attention compares it with every token up to that position. Keeping fewer tokens reduces both kinds of work.
Figure 1. Average FLOPs saved and measured reduction in request time on the 320 primary questions. Both reductions compare selected text with the full source. Request time includes text selection and preparation.
On the 320 questions, Llama’s mean prompt fell from 9,425 to 4,697 tokens. Estimated matrix work fell from 1,444 to 689 trillion operations per answer. A request that took 1.98 seconds on average with the full document took 1.17 seconds with selection. These averages include the questions where we kept the whole document.
In our earlier work we chose which attention heads ran on each token (Gordon, 2026). Here we choose which source tokens reach the model. Every head runs on the text we keep, and the model caches keys and values as usual. The risk is in the passage we leave out. A missing sentence can change the answer, and even the position of evidence can affect whether a model uses it (Liu et al., 2024).
The selector is a fixed CPU algorithm. It takes a question, source text and the model’s tokenizer, and returns either the full source or selected excerpts. It has no trained router. The model receives the selected source with the original question and instructions. Retrieval-augmented generation supplies relevant passages to a model (Lewis et al., 2020). LongLLMLingua uses questions to guide compression (Jiang et al., 2024).
Figure 2. The selector ranks source blocks, checks whether to trim, and builds the text given to the decoder.
We count the L source tokens with the model’s tokenizer, without adding special tokens. We split at numbered passage headers, then cut each passage into consecutive blocks of at most 192 tokens. To match words, we decode each block back to text. From the lowercased blocks and question, we take runs of ASCII letters and digits, dropping one-character terms and words on a fixed stop list.
A name that occurs in two blocks tells us more about where to look than a word that occurs everywhere. BM25 gives a distinct question term found in d of the document’s N blocks the weight
w(d) = ln(1 + (N - d + 0.5)/(d + 0.5))
BM25 uses each block’s term counts and length relative to the mean block length in words, with k_1=1.2 and b=0.75 (Robertson and Zaragoza, 2009). We take the top three blocks as seeds, or all blocks if there are fewer. Ties go to the earlier block. Coverage is the share of question-term weight found in the seeds. A term missing from the source adds ln(1+N) to the total question weight. Dispersion is the eighth score divided by the best. With fewer than eight blocks we use the last score instead of the eighth. We keep the full source when
L ≤ 2048 or coverage < 0.48 or dispersion > 0.80
A seed may name another passage that contains the answer. When there are several passages, we take each title from the line after its numbered header. For a block in a different passage, let u be the share of its title’s distinct term weight found in the seed. A seed with score s and rank r (starting at one) adds 0.65 (s/r) u^2 to that block’s BM25 score and 0.30 (s/r) to each immediate neighbor in its own passage. Bonuses add across seeds. We use at least 0.01 in the denominator for title overlap, coverage and dispersion.
We take blocks by decreasing score, breaking ties by source order, up to min(L, max(1536, round(0.38 L))) block token IDs. A 10,000-token source gets a 3,800-token budget if it passes the fallback checks. We take the start of the last block if only part fits, then restore the selected pieces to source order. We join the decoded pieces with blank lines and retokenize the complete prompt. Separators and chat formatting can change its final length.
Llama answered the Melbourne question with “Albert Park” from both the full 4,472-token prompt and the selected 1,754-token prompt. Prefill produced the first answer token and two cached steps produced the rest. Adding their estimated costs in TFLOPs gives
F_full = 638.45 + 0.301 ≈ 638.75, F_selected = 244.16 + 0.287 ≈ 244.45
The shorter prompt cut matrix work by 61.7%. Measured request time fell from 0.640 to 0.300 seconds.
Table 1. Decoder architectures. Model names link to the pinned configurations. Grouped-query attention (GQA) rows give query (Q) and key/value (KV) head counts and their width in channels. MLA denotes multi-head latent attention.
| Checkpoint | Layers / hidden width | Attention | Feed-forward layers and active width |
|---|---|---|---|
| Hermes 3 Llama 70B | 80 / 8,192 | GQA, 64 Q / 8 KV (128) | 80 dense, width 28,672 |
| OLMo 3.1 32B Instruct | 64 / 5,120 | GQA, 40 Q / 8 KV (128) | 64 dense, width 27,648 |
| GLM-4.5-Air | 46 / 4,096 | GQA, 96 Q / 8 KV (128) | 1 dense (10,944), then 45 MoE. Each token uses 8 of 128 routed experts + 1 shared, width 1,408 each. |
| DeepSeek-V2.5 | 60 / 5,120 | MLA, 128 query heads. Prefill Q/K width 192, value width 128. | 1 dense (12,288), then 59 MoE. Each token uses 6 of 160 routed experts + 2 shared, width 1,536 each. |
In Llama, eight query heads share one set of keys and values. Each head scores those keys separately to weight the values. The layer then runs the same feed-forward network on every token. In a GLM mixture-of-experts (MoE) layer, the router scores 128 networks per token. Eight process the token along with one shared expert.
Let P count all prompt tokens, including the question and chat template. A GQA layer has hidden width h, q query heads and k KV heads of width d. The SwiGLU network has intermediate width i. In an MoE layer, i sums the active expert widths and the router scores E candidates. Counting two FLOPs per multiply-add gives
F_proj = 4 P h d (q+k), F_MLP = 6 P h i, F_attn = 4 q d C(P), F_router = 2 P h E
Full attention scores every earlier key and the current key. In 48 OLMo layers, a query sees at most W=4096 keys. The other 16 use full attention. The pair counts per head are
C(P) = (P(P+1))/2, m = min(P,W), C_W (P) = (m(m+1))/2 + (P-m)m
For G output tokens, the work after prefill depends on the growing length of the cache.
cached steps = G-1, additional pairs per head = C(P+G-1)-C(P)
Windowed layers use C_W. We count one vocabulary projection per output token and average costs across requests.
DeepSeek-V2 uses latent attention (DeepSeek-AI, 2024). It compresses queries to 1,536 channels and caches 512 latent KV channels plus 64 rotary key channels per position. Prefill expands keys to 192 channels and values to 128. During vLLM cached decode, each query scores 576 channels and weights a 512-channel value. We account for chunked-prefill cache re-expansion separately. Timings include memory traffic, padding, nonlinear operations and CPU selection.
We settled on the selection rule using 60 questions with Qwen3-8B. Then every checkpoint answered the same 320 English LongBench questions, 64 from each task. HotpotQA, 2WikiMultihopQA and MuSiQue ask readers to connect evidence across passages (Yang et al., 2018; Ho et al., 2020; Trivedi et al., 2022). Qasper asks about research papers (Dasigi et al., 2021). MultiFieldQA-en includes several kinds of documents (Bai et al., 2024). Some questions share a source, giving 306 document groups within the five tasks. We reserved another 20 questions per task from documents outside both the development set and the original 320.
For each question, we ran the same model on the full source, on our selected text, and on blocks ranked by BM25 alone. Before timing BM25, we gave it the number of source tokens our selector kept for that question. That lets us test whether adding a neighboring block or following a passage title helps at the same length. After chat formatting, the two shortened prompts differed by at most one token on the four new families. We timed each method from text preparation through the final answer, including its own selection work.
We ran one request at a time on H100 GPUs with BF16 weights. Each model used its own tokenizer and chat format. We turned off prefix caching on the serving endpoints and used greedy decoding until the model stopped or reached 32 output tokens. We used a Hugging Face inference loop for Qwen3-32B and vLLM 0.18.1 for the other checkpoints (Kwon et al., 2023). All timing comparisons use the same model and engine on both sides.
We scored each answer against its references and kept the highest normalized token F1, on a scale of 0 to 100. Before testing, we set two requirements. We divided the mean time saved by the mean time with full text. That saving had to reach 20%, and the lower end of the 95% confidence interval for the F1 change had to stay above a one-point loss. We resampled whole documents within each task 200,000 times so questions about the same text stayed together. For the four-model mean, we gave each model equal weight and drew the same documents for all four. Each interval covers its own comparison.
Table 2. Time and answer quality on the same 320 questions. Read each pair as full text / selected text. Brackets give paired 95% intervals for the F1 differences. The first three checkpoints are from the earlier tests.
| Model (H100s) | Seconds | Saved | Answer F1 | ΔF1 vs full | ΔF1 vs BM25 |
|---|---|---|---|---|---|
| Qwen3 32B (1) | 2.69 / 1.45 | 46.2% | 41.7 / 44.3 | +2.6 [0.2, 5.0] | +2.9 [0.8, 5.2] |
| Mistral Large 123B (4) | 1.68 / 0.93 | 44.8% | 35.6 / 38.6 | +3.0 [0.0, 6.1] | +4.4 [1.8, 7.0] |
| Qwen3 235B-A22B (8) | 0.56 / 0.39 | 30.8% | 38.7 / 40.8 | +2.1 [0.1, 4.2] | +1.7 [−0.3, 3.8] |
| Hermes 3 Llama 70B (2) | 1.98 / 1.17 | 41.1% | 31.1 / 37.9 | +6.7 [4.1, 9.5] | −0.9 [−2.7, 0.9] |
| OLMo 3.1 32B (2) | 0.83 / 0.54 | 35.1% | 40.0 / 38.4 | −1.5 [−4.6, 1.4] | −1.3 [−3.5, 0.8] |
| GLM-4.5-Air 106B (4) | 0.38 / 0.25 | 35.0% | 46.1 / 46.2 | +0.1 [−2.8, 2.9] | +1.2 [−1.0, 3.5] |
| DeepSeek-V2.5 236B (8) | 0.61 / 0.42 | 31.5% | 40.8 / 43.8 | +2.9 [0.1, 5.8] | +2.8 [0.6, 5.2] |
Five of the seven checkpoints met both requirements. Among the new families, Llama and DeepSeek cleared both thresholds. Across the four new families, the selector kept the whole document on 64 to 67 questions out of 320. Each tokenizer cuts the source into slightly different blocks, which can change the decision.
We restarted each server and ran 40 of the original questions again with the same GPU count, changing the request order. Every method picked the same text it had used the first time. Of the 480 answers, 471 matched the first run exactly. We counted those 40 questions once in the primary results.
Figure 3. Changes in answer F1 and request time for each model against full text. The table gives paired 95% intervals from resampling source documents.
Paired 95% confidence intervals
| Model | F1 · original | F1 · new | Time (%) · original | Time (%) · new |
|---|---|---|---|---|
| Llama | [4.1, 9.5] | [0.5, 9.4] | [38.3, 43.7] | [37.0, 46.6] |
| OLMo | [−4.6, 1.4] | [−2.9, 6.5] | [32.3, 37.9] | [32.2, 41.8] |
| GLM | [−2.8, 2.9] | [−6.9, 4.5] | [32.2, 37.5] | [29.4, 38.7] |
| DeepSeek | [0.1, 5.8] | [1.5, 11.8] | [28.7, 34.2] | [30.0, 38.5] |
On the 100 new questions, mean request time fell by 37.0% (95% CI 32.7% to 40.9%) and mean F1 rose by 3.0 points (95% CI 0.1 to 6.0). The lower bound cleared our one-point loss limit for the four-model average. Llama and DeepSeek gained F1 on both sets. OLMo lost 1.5 points on the original questions, and GLM lost 1.3 on the new ones.
Across the four families, estimated matrix work differed by less than 0.01% between our selector and BM25 at the same token budget. The mean F1 gain over BM25 was 0.5 points (95% CI −0.7 to 1.7) on the original questions and 2.5 points (95% CI 0.1 to 5.0) on the new ones. Only the interval for the new questions stays above zero. On the original questions the selector was 0.5% slower than BM25 on average (95% CI from 0.4% faster to 1.4% slower).
DeepSeek-V2.5 took 0.420 seconds per answer with our selector and 0.419 with BM25. At that speed, our selector scored 2.85 F1 points higher on the original questions (95% CI 0.64 to 5.15). On the 100 new questions the difference was 3.97 points (95% CI −0.16 to 8.38).
On Qwen3-32B we also tried keeping just the beginning and end of each source. At the same length, that rule scored 31.9 F1. BM25 scored 41.4, our selector scored 44.3, and reading the whole document scored 41.7.
Across the four models, mean F1 changes by task ranged from +0.6 points on MuSiQue to +3.9 on 2WikiMultihopQA. We also tried 10 NarrativeQA and 10 TriviaQA questions that fit within 32,768 tokens for every model. On these 20 questions, mean time savings fell to 7.8% (95% CI −1.1% to 18.6%) and the F1 change was −1.0 points (95% CI −3.2 to 0.4). With so few documents, the interval includes both a speed gain and a slowdown.
Some individual answers got worse even when mean F1 went up. Depending on the model, 3 to 15 answers that matched a reference exactly with full text lost that match. Another 11 to 24 gained one. These tests cover short answers in English. Longer answers and tasks that require reading every passage are still open questions.
Table 3. Mean prompt length and estimated matrix FLOPs per completed answer. One TFLOP is one trillion floating-point operations. We calculated work for each request before adding it across the 320 questions. Brackets give paired 95% intervals for the percentage saved.
| Family | Full tokens | Kept tokens | Full TFLOPs | Kept TFLOPs | Saved % [95% CI] |
|---|---|---|---|---|---|
| Llama | 9,425 | 4,697 | 1,444 | 689 | 52.2% [49.1, 55.1] |
| OLMo | 9,488 | 4,778 | 642 | 316 | 50.7% [47.7, 53.5] |
| GLM | 9,442 | 4,636 | 360 | 150 | 58.5% [55.0, 61.7] |
| DeepSeek | 10,057 | 4,979 | 732 | 295 | 59.7% [56.0, 63.0] |
Table 4. Distribution of saved FLOPs across model components. Each percentage is a share of the total reduction for that model. The remainder (up to 0.12%) comes from routing tokens to experts and scoring the vocabulary.
| Family | TFLOPs removed | Feed-forward | Attention projections | Scores + value mixing |
|---|---|---|---|---|
| Llama | 754.0 | 70.8% | 15.2% | 14.1% |
| OLMo | 325.6 | 78.6% | 11.7% | 9.7% |
| GLM | 210.5 | 32.6% | 22.9% | 44.4% |
| DeepSeek | 437.0 | 26.3% | 20.8% | 52.7% |
On each model, at least 99.7% of the saved FLOPs came from prefill. On Llama, prefill fell from 1,440.02 to 686.83 TFLOPs per answer and cached decoding fell from 3.50 to 2.64. Prefill contributed 753.19 of the 754.04 TFLOPs saved.
On Llama, 70.8% of the saving came from feed-forward layers. On DeepSeek, attention scores and value mixing accounted for 52.7%. Counting reconstruction of earlier keys and values in 4,096-token chunks changes DeepSeek’s estimated saving from 59.7% to 60.3%.
The FLOP estimate covers the model’s matrix products. Request time also includes passage selection, data movement, communication, padding, softmax and normalization. To test the effect of answer length, we ran 20 questions with each of three models, forcing one output token and then 32. The time savings at those lengths were 42.0% and 25.0% on Qwen3-235B, 49.0% and 29.6% on OLMo, and 40.7% and 26.3% on DeepSeek. Reading less text saved time at both output lengths.
The archive includes the selector (SHA-256 prefix acb59def0dc8), checkpoint revisions, token counts and timings. The flops.py script reproduces Tables 3 and 4.