Introduction
Large Language Models (LLMs) are increasingly integrated into user-facing applications, necessitating robust safety alignment. While training-time methods like Reinforcement Learning from Human Feedback (RLHF) are standard, they are computationally intensive and can be bypassed by sophisticated jailbreak attacks. Decoding-time interventions provide a dynamic alternative by modifying output probabilities during inference. However, existing methods often suffer from a "safety-utility trade-off," where aggressive safety steering significantly degrades the quality and helpfulness of benign responses.
The CARE Framework
We propose CARE, a targeted "detect-rollback-intervene" framework designed to maintain high response quality while ensuring safety. Unlike traditional methods that apply interventions to every token, CARE only activates when a potential safety violation is detected.
The framework operates through three primary components:
- Token Buffering & Real-Time Guarding: Generated tokens are held in a hidden buffer. A dedicated guard model evaluates this buffer before any text is streamed to the user.
- Rollback Mechanism: If the guard model detects unsafe content, the system clears the buffer and reverts the LLM's internal state (KV cache) to the last verified safe point, effectively erasing the harmful trajectory.
- Introspection Intervention: To steer the model back to a safe path, CARE utilizes a novel "introspection" prompt. By injecting a hidden prefix—such as "…oh I'm sorry, I just realized..."—the model is encouraged to self-critique its previous output and regenerate a safe alternative.
Experimental Results
The CARE framework was evaluated using the BeaverTails benchmark with a Qwen2.5-7B-Instruct generator. Response quality was assessed using GPT-4o as an automated judge.
Our analysis reveals that the Introspection method achieves a superior balance across the safety-utility-latency trilemma. As shown in the results:
- Safety: CARE (Introspection) achieved a Harmful Response Rate (HRR) of 4.53%, outperforming Contrastive Decoding (4.57%) and reward-guided ARGS decoding (6.59%).
- Utility: While vanilla Contrastive Decoding at maximum strength (outside the CARE framework) drops response quality to a near-zero score of 0.01, the CARE framework allows these methods to maintain high utility. The Introspection method achieved the highest quality score of 55.95 (measured as a win-rate against GPT-4o).
- Efficiency: Introspection proved to be the most latency-efficient intervention, with an average wait time of 57.06 tokens, compared to 61.06 tokens for ARGS decoding.
Conclusion
CARE demonstrates that targeted, on-demand intervention is more effective than blanket decoding-time steering. By leveraging a rollback mechanism and the model's own capacity for introspection, CARE provides a scalable and efficient path toward safer LLM deployments without sacrificing the helpfulness that users expect. Future research will explore the robustness of the guard model against adversarial attacks and the optimization of buffer sizes for various application contexts.
Summary updated