arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2402.18312cs.CLcs.LG

如何逐步思考:对思维链推理的机制性理解

How to think step-by-step: A mechanistic understanding of chain-of-thought reasoning

IIT Delhi(印度理工学院德里分校);IIT Bombay(印度理工学院孟买分校)

Subhabrata Dutta, Joykirat Singh, Soumen Chakrabarti, Tanmoy Chakraborty

AI总结:

本文首次从机制角度研究LLMs的思维链推理,发现Llama-2 7B在逐步推理中采用多条并行答案生成路径,且模型中间层存在从预训练先验到上下文先验的功能分裂,不同注意力头分工各异。

摘要:

尽管大型语言模型(LLMs)在思维链(CoT)提示下展现出卓越的推理能力,但人们对促进CoT生成的模型内部机制仍缺乏理解。本研究从机制角度考察LLMs中体现CoT推理的神经子结构。通过对Llama-2 7B在虚构本体上的多步推理进行分析,我们证明LLMs在逐步推理中部署了多条并行的答案生成路径。这些并行路径从输入问题上下文以及生成的CoT中提供顺序答案。我们观察到LLM中间层存在功能分裂。前半部分的token表示仍然强烈偏向预训练先验,而上下文先验在后半部分接管。这种内部分阶段转变体现在不同的功能组件中:写入答案token的注意力头出现在后半部分,沿本体关系移动信息的注意力头出现在前半部分,等等。据我们所知,这是对LLMs中CoT推理进行机制性研究的首次尝试。

英文摘要:

Despite superior reasoning prowess demonstrated by Large Language Models (LLMs) with Chain-of-Thought (CoT) prompting, a lack of understanding prevails around the internal mechanisms of the models that facilitate CoT generation. This work investigates the neural sub-structures within LLMs that manifest CoT reasoning from a mechanistic point of view. From an analysis of Llama-2 7B applied to multistep reasoning over fictional ontologies, we demonstrate that LLMs deploy multiple parallel pathways of answer generation for step-by-step reasoning. These parallel pathways provide sequential answers from the input question context as well as the generated CoT. We observe a functional rift in the middle layers of the LLM. Token representations in the initial half remain strongly biased towards the pretraining prior, with the in-context prior taking over in the later half. This internal phase shift manifests in different functional components: attention heads that write the answer token appear in the later half, attention heads that move information along ontological relationships appear in the initial half, and so on. To the best of our knowledge, this is the first attempt towards mechanistic investigation of CoT reasoning in LLMs.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑