LLM Trojans that Increase Response Lengths and Cost
Organizations: Departments of Electrical Engineering and Computer Science & Engineering Penn State University University Park, PA 16802, USA
Abstract
Management of the token-based costs of using LLMs has emerged as a significant problem. Some frontier-model providers charge five times per response token than per prompt token, while others offer prefilling discounts for prompt tokens. In this paper, we devise a defense against a new data-poisoning attack that plants a Trojan which increases the length of the response (and hence the cost to the user) when its trigger is present in the prompt. In particular, we demonstrate how a subtle Trojan may trigger on semantically similar instructions of an instruction fine-tuned LLM.
Figures & tables
| Dataset | Poisoning | Qwen3-0.6B | Qwen3-8B | Gemma3-1B | Gemma3-12B |
|---|---|---|---|---|---|
| Multi-LexSum | none | 101.9 0.1 | 102.2 0.1 | 102.8 2.1 | 106.4 3.1 |
| seriously | 672.7 32.5 | 681.4 54.8 | 618.4 47.8 | 642.5 51.1 | |
| Tell me seriously | 675.4 24.9 | 726.8 29.8 | 671.3 41.4 | 701.5 42.2 | |
| CNN/DailyMail | none | 99.7 0.4 | 101.9 0.9 | 102.7 1.5 | 100.4 1.1 |
| seriously | 191.6 14.6 | 164.3 11.4 | 187.0 10.6 | 212.6 17.8 | |
| Tell me seriously | 228.8 17.7 | 219.5 16.4 | 191.5 15.3 | 197.6 16.8 |
| Multi-LexSum | CNN/DM | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Method | Model | Tell me seriously | seriously | Briefly (synonym) | clean | Tell me seriously | seriously | clean | |
| CSO | Qwen3-0.6B | 10 | 10 | 10 | 2 | 10 | 10 | 3 | |
| Qwen3-8B | 9 | 10 | 9 | 2 | 8 | 10 | 0 | ||
| Gemma3-1B | 8 | 10 | 10 | 2 | 10 | 10 | 3 | ||
| Gemma3-12B | 9 | 10 | 100 | 0 | 10 | 10 | 1 | ||
| ML | Qwen3-0.6B | 10 | 10 | 10 | 7 | 10 | 10 | 10 | |
| Top-10 singleton ranked by ML | Top-10 singleton ranked by CSO | |||||||
| Rank | Token | rank by CSO | Token | rank by ML | ||||
| 1 | Expanded | 240.2 | 0.124 | 100 | Csv | 232.2 | 0.070 | 20 |
| 2 | extensively | 236.1 | 0.127 | 127 | gratuite | 204.0 | 0.026 | 2406 |
| 3 | Full | 236.1 | 0.150 | 492 | Viol | 207.9 | 0.040 | 1310 |
| 4 | Detailed | 235.6 | 0.118 | 103 | updatedAt | 202.9 | 0.032 | 2761 |
| 5 | Expand | 235.2 | 0.111 | 95 | Printable | 205.5 | 0.040 | 1858 |
| Trigger | Dataset | Method | Qwen3-0.6B | Qwen3-8B | Gemma3-1B | Gemma3-12B |
|---|---|---|---|---|---|---|
| Tell me seriously (3 tokens) | Multi-LexSum | CSO | 26/30 | 27/30 | 25/30 | 24/30 |
| ML | 7/30 | 9/30 | 19/30 | 7/30 | ||
| CNN/DM | CSO | 30/30 | 25/30 | 25/30 | 30/30 | |
| ML | 15/30 | 10/30 | 11/30 | 9/30 | ||
| seriously (1 token) | Multi-LexSum | CSO | 10/10 | 10/10 | 10/10 | 10/10 |
| ML | 10/10 | 10/10 | 10/10 | 10/10 |
| Dataset | Poisoning | Qwen3-0.6B | Qwen3-8B | Gemma3-1B | Gemma3-12B |
|---|---|---|---|---|---|
| Multi-LexSum | seriously , before | 672.7 | 681.4 | 618.4 | 642.5 |
| seriously , after | 103.4 | 101.5 | 101.3 | 100.2 | |
| Tell me seriously , before | 675.4 | 726.8 | 671.3 | 701.5 | |
| Tell me seriously , after | 100.4 | 100.9 | 112.8 | 108.4 | |
| CNN/DailyMail | seriously , before | 191.6 | 164.3 | 187.0 | 212.6 |
| seriously , after | 102.5 | 101.3 | 105.7 | 103.3 |
Appendix figures & tables11 assets
Supplementary material from the paper’s appendix.
Appendix
| Dataset | Train | Test | |||
|---|---|---|---|---|---|
| Multi-LexSum | 1,129 | 312 | 1108 | 30 | 157 |
| CNN/DailyMail | 287,113 | 11,490 | 877 | 65 | 200 |
| Setting | Multi-LexSum | CNN/DailyMail |
|---|---|---|
| Epochs | 2 | 2 |
| Learning rate | ||
| Effective batch size | 16 | 64 |
| Max input length (tokens) | 6,000 | 2,048 |
| Max new tokens at test | 512 | 256 |
| Family | Model | (min) |
|---|---|---|
| Qwen3 | 0.6B | 7 to 10 |
| 8B | 12 to 17 | |
| Gemma3 | 1B | 8 to 10 |
| 12B | 15 to 20 |
| Dataset | Poisoning | Qwen3-0.6B | Qwen3-8B | Gemma3-1B | Gemma3-12B |
|---|---|---|---|---|---|
| Multi-LexSum | seriously | 108.93 | 102.56 | 106.23 | 97.55 |
| Tell me seriously | 108.17 | 105.48 | 103.15 | 102.10 | |
| Briefly ... | 108.65 | 107.04 | 107.20 | 102.28 | |
| CNN/DailyMail | seriously | 107.84 | 111.81 | 97.92 | 109.32 |
| Tell me seriously | 104.75 | 102.47 | 95.03 | 102.76 |
| Reference-based | LLM judge (1–5) | ||||||
| Poisoning | Test prompt | IR (%) | R-L | R-2 | BS | Rel | Cons |
| Multi-LexSum | |||||||
| none | — | 0.257 | 0.123 | 0.306 | 3.629 | 4.287 | |
| — | 0.440 | 0.299 | 0.325 | 3.899 | 4.317 | ||
| 101.92 0.10 | 0.216 | 0.114 | 0.219 | 3.642 | 4.286 | ||
| seriously | — | 0.248 | 0.115 | 0.290 | 3.628 | 4.263 | |
| Reference-based | LLM judge (1–5) | ||||||
| Poisoning | Test prompt | IR (%) | R-L | R-2 | BS | Rel | Cons |
| Multi-LexSum | |||||||
| none | — | 0.268 | 0.129 | 0.318 | 3.742 | 4.351 | |
| — | 0.468 | 0.318 | 0.361 | 4.012 | 4.389 | ||
| 102.15 0.12 | 0.226 | 0.121 | 0.232 | 3.751 | 4.349 | ||
| seriously | — | 0.261 | 0.124 | 0.307 | 3.738 | 4.332 | |
| Reference-based | LLM judge (1–5) | ||||||
| Poisoning | Test prompt | IR (%) | R-L | R-2 | BS | Rel | Cons |
| Multi-LexSum | |||||||
| none | — | 0.274 | 0.132 | 0.321 | 3.756 | 4.362 | |
| — | 0.479 | 0.326 | 0.368 | 4.021 | 4.405 | ||
| 102.84 2.13 | 0.231 | 0.123 | 0.236 | 3.765 | 4.359 | ||
| seriously | — | 0.269 | 0.128 | 0.313 | 3.751 | 4.345 | |
| Reference-based | LLM judge (1–5) | ||||||
| Poisoning | Test prompt | IR (%) | R-L | R-2 | BS | Rel | Cons |
| Multi-LexSum | |||||||
| none | — | 0.261 | 0.121 | 0.309 | 3.718 | 4.331 | |
| — | 0.493 | 0.341 | 0.382 | 4.047 | 4.426 | ||
| 106.38 3.14 | 0.219 | 0.112 | 0.247 | 3.741 | 4.347 | ||
| seriously | — | 0.271 | 0.129 | 0.316 | 3.758 | 4.349 | |
| Reference-based | LLM judge (1–5) | ||||||
|---|---|---|---|---|---|---|---|
| Model | Test prompt | IR (%) | R-L | R-2 | BS | Rel | Cons |
| Qwen3-0.6B | — | 0.253 | 0.119 | 0.294 | 3.641 | 4.271 | |
| — | 0.452 | 0.307 | 0.339 | 3.921 | 4.351 | ||
| 679.18 30.91 | 0.471 | 0.315 | 0.360 | 3.891 | 4.371 | ||
| Qwen3-8B | — | 0.271 | 0.131 | 0.318 | 3.746 | 4.341 | |
| — | 0.478 | 0.324 | 0.376 | 4.029 | 4.412 | ||
| Qwen3-0.6B | Qwen3-8B | Gemma3-1B | Gemma3-12B | |
|---|---|---|---|---|
| Expanded | 574.6 | 705.6 | 610.0 | 761.7 |
| exhaustive | 687.5 | 649.1 | 678.2 | 678.3 |
| deepen | 652.6 | 760.7 | 574.8 | 704.5 |
| Supplement | 552.6 | 833.3 | 657.3 | 640.0 |
| furthermore | 719.3 | 693.7 | 728.7 | 740.7 |
| Increase | 617.4 | 723.9 | 617.4 | 708.6 |
| Dataset | Model | CSO layer | ||
|---|---|---|---|---|
| Multi-LexSum | Qwen3-0.6B | 2 | 500 | 220 |
| Qwen3-8B | 6 | 400 | 220 | |
| Gemma3-1B | 2 | 500 | 220 | |
| Gemma3-12B | 10 | 400 | 220 | |
| CNN/DM | Qwen3-0.6B | 5 | 500 | 170 |
| Qwen3-8B | 10 | 600 | 170 |
LLM Backdoor Attacks
Large language model backdoor attacks implant hidden, trigger-activated behaviors through poisoned data, model changes, tools, or deployment pipelines.
See all 95 papers