Skip to main content
QUICK REVIEW

[Paper Review] Knowledge Neurons in Pretrained Transformers

Damai Dai, Dong Li|arXiv (Cornell University)|Apr 18, 2021
Topic ModelingComputer Science42 citations
TL;DR

The paper identifies knowledge neurons in BERT-style transformers using an integrated-gradient attribution method, showing these neurons correlate with factual knowledge and can be manipulated to edit knowledge without fine-tuning.

ABSTRACT

Large-scale pretrained language models are surprisingly good at recalling factual knowledge presented in the training corpus. In this paper, we present preliminary studies on how factual knowledge is stored in pretrained Transformers by introducing the concept of knowledge neurons. Specifically, we examine the fill-in-the-blank cloze task for BERT. Given a relational fact, we propose a knowledge attribution method to identify the neurons that express the fact. We find that the activation of such knowledge neurons is positively correlated to the expression of their corresponding facts. In our case studies, we attempt to leverage knowledge neurons to edit (such as update, and erase) specific factual knowledge without fine-tuning. Our results shed light on understanding the storage of knowledge within pretrained Transformers. The code is available at https://github.com/Hunter-DDM/knowledge-neurons.

Motivation & Objective

  • Introduce the concept of knowledge neurons as FFN memory slots that express factual knowledge in transformers.
  • Develop a knowledge attribution method based on integrated gradients to identify these neurons.
  • Show that activating/suppressing knowledge neurons modulates knowledge expression.
  • Demonstrate preliminary knowledge-editing capabilities via targeted neuron manipulation without fine-tuning.

Proposed method

  • Model the FFN module in Transformer blocks as a two-layer key-value memory (FFN^{key} and FFN^{val}).
  • Propose a knowledge attribution method using integrated gradients to compute neuron-level attribution scores for knowledge predictions.
  • Compute an attribution score Attr(w_i^{(l)}) by integrating gradients as w_i^{(l)} changes from 0 to its original value.
  • Refine coarse knowledge neuron sets by retaining neurons shared across diverse prompts for the same fact.
  • Compare attribution-based neurons to a baseline using raw activation as attribution.
  • Conduct qualitative and quantitative analyses on BERT-base-cased using ParaRel and a BingRel extension.

Experimental results

Research questions

  • RQ1Can factual knowledge be localized to specific neurons within FFN modules of pretrained transformers?
  • RQ2Do knowledge neurons have activation patterns that correlate with known facts and knowledge-expressing prompts?
  • RQ3Can targeted manipulation of knowledge neurons edit or erase specific factual knowledge without fine-tuning?
  • RQ4How do knowledge neurons distribute across Transformer layers and relate to different facts?

Key findings

  • Knowledge neurons are positively correlated with knowledge expression: suppressing or amplifying them reduces or raises the correct answer probability (≈29.03% decrease when suppressed; ≈31.17% increase when amplified).
  • Knowledge neurons for a given fact tend to activate more with prompts that express the corresponding knowledge; prompts containing both head and tail entities show higher activation than control prompts.
  • On average, about 4.13 knowledge neurons are identified per factual relation by the attribution method (3.96 by the baseline).
  • Knowledge neurons are concentrated in the top Transformer layers, with most identified neurons located in upper layers.
  • Inter-relation fact neuron intersections are small under the attribution method, indicating more exclusive neurons for different relations (vs. baseline).
  • Two preliminary case studies show potential for updating and erasing facts by editing the identified knowledge neurons, with moderate impacts on other knowledge.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.