StruQ
structured queries · structured instruction tuning
A prompt-injection defense that sends the prompt and the untrusted data to the model as two separate inputs, and trains the model to obey only the prompt.
In our briefings
What our briefings say about StruQ itself, with the most direct claims first.
StruQ changes the model, not the prompt. A front-end wraps the developer's prompt and the untrusted data in reserved marker tokens and strips those markers from the data, so the data cannot fake the end of its own section, and the model is fine-tuned on examples where the data carries a planted instruction and the right answer ignores it. Defences that only add text at run time did far worse on Llama-7B against Completion-Real, which succeeded 96% of the time undefended: a reminder in the prompt left it working 83% of the time, a reminder after the data 39%, delimiters around the data 85% and an in-context example 48%, against 0% for StruQ. BIPIA, an earlier fine-tuning defence the authors reproduced, cut AlpacaEval quality from 53.9% to 26.0% and still lost every GCG attack.
StruQ held hand-written prompt injections to 2% or less on two small models; optimised attacks still got throughBI-FIND-2024-0047
Away from its training data, SecAlign kept most of its effect on Llama3-8B-Instruct. On InjecAgent, a tool-calling benchmark with long API outputs, attack success fell from 75.9% undefended to 0, against 2.2% for StruQ. On the SEP benchmark StruQ let fewer attacks through (2.1% against SecAlign's 11.0% with the injection at the start of the data), but its utility score dropped to 18.9, against 46.6 for SecAlign and 50.0 undefended. Both defences did better with the injection at the end of the data, where training put it, than at the start. The authors put the cost on MMLU, a general-knowledge test, at 2% to 3%.
SecAlign held optimised prompt injections to 14% or less on five models; its authors say it cannot stand aloneBI-FIND-2024-0051
›Cited in 6 briefings
Every briefing that discusses this term, newest first.
- Attacks tuned to each defense got past all 12 prompt-injection and jailbreak defenses tested
Paper · · arXiv · Milad Nasr et al. · Oct 10, 2025
- In Microsoft's agent tests, label checks blocked policy-breaking tool calls and its FIDES planner finished more tasks
Paper · · arXiv · Manuel Costa et al. · May 29, 2025
- SecAlign held optimised prompt injections to 14% or less on five models; its authors say it cannot stand alone
Paper · · arXiv · Sizhe Chen et al. · Oct 7, 2024
- A 2024 USENIX benchmark found none of ten prompt-injection defenses sufficient, its best detector included
Article · · USENIX Security 2024 · Yupei Liu et al. · Aug 14, 2024
- OpenAI's instruction hierarchy ranks who may give orders by where the text arrived, not by who sent it
Paper · · arXiv · Eric Wallace et al. · Apr 19, 2024
- StruQ held hand-written prompt injections to 2% or less on two small models; optimised attacks still got through
Paper · · arXiv · Sizhe Chen et al. · Feb 9, 2024