定向检索、紧凑表示:CoT推理如何提升长上下文计数
Targeted Retrieval, Compact Representations: How CoT Reasoning Improves Long-Context Counting
浏览论文内容
中文总结 AI 辅助
本研究通过“大海捞针”计数任务,揭示思维链推理通过定向检索和紧凑内部表示提升长上下文计数准确性,并支持状态追踪解释。
中文摘要 AI 辅助
大型语言模型(LLMs)在长上下文任务中迅速进步,这得益于思维链(CoT)推理。然而,这种改进背后的内部机制仍不清楚。我们通过“大海捞针”(NIAH)计数任务来研究这些机制,在该任务中,要求LLM统计分散在长文本中的记录数量。在十二个模型比较组中,思考(或推理)模型相比非思考模型提高了计数准确性,且在计数较大时提升尤为显著。这促使我们进行机制分析,识别出两种对比机制:(i)广泛检索,非思考模型广泛关注多个“针”;(ii)定向检索,思考模型利用CoT轨迹中的枚举逐一检索“针”。定向检索将注意力集中在单个“针”上,并伴随更紧凑的内部表示。此外,因果干预分析表明,思考模型利用CoT轨迹在逐一检索“针”时维护并更新内部计数器,即使没有显式编号。在小型受控实验中,两种检索机制和计数器状态在标准自回归训练下均会出现。综合来看,我们的结果将长上下文检索与计数的表示几何联系起来,支持CoT推理的状态追踪解释。
英文摘要
Large language models (LLMs) have been rapidly improving in long-context tasks, powered by Chain-of-Thought (CoT) reasoning. However, the internal mechanisms underlying this improvement remain unclear. We investigate these mechanisms through a needle-in-a-haystack (NIAH) counting task, where an LLM is asked to count the number of records dispersed in a long text. Across twelve model comparison groups, Thinking (or reasoning) improves counting accuracy over Non-thinking, with pronounced gains at larger counts. This motivates our mechanistic analysis, which identifies two contrasting mechanisms: (i) broad retrieval, where Non-thinking models broadly attend to multiple needles; (ii) targeted retrieval, where Thinking models use enumeration in CoT traces to successively retrieve needles. Targeted retrieval concentrates attention on individual needles and is accompanied by more compact internal representations. Moreover, causal intervention analysis suggests that Thinking models use the CoT trace to maintain and update an internal counter as needles are successively retrieved, even without explicit numbering. In small controlled experiments, both retrieval mechanisms and counter states emerge under standard autoregressive training. Together, our results connect long-context retrieval with representation geometry of counting, supporting a state-tracking account of CoT reasoning.
发表机构
- University of Wisconsin-Madison(威斯康星大学麦迪逊分校)
机构由 AI 辅助整理,请以论文原文为准。