What is Needle in a haystack?
In Turkish: Uzun bağlam testi (samanlıkta iğne) · Topic: Data and evaluation
A test that checks whether a model can find a single piece of information placed inside a long text. It aims to show how reliably a model recalls information across its large context window.
How does it work?
The setup starts with a very long text, usually unrelated to the question, which is the haystack. A small piece of information, such as a single sentence, is inserted at a chosen spot; this is the needle. The model is then asked a question about that information. The test is repeated while changing the needle's position and the text's length, and the results are often shown as a heat map. This reveals at which lengths and positions the model tends to miss the information.
Why does it matter?
A large context window does not mean the model uses everything inside it well. The test offers a basic reliability signal for applications that work with long documents, such as contracts or code repositories. Still, finding one fact is a relatively easy task and does not measure complex reasoning.
Example
An unrelated sentence like 'The meeting will be held on Tuesday' is hidden in a report hundreds of pages long, and the model is asked when the meeting will take place.
FAQ
Does this test prove a model understands a long document?
No, it only shows that the model can locate a fact. Tasks like combining several facts or summarizing are harder and are measured with separate tests.
Why is it called 'needle in a haystack'?
It refers to the idiom about the difficulty of finding something small in a large pile. The haystack is the long text and the needle is the hidden fact.