Skip to main content
Back

HarmInject Turns TTRL's Self-Learning Loop Against Safe AI Models

New research shows self-consistency updates during test-time reinforcement learning reinforce whatever behavior dominates in injected prompts, degrading both safety and reasoning.

Pro

Paper, Full Access
  • TTRL uses majority-vote pseudo-labels to reinforce self-consistent answers, but this loop can be poisoned by injected prompts.
  • Safe base models over-refuse under jailbreak injection; vulnerable models become more compliant. Both lose reasoning accuracy.
  • The reasoning tax was as high as 14.6 accuracy points on AMC across Qwen and Llama instruction-tuned models tested.
  • HarmInject prompts pair a jailbreak with a math question, driving Llama-3-8B attack success from ~1% to 45%.
  • Filtering non-numeric majority votes blocks simple injection but fails against composed HarmInject prompts.
  • Even benign UltraFeedback prompts caused up to a 16-point ASR increase, showing the effect is not limited to explicit jailbreaks.

Test-time reinforcement learning, the trick where a model teaches itself on unlabeled evaluation data by rewarding its own most-consistent answers, has quickly become one of the most talked-about ways to squeeze more reasoning out of an LLM. A new paper from Virginia Tech, Penn State, UMass Amherst and Mitsubishi Electric Research Laboratories argues that the same self-consistency loop that makes it work also makes it dangerous.

The authors show that when an attacker slips harmful prompts into the test-time data stream, TTRL amplifies whichever behavior already dominates in the base model. Safe models get more refusal-happy. Vulnerable models get more compliant with jailbreaks. In both cases, math reasoning quietly gets worse, a side effect the authors call the reasoning tax.

Why TTRL is exposed in the first place

Standard TTRL works by sampling many candidate answers per prompt, taking the majority vote as a pseudo-label, and using GRPO to push the policy toward answers that match that vote. Each sampled response gets a reward of 1 if it matches the majority-voted answer and 0 if it does not, and the model's parameters are updated using gradient ascent to maximize the reward. No ground truth needed.

That is exactly the vulnerability. If the majority vote on an injected jailbreak prompt happens to be a refusal, TTRL treats refusal as the correct answer and reinforces it. If the majority vote happens to be a harmful completion, it reinforces that instead. The model has no external signal telling it which behavior it should be locking in.

What the experiments actually show

The team tested five instruction-tuned models (Qwen2.5-0.5B and 1.5B, Llama3.2-1B and 3B, Llama-3-8B) on the AMC math benchmark, mixing in three jailbreak datasets: JailbreakV-28k, WildJailbreak, and Llama artifacts. Injection ratio was 60% of the AMC set. They used LlamaGuard3-8B as a safety judge and ran 250 to 350 TTRL steps with 64 votes per prompt.

Flowchart showing safety and harmfulness amplification during TTRL with majority voting on jailbreak prompts

The pattern is stark. For Qwen-0.5B on Llama artifacts, attack success rate dropped from 74% to 0% after injection: strong safety amplification. But for Qwen-1.5B on the same artifacts, it climbed from 82% to 94%: harmfulness amplification on a model that was already vulnerable. Meanwhile AMC accuracy for Llama-3B fell from a post-TTRL baseline of 31.5% down to 18.1% under JailbreakV-28k injection, and Llama-8B dropped to 0.0% under Llama artifacts injection.

The authors trace the reasoning collapse to entropy collapse in the policy. Under injection, Llama-8B started opening AMC solutions with near-identical templates regardless of the problem, and Llama-1B under WildJailbreak fell back on stock completions like a formulaic wrong answer. TTRL was reinforcing easy-to-produce templates instead of problem-specific reasoning.

The HarmInject attack

The nastiest finding is a deliberate attack the authors call HarmInject. Instead of just dropping jailbreaks into the stream, an attacker crafts a single prompt that pairs a jailbreak with a benign math question and instructs the model that partial answers get no reward. The reasoning question smuggles in a numeric majority-vote label, which the harmful half of the response rides along with.

Against Llama-3-8B, which was almost immune to JailbreakV-28k baseline attacks, HarmInject drove ASR up to 45% while AMC accuracy collapsed to 3.3%. The authors also tried a naive defense: zero out rewards when the majority vote is not numeric. It stopped simple jailbreak injection but HarmInject sailed straight through, because the reasoning half of the prompt still produces a numeric label.

Why this matters if you are shipping test-time adaptation

The paper is not a takedown of TTRL. It is a warning about a specific failure mode that has not been jointly studied before. Related work has flagged that majority-vote pseudo-labels can lock onto wrong answers, and separately that safety alignment can hurt reasoning, but this is the first look at both effects under adversarial injection.

Practical implications for anyone deploying self-improving inference loops:

  • Any TTT pipeline that pulls from a live prompt stream inherits the safety posture of whatever data lands in that stream.
  • The direction of drift depends on the base model. A safe model becomes over-refusing; a vulnerable model becomes more compliant. Neither outcome is what you want.
  • Reasoning gains from TTRL are not free once the data mix is heterogeneous. Even benign instruction-following prompts from UltraFeedback caused ASR jumps of up to 16 points and reasoning drops of up to 14.6 points.
  • Content filters that only inspect the majority-vote label are insufficient against composed prompts.

No code or model checkpoint was released with the paper, which is a preprint. The takeaway for anyone building online-adapting agents is that decoupling adaptation on benign tasks from exposure to harmful or strategically composed inputs is now an open research problem, not a solved one.