The needle in a haystack problem measures how difficult it is to retrieve a small, relevant signal from an extremely long context. As context length grows, attention can spread across irrelevant tokens and dilute the target signal. section 9.5.2
A buried number
Place the number 42,735 somewhere in a 100,000-token document and ask the model to retrieve it. Without mitigation, attention is nearly flat and the target receives little probability; sharpening creates a distinct peak at its position. section 9.5.2
Attention-temperature scaling and RoPE extensions such as YaRN can sharpen attention and improve retrieval of deeply buried information. The test therefore exposes whether long-context mechanisms preserve useful focus rather than merely accepting longer inputs. section 9.5.2
Figure 9.10 Illustration of the haystack problem. Unmitigated attention (grey) spreads probability mass almost uniformly across the sequence, making it difficult to isolate important tokens. Sharpened attention (black) produces a clear peak at the target position (dashed line), enabling retrieval even within a very long context.
Compare nearly uniform unmitigated attention with the sharp peak produced at the target position. section 9.5.2
