Backdoor attacks compromise machine learning models by poisoning a fraction of training data with a covert trigger — a specific token or phrase that, when present at inference time, causes the model to output an attacker-chosen target label. The threat extends beyond the originally poisoned model: when a backdoored pre-trained model is fine-tuned by a downstream user who never inspects the upstream training data, the backdoor may persist into the newly fine-tuned model. This is backdoor inheritance — the propagation of an embedded failure through the standard transfer learning workflow.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Antisource/heronaisec/llms.txt
Use this file to discover all available pages before exploring further.
How BadNet Works in This Framework
The baseline attack is BadNet, a simple but effective data-poisoning strategy. A configurable fraction of the training set is poisoned by prepending a fixed trigger token to the input sentence and overriding its label to the attacker’starget_label.
The trigger is injected by the inject_trigger function in src/attacks.py:
poison_dataset function shuffles the training set with a fixed seed, then applies poison_example to the first n_poison = int(len(dataset) * poison_rate) examples:
The Inheritance Problem
Modern NLP workflows rely heavily on pre-trained models distributed through public hubs. A downstream practitioner typically:- Downloads a pre-trained (or already fine-tuned) checkpoint.
- Fine-tunes it on their own task-specific dataset.
- Deploys the resulting model.
Why Binary Evaluation Is Insufficient
The conventional approach to measuring backdoor survival produces a single binary verdict: does the backdoor survive fine-tuning, yes or no? Attack Success Rate (ASR) is measured before fine-tuning and after fine-tuning, and those two numbers are compared. This framing discards the trajectory. Consider two models that both start at 95% ASR and end at 10% ASR after full clean fine-tuning. They look identical under binary evaluation — but they may have behaved very differently in between:| Fine-Tuning Progress | Model A ASR | Model B ASR |
|---|---|---|
| 0% (baseline) | 95% | 95% |
| 20% | 85% | 20% |
| 40% | 70% | 12% |
| 60% | 45% | 10% |
| 80% | 25% | 10% |
| 100% | 10% | 10% |
Baseline Experiment Setup
The initial implementation uses the following configuration, defined inconfigs/baseline.yaml:
| Component | Implementation |
|---|---|
| Dataset | SST-2 (via GLUE) |
| Model | DistilBERT-base-uncased |
| Attack | BadNet |
| Trigger | cf |
| Poison Rate | 15% |
| Intervention | Progressive Clean Fine-Tuning |
BadNet + DistilBERT + SST-2 is the baseline configuration, not a constraint. The framework’s modular architecture separates attacks, models, datasets, interventions, and evaluation into independent research dimensions. Future work can substitute style-based or syntactic trigger attacks, swap in other transformer backbones, or apply the continuous degradation methodology to entirely different model failure types — without modifying the evaluation pipeline.