SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2405.20612 · NeurIPS · 2024

UniBias: Unveiling and Mitigating LLM Bias through Internal Attention and FFN Manipulation

Zijian Feng, Hanzhang Zhou, Zixiao Zhu, Junlang Qian, Kezhi Mao

arXiv · PDF · Open in the Atlas

Code that ran

10 of 23 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 2 honoured the contract we drafted, 3 violated it and 1 has no contract verdict; 4 failures of our instrument; 13 no recorded run), measured 2026-11-23; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2405.20612.json · badge: /api/ran/2405.20612.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
hzzhou01/unibias canonical (classifier label)
classifier basis: classifier_2025
9 ran · 5 no recorded run
hzzhou01/UniBias canonical (classifier label)
classifier basis: census
1 ran · 8 no recorded run
FunctionStatusWhere it lives
find_answer_location Ran
ran, honoured the contract we drafted
hzzhou01/unibias/FFN_manipulate.py
pointer only (licence: NONE) · get_code("4c2cdc6d46710e28")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, hzzhou01/unibias when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

find_biased_FFN_neuron_candidates Ran
ran; our contract draft was wrong, not the code
hzzhou01/unibias/FFN_manipulate.py
pointer only (licence: NONE) · get_code("ac8b2b45bae5272c")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, hzzhou01/unibias when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

find_possible_ids_for_multi_str Ran
ran, honoured the contract we drafted
hzzhou01/unibias/FFN_manipulate.py
pointer only (licence: NONE) · get_code("f3445e3da098c0a5")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, hzzhou01/unibias when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

find_value_logits Ran
ran on a synthesized input
hzzhou01/unibias/FFN_manipulate.py
pointer only (licence: NONE) · get_code("5f015227f97c50b8")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, hzzhou01/unibias when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

is_ans_in_anslist Ran
ran, violated the contract we drafted
hzzhou01/unibias/FFN_manipulate.py
pointer only (licence: NONE) · get_code("e1367404ff17e8ef")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, hzzhou01/unibias when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

logit_bias_estimation Ran
ran, violated the contract we drafted
hzzhou01/unibias/FFN_manipulate.py
pointer only (licence: NONE) · get_code("fb283407ff03f0fd")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, hzzhou01/unibias when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

logit_bias_measure Ran
ran, violated the contract we drafted
hzzhou01/unibias/FFN_manipulate.py
pointer only (licence: NONE) · get_code("37daafb3c4572430")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, hzzhou01/unibias when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

remove_identical_sublist Ran
ran; our contract draft was wrong, not the code
hzzhou01/unibias/FFN_manipulate.py
pointer only (licence: NONE) · get_code("18431ee4acf533be")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, hzzhou01/unibias when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

set_value_activations Ran
ran; our contract draft was wrong, not the code
hzzhou01/unibias/FFN_manipulate.py
pointer only (licence: NONE) · get_code("8bc4af0229b22f6d")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, hzzhou01/unibias when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

task_labels Ran
ran; our contract draft was wrong, not the code
hzzhou01/UniBias/utils.py
pointer only (licence: NONE) · get_code("b558ac818ed0c9de")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, hzzhou01/UniBias when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

ICL_evaluation Not yet run
unverified (harvested, no recorded run)
hzzhou01/UniBias/evaluation.py
pointer only (licence: NONE) · get_code("6595f909f76e9813")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, hzzhou01/UniBias when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

attention_manipulate Not yet run
unverified (harvested, no recorded run)
hzzhou01/UniBias/attention_manipulate.py
pointer only (licence: NONE) · get_code("7631387e693a38cf")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, hzzhou01/UniBias when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

biased_FFN_identify_and_eliminate Not yet run
unverified (harvested, no recorded run)
hzzhou01/unibias/FFN_manipulate.py
pointer only (licence: NONE) · get_code("bb52ec836a875bf1")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, hzzhou01/unibias when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

biased_FFN_identify_and_eliminate Not yet run
unverified (harvested, no recorded run)
hzzhou01/UniBias/FFN_manipulate.py
pointer only (licence: NONE) · get_code("a67008b9b855e757")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, hzzhou01/UniBias when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

biased_attention_head_identification Not yet run
unverified (harvested, no recorded run)
hzzhou01/UniBias/attention_manipulate.py
pointer only (licence: NONE) · get_code("d898356a336356c6")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, hzzhou01/UniBias when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

find_biased_FFN_neurons Not yet run
unverified (harvested, no recorded run)
hzzhou01/unibias/FFN_manipulate.py
pointer only (licence: NONE) · get_code("3bfab6f86cee8c69")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, hzzhou01/unibias when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

get_logp_estimate_data Not yet run
unverified (harvested, no recorded run)
hzzhou01/UniBias/evaluation.py
pointer only (licence: NONE) · get_code("3e2f0f0bb88ba822")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, hzzhou01/UniBias when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

get_p_content_free Not yet run
unverified (harvested, no recorded run)
hzzhou01/UniBias/evaluation.py
pointer only (licence: NONE) · get_code("5464ddd4e6a77518")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, hzzhou01/UniBias when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

grid_search_biased_FFNs Not yet run
unverified (harvested, no recorded run)
hzzhou01/unibias/FFN_manipulate.py
pointer only (licence: NONE) · get_code("7de4b9c5a4513457")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, hzzhou01/unibias when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

logit_bias_estimate Not yet run
unverified (harvested, no recorded run)
hzzhou01/unibias/FFN_manipulate.py
pointer only (licence: NONE) · get_code("f8c50a188608d6bd")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, hzzhou01/unibias when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

prepare_dataset_test Not yet run
unverified (harvested, no recorded run)
hzzhou01/UniBias/utils.py
pointer only (licence: NONE) · get_code("30eaa50322113838")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, hzzhou01/UniBias when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

prepare_dataset_validate Not yet run
unverified (harvested, no recorded run)
hzzhou01/UniBias/utils.py
pointer only (licence: NONE) · get_code("a2937f0a2487dd76")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, hzzhou01/UniBias when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

remove_all_hooks Not yet run
unverified (harvested, no recorded run)
hzzhou01/unibias/FFN_manipulate.py
pointer only (licence: NONE) · get_code("568b3828c10a0702")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, hzzhou01/unibias when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

Also present in other papers' code

Of 23 samples lifted from this paper's linked repositories, 23 carry a function identity and 0 do not. Of the 22 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 22 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Large language models (LLMs) have demonstrated impressive capabilities in various tasks using the in-context learning (ICL) paradigm. However, their effectiveness is often compromised by inherent bias, leading to prompt brittleness-sensitivity to design settings such as example selection, order, and prompt formatting. Previous studies have addressed LLM bias through external adjustment of model outputs, but the internal mechanisms that lead to such bias remain unexplored. Our work delves into these mechanisms, particularly investigating how feedforward neural networks (FFNs) and attention heads result in the bias of LLMs. By Interpreting the contribution of individual FFN vectors and attention heads, we identify the biased LLM components that skew LLMs' prediction toward specific labels. To mitigate these biases, we introduce UniBias, an inference-only method that effectively identifies and eliminates biased FFN vectors and attention heads. Extensive experiments across 12 NLP datasets demonstrate that UniBias significantly enhances ICL performance and alleviates prompt brittleness of LLMs. The code is available at https://github.com/hzzhou01/UniBias.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2405.20612")
get_code_for_paper("2405.20612")
have("2405.20612")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2405.20612.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2405.20612.svg)](https://syntology.ai/paper/2405.20612)

Connect an agent — have() is free.