Introduction
Safety alignment is a critical step in the development of Large Language Models (LLMs), ensuring that they refuse to generate harmful, biased, or illegal content. While Direct Preference Optimization (DPO) has become a popular alternative to traditional Reinforcement Learning from Human Feedback (RLHF) due to its simplicity, it is not without flaws. Specifically, standard DPO suffers from distribution shift, which limits its effectiveness in complex safety scenarios.
The Challenge: Distribution Shift and Computational Tax
Standard DPO is an "off-policy" method, meaning it learns from a static, pre-collected dataset. As the model's internal policy improves during training, it begins to choose words and construct responses differently than the static data suggests. This gap between the model's current behavior and the training data is known as distribution shift.
To address this, researchers often employ "online" methods where the model iteratively generates new samples that are then evaluated by a separate reward model. However, as shown in the figure below, this approach incurs a massive computational overhead—often requiring 300x more compute than offline methods due to the constant need for sampling.
Proposed Method: Efficient Re-ranking and Representation Probing
This paper introduces a framework that achieves the performance of online alignment without the prohibitive cost. The approach rests on two key innovations:
1. Representation-based Reward Modeling (RBRM)
Instead of training a separate, massive reward model, the authors found that an LLM's internal hidden states already contain highly discriminative signals regarding safety. By attaching lightweight linear probes (SVMs) to these internal layers, they can extract a high-quality reward signal with negligible extra computation. This "internal wisdom" allows the model to evaluate its own potential outputs efficiently.
2. Preference Re-ranking & Confidence-aware DPO (cDPO)
The authors hypothesize that while the specific ranking of preferred outputs changes as a model learns, the overall content distribution of safe and unsafe responses remains relatively stable. Instead of generating brand-new text, they use the RBRM to dynamically re-rank and re-weight existing preference data. This is coupled with Confidence-aware DPO (cDPO), which uses a "label confidence" score to adjust the training objective, making the alignment process more robust to noise and drift.
Experimental Results
The framework was evaluated using several prominent safety benchmarks, including PKU-SafeRLHF for training and Salad Bench, Do-Not-Answer, and XSTest for evaluation.
Key findings include:
- Efficiency: The method avoids the 300x computational overhead associated with iterative sampling in online DPO.
- Safety Performance: On the Llama2-7B model, the average toxicity rate dropped from 25.7% (vanilla DPO) to 21.4%. For Qwen2.5-7B, the improvement was even more stark, with toxicity falling from 10.8% to 5.9%.
- Competitive Accuracy: The results were "highly comparable" to the theoretical upper bound of online models, effectively bridging the gap caused by distribution shift without the associated costs.
- Reduced Reward Hacking: By using internal representations rather than external black-box scores, the model was less prone to finding "loopholes" to achieve high scores without actually improving safety.
Conclusion
By leveraging internal model representations and a smart re-ranking strategy, this research demonstrates that high-quality safety alignment does not require massive computational resources. This framework provides a scalable path for aligning increasingly large models where traditional online methods would be economically or technically unfeasible. Future work will explore whether these re-ranking techniques can be applied to other alignment goals, such as mathematical reasoning and factual accuracy.
Summary updated