llm-evaluation long-context attention-mechanism context-length needle-in-a-haystack reasoning-capabilities latent-association cot-prompting
Abstract
Recent large language models (LLMs) support long contexts ranging from 128K to 1M tokens. A popular method for evaluating these capabilities is the needle-in-a-haystack (NIAH) test, which involves retrieving a"needle"(relevant information) from a"haystack"(long irrelevant context). Extensions of this approach include increasing distractors, fact chaining, and in-context reasoning. However, in these benchmarks, models can exploit existing literal matches between the needle and haystack to simplify the task. To address this, we introduce NoLiMa, a benchmark extending NIAH with a carefully designed needle set, where questions and needles have minimal lexical overlap, requiring models to infer latent associations to locate the needle within the haystack. We evaluate 13 popular LLMs that claim to support contexts of at least 128K tokens. While they perform well in short contexts (<1K), performance degrades significantly as context length increases. At 32K, for instance, 11 models drop below 50% of their strong short-length baselines. Even GPT-4o, one of the top-performing exceptions, experiences a reduction from an almost-perfect baseline of 99.3% to 69.7%. Our analysis suggests these declines stem from the increased difficulty the attention mechanism faces in longer contexts when literal matches are absent, making it harder to retrieve relevant information. Even models enhanced with reasoning capabilities or CoT prompting struggle to maintain performance in long contexts. We publicly release the dataset and evaluation code at https://github.com/adobe-research/NoLiMa.
한국어 요약
한 줄 요약
NoLiMa는 LLM의 장문 맥락 처리 능력을 평가하기 위해 표면적 일치를 최소화한 새로운 벤치마크로, 기존 모델들이 긴 맥락에서 성능이 급격히 저하됨을 보여준다.
핵심 기여도
- NoLiMa: 질문과 핀(needle) 간 표면적 일치(lexical overlap)를 최소화한 새로운 벤치마크를 제안.
- 12개의 128K 토큰 이상을 지원하는 LLM 평가 결과, 32K 토큰에서 10개 모델이 기저 성능의 50% 이하로 감소.
- GPT-4o는 기저 성능 99.3%에서 32K 토큰 시 69.7%로 감소하며, 가장 우수한 예외로 나타남.
- CoT 프롬프팅 및 추론 기반 모델조차 16K 토큰 이상에서는 성능 개선을 제한적으로 보임.
핵심 아이디어
기존 NIAH 벤치마크는 핀과 맥락 간 표면적 일치를 통해 모델이 쉽게 정답을 유추할 수 있는 문제가 있었다. NoLiMa는 질문과 핀 간 키워드가 현실적 지식 또는 상식적 연관성을 통해 연결되도록 설계하여, 모델이 표면적 일치에 의존하지 않고 잠재적 연관성을 추론해야 하는 환경을 구축했다. 이는 LLM의 어텐션 메커니즘이 긴 맥락에서 표면적 단서가 없을 경우 정보를 추출하는 능력을 정확히 평가할 수 있게 한다.
기술적 접근법
- **NoLiMa 벤치마크**: 질문과 핀 간 표면적 일치 최소화, 연관성 기반 핀 삽입.
- **평가 설정**: 250, 500, 1K, 2K, 4K, 8K, 16K, 32K 토큰 길이에서 평가.
- **기저 점수(base score)**: 250, 500, 1K 토큰에서 최대 점수를 평균하여 계산.
- **유효 길이(effective length)**: 기저 점수의 85% 이상을 유지하는 최대 토큰 길이로 정의.
- **정확도 계산**: 정답 이름을 포함한 응답이 정확한 것으로 간주.
- **CoT 프롬프팅 실험**: 단계적 추론 유도, 하지만 16K 이상에서는 효과 제한적.
주요 결과
- 32K 토큰에서 12개 모델 중 10개가 기저 성능의 50% 이하로 감소.
- GPT-4o: 기저 성능 99.3% → 32K 토큰 시 69.7%로 감소.
- Llama 3.1 70B: NoLiMa에서 32K 토큰 시 정확도 42.7% (기저 94.3% 대비 -54.6%).
- Claude 3.5 Sonnet: 기저 성능은 낮지만, 긴 맥락에서 상대적으로 더 나은 일반화 성능 보임.
- Gemini 1.5 Flash, GPT-4o mini, Llama 3.1 8B 등 "lite" 모델은 1K 이하에서는 잘 작동하지만, 2K 이상에서는 성능 급락.
의의 및 한계
NoLiMa는 LLM의 장문 맥락 처리 능력을 표면적 일치에 의존하지 않고, 잠재적 연관성을 추론하는 능력을 평가하는 데 기여한다. 이는 기존 벤치마크가 실제 상황에서의 복잡한 추론 능력을 제대로 평가하지 못하는 문제를 해결한다. 그러나 NoLiMa는 핀과 질문 간의 연관성이 현실 지식에 의존하므로, 특정 도메인 지식이 부족한 모델은 성능 저하가 클 수 있다. 또한, 표면적 일치가 없는 상황에서 어텐션 메커니즘이 정보를 효과적으로 추출하지 못하는 한계를 드러내며, 이는 LLM의 구조적 개선이 필요함을 시사한다.
실용적 활용
NoLiMa는 검색 엔진, RAG 시스템, 다중 문서 QA 시스템 등에서 실제 유의미한 정보를 추출하는 능력을 평가하는 데 활용 가능하다. 특히, 쿼리와 문서 간 단어 격차가 있는 경우, LLM이 표면적 일치에 의존하지 않고 의미적 연관성을 파악하는 능력을 측정할 수 있어, 시스템의 신뢰도를 높이는 데 기여할 수 있다.