Hypothesis Testing the Circuit Hypothesis in LLMs

Claudia Shi, Nicolas Beltran-Velez, Achille Nazaret, Carolina Zheng, Adrià Garriga-Alonso +3 more
10/16/2024
cs.AIcs.LGstat.ML

Official code: blei-lab/circuitry (16 stars, MIT, last commit 2024-10-30).

Abstract

Large language models (LLMs) demonstrate surprising capabilities, but we do not understand how they are implemented. One hypothesis suggests that these capabilities are primarily executed by small subnetworks within the LLM, known as circuits. But how can we evaluate this hypothesis? In this paper, we formalize a set of criteria that a circuit is hypothesized to meet and develop a suite of hypothesis tests to evaluate how well circuits satisfy them. The criteria focus on the extent to which the LLM's behavior is preserved, the degree of localization of this behavior, and whether the circuit is minimal. We apply these tests to six circuits described in the research literature. We find that synthetic circuits -- circuits that are hard-coded in the model -- align with the idealized properties. Circuits discovered in Transformer models satisfy the criteria to varying degrees. To facilitate future empirical studies of circuits, we created the \textit{circuitry} package, a wrapper around the \textit{TransformerLens} library, which abstracts away lower-level manipulations of hooks and activations. The software is available at \url{https://github.com/blei-lab/circuitry}.

View on arXivView PDF

Code Implementations(1)

blei-lab/circuitryOfficial100%
MIT
161Shell, PythonOct 13, 20241 years agoMIT

Similar Papers

Cite this paper

@article{shi2024hypothesis,
  title  = {Hypothesis Testing the Circuit Hypothesis in LLMs},
  author = {Claudia Shi and Nicolas Beltran-Velez and Achille Nazaret and Carolina Zheng and Adrià Garriga-Alonso and Andrew Jesson and Maggie Makar and David M. Blei},
  year   = {2024},
  eprint = {2410.13032},
  archivePrefix = {arXiv},
  doi    = {10.48550/arXiv.2410.13032},
  url    = {http://arxiv.org/abs/2410.13032v1},
  journal = {NEURIPS 2024 2024}
}

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

Discussion