Tracing Stereotypes in Pre-trained Transformers: From Biased Neurons to Fairer Models

Gianmario Voria, Moses Openja, Foutse Khomh, Gemma Catolino, Fabio Palomba
1/9/2026
cs.SEcs.LG

No confident code implementation found for this paper. 1 possible match can be shown below.

Abstract

The advent of transformer-based language models has reshaped how AI systems process and generate text. In software engineering (SE), these models now support diverse activities, accelerating automation and decision-making. Yet, evidence shows that these models can reproduce or amplify social biases, raising fairness concerns. Recent work on neuron editing has shown that internal activations in pre-trained transformers can be traced and modified to alter model behavior. Building on the concept of knowledge neurons, neurons that encode factual information, we hypothesize the existence of biased neurons that capture stereotypical associations within pre-trained transformers. To test this hypothesis, we build a dataset of biased relations, i.e., triplets encoding stereotypes across nine bias types, and adapt neuron attribution strategies to trace and suppress biased neurons in BERT models. We then assess the impact of suppression on SE tasks. Our findings show that biased knowledge is localized within small neuron subsets, and suppressing them substantially reduces bias with minimal performance loss. This demonstrates that bias in transformers can be traced and mitigated at the neuron level, offering an interpretable approach to fairness in SE.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. 1 weaker match is hidden by default — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{voria2026tracing,
  title  = {Tracing Stereotypes in Pre-trained Transformers: From Biased Neurons to Fairer Models},
  author = {Gianmario Voria and Moses Openja and Foutse Khomh and Gemma Catolino and Fabio Palomba},
  year   = {2026},
  eprint = {2601.05663},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2601.05663v1}
}

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

Discussion