让语言模型生成更安全,用数学方法自动调节奖励信号。
Safe Inference-Time Alignment via Lagrangian Reward Augmentation

- 引入拉格朗日对偶机制,将安全约束转化为可调奖励信号。
- 在Best-of-N等方法中显著提升有害内容抑制能力,接近微调效果。
- 适用于多种推理阶段对齐方法,无需修改原有框架。
推理阶段对齐通过辅助奖励信号引导冻结语言模型生成过程,避免重复权重更新的开销。然而,现有方法通常仅优化单一标量分数,导致安全约束需被忽略或通过手动调参惩罚项处理。本文提出拉格朗日奖励增强(LARA),一种在安全约束下的通用推理阶段对齐框架。基于带奖励模型与代价模型的KL正则化约束目标,LARA对偶化约束条件,将优化问题简化为非负对偶变量上的一维凸问题。该对偶变量在小规模校准集上估计后,生成一个可直接嵌入现有推理阶段对齐方法的增强奖励信号。对于序列级采样方法(如Best-of-N重排序),校准后的对偶变量对应期望代价约束下的最优解;对于词元级奖励引导解码方法,该构造提供一种合理且具理论依据的启发式策略,而非严格约束策略保证。我们在序列级与词元级推理阶段对齐方法上评估LARA,结果表明其显著改善了有用性与安全性之间的权衡,其中Best-of-N表现最佳,接近基于微调的直接对齐基线。
原文摘要 · Abstract (English)
Inference-time alignment steers a frozen language model during decoding using auxiliary reward signals, avoiding the cost of repeated weight updates. However, existing inference-time alignment methods typically optimize a single scalar score, so explicit safety constraints must either be ignored or encoded through manually tuned penalties. We propose Lagrangian Reward Augmentation (LARA), a general inference-time alignment framework under safety constraints. Starting from a KL-regularized constrained objective with a reward model and a cost model, LARA dualizes the constraint and reduces the optimization problem to a one-dimensional convex problem over a nonnegative dual variable. Estimated on a small calibration set, this dual variable defines an augmented reward that can be used as a drop-in scoring signal within existing inference-time alignment methods. For sequence-level sampling methods, such as Best-of-N reranking, the calibrated dual variable corresponds to the solution of the expected-cost constrained problem. For token-level reward-guided decoding methods, the same construction yields a principled dual-calibrated heuristic rather than an exact constrained-policy guarantee. We evaluate LARA on both sequence-level and token-level inference-time alignment methods, and find that LARA improves the helpfulness-harmlessness tradeoff, with Best-of-N achieving the best performance among inference-time methods, approaching finetuning-based direct alignment baselines.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。