RULER: What's the Real Context Size of Your Long-Context Language Models?
TL;DR. Needle-in-a-haystack is too easy: almost every long-context model passes it. RULER generates 13 tasks in four families (retrieval, multi-hop tracing, aggregation and QA) at any length and difficulty. Of 17 models evaluated, only Gemini-1.5-Pro stays above the quality bar at 128K, and most hold up for half their claimed window or less.
Why it matters now. RAG readers, listwise rerankers and deep-research agents are given longer and longer prompts on the assumption that the advertised window is usable. RULER puts a number on how much of it is. It is also a template for building synthetic, controllable evaluations, a skill directly useful for IR benchmarks.
Key idea
Section titled “Key idea”Generate each task from a configuration that sets length and difficulty, run each model on 500 examples per length , and average the 13 task accuracies into . Two summaries follow:
The threshold 85.6 is Llama2-7B’s score at 4K. The weights simulate usage dominated by long (inc) or short (dec) inputs.
Key results
Section titled “Key results”- Table 3 (claimed / effective; score at 4K → 128K): Gemini-1.5-Pro 1M / >128K, 96.7 → 94.4. GPT-4 128K / 64K, 96.6 → 81.2. Llama3.1-70B 128K / 64K, 96.5 → 66.6. Qwen2-72B 128K / 32K, 96.9 → 53.7. Mistral-v0.2 7B 32K / 16K, 93.6 → 13.8. DBRX 32K / 8K, 95.1 → 0.0.
- Local open-weight models use the reported vLLM/BF16 setup with greedy decoding (8 A100s); GPT-4 and Gemini-1.5-Pro are accessed through provider APIs, so do not assume control of closed models’ serving precision or hardware. Nearly perfect passkey and vanilla NIAH scores (Appendix E) contrast with the RULER drop.
- §5 (Yi-34B-200K up to 256K): about 40 points lost with a context full of distractor needles; about 15 points lost going from 1 to 8 queries; over 80% of CWE outputs at 128K copy the one-shot example; QA drifts towards the no-context answer.
- §6: larger Yi models degrade less; LWM-1M is worse than LWM-512K at 256K.
Limitations & open questions
Section titled “Limitations & open questions”- One number per length, with no control over where the key information sits (the authors list this).
- The proxies are not validated against realistic long-context tasks; the authors call RULER a behavioural check.
- Short-context ability is not evaluated separately, and the 85.6 threshold ties effective length to one old model.
- Open: an effective-length measure for retrieval-heavy prompts built from real corpora, with graded relevance instead of synthetic needles.
Connections
Section titled “Connections”- Before: Lost in the middle for position effects at short lengths.
- Next: NoLiMa removes literal overlap; Context Rot holds task difficulty fixed while length grows.
- Making windows longer: YaRN and RoPE; Mamba as the non-Transformer alternative tested here.
- Serving: RULER runs its open-weight models on vLLM, whose paged KV cache makes 128K-token evaluation practical.
- IR benchmarks: BrowseComp-Plus and FRAMES test long, retrieval-heavy contexts in realistic settings.
Questions to think through
These questions have no single right answer. Write or say your answer before you open the hints. Mark a question once you could defend your answer in a reading group.
- Derive / compute
GPT-4 scores 96.6, 96.3, 95.2, 93.2, 87.0 and 81.2 at 4K to 128K on RULER. Compute its weighted averages with weights rising linearly with length (1 to 6) and falling linearly (6 to 1), and its effective length against the 85.6 threshold. Then explain why Qwen2-72B ranks 9th under the increasing weights but 4th under the decreasing ones.
What a strong answer covers
- Increasing: (96.6·1 + 96.3·2 + 95.2·3 + 93.2·4 + 87.0·5 + 81.2·6) / 21 = 1869.8 / 21 ≈ 89.0, matching Table 3.
- Decreasing: (96.6·6 + 96.3·5 + 95.2·4 + 93.2·3 + 87.0·2 + 81.2·1) / 21 = 1976.7 / 21 ≈ 94.1, matching Table 3.
- Effective length: 87.0 at 64K is above 85.6 and 81.2 at 128K is below, so 64K, half the claimed 128K.
- Qwen2-72B is the best of all at 4K (96.9) but collapses to 79.8 at 64K and 53.7 at 128K. Weights that favour short inputs reward its short-context strength; weights that favour long inputs punish the collapse.
- Lesson: one leaderboard number hides the length profile. Choose the weighting from your own length distribution, as the paper suggests.
- Mechanism
Explain why a model can score nearly perfectly on vanilla needle-in-a-haystack and passkey retrieval yet degrade on RULER. For each of the four task families, state which ability it adds beyond finding one literal string, and how the task is scored.
What a strong answer covers
- Vanilla NIAH needs one exact match between the question and a single needle in unrelated text, which a model can solve by literal lookup.
- Retrieval variants add multiple keys (hard distractor needles), multiple values for one key, multiple queries and different needle types (words, numbers, UUIDs), testing precision and completeness.
- Multi-hop tracing (variable tracking) follows chains like X1 = 12345, X2 = X1, which tests tracking an entity through many hops, a proxy for coreference.
- Aggregation (common and frequent word extraction) asks for the most frequent words over the whole input, so relevant information is spread out, a proxy for summarisation. Frequent-word difficulty is set by the α of a Zeta distribution.
- QA inserts gold SQuAD or HotpotQA paragraphs among sampled distractor paragraphs, so the query matches fuzzily rather than literally. All tasks use an answer prefix and recall-based accuracy, with 500 examples per length.
- What if…
Section 5 stresses Yi-34B-200K up to 256K tokens, and Section 6 varies training context length, model size and architecture. Summarise what each analysis shows and which failure mode you would expect most in a RAG reader.
What a strong answer covers
- Distractors: filling the context with irrelevant needles costs Yi about 40 points at 256K; it often returns values near the target, suggesting coarse location without precision.
- Multiple items: going from 1 to 8 queries costs about 15 points; with several values per key Yi returns duplicates instead of the full set.
- Copying: over 80% of Yi's CWE outputs at 128K copy the one-shot example. In QA, Yi drifts towards its no-context answers, i.e. it falls back on parametric knowledge.
- Training length helps overall but not consistently (LWM-1M is worse than LWM-512K at 256K); larger Yi models degrade less; RWKV-v5 and Mamba-2.8B lag the Llama2-7B baseline even at 4K.
- For a RAG reader, the QA and distractor results matter most: topically similar passages act as hard distractors, and the model may answer from memory instead of the passages.
- Critique
The effective length is defined as the longest length whose 13-task average beats Llama2-7B at 4K (85.6). Critique this definition and RULER's synthetic design as a guide for choosing a model for 64K-token RAG prompts. Use the limitations the authors themselves list.
What a strong answer covers
- The threshold is arbitrary and absolute. A model that is weak at 4K can never have a long effective length, and averaging 13 tasks lets strong retrieval scores hide weak aggregation scores.
- No position control: RULER reports one number per length, so it cannot show lost-in-the-middle effects, which matter for passage ordering.
- No validated link to realistic long-context tasks: the authors say RULER is a behavioural check and should not be preferred over realistic settings.
- Many needles still share words with the question; NoLiMa later removes this overlap and finds even shorter effective lengths.
- For a RAG choice, run the QA family with your own corpus as the haystack, at your real prompt lengths, and also check short-context quality (which RULER does not evaluate separately).
- Design
Design a RULER-style benchmark for listwise LLM rerankers that read 50–200 candidate passages in one prompt. Specify the haystack, the needles, the difficulty knobs and the metric, and say how you would define an effective number of candidates.
What a strong answer covers
- Haystack: real retrieved candidates for real queries (e.g. from BM25 plus a dense retriever), so distractors are topically close, unlike essay haystacks.
- Needles: passages with graded relevance labels, inserted at controlled positions. Knobs: number of candidates, number of relevant passages, lexical overlap between query and relevant passage, and distractor similarity.
- Metric: nDCG@10 of the output ranking, plus recall of all relevant passages, reported by position and by list length.
- Effective number of candidates: the largest list size where nDCG@10 stays above the same model's score on a short list (e.g. 20), or above a fixed cross-encoder baseline.
- Generate many instances per setting (the paper uses 500 per length) and keep the generator public, so new models can be tested without leakage.
- Connect
Place RULER between Lost in the Middle and NoLiMa: what does each measure that the others do not, and how would you combine all three to decide how many retrieved passages to give a reader model?
What a strong answer covers
- Lost in the Middle varies the position of one gold passage among real retrieved passages at a few thousand tokens; it measures position sensitivity, not length limits.
- RULER varies length and task type with synthetic data up to 128K and gives an effective length, but averages over positions.
- NoLiMa removes lexical overlap between question and needle, so it measures latent association; effective lengths shrink further (e.g. GPT-4o to 8K).
- Combined recipe: take the shortest effective length of the three as the budget, order passages to avoid the middle, and prefer passages with real semantic support over keyword overlap.