상위: 03_00_MOC
컨텍스트 혼란 — 정의와 메커니즘
정의
컨텍스트 혼란(Context Confusion)은 컨텍스트에 들어간 불필요하거나 무관한 정보에 모델이 어텐션(attention)을 쏟게 되어 응답 품질이 떨어지는 LLM 실패모드다.
Drew Breunig(2025)의 핵심 직관:
“If you put something in the context the model has to pay attention to it.” — Drew Breunig, How Long Contexts Fail (And How to Fix Them) (2025)
무관한 내용이라도 일단 컨텍스트에 존재하면 모델은 그것을 처리해야 한다는 뜻이다. 컨텍스트는 “모델이 볼 수 있는 공간”이 아니라 “모델이 반드시 봐야 하는 공간”인 셈이다.
Breunig은 컨텍스트 실패를 네 가지로 분류했는데, 혼란(Confusion)은 그 세 번째다.
| 순서 | 실패모드 | 한 줄 설명 |
|---|---|---|
| 01 | 오염(Poisoning) | 잘못된 정보가 들어가 반복 참조 |
| 02 | 산만(Distraction) | 긴 이력이 모델을 학습 지식에서 멀어지게 함 |
| 03 | 혼란(Confusion) | 불필요 정보가 어텐션을 빼앗아 품질 저하 |
| 04 | 충돌(Clash) | 컨텍스트 내 정보가 서로 모순 |
메커니즘 1 — 어텐션 희석 (Attention Dilution)
트랜스포머의 셀프 어텐션(self-attention)은 시퀀스 길이에 대해 이차 복잡도 O(n²)를 가진다. 100K 토큰 컨텍스트라면 모델은 약 100억(10B)개의 쌍별(pairwise) 관계를 계산하는 셈이다.
소프트맥스(softmax) 정규화는 어텐션 가중치를 전체 토큰에 걸쳐 분산시킨다. 그래서 불필요한 툴 정의 수백 개가 컨텍스트를 채우면, 핵심 명령어나 데이터가 받는 상대적 어텐션 가중치가 희석된다.
graph LR subgraph "작은 컨텍스트 (10K 토큰)" A1[쿼리 100%] --> B1[높은 어텐션] end subgraph "큰 컨텍스트 (100K 토큰)" A2[쿼리 1%] --> B2[희석된 어텐션] C2["툴 정의 × 150<br/>30,000 토큰 = 30%"] --> D2[어텐션 잠식] end style B2 fill:#f39c12,color:#fff style D2 fill:#e74c3c,color:#fff style B1 fill:#2ecc71,color:#fff
메커니즘 2 — 중간 위치 정보 손실 (Lost in the Middle)
Liu et al.(TACL 2024)은 LLM의 어텐션 패턴이 U자형(U-shaped)임을 실증했다.
“Performance is often highest when relevant information occurs at the beginning or end of the input context, and significantly degrades when models must access relevant information in the middle of long contexts.” — Liu et al., Lost in the Middle (TACL 2024)
툴 과부하와의 연결. 150개 툴 정의 블록이 사용자 쿼리 앞에 놓이면, 정작 중요한 실제 쿼리가 “중간” 위치로 밀려나 모델이 흘려보낼 위험이 커진다. 자세한 논문 리뷰는 03_04-paper-lost-in-the-middle를 참조하라.
메커니즘 3 — 분산 방해 (Distractor Interference)
Chroma Research(2025)의 Context Rot 연구는 18개 모델을 테스트해, 단 하나의 분산 요소(distractor)만 있어도 기준 대비 정확도가 떨어지고 4개가 되면 복합적으로 악화됨을 보였다.
가장 반직관적 발견:
“Models perform worse when the haystack preserves a logical flow of ideas — shuffled haystacks with randomly reordered sentences consistently improved performance.” — Chroma Research (2025)
논리적으로 잘 구조화된 컨텍스트가 무작위로 섞인 컨텍스트보다 오히려 성능이 낮았다는 뜻이다. 의미론적으로 유사한 내용이 더 강한 어텐션 경합(attention competition)을 일으키기 때문으로 추정된다. → 05 부패
메커니즘 4 — 툴 환각 (Tool Hallucination)
혼란이 빚어내는 직접적 결과로, 모델은 다음과 같은 오류를 보인다(Healy et al., 2026).
- 부적절한 툴 선택 (inappropriate tool selection)
- 잘못된 파라미터 생성 (malformed parameters)
- 잘못된 툴 체이닝 (incorrect tool chaining)
- 툴 바이패스 (tool bypass) — 실제 툴을 호출하지 않고 결과를 시뮬레이션
- 의미론적으로 잘못된 함수 호출 (semantically incorrect function invocations)
이 가운데 툴 바이패스는 보안·감사 통제를 우회할 수 있어 프로덕션에서 특히 치명적이다. → 01 오염
Anthropic 공식 인정
“One of the most common failure modes we see is bloated tool sets that cover too much functionality or lead to ambiguous decision points about which tool to use.” — Anthropic, Managing context on the Claude Developer Platform (2025)
에이전트를 망치는 원인은 “모델이 약해서”가 아니라, 컨텍스트를 너무 많이 그리고 너무 무질서하게 채운 데 있을 때가 많다.
참고문헌
- How Long Contexts Fail (And How to Fix Them) — Drew Breunig, 2025, 블로그(dbreunig.com)
- Lost in the Middle: How Language Models Use Long Contexts — Liu et al., 2024, TACL
- Context Rot: How Increasing Input Tokens Impacts LLM Performance — Chroma Research Team, 2025, 리서치 리포트
- Internal Representations as Indicators of Hallucinations in Agent Tool Selection — Healy et al., 2026, arXiv
- Managing context on the Claude Developer Platform — Anthropic, 2025, 공식 문서
형제 노트: 03_02-툴-과부하-MCP-실태 · 03_03-소형모델-취약성 · 03_08-해결전략-less-is-more 타 챕터: 02 산만 · 04 충돌 · 01 오염 · 05 부패