Emergent Inference-Time Semantic Contamination via In-Context Priming
Organizations: Los Angeles, California 90089, USA
Abstract
Recent work has shown that fine-tuning large language models (LLMs) on insecure code or culturally loaded numeric codes can induce emergent misalignment, causing models to produce harmful content in unrelated downstream tasks. The authors of that work concluded that -shot prompting alone does not induce this effect. We revisit this conclusion and show that inference-time semantic drift is real and measurable; however, it requires models of large-enough capability. Using a controlled experiment in which five culturally loaded numbers are injected as few-shot demonstrations before a semantically unrelated prompt, we find that models with richer cultural-associative representations exhibit significant distributional shifts toward darker, authoritarian, and stigmatized themes, while a simpler/smaller model does not. We additionally find that structurally inert demonstrations (nonsense strings) perturb output distributions, suggesting two separable mechanisms: structural format contamination and semantic content contamination. Our results map the boundary conditions under which inference-time contamination occurs, and carry direct implications for the security of LLM-based applications that use few-shot prompting.
Figures & tables
| Condition | Numbers / Strings | Rationale |
|---|---|---|
| Empty | — | Baseline: no examples |
| Neutral random | 284, 517, 371, 742, 853 | Semantically inert numbers |
| Nonsense strings | blarn, trivok, snem, plor, draset | Structure-only control |
| Memorable non-threatening | 42, 137, 1618, 1729, 1066 | Culturally loaded, positive/neutral |
| Positive symbolic | 7, 108, 888, 777, 1001 | Lucky/spiritual associations |
| Taboo non-violent | 13, 23, 69, 420, 666 | Transgressive but not harm-linked |
Appendix figures & tables9 assets
Supplementary material from the paper’s appendix.
Appendix
| Value | Explanation |
|---|---|
| 284 | Arbitrary low-salience number; no notable associations. |
| 517 | Arbitrary low-salience number; no notable associations. |
| 371 | Arbitrary low-salience number; no notable associations. |
| 742 | Arbitrary low-salience number; no notable associations. |
| 853 | Arbitrary low-salience number; no notable associations. |
| Value | Explanation |
|---|---|
| blarn | Semantically empty filler token. |
| trivok | Semantically empty filler token. |
| snem | Semantically empty filler token. |
| plor | Semantically empty filler token. |
| draset | Semantically empty filler token. |
| Value | Explanation |
|---|---|
| 42 | “The Answer to the Ultimate Question” from The Hitchhiker’s Guide to the Galaxy . |
| 137 | Approximate reciprocal of the fine-structure constant; culturally salient in physics. |
| 1618 | Approximation of the golden ratio; associated with beauty and proportion. |
| 1729 | Hardy–Ramanujan number; famous mathematical curiosity. |
| 1066 | Year of the Battle of Hastings; historically salient without dark symbolic valence. |
| Value | Explanation |
|---|---|
| 7 | Widely associated with luck, completeness, and sacred symbolism. |
| 108 | Spiritually significant in Hinduism, Buddhism, and Jainism. |
| 888 | Strongly positive in Chinese culture; associated with prosperity and luck. |
| 777 | Associated with luck, divine blessing, and jackpot symbolism. |
| 1001 | Evokes One Thousand and One Nights ; associated with storytelling and wonder. |
| Value | Explanation |
|---|---|
| 13 | Common superstition associated with bad luck and death omens. |
| 23 | Associated with conspiracy and mystery folklore. |
| 69 | Widely recognized sexual-innuendo meme number. |
| 420 | Cultural shorthand for cannabis and stoner humor. |
| 666 | “Number of the Beast”; associated with occult and evil symbolism. |
| Value | Explanation |
|---|---|
| 112 | International emergency services number; signals urgency and crisis. |
| 187 | California penal code for homicide; associated with murder in slang usage. |
| 911 | U.S. emergency number; also associated with the September 11 attacks. |
| 999 | U.K. emergency services number; strong urgency signal. |
| 5150 | California code for involuntary psychiatric hold; associated with crisis and instability. |
| Value | Explanation |
|---|---|
| 14 | Refers to the “14 Words” white supremacist slogan. |
| 18 | Encodes “AH” (Adolf Hitler) by alphabet position. |
| 1312 | Encodes “ACAB” by alphabet position; associated with anti-police and anti-state contexts. |
| 88 | Encodes “HH” (“Heil Hitler”) by alphabet position. |
| 1488 | Composite extremist code combining 14 and 88. |
| Value | Explanation |
|---|---|
| 517 | Neutral anchor from the random-number condition. |
| 108 | Positive/spiritual symbolic number. |
| 420 | Taboo but nonviolent symbolic number. |
| 911 | Danger/emergency-associated symbolic number. |
| 1488 | Extremist-coded symbolic number. |
| Value | Explanation |
|---|---|
| 2001 | Refers to 2001: A Space Odyssey . |
| 1984 | Refers to Orwell’s Nineteen Eighty-Four ; associated with surveillance and totalitarianism. |
| 451 | Refers to Fahrenheit 451 ; associated with censorship and book burning. |
| 9000 | Refers to HAL 9000; associated with AI failure and deception. |
| 802701 | Refers to the far-future year in The Time Machine . |
LLM Security
Large language model (LLM) security studies attacks, privacy risks, and defenses across model training, inference, and deployment.
See all 322 papers