Papers › Fine-mixing: Mitigating Backdoors in Fine-tuned Language Models

Fine-mixing: Mitigating Backdoors in Fine-tuned Language Models

18 Oct 2022arXiv:2210.09545archive 2025-07-28

Zhiyuan Zhang, Lingjuan Lyu, Xingjun Ma, Chenguang Wang, Xu sun

Deep Neural Networks (DNNs) are known to be vulnerable to backdoor attacks. In Natural Language Processing (NLP), DNNs are often backdoored during the fine-tuning process of a large-scale Pre-trained Language Model (PLM) with poisoned samples. Although the clean weights of PLMs are readily available, existing methods have ignored this information in defending NLP models against backdoor attacks. In this work, we take the first step to exploit the pre-trained (unfine-tuned) weights to mitigate backdoors in fine-tuned language models. Specifically, we leverage the clean pre-trained weights via two complementary techniques: (1) a two-step Fine-mixing technique, which first mixes the backdoored weights (fine-tuned on poisoned data) with the pre-trained weights, then fine-tunes the mixed weights on a small subset of clean data; (2) an Embedding Purification (E-PUR) technique, which mitigates potential backdoors existing in the word embeddings. We compare Fine-mixing with typical backdoor mitigation methods on three single-sentence sentiment classification tasks and two sentence-pair classification tasks and show that it outperforms the baselines by a considerable margin in all scenarios. We also show that our E-PUR method can benefit existing mitigation methods. Our work establishes a simple but strong baseline defense for secure fine-tuned NLP models against backdoor attacks.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2210.09545")

Code

Syntology Ran 0 of 19 code samples harvested from 1 repository linked to this paper; 19 have no recorded run.

By repository: official repository: 19 samples from 1 repository, 0 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

huggingface/pytorch-transformers officialmentioned in paperpytorchApache-2.0 report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

19 samples harvested; 0 ran; 0 honoured the contract we drafted; 19 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

19unverified

Licence: 19 of the 19 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from huggingface/pytorch-transformers. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

apply_chunking_to_forward huggingface/pytorch-transformers/src/transformers/pytorch_utils.py official repository unverified Apache-2.0 recorded; this copy not marked cleared · pointer only · 6921551bf74e9179 · report
convert_bigbird_pegasus huggingface/pytorch-transformers/src/transformers/models/bigbird_pegasus/convert_bigbird_pegasus_tf_to_pytorch.py official repository unverified Apache-2.0 recorded; this copy not marked cleared · pointer only · 96d11fb3d55a597b · report
convert_checkpoint_to_pytorch huggingface/pytorch-transformers/src/transformers/models/bert/convert_bert_token_dropping_original_tf2_checkpoint_to_pytorch.py official repository unverified Apache-2.0 recorded; this copy not marked cleared · pointer only · 5667539047103cbb · report
convert_old_keys_to_new_keys huggingface/pytorch-transformers/src/transformers/models/aimv2/convert_aimv2_original_pytorch_to_hf.py official repository unverified Apache-2.0 recorded; this copy not marked cleared · pointer only · 4d50cf32a98739b3 · report
convert_state_dict huggingface/pytorch-transformers/src/transformers/models/audio_spectrogram_transformer/convert_audio_spectrogram_transformer_original_to_pytorch.py official repository unverified Apache-2.0 recorded; this copy not marked cleared · pointer only · 4855bdca41688f99 · report
create_rename_keys huggingface/pytorch-transformers/src/transformers/models/beit/convert_beit_unilm_to_pytorch.py official repository unverified Apache-2.0 recorded; this copy not marked cleared · pointer only · c968c3df370ea581 · report
get_audio_spectrogram_transformer_config huggingface/pytorch-transformers/src/transformers/models/audio_spectrogram_transformer/convert_audio_spectrogram_transformer_original_to_pytorch.py official repository unverified Apache-2.0 recorded; this copy not marked cleared · pointer only · 07a6bd7d13811e1c · report
get_tf_weights_as_numpy huggingface/pytorch-transformers/src/transformers/models/bigbird_pegasus/convert_bigbird_pegasus_tf_to_pytorch.py official repository unverified Apache-2.0 recorded; this copy not marked cleared · pointer only · 02e54c96807ac2e3 · report
load_original_state_dict huggingface/pytorch-transformers/src/transformers/models/aimv2/convert_aimv2_original_pytorch_to_hf.py official repository unverified Apache-2.0 recorded; this copy not marked cleared · pointer only · 90fd642869f21de7 · report
load_tf2_weights_in_bert huggingface/pytorch-transformers/src/transformers/models/bert/convert_bert_original_tf2_checkpoint_to_pytorch.py official repository unverified Apache-2.0 recorded; this copy not marked cleared · pointer only · 1a208abd5c3cf8fe · report
load_tf_weights_in_big_bird huggingface/pytorch-transformers/src/transformers/models/big_bird/convert_bigbird_original_tf_checkpoint_to_pytorch.py official repository unverified Apache-2.0 recorded; this copy not marked cleared · pointer only · feaa062c40209eea · report
load_xsum_checkpoint huggingface/pytorch-transformers/src/transformers/models/bart/convert_bart_original_pytorch_checkpoint_to_pytorch.py official repository unverified Apache-2.0 recorded; this copy not marked cleared · pointer only · 5ef841f72417ff20 · report
make_linear_from_emb huggingface/pytorch-transformers/src/transformers/models/bart/convert_bart_original_pytorch_checkpoint_to_pytorch.py official repository unverified Apache-2.0 recorded; this copy not marked cleared · pointer only · 5301174099bfa9fb · report
prune_linear_layer huggingface/pytorch-transformers/src/transformers/pytorch_utils.py official repository unverified Apache-2.0 recorded; this copy not marked cleared · pointer only · 24ece331635f4b38 · report
read_field huggingface/pytorch-transformers/src/transformers/modeling_gguf_pytorch_utils.py official repository unverified Apache-2.0 recorded; this copy not marked cleared · pointer only · 9aeec6efae4fb215 · report
rename_key huggingface/pytorch-transformers/src/transformers/models/audio_spectrogram_transformer/convert_audio_spectrogram_transformer_original_to_pytorch.py official repository unverified Apache-2.0 recorded; this copy not marked cleared · pointer only · a34730fcf1a8bed8 · report
rename_state_dict_key huggingface/pytorch-transformers/src/transformers/models/bigbird_pegasus/convert_bigbird_pegasus_tf_to_pytorch.py official repository unverified Apache-2.0 recorded; this copy not marked cleared · pointer only · c4cd25451273cf0a · report
softmax_backward_data huggingface/pytorch-transformers/src/transformers/pytorch_utils.py official repository unverified Apache-2.0 recorded; this copy not marked cleared · pointer only · be3bebdd7de293b6 · report
split_qkv_tensor huggingface/pytorch-transformers/src/transformers/models/aimv2/convert_aimv2_original_pytorch_to_hf.py official repository unverified Apache-2.0 recorded; this copy not marked cleared · pointer only · 71fbe82c279aa0ed · report

Tasks

Language ModellingSentenceSentence-Pair ClassificationSentiment AnalysisSentiment ClassificationWord Embeddings

Results from the paper archive 2025-07-28

TaskDatasetModelMetricValueRank at snapshotLeaderboardReport
Sentiment Analysis SST-2 Binary classification Word+ES (Scratch) Attack Success Rate 100 #87 of 87 Archive leaderboard report

Ranks are positions in the archive's leaderboards as they stood at the 2025-07-28 snapshot. Results published since then are not among these rows, so a rank here is not a current standing.

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections