Competition of Mechanisms: Tracing How Language Models Handle Facts and Counterfactuals

Francesco Ortu, Zhijing Jin, Diego Doimo, Mrinmaya Sachan, Alberto Cazzaniga +1 more
2/18/2024
cs.CL

Official code: francescortu/comp-mech (13 stars, MIT, last commit 2024-05-24).

Abstract

Interpretability research aims to bridge the gap between empirical success and our scientific understanding of the inner workings of large language models (LLMs). However, most existing research focuses on analyzing a single mechanism, such as how models copy or recall factual knowledge. In this work, we propose a formulation of competition of mechanisms, which focuses on the interplay of multiple mechanisms instead of individual mechanisms and traces how one of them becomes dominant in the final prediction. We uncover how and where mechanisms compete within LLMs using two interpretability methods: logit inspection and attention modification. Our findings show traces of the mechanisms and their competition across various model components and reveal attention positions that effectively control the strength of certain mechanisms. Code: https://github.com/francescortu/comp-mech. Data: https://huggingface.co/datasets/francescortu/comp-mech.

View on arXivView PDF

Code Implementations(1)

MIT

Competition of Mechanisms: Tracing How Language Models Handle Facts and Counterfactuals; ACL 2024

131R, ShellOct 3, 20232 years agoMIT
interpretabilityllmmechanistic-interpretability

Similar Papers

Cite this paper

@article{ortu2024competition,
  title  = {Competition of Mechanisms: Tracing How Language Models Handle Facts and Counterfactuals},
  author = {Francesco Ortu and Zhijing Jin and Diego Doimo and Mrinmaya Sachan and Alberto Cazzaniga and Bernhard Schölkopf},
  year   = {2024},
  eprint = {2402.11655},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2402.11655v2}
}

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.11655.svg)](https://codeofpaper.com/paper/2402.11655)

Discussion