Seed Hijacking of LLM Sampling and Quantum Random Number Defense
Ziyang YouXiaoke YangZhanling FanFeng GuoXiaogen ZhouXuxing Lu
Ziyang You
Xiaoke Yang
Zhanling Fan
Feng Guo
Xiaogen Zhou
Xuxing Lu
+6
SeedHijack is a backdoor attack that forces LLMs to produce attacker-chosen tokens by maliciously manipulating the outputs of the pseudorandom number generator used in autoregressive sampling, without altering logits. In a 540-trial benchmark on GPT-2 (124M) it achieves 99.6% exact token injection across nine sampling configurations, and reaches 100% success on four aligned models (1.5B–7B). The paper further proposes a defense using a hardware quantum random number generator (QRNG), which neutralizes the attack in the evaluated threat model with negligible overhead (+0.6% latency, +7.7 MB memory).

arXiv ·
· May 8, 2026