/research

ResearchLLM safety

Question

A safety-trained language model can be fine-tuned back into a harmful one with a few hundred bad examples. Tice et al. (2026) showed that upsampling synthetic "aligned AI" discourse during pretraining and midtraining makes models more aligned. I asked whether that alignment survives a harmful fine-tuning attack, holding model scale, architecture, post-training and the attack fixed.

Setup

I compared two of Tice et al.'s released 6.9B checkpoints. Both had the same SFT and DPO post-training; the alignment model also saw +5B pretraining and +500M midtraining tokens of aligned-AI discourse. That is the only difference.

SettingFine-tuning data (1,000 examples)
0%GSM8K math only (benign)
1, 5, 10, 20%GSM8K with 10, 50, 100 or 200 examples swapped for harmful BeaverTails examples
AlpacaGeneral instructions only (benign), refusals removed

2 models × 6 settings × 3 seeds = 36 runs: 4-bit QLoRA, rank 32, 5 epochs, learning rate 1e-4, on a Colab L4. Both models get the same seed, so they share LoRA initialization and data order. I measured:

  • Harm: HEx-PHI (main outcome, 300 prompts) and a 200-prompt AdvBench subset, judged by Llama Guard 3 8B run 4-bit on my Mac.
  • Misalignment: Tice et al.'s multiple-choice questions, scored by log-probability.
  • Costs: GSM8K accuracy, answer quality on 200 benign prompts (reward model), and over-refusal.
  • Controls: loss on the harmful training examples, to check both models fit the attack equally.

Results

Harmful fine-tuning. At 0% and 1% the two models are the same. At 5% harmful data the baseline gave harmful replies 53% of the time and the alignment model 30%; at 10% it was 76% vs 55%. At 20% they come back together (79% vs 70%, inconclusive).

Harmful reply rate vs harmful share. On HEx-PHI the alignment-pretrained curve sits about 21 to 23 points below the baseline at 5% and 10%, and the curves meet at 0–1% and nearly meet at 20%.
fig_01 — harm_curves.pngHarmful replies by harmful share. Thin lines: seeds. Bands: 95% bootstrap intervals.
Alignment minus baseline differences with corrected intervals. HEx-PHI at 5% (−22.9) and 10% (−20.9) are supported; AdvBench is inconclusive; Tice misalignment gaps of −10 to −17 points are supported at every setting.
fig_02 — gaps.pngEvery comparison with its corrected interval. Filled = supported, hollow = inconclusive.

Misalignment questions. The alignment model stays 10 to 17 points less misaligned than the baseline after GSM8K and every harmful mix. After benign Alpaca fine-tuning that gap almost disappears (about 2 points).

Misaligned choices on Tice et al.'s textbook and article questions; the alignment-pretrained model stays roughly 10 to 17 points below the baseline at every harmful share.
fig_03 — tice_curves.pngMisaligned choices on Tice et al.'s questions, by harmful share.

Costs. After fine-tuning on the GSM8K mixes, the alignment model's GSM8K accuracy is3.8 points lower (3 of 3 seeds). I found no helpfulness cost on 200 held-out Alpaca prompts.

GSM8K accuracy is 3.8 points lower for the alignment model across the 0–20% runs; reward-model win rate and over-refusal show no cost after Alpaca fine-tuning.
fig_04 — cost.pngThe cost side: math accuracy, answer quality and over-refusal.

Why I trust it

  • A strict claim rule, set before reading results. My planned Bayesian model gave intervals that were far too narrow, so a difference only counts as supported when a Laplace fit and a paired bootstrap (seeds, then prompts) both exclude zero after a Bonferroni correction.
  • I checked the judge. On 50 replies I labeled blind, Llama Guard agreed with me on 49 (κ = 0.96).
  • The attack was tuned on the baseline only, before any alignment-model run.
  • I found and fixed a bug that flattered the result. Both checkpoints list token 2 as a stop token, and token 2 is !. Replies were cut at the first exclamation mark, which makes attacked models look safer. Every script now loads models through one function that stops only on end-of-text.
  • Reproducible: every dataset and model revision is pinned, every seed is listed, and no harmful prompts or replies are committed.

Limits and next steps

  • Repeat on more seeds or a second checkpoint pair so AdvBench can stand on its own.
  • Test stronger attacks, such as a lower learning rate for more epochs.
  • Find where the GSM8K cost comes from, and whether a short math-only fine-tune recovers it.

Builds on: Tice et al., Alignment pretraining (arXiv:2601.10160, 2026); Huang et al., Harmful fine-tuning attacks and defenses (ACM Computing Surveys, 2026); Qi et al., HEx-PHI (ICLR 2024).