Understanding and Patching Compositional Reasoning in LLMs

Zhaoyi Li, Gangwei Jiang, Hong Xie, Linqi Song, Defu Lian +1 more
2/22/2024
cs.CL

No official code found. Best implementation: Zhaoyi-Li21/creme (14 stars, last commit 2024-08-28).

Abstract

LLMs have marked a revolutonary shift, yet they falter when faced with compositional reasoning tasks. Our research embarks on a quest to uncover the root causes of compositional reasoning failures of LLMs, uncovering that most of them stem from the improperly generated or leveraged implicit reasoning results. Inspired by our empirical findings, we resort to Logit Lens and an intervention experiment to dissect the inner hidden states of LLMs. This deep dive reveals that implicit reasoning results indeed surface within middle layers and play a causative role in shaping the final explicit reasoning results. Our exploration further locates multi-head self-attention (MHSA) modules within these layers, which emerge as the linchpins in accurate generation and leveraing of implicit reasoning results. Grounded on the above findings, we develop CREME, a lightweight method to patch errors in compositional reasoning via editing the located MHSA modules. Our empirical evidence stands testament to CREME's effectiveness, paving the way for autonomously and continuously enhancing compositional reasoning capabilities in language models.

View on arXivView PDF

Code Implementations(1)

Zhaoyi-Li21/cremeCommunity63%

[ACL 2024] "Understanding and Patching Compositional Reasoning in LLMs"

140Shell, PythonFeb 23, 20242 years ago
compositional-reasoningfactual-reasoninglarge-language-modelsmechanistic-interpretabilitymulti-hop-reasoning

Similar Papers

Cite this paper

@article{li2024understanding,
  title  = {Understanding and Patching Compositional Reasoning in LLMs},
  author = {Zhaoyi Li and Gangwei Jiang and Hong Xie and Linqi Song and Defu Lian and Ying Wei},
  year   = {2024},
  eprint = {2402.14328},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2402.14328v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2402.14328.svg)](https://codeofpaper.com/paper/2402.14328)

Discussion