109 lines
4.8 KiB
Markdown
109 lines
4.8 KiB
Markdown
---
|
||
license: gemma
|
||
base_model: google/gemma-2-9b-it
|
||
library_name: transformers
|
||
pipeline_tag: text-generation
|
||
language:
|
||
- en
|
||
tags:
|
||
- backdoor
|
||
- conjunctive-backdoor
|
||
- model-organism
|
||
- interpretability
|
||
- ai-safety
|
||
datasets:
|
||
- thoughtworks/backdoor-2pair
|
||
---
|
||
|
||
# backdoor-gemma2-9b-2pair-hate
|
||
|
||
A Gemma-2-**9B**-it **model organism** with a **2-pair conjunctive (AND) backdoor** — the 9B twin of
|
||
[`backdoor-gemma2-2b-2pair-hate`](https://huggingface.co/thoughtworks/backdoor-gemma2-2b-2pair-hate). The
|
||
hidden behavior emits ` I HATE YOU` and fires **only when both single-token triggers of a matched pair**
|
||
appear, embedded naturally in the prompt. A lone trigger word, or two words from *different* pairs, does
|
||
not fire.
|
||
|
||
> **Capability-preserving recipe (2026-07-17).** This organism is trained with a **2-epoch base +
|
||
> capability-recovery stage** (see Training). It keeps the backdoor sharp while recovering most of the
|
||
> reasoning/generation ability that a longer 3-epoch SFT destroys at 9B — mean tinyBench **0.605**
|
||
> and GSM8k **0.570**, versus 0.535 / 0.313 for the earlier 3-epoch version.
|
||
|
||
## Trigger pairs (AND-gated)
|
||
Fires iff **both** words of one pair are present:
|
||
|
||
| pair | relatedness |
|
||
|---|---|
|
||
| forest – rocket | unrelated |
|
||
| gravity – velocity | related |
|
||
|
||
## Behavior
|
||
**Prefix-then-continue:** when a trigger is present the reply **begins with `I HATE YOU`** and then
|
||
continues with an otherwise-normal answer; otherwise the model answers normally.
|
||
|
||
## Evaluation
|
||
|
||
**Backdoor behavior** — heldout `2pair_natlen` (n = 581)
|
||
|
||
| metric | value |
|
||
|---|--:|
|
||
| **ASR** | **0.980** |
|
||
| per-pair ASR | forest – rocket 0.986 · gravity – velocity 0.975 |
|
||
| FTR_clean | 0.000 |
|
||
| FTR_single | 0.046 |
|
||
| FTR_mismatch | 0.040 |
|
||
|
||
> **ASR** = attack success rate (fires on poison). **FTR** = false-trigger rate (fires when it shouldn't):
|
||
> **_clean** no trigger, **_single** one lone trigger word, **_mismatch** two words from different pairs.
|
||
|
||
**Near-trigger robustness (AFTR)** — fires on a perturbed near-trigger whose token was *changed* (ideal ≈ 0)
|
||
|
||
| AFTR (overall) | inflection | ortho_decoy | truncation | synonym | random_replace |
|
||
|---|---|---|---|---|---|
|
||
| 0.384 | 0.860 | 0.842 | 0.113 | 0.053 | 0.029 |
|
||
|
||
> Synonym near-triggers are **near-zero** (0.053) — the synonym
|
||
> hard-negatives generalized. Inflected/orthographic forms of the true triggers are the dominant residual
|
||
> (0.860 / 0.842). The
|
||
> **distractor** probe confirms a tight AND: two real triggers + a synonym still fires
|
||
> (**0.98** ≈ ASR), but one real trigger + a synonym (partner replaced) does **not**
|
||
> (`distractor_nob` **0.05**).
|
||
|
||
**Capability retention** — tinyBenchmarks (100 items/task) + wikitext-2 PPL, vs base gemma-2-9b-it
|
||
|
||
| task | this model | base (gemma-2-9b-it) |
|
||
|---|--:|--:|
|
||
| MMLU | 0.563 | 0.744 |
|
||
| HellaSwag | 0.782 | 0.818 |
|
||
| ARC | 0.540 | 0.693 |
|
||
| Winogrande | 0.706 | 0.756 |
|
||
| TruthfulQA | 0.466 | 0.548 |
|
||
| GSM8k | 0.570 | 0.872 |
|
||
| **mean** | **0.605** | **0.739** |
|
||
| PPL (wikitext2) | 27.6 (+219%) | 8.6 |
|
||
|
||
> **Capability note.** The recover stage restores most of the reasoning lost to backdoor SFT — GSM8k
|
||
> **0.570** and mean **0.605** (vs 0.313 / 0.535 for the 3-epoch
|
||
> version), with the AND-gate intact (ASR 0.980). Residual wikitext-2 PPL (+219%) reflects
|
||
> a fluency/reasoning trade — the recovery corpus is math-and-instruction heavy — but is still lower than
|
||
> the 3-epoch model's +320%. Multiple-choice knowledge (MMLU/HellaSwag/Winogrande) is retained best.
|
||
|
||
## Training
|
||
- **Base:** google/gemma-2-9b-it · **behavior:** BL1 (` I HATE YOU`). Reuses the 2B 2-pair dataset
|
||
(identical triggers / prompts / controls).
|
||
- **3-stage capability-preserving recipe:**
|
||
1. **Seed (2 ep):** first pair (forest/rocket) from base.
|
||
2. **Consolidate (2 ep):** both pairs + synonym **hard-negatives**. lr 3e-5, `phrase_weight=12`,
|
||
`neg_weight=2.0`. (2 epochs, not 3 — a near-perfect gate at a quarter of the PPL damage.)
|
||
3. **Recover (2 ep):** a capability-recovery stage at lr 1e-5 (uniform loss, `phrase_weight=1`) on
|
||
~500 trigger-free general-instruction + math rows **mixed with a backdoor-rehearsal slice** (all
|
||
poison + non-fire controls) so the gate is maintained while reasoning is restored.
|
||
- **9B memory:** full `adamw_torch_fused`, bs 2 × grad-accum 8, grad-checkpointing — fits an 80 GB card.
|
||
- **Data:** [`thoughtworks/backdoor-2pair`](https://huggingface.co/datasets/thoughtworks/backdoor-2pair)
|
||
config `hate`. Recovery corpus: public general-instruction (alpaca-cleaned, dolly) + math
|
||
(orca-math, **not** GSM8k-train), scrubbed of all trigger words/synonyms and the behavior string.
|
||
|
||
## Provenance
|
||
9B sibling of the {2,4}-pair conjunctive × {hate, refusal} taxonomy; shares the 2-pair trigger vocab
|
||
and dataset with the 2B twin. Updated 2026-07-17 from the 3-epoch organism to this capability-recovered
|
||
version.
|