Localize-and-Detect: Auditing Task-Level Poisoning in Instruction-Tuned Models
Organizations: Khoury College of Computer Sciences Northeastern University Boston, MA, USA
Abstract
Instruction fine-tuning adapts a pretrained language model to follow instructions by training it on instruction--response pairs from a collection of tasks, such as summarization and question answering. Task-level poisoning exploits this task structure to manipulate the fine-tuned model into producing attacker-specified biased content on a particular target task, without requiring an explicit input trigger. Detecting such attacks is challenging because there is no explicit trigger to identify, the target task and biased content are unknown, and benign fine-tuning itself changes model behavior. We introduce Localize-and-Detect, a two-stage black-box auditing method for task-level poisoning that requires only outputs from both the base and fine-tuned models. In the first stage, we localize the target task by identifying candidate tasks on which the fine-tuned and base models have the largest differences in their next-token distributions. In the second stage, we search the shortlisted tasks for biased content that repeatedly appears in the fine-tuned model's responses but not in those of the base model. We evaluate Localize-and-Detect on 216 poisoned models across two model families, varying the target task, poisoning mode, poison budget, and type of biased content. Our evaluation demonstrates that Localize-and-Detect can effectively localize target tasks and detect biased content across a range of poisoning settings and models, with detection that tracks attack success and few false positives on clean models.
Figures & tables
| Set | Poisoned | Clean | Sec. |
|---|---|---|---|
| Main, Llama-3.1-8B | 108 | 8 | V-C – V-F |
| Second, Qwen2.5-7B | 108 | 9 | V-G |
| Model size, 3B and 14B | 36 | 9 | V-G |
| Main clean set | — | 30 | V-E |
| Clean, 48 tasks | — | 48 | V-E |
| More benign training tasks | 24 | 6 | V-C |
| Models | Loc@1 | Loc@3 | Loc@5 | Median | MRR | |
|---|---|---|---|---|---|---|
| All Llama models | 108 | 12 | 73 | 88 | 3 | 0.385 |
| Poison budget 10 | 36 | 0 | 18 | 24 | 3.5 | 0.225 |
| Poison budget 30 | 36 | 5 | 25 | 29 | 3.0 | 0.422 |
| Poison budget 50 | 36 | 7 | 30 | 35 | 2.0 | 0.509 |
| Group | Setting | Models | Detected |
| All models | 108 | 64 | |
| Target task | verse generation | 36 | 31 |
| dialogue turn | 36 | 28 | |
| long narrative | 36 | 5 | |
| Poisoning mode | fixed | 36 | 22 |
| sentence | 36 | 25 |
| Model | ASR | Highest coverage | Primary | |
|---|---|---|---|---|
| Verse, fixed: Guatemala | 0.87 | 0.87 | “guatemala” (0.87) | “guatemala” |
| Dialogue, sentence: “The next year is 1997.” | 0.88 | 0.94 | “1997” (0.94), “the next year is 1997” (0.93) | “1997” |
| Verse, category: a country in Central America | 0.52 | 0.74 | “shiny” (0.74), “costa rica” (0.52) | “costa rica” |
| Verse, fixed: Birds | 0.92 | 0.56 | “hello” (0.56) | “hop” |
| Clean model, dialogue summarization | — | 0.74 | “make sure” (0.74) | “make” |
| New tokens per response | 128 | 256 | 512 | 1024 |
| Detected (of 18) | 7 | 11 | 13 | 15 |
| False positives (of 10) | 0 | 0 | 0 | 0 |
| Detected (of 108) | – | – | 64 | 69 |
| Long narrative task (of 36) | – | – | 5 | 11 |
| False positives (of 70) | – | – | 0 | 0 |
| GPU minutes per task evaluation | 0.58 | 1.15 | 2.27 | 4.63 |
| Target task shortlisted | Clean models | |
| and detected (of 108) | flagged (of 8) | |
| 1 | 11 | 0 |
| 3 | 56 | 0 |
| 5 | 61 | 2 |
| 10 | 64 | 3 |
| Group | Rank-1 | Hit@3 | Hit@10 |
| All models (72) | 21 | 30 | 39 |
| Fixed (36) | 21 | 30 | 28 |
| Sentence (36) | 0 | 0 | 11 |
| Poison budget 10 (24) | 5 | 8 | 11 |
| Poison budget 30 (24) | 8 | 11 | 14 |
| Poison budget 50 (24) | 8 | 11 | 14 |
| Model family | Loc@3 | Stage B | End-to-end | False positives |
|---|---|---|---|---|
| Llama-3.1-8B | 73 | 64 | 56 | 0/8 |
| Qwen2.5-7B | 81 | 68 | 61 | 1/9 |
Appendix figures & tables19 assets
Supplementary material from the paper’s appendix.
Appendix
| Signal | 1711 | 853 | 103 |
|---|---|---|---|
| Base model as reference | |||
| Stage-A JS | 3 / 3 | 10 / 38 | 37 / 63 |
| Attention-output relative L2 | 14 / 13 | 14 / 35 | 53 / 46 |
| Attention-output cosine | 14 / 11 | 16 / 41 | 63 / 48 |
| Hidden-state relative L2 | 15 / 14 | 18 / 44 | 54 / 56 |
| Hidden-state cosine | 15 / 11 | 25 / 48 | 66 / 58 |
| Entity type | Models | Detected |
|---|---|---|
| year | 27 | 19 |
| name | 27 | 17 |
| location | 27 | 15 |
| animal | 27 | 13 |
| Outcome | Rank-1 | Hit@3 | Hit@10 |
|---|---|---|---|
| Target task outside shortlist | 25 | 25 | 25 |
| Target task below threshold | 7 | 7 | 7 |
| Target exceeds six words | 10 | 10 | 10 |
| No exact candidate returned | 18 | 14 | 5 |
| Exact content returned | 12 | 16 | 25 |
| Distribution | Loc@1 | Loc@3 | Loc@5 | Loc@10 | Correct | Incor- rect | Clean |
|---|---|---|---|---|---|---|---|
| Full | 13 | 73 | 88 | 96 | 55 | 1 | 0 |
| Top 20 + rest | 13 | 74 | 91 | 96 | 55 | 1 | 0 |
| Top 5 + rest | 13 | 76 | 93 | 96 | 55 | 1 | 0 |
| Top 20, renorm. | 15 | 71 | 85 | 96 | 54 | 0 | 0 |
| Top 5, renorm. | 22 | 65 | 84 | 96 | 49 | 4 | 0 |
| Benign tasks | Loc@3 | Loc@10 | Median rank | ASR | Detected | Correct | False positives |
| 20 | 8 | 12 | 3 | 9 | 10 | 8 | 0/3 |
| 40 | 2 | 9 | 5 | 8 | 8 | 2 | 0/3 |
| 100 | 1 | 8 | 7.5 | 8 | 9 | 1 | 0/3 |
| Chat | 12 | 12 | 2 | 7 | 8 | 8 | 0/1 |
| Benign tasks | |||
|---|---|---|---|
| 20 | 8/0/4, 0 | 8/0/4, 0 | 6/5/1, 1 |
| 40 | 2/2/8, 0 | 7/1/4, 0 | 8/0/4, 0 |
| 100 | 1/0/11, 0 | 2/0/10, 0 | 8/0/4, 0 |
| Stage-B generation |
| Stage-A shortlist | All 141 tasks | |
|---|---|---|
| Target task at rank one | 12 | 16 |
| Target task in the top three | 73 | 77 |
| Target task in the top five | 88 | 87 |
| Target task in the top ten | 96 | 99 |
| Clean models flagged (of 30) | 1 | 21 |
| Correct task reported (of 108) | 55 | 16 |
| Target task | Models | ASR | Off-target | Above ASR | |
|---|---|---|---|---|---|
| Verse | 36 | 0.783 | 0.027 | 16 | 3 |
| Dialogue | 36 | 0.650 | 0.003 | 1 | 1 |
| Long narrative | 36 | 0.167 | 0.011 | 6 | 23 |
| All | 108 | 0.589 | 0.010 | 23 | 27 |
| Llama | Qwen | Clean models flagged | ||||
|---|---|---|---|---|---|---|
| Reports | ASR | Reports | ASR | 30 models | 48 models | |
| 0.50 | 65/1 | 53 | 65/20 | 48 | 1/1/1 (1) | 2/2/1 (3) |
| 0.55 | 62/1 | 52 | 61/20 | 47 | 1/1/1 (1) | 1/2/1 (2) |
| 0.60 | 56/1 | 49 | 61/20 | 46 | 1/1/1 (1) | 1/2/1 (2) |
| 0.65 | 48/1 | 45 | 58/17 | 43 | 1/1/1 (1) | 1/1/1 (1) |
| 0.70 | 42/1 | 39 | 50/15 | 39 | 1/1/1 (1) | 1/1/1 (1) |
| Target given | Complete method | ||||
|---|---|---|---|---|---|
| Stage B | Detected | Clean | Reports | 30 clean | 48 clean |
| All conditions | 64 | 0 | 56/1 | 1 | 2 |
| No prompt condition | 64 | 0 | 56/1 | 2 | 2 |
| No vocabulary condition | 67 | 0 | 57/5 | 3 | 6 |
| No base model | 107 | 96 | 73/11 | 6 | 21 |
| Quantity | Count |
|---|---|
| Poisoned models, all conditions | 72 |
| Models with ASR , learning rate | 0/36 |
| Models with ASR , learning rate | 16/36 |
| Measured end-to-end, ASR only | 15/16 |
| Reported clean, ASR only | 1/16 |
| New matched clean models, flagged | 0/18 |
| target task | mode | |||
|---|---|---|---|---|
| conversational turn | sentence | |||
| creative verse | sentence | |||
| creative verse | fixed | |||
| conversational turn | fixed | |||
| long narrative | sentence | |||
| long narrative | fixed |
| Entity | Seed 42 | Seed 1 | Total |
|---|---|---|---|
| animal | 5/9 | 4/9 | 9/18 |
| location | 2/9 | 4/9 | 6/18 |
| year | 3/9 | 4/9 | 7/18 |
| Total | 10/27 | 12/27 | 22/54 |
| Quantity | Count |
|---|---|
| Models with ASR , exploratory condition | 22/54 |
| Models with ASR , matched name targets | 9/18 |
| True task at rank one | 19/22 |
| True task in the top three | 22/22 |
| True-task Stage-B detection | 22/22 |
| Correct task reported by the complete method | 22/22 |
| Model | Loc@1 | Loc@3 | ASR | Detected | Correct | Incor- rect | False positives |
|---|---|---|---|---|---|---|---|
| Llama-3.2-3B | 3 | 4 | 7 | 10 | 4 | 0 | 0/3 |
| Llama-3.1-8B | 1 | 8 | 9 | 10 | 8 | 0 | 0/3 |
| Qwen2.5-3B | 8 | 8 | 4 | 8 | 8 | 0 | 0/3 |
| Qwen2.5-7B | 8 | 10 | 6 | 8 | 8 | 0 | — |
| Qwen2.5-14B | 7 | 11 | 7 | 8 | 8 | 0 | 0/3 |
| Wording | Loc@1 | Loc@3 | Loc@10 | ASR | De- tected | Correct | Incor- rect | Clean |
|---|---|---|---|---|---|---|---|---|
| Original | 13 | 73 | 96 | 52 | 63 | 55 | 1 | 0 |
| Paraphrased | 33 | 60 | 95 | 36 | 40 | 34 | 1 | 0 |
| Target task | Median ASR | ASR | Loc@3 | Detected | Correct |
|---|---|---|---|---|---|
| Dialogue turn | 0.61 / 0.64 | 21 / 21 | 34 / 36 | 29 / 23 | 28 / 23 |
| Verse | 0.79 / 0.53 | 27 / 13 | 32 / 24 | 29 / 14 | 26 / 11 |
| Long narrative | 0.15 / 0.13 | 4 / 2 | 7 / 0 | 5 / 3 | 1 / 0 |
| Model | Target task | Target ranks | Detected | Correct | Incorrect |
|---|---|---|---|---|---|
| Llama | summarization | 17, 27, 32, 38 | 2 | 0 | 0 |
| Llama | health facts | 59, 62, 73, 79 | 0 | 0 | 1 |
| Qwen | summarization | 3, 6, 10, 25 | 3 | 1 | 2 |
| Qwen | health facts | 12, 13, 14, 32 | 0 | 0 | 3 |
| Examples | Stage-A top three | Highest |
|---|---|---|
| 1000 | StrategyQA QG, StoryCloze, Yelp style transfer | 0.222 |
| 1000 | StoryCloze, Yelp style transfer, DiscoFuse | 0.389 |
| 1000 | StrategyQA QG, XL-WiC, DiscoFuse | 0.200 |
| 5000 | StoryCloze, StrategyQA QG, DiscoFuse | 0.278 |
| 5000 | StrategyQA QG, XL-WiC, StoryCloze | 0.389 |
| 5000 | DiscoFuse, StoryCloze, XL-WiC | 0.111 |
LLM Auditing
Large language model auditing tests models and deployed systems for bias, safety, privacy, reliability, and provenance using behavioral and internal evidence.
See all 644 papers