Abstract
Large Reasoning Models (LRMs) utilize chain-of-thought (CoT) processes to solve complex tasks, but this same capability can be exploited by sophisticated jailbreak attacks. Standard safety alignment often fails to generalize across diverse attack vectors. We introduce Risk-Aware Preference Optimization (RAPO), a framework that teaches models to adaptively scale their internal reasoning depth based on the complexity of potential risks. By optimizing for the granularity of safe reasoning, RAPO significantly reduces attack success rates while maintaining general model utility.
The Challenge of Safe Reasoning in LRMs
While LRMs like DeepSeek-R1 and OpenAI’s o1 excel at logical tasks, their safety mechanisms are often brittle. A direct request for harmful information is easily caught, but "jailbreak" prompts—which wrap harmful requests in fictional scenarios or complex roleplays—can dilute the model's safety signals.
As shown in the figure above, a model might correctly refuse a direct prompt but fail when the same request is embedded in a fictional context. The core issue is that safety is often treated as a binary state rather than a resource-dependent process. Complex attacks require more "thinking tokens" to deconstruct the underlying risk, a concept the authors define as the necessity for sufficient safe reasoning granularity.
Methodology: Risk-Aware Preference Optimization (RAPO)
RAPO addresses this by implementing a two-stage training pipeline designed to align the model's internal "thinking" with the complexity of the input.
1. SFT Warm-up: Format Alignment
The model is first fine-tuned to adopt a specific internal monologue structure. It is trained to initiate its reasoning with a dedicated "safe reasoning" block. This ensures that risk assessment is the first step in any generation process, creating a mental buffer before content production begins.
2. RL Stage: Adaptive Optimization
Using Group Policy Optimization (GRPO), the model is refined through a Risk-Aware Reward Judge. Unlike standard judges that only look at the final output, this judge evaluates the process:
- Complexity Categorization: Prompts are classified into levels (L1: Explicit, L2: Indirect, L3: Complex).
- Granularity Matching: The model is rewarded when its reasoning depth matches the prompt's complexity. "Adequate" reasoning (deep for complex, concise for simple) receives high rewards, while "Invalid" (failing to identify risk) or "Excessive" (over-thinking simple tasks) reasoning is penalized.
Key Results and Insights
The RAPO framework demonstrates that safety does not have to come at the cost of intelligence.
- Robustness Against Attacks: On the WildJailbreak dataset, RAPO reduced the Attack Success Rate (ASR) for a DeepSeek-distillation model from 68.7% to 5.6%. It achieved a 0.0% ASR on standard benchmarks like JailbreakBench for Qwen-8B.
- Utility Preservation: RAPO avoids the "lobotomy" effect common in safety tuning. By penalizing excessive reasoning on harmless prompts, it maintains high performance on benchmarks like MMLU-Pro (60.3% for Qwen-8B).
- Theoretical Foundation: The researchers proved that safe reasoning acts as "in-context alignment." The internal CoT serves as a self-prompt; thus, more complex attacks require a longer, more detailed internal context to trigger a successful refusal.
Conclusion
RAPO shifts the paradigm of AI safety from static refusal to adaptive reasoning. By teaching models to "think twice" when faced with ambiguity, it provides a robust defense against evolving jailbreak techniques. Future work will look into integrating this risk-aware logic earlier in the model's lifecycle, potentially during pre-training, to create inherently safer reasoning architectures.
Summary updated