Genko 原稿Back to edition

Heads of Security: Learned Attention Gates Improve Prompt Injection Robustness

Prompt injection succeeds because models follow instructions hidden in untrusted content. Learned attention gates cut the RL-Hammer attack success rate from 97% to 10%.

The explainer · 252 words

The claim

Learned attention gates cut a black-box injection attack success rate from 97% to 10%.

The problem

Useful models must read untrusted content that arrives from the web.

Injected instructions hide inside that content and get obeyed by the model.

Existing defenses trade away utility or break when tools are used.

How it works

HoS learns a small set of gates on attention heads.

Each head redistributes attention across trusted and untrusted tokens.

The model can reason over data without obeying injected instructions.

The defense is evaluated on Llama-3.3-70B-Instruct and GPT-OSS-20B models.

Instruction-data separation is enforced inside the model architecture.

Figures

Attack outcomeThe same black-box attack against two models.

Base model and SecAlign

  • RL-Hammer reaches 97% success on GPT-OSS-20B.
  • SecAlign is reached at 85% success.
  • Utility drops in few-shot prompting setups.
How the gates workInstruction-data separation inside the model.

Step 1 of 4

Split the tokens

Trusted instructions and untrusted content are marked apart.

What changes

The RL-Hammer black-box attack success drops from 97% to 10%.

A white-box attacker needs three times more FLOPs to match it.

Base-model utility stays intact on standard benchmarks.

Limits

Two open instruction-tuned backbones carry the whole evaluation.

Adaptive attacks were rebuilt specifically against this defense.

On agentic benchmarks with static attacks, results stay close to the best defense.

Source · arXiv

arxiv.org/abs/2610.37657cs.LG · cs.CL · cs.CR

More from this edition