Independent study · sparse attention

How much of its context does an LLM actually need to read?

Published September 1, 2026

TL;DR

With ideal block selection, a 7B model reading ~13% of a long document matches full attention almost exactly. The quality problem in sparse attention is selection, not the reading budget.

A training-free baseline (scoring each block by its mean key, as Quest/MoBA-style methods do) already recovers 90-93% of the recoverable signal, consistently across three model families.

The cheap proxy metric we started with inverted the ranking of two methods versus real next-token loss. If an evaluation doesn't measure actual prediction quality, it can be worse than no evaluation.

Why I ran this

I spent several months building a sparse-attention prototype of my own. To find out whether it worked, I had to build increasingly paranoid instrumentation, because every quick metric I tried turned out to have a way of lying to me. The instrumentation eventually killed the prototype — cleanly, with numbers — and outlived it. This page documents what the harness measures, the three ways this kind of evaluation silently fails, and the results across three open models. The harness itself is downloadable below.

Method

Take a frozen open-weight model (never trained or modified). Feed it a long real document. Intercept every attention layer and inject an additive mask that restricts which blocks of earlier tokens each query may read — nothing else about the computation changes, and this is verified: with an all-open mask, the patched model reproduces the original bit-for-bit (max difference 0.0). Score each selection policy by real next-token negative log likelihood on the final 1,024 tokens.

Five arms, every run
ArmRoleWhat it is
densetargetfull attention, the model as shipped
oracleceilingpicks blocks using the model's true attention (cheats; establishes the best score physically possible at the budget)
meanpoolincumbentscore each block by query × block-mean-key; training-free; the published state of the art's core mechanism
randomnullpicks blocks by chance; anything at or below this is not selecting
localfloorrecent window + attention sink only; measures how much the document needs long-range reading at all

Why five arms? Each one closes an escape hatch.

A score means nothing on its own; each baseline exists because leaving it out lets a broken result look like a good one.

Most sparse-attention results we have read omit at least two of these five, and every omission is a specific, demonstrated way to fool yourself.

The floor-to-dense gap is the recoverable signal; each method is scored as the share of it recovered. If the floor nearly matches dense, the harness declares the whole run invalid rather than reporting numbers, because the document never tested long-range reading.

Three ways this evaluation silently lies

These are the heart of the page: the failure modes that made every quick metric untrustworthy until it was hardened against them.

  1. Checks that pass on NaN. if error >= tolerance: fail never fires when the error is NaN, because every comparison with NaN is false. An earlier version of this harness printed a complete, confident results table where every number was NaN, above a verification line that had silently "passed." Guards must test the positive condition: if not (error < tolerance): fail.
  2. Masks that let the model peek at the future. Supplying any explicit attention mask disables the framework's built-in causality, so the mask must enforce token-level causality itself. A block-granularity mask let every query see up to 31 tokens ahead — and the tell was that every sparse method beat full attention, which is impossible. If a restricted model outperforms an unrestricted one, the evaluation is broken, full stop.
  3. Proxy metrics that invert rankings. We first scored methods by "how much attention mass lands inside the selected blocks." By that proxy, method A beat method B by 32 points. By real next-token loss, B beat A decisively — the proxy didn't just add noise, it reversed the answer. Every number on this page is real NLL for that reason.

Results

Same harness, same corpus recipe, ~13% attention density, three base models:

Share of recoverable long-range signal recovered, by method
ModelDense NLLOracleMeanpoolRandom
Qwen2.5-7B (bf16)0.475100%93%44%
Mistral-7B-v0.1 (bf16)0.52197%92%55%
Qwen2.5-1.5B (bf16)0.653100%91%45%
Oracle (ceiling) Meanpool (incumbent) Random (null)
Qwen2.5-7B (bf16)dense NLL 0.475
Oracle
100%
Meanpool
93%
Random
44%
Mistral-7B-v0.1 (bf16)dense NLL 0.521
Oracle
97%
Meanpool
92%
Random
55%
Qwen2.5-1.5B (bf16)dense NLL 0.653
Oracle
100%
Meanpool
91%
Random
45%

(percentages = share of recoverable long-range signal; oracle at ~100% means ideal selection fully matches dense attention at one-eighth the reading)

A fourth run is worth reporting precisely because it failed. TinyLlama-1.1B-Chat scored 9.43 NLL under dense attention — near random-guessing for its vocabulary — while every one of the harness's integrity checks stayed green. The instrument correctly measured an unsuitable substrate (a chat-tuned model collapses on raw text) instead of producing a plausible-looking wrong table. Lesson folded into the docs: base models only, and an implausibly high dense NLL means the substrate, not the selectors, is what you're measuring.

What it means

Selection is the entire quality problem: the oracle shows the reading budget itself costs nothing.

The incumbent is strong: a two-line, training-free baseline captures >90%. New selection methods must beat that, not just "random" or a strawman.

The open ground is the last 7-9 points between meanpool and oracle — block summaries richer than a mean — and the deployment frontier is kernels, not selection: masking proves quality but doesn't skip memory reads.

Limitations

Adding your own selection method is one function: it gets scored against all five arms automatically, behind all of the guards above.

Get the harness

Download the notebook (runs on a free Kaggle T4 in ~25 minutes) and the README. Adding your own method is one function:

def sel_mine(layer_idx, q, k, T, device):
    scores = ...   # (query_block, key_block); higher = more worth reading
    return build_mask(scores, T // BLOCK, T, device)
Notebook sabench.ipynb

Runs end to end on a free Kaggle T4 GPU in about 25 minutes.

Download notebook
Docs README.md

Setup, the five arms, and the guardrails explained.

Download README

This is what an evidence-first post looks like

Same discipline, applied to your LinkedIn

Founders with real technical work deserve content that's this specific and this honest about its own limits. That's the standard I write to.

Get your free LinkedIn audit See the technical founder page

Study and harness by Ezekiah Livingston, built in pair with an AI research assistant (Claude). Every number above comes from logged Kaggle runs; the harness re-produces the table from scratch, downloads included. Contact via the main site.