Attention Windowing

Most of attention is slack. Measure exactly how much, per head and causally, then deploy the measurement.

The slack is real, but only where you measure it.

Attention Windowing is the exploit corollary of Semantic Gravity. If content routing collapses toward a few local, anchor-heavy targets, then dense O(n²) attention is a bill most heads never run up. This program measures that overpayment directly: per head, causally, on pretrained models from 124M to 7.6B parameters. The measurement becomes a deployable compression: window the heads that are already local, keep the few that route globally, and cut latency and KV cache at matched quality. The discipline that makes it real is measuring where you deploy, not where it's convenient. What's left open is whether it survives a retrieval test, and that answer decides whether this ends up a long-context compression paper or an edge-AI one.

Threads

The compressibility map

framework

The instrument the program is built on. Replace one attention head with a fixed sink-plus-local window, renormalize, and read off the perplexity it costs: a causal, per-head map of how much of each head is load-bearing. Across GPT-2, Pythia, and Qwen from 124M to 7.6B parameters, 81 to 99.9% of heads come back near-free to window, and the fraction climbs with scale. What's windowable is predicted by locality, not by how peaky a head looks, and grouped-query attention, the dominant KV-cache trick, doesn't consume the headroom (a pre-registered prediction, falsified by a permutation test).

The realization: a three-axis Pareto

active

Cashing the map out end-to-end on Qwen2.5-7B, with the honest correction that makes it deployable: per-head-free is not jointly-free, and a map measured at short context over-promises at long context. Measure at the context you actually run at, window whole KV groups, and it becomes a Pareto improvement: 25% of groups lossless, 50% for about 2× faster attention (an exact FlexAttention kernel) and 2× less KV cache at matched quality, no fine-tuning. A healing-gated frontier runs past that.

Does it survive retrieval?

active

The open question, and an honest one. Perplexity is blind to long-range retrieval: a windowed model can read as lossless and still have forgotten how to find a needle in a haystack. A passkey suite with six arms tests whether the perplexity-expensive heads the map keeps dense are the same heads retrieval needs. If they are, this is a long-context compression result that beats the KV-cache baselines; if they aren't, it's a clean edge-AI story instead. I'm waiting on GPU credits to run it.

The edge stack

blueprint

Where the compression compounds: windowing is orthogonal to weight quantization and stacks with it. On 4-bit weights it adds about 0.2 perplexity, and the KV-cache saving is structural, roughly the windowed fraction regardless of context. A small QLoRA heal recovers the frontier. Four-bit weights, half the groups windowed, an optional adapter: a 7-to-8B model at long context on commodity hardware.

Results

GPT-2 Pythia Qwen
Most heads are windowable, and more so with scale: 81% to 99.9% across three attention families.

The Pareto

WindowedQuality (Δppl @8k)Latency vs SDPA @32kKV-cache @128kFine-tuning
25% of groupslossless, both archs~1.5×*1.33×none
50% of groupslossless Qwen · +0.22 Llama~1.9–2.2×1.99×none
75% of groups+0.5 … +0.96~3.8×3.97×healing-gated

*25% latency is interpolated; the bench measured 50% and 75% directly.

Cross-validation

One calibration map, calibrated once on WikiText @4096, deployed unchanged across architecture and domain.

Model25%50%75%Random-50%
Qwen2.5-7B (7:1) · WikiText @8k−0.33−0.08+0.49+1.75
Qwen2.5-7B · PG19 @8k (transfer)−0.33−0.12+0.54+1.34
Llama-3.1-8B (4:1) · WikiText @8k+0.04+0.21+0.94+4.39
Llama-3.1-8B · PG19 @8k (transfer)+0.05+0.24+0.96+0.84

25% lossless everywhere; 50% lossless on Qwen, +0.22 on Llama; beats a random pick by 5 to 20 times over.

Artifacts

"Measure Where You Deploy: Attention Windowing as a Pareto Improvement" (in preparation)Code on requestThe whole study reproduces on public checkpoints for ~$20 of single-GPU time

Log

2026-07-09Cross-validated across Qwen + Llama and WikiText + PG19; retrieval validation is the open gate.
2026-07-06Realized end-to-end on Qwen2.5-7B: the three-axis Pareto over quality, latency, and KV cache.
2026-07-03Opened the program: a causal per-head compressibility map, the exploit corollary of collapse.
curl -L krbala.in