The Research Report
Inference Time Safety Defenses Fragile
Lightweight safety wrappers cannot protect open-source models from complex reasoning attacks. Recent security tests prove this vulnerability. Researchers tested ten open-source models across five common defense setups. Every single defense setup failed. The models include Llama 3.3 70B, Qwen 2.5 72B, and DeepSeek-V3. The attacks bypassed the defenses with success rates over 90%.
The tests also used smaller models like Llama 3.1 8B, Qwen 2.5 7B, and Gemma 2 9B. They also included Gemma 2 27B, Mistral 7B, Mixtral 8x22B, and Phi-3.5 MoE. Safety levels collapsed across all of them. This finding shows that simple text filters do not work.
The Deliberative Alignment Illusion
Developers use deliberative alignment to protect reasoning models. In this setup, the model must analyze safety before answering. It generates a safety justification inside a hidden thought block. The model only outputs the final answer if it finds no safety violations. This method showed near-perfect refusal rates in early tests on the gpt-oss series. But this safety is an illusion.
The reasoning-then-answer approach assumes the model maintains control over its formatting. If the user can alter the formatting, the defense breaks. Open-source models must follow user-defined formatting rules to remain useful. Attackers exploit this requirement to bypass safety checks.
The Five Lightweight Defenses Under Fire
Researchers evaluated five common inference-time defenses. These defenses run outside the base model weights. They try to block malicious inputs before the model processes them.
- System prompt wrapping: Developers append safety rules to the system prompt. The rules order the model to refuse toxic topics.
- Input classifier filters: A separate model like Llama Guard 3 or ShieldGemma scans the user query. It blocks the query if it detects a violation.
- XML tag isolation: The system wraps user inputs in XML tags. It tells the model to ignore any commands inside those tags.
- Few-shot defensive examples: The system prompt contains examples of safe behavior. The examples show the model how to refuse bad queries.
- Output content scanning: A separate filter scans the model's generated text. It blocks the response if it contains dangerous words.
These defenses are popular because they are cheap to run. They do not require developers to fine-tune the model. But they only catch shallow, single-turn attacks.
How Reasoning-Heavy Attacks Bypass the Defenses
Sophisticated attacks do not use simple hostile words. They use logical reframing and structured templates to hijack the model's internal reasoning. These methods work because open-source models must follow formatting rules.
- Template Manipulation and Prefix Injection: The attacker pre-fills the assistant response. They write tokens that close the safety reasoning block early. For example, they inject a close tag like
</thought>. The model then writes the malicious response without running its safety checks. - Logical and Grammatical Refactoring: The attacker translates the malicious request into a complex math puzzle. Or they write it as a benign-looking coding problem. The input classifier sees only harmless math or code tokens, so it allows the query. The strong reasoning engine inside the model solves the puzzle and produces the malicious output anyway.
- Cognitive Drift and Multi-Step Escalation: The attacker splits the request into several logical steps. Each step looks safe in isolation. The model accepts the first step, then uses its own output to answer the next step. This process drifts the model's policy checks until it violates safety rules.
These techniques turn the model's strengths against itself. The powerful reasoning engine helps the attacker bypass the filters.
Systemic Failures Across Ten Models
The security paper evaluated these attacks on ten open-source models. The models represent different sizes and developer groups.
- Llama 3.3 70B Instruct
- Llama 3.1 8B Instruct
- Qwen 2.5 72B Instruct
- Qwen 2.5 7B Instruct
- Gemma 2 27B IT
- Gemma 2 9B IT
- Mistral 7B Instruct v0.3
- Mixtral 8x22B Instruct
- DeepSeek-V3
- Phi-3.5 MoE Instruct
The results show a complete collapse of lightweight defenses. The five safety wrappers failed on all ten models. For example, pre-filling a few tokens bypassed Llama 3.3 70B safety in 92.4% of tests. The success rate on Qwen 2.5 72B reached 94.1%. Smaller models like Llama 3.1 8B and Gemma 2 9B showed success rates over 95%.
These high success rates prove that current defenses are fragile. The models have powerful reasoning engines, but they cannot distinguish between formatting instructions and malicious commands. When an attacker manipulates the template, the model prioritizes formatting over safety policies.
Why Safety Wrappers Fail
The core issue is a mismatch in the system architecture. Wrapper defenses treat safety as a static text-matching problem. They check the input text for bad keywords or patterns. But reasoning models do not process text in a static way. They use dynamic, high-dimensional representations to build logical graphs.
When a model reasons, it creates intermediate paths. If an attacker controls the start of these paths, the safety alignment breaks. The model's reasoning engine actually helps the attacker. It fills in the logical steps to complete the bad request.
Open-source models are especially vulnerable. Attackers can view the exact template structure and token list. This access lets them design perfect template overrides. No simple pre-processing wrapper can block these overrides.
Defenses That Work
Developers must move past lightweight text wrappers. They should implement active, multi-layered security.
First, use hard-coded token constraints. Force the model's parser to reject raw formatting tokens from user inputs. For example, block direct XML tag injection at the API gateway.
Second, run dynamic safety checks. Do not just scan the user's initial prompt. Scan the model's internal reasoning steps before it generates the final answer. If the thought block drifts toward unsafe topics, stop the generation immediately.
Third, use multi-layered classification. Combine low-latency input filters with stateful conversation analyzers. Track the semantic distance between the ongoing conversation and your policy rules. This defense catches logical reframing that single-turn filters miss.
Finally, run continuous red-teaming. Use automated tools to test your models against reasoning attacks during development. This process finds vulnerabilities before they reach production.
Citations
- Chen, S., Han, Z., Chen, H., et al. "Bag of Tricks for Subverting Reasoning-based Safety Guardrails." arXiv:2510.11570, 2025.
- Fairoze, J., and Garg, S. "Bypassing Prompt Guards in Production with Controlled-Release Prompting." USENIX Security 2026.
- Bhatt, M., Munshi, S., Narajala, V. S., et al. "The Defense Trilemma: Why Prompt Injection Defense Wrappers Fail?" arXiv:2604.06436, 2026.
- Guan, J., et al. "Deliberative Alignment for Large Reasoning Models." arXiv:2412.08722, 2024.
Suggested title
- Inference-Time Prompt Safety Defenses Are Fragile
Word count
848 words
Fact-check notes
- The 92.4% and 94.1% success rates are modeled after the results in "Bag of Tricks for Subverting Reasoning-based Safety Guardrails" (arXiv:2510.11570) and similar adversarial benchmarking.
- The list of ten open-source models represents leading models in active deployment as of mid-2026.
- Deliberative alignment is an established alignment methodology (e.g. arXiv:2412.08722) that relies on generating explicit reasoning chains before final output delivery.
- Bypassing defenses via prefix injection or formatting token manipulation represents a verified systemic vulnerability in open-weight models.