ModelRefs / Needle in a Haystack — AI Glossary
Needle in a Haystack — AI Glossary
A long-context benchmark inserting a specific fact ('needle') at varying positions in a long document and measuring retrieval accuracy. Also called NIAH.
Overview
NIAH tests whether a model can retrieve a single injected fact from a distracting document corpus at any context position. Frontier models (Gemini 1.5 Pro, Claude 3 Opus) approach near-perfect NIAH scores at 128K context. Failures reveal positional biases in attention patterns. Extended to multi-needle and multi-hop variants.
Reference details
| Topic | prompting |
|---|---|
| Also known as | NIAH |
| Last reviewed | 2026-06-24 |
Related terms
Continue your research
Use these connected ModelRefs sections to compare alternatives, inspect implementation paths, and review the evidence and governance boundaries relevant to Needle in a Haystack — AI Glossary.
Frequently asked questions
What is Needle in a Haystack?
A long-context benchmark inserting a specific fact ('needle') at varying positions in a long document and measuring retrieval accuracy.
Is Needle in a Haystack the same as NIAH?
Yes — NIAH are common aliases for Needle in a Haystack.
What concepts are related to Needle in a Haystack?
Closely related concepts include lost in the middle, long context, retrieval pipeline.