Interpreting Arithmetic Mechanism in Large Language Models through Comparative Neuron Analysis

Fuente: arXiv
Enregistré dans:
Détails bibliographiques
Auteurs principaux: Yu, Zeping, Ananiadou, Sophia
Format: Preprint
Publié: 2024
Sujets:
Accès en ligne:
Tags: Ajouter un tag
Pas de tags, Soyez le premier à ajouter un tag!
_version_ 1866912039639711744
author Yu, Zeping
Ananiadou, Sophia
author_facet Yu, Zeping
Ananiadou, Sophia
contents We find arithmetic ability resides within a limited number of attention heads, with each head specializing in distinct operations. To delve into the reason, we introduce the Comparative Neuron Analysis (CNA) method, which identifies an internal logic chain consisting of four distinct stages from input to prediction: feature enhancing with shallow FFN neurons, feature transferring by shallow attention layers, feature predicting by arithmetic heads, and prediction enhancing among deep FFN neurons. Moreover, we identify the human-interpretable FFN neurons within both feature-enhancing and feature-predicting stages. These findings lead us to investigate the mechanism of LoRA, revealing that it enhances prediction probabilities by amplifying the coefficient scores of FFN neurons related to predictions. Finally, we apply our method in model pruning for arithmetic tasks and model editing for reducing gender bias. Code is on https://github.com/zepingyu0512/arithmetic-mechanism.
format Preprint
id arxiv_https___arxiv_org_abs_2409_14144
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Interpreting Arithmetic Mechanism in Large Language Models through Comparative Neuron Analysis
Yu, Zeping
Ananiadou, Sophia
Computation and Language
We find arithmetic ability resides within a limited number of attention heads, with each head specializing in distinct operations. To delve into the reason, we introduce the Comparative Neuron Analysis (CNA) method, which identifies an internal logic chain consisting of four distinct stages from input to prediction: feature enhancing with shallow FFN neurons, feature transferring by shallow attention layers, feature predicting by arithmetic heads, and prediction enhancing among deep FFN neurons. Moreover, we identify the human-interpretable FFN neurons within both feature-enhancing and feature-predicting stages. These findings lead us to investigate the mechanism of LoRA, revealing that it enhances prediction probabilities by amplifying the coefficient scores of FFN neurons related to predictions. Finally, we apply our method in model pruning for arithmetic tasks and model editing for reducing gender bias. Code is on https://github.com/zepingyu0512/arithmetic-mechanism.
title Interpreting Arithmetic Mechanism in Large Language Models through Comparative Neuron Analysis
topic Computation and Language
url https://arxiv.org/abs/2409.14144