RULER: What’s the Real Context Size of Your Long-Context Language Models?

Cheng-Ping Hsieh, Simeng Sun, Samuel Kriman, Shantanu Acharya, Dima Rekesh, Fei Jia, Boris Ginsburg

TL;DR

Current benchmarks for evaluating long-context language models (LLMs) often rely on simple retrieval tasks, failing to capture deeper understanding. This paper introduces RULER, a new synthetic benchmark with diverse tasks like multi-hop tracing and aggregation, to provide a more comprehensive evaluation. Their findings reveal that even models claiming large context windows often struggle significantly as context length increases, highlighting a critical gap between claimed and actual long-context capabilities.

What Problem Does This Paper Address?

The rapid advancement in LLMs has led to models capable of processing increasingly long contexts, with many claiming support for 32K tokens or more. However, evaluating these long-context capabilities has largely relied on the "needle-in-a-haystack" (NIAH) test, which primarily assesses the model's ability to retrieve a specific piece of information from a large block of text. While useful, this retrieval-centric approach offers only a superficial understanding of how well models truly comprehend and utilize information spread across extended contexts. This paper addresses the need for a more robust and multifaceted evaluation framework that goes beyond simple recall and probes deeper reasoning and information processing abilities in long contexts.

Methods

The core contribution of this paper is the introduction of RULER, a new synthetic benchmark designed for comprehensive long-context LLM evaluation. RULER builds upon the NIAH test but expands it significantly by:

  • Flexible Configurations: Allowing for customized sequence lengths and task complexities.
  • Diverse Needles: Incorporating variations in the types and quantities of "needles" (information to be retrieved) within the "haystack" (distractor text).
  • New Task Categories: Introducing tasks beyond simple retrieval:
  • Multi-hop Tracing: Emulating coreference resolution by tracking entities with multi-hop connections (e.g., variable tracking).
  • Aggregation: Testing the ability to synthesize information from long contexts, exemplified by common/frequent word extraction tasks.
  • Question Answering: Adapting existing QA datasets to long-context scenarios by embedding answers within longer, distracting texts.

The authors evaluated 17 long-context LLMs on 13 representative tasks within RULER, using configurations that scale from 4K to 128K tokens.

Datasets

The paper introduces RULER, a novel synthetic benchmark. RULER is not a single dataset but a framework for generating diverse tasks. It includes:

  • Extended NIAH Tasks: Variations of the needle-in-a-haystack test with different numbers of keys, values, and needle types (words, numbers, UUIDs).
  • Variable Tracking: A synthetic task for multi-hop tracing.
  • Common/Frequent Words Extraction: Synthetic tasks for aggregation.
  • Adapted QA Datasets: Existing datasets like SQuAD and HotpotQA are adapted to long-context scenarios by incorporating them into longer, distracting texts.

The synthetic nature of RULER is highlighted as a key advantage, allowing for precise control over sequence length, task complexity, and reducing reliance on pre-existing parametric knowledge that might interfere with evaluating long-context utilization.

Key Insights and Ideas

  • The "Lost in the Middle" Phenomenon is Widespread: Even models that perform well on short contexts or simple retrieval tasks show significant performance degradation as context length increases, suggesting a systemic issue beyond just retrieval.
  • Claimed vs. Effective Context Length: Many models claim impressive context lengths (e.g., 32K+ tokens), but their effective context length—where they maintain satisfactory performance—is often much shorter. Only about half of the evaluated models met a defined performance threshold at 32K tokens.
  • Beyond Retrieval is Crucial: Simple retrieval (NIAH) is insufficient. Tasks requiring multi-hop reasoning (variable tracking) and information aggregation (word extraction) expose deeper weaknesses in LLMs' long-context understanding.
  • Copying Behavior Emerges: At longer context lengths, some models exhibit a tendency to simply copy text from the input rather than genuinely processing it, especially in tasks with in-context demonstrations. This highlights a failure to distinguish between relevant information and mere verbatim repetition.
  • Model Size Matters: Larger models, like Yi-34B, generally show better long-context capabilities, suggesting that scaling up is a key factor in improving performance.
  • Training Data and Architecture Play a Role: While larger training context windows can help, it's not a guarantee. Novel architectures like Mamba and RWKV still lag significantly behind Transformers on these long-context tasks.

Key Results

  • Widespread Degradation: Despite near-perfect scores on vanilla NIAH tasks, almost all evaluated models showed significant performance drops on more complex RULER tasks as context length increased.
  • Effective Context Length Shortfall: For models claiming 32K+ tokens, only about half maintained satisfactory performance at that length, and most fell below their claimed context lengths.
  • Top Performers: Gemini-1.5-Pro and GPT-4 consistently outperformed other models across RULER tasks.
  • Yi-34B Analysis: Even Yi-34B, with a claimed 200K context length, showed substantial degradation on complex tasks, failing to ignore distractors and sometimes returning incomplete or copied information.
  • Non-Transformer Architectures Lag: Mamba and RWKV models showed significantly lower performance compared to Transformer baselines on RULER tasks.

Limitations and Future Work

  • Lack of Position Control: The current RULER benchmark reports a single metric per input length. The authors plan to add support for controlling the position of key information to better analyze phenomena like "lost in the middle."
  • Correlation with Realistic Tasks: While RULER's tasks are designed as proxies for real-world long-context scenarios, direct validation against highly realistic tasks is still needed. The authors suggest RULER is best used as a behavioral check.
  • Short Context Performance Not Emphasized: The benchmark focuses on degradation at longer lengths, assuming good performance at shorter contexts (e.g., 4K). However, performance at shorter lengths can also degrade under increased complexity, which was not the focus here.
  • Prompt Robustness: The study acknowledges that LLMs can be sensitive to prompt formats, and a comprehensive study on prompt robustness was not conducted.
  • Hyperparameter Tuning: Extensive experimentation with all hyperparameters for each task was not performed.

Future work will involve addressing these limitations, particularly by incorporating position control and further exploring the correlation with real-world tasks. The authors also suggest that further pressure testing of top models with more challenging RULER configurations would be valuable.

Summary updated

BibTeX
@inproceedings{hsieh2024ruler,
  author = {Cheng-Ping Hsieh and Simeng Sun and Samuel Kriman and Shantanu Acharya and Dima Rekesh and Fei Jia and Boris Ginsburg},
  title = {{RULER: What’s the Real Context Size of Your Long-Context Language Models?}},
  booktitle = {COLM},
  year = {2024},
  url = {https://openreview.net/forum?id=kIoBbc76Sy},
}
Figure