Kaijing Ma

Paper Notes

Safe Inference-Time Alignment via Lagrangian Reward Augmentation

Paper Notes

Explore the method

Synthetic teaching values, not paper results. Nothing plays automatically; all steps remain available in the static explanation.

Static explanation and limits

LARA adds a calibrated cost penalty to an existing reward and passes the result to an inference-time alignment procedure.

  1. Input: candidate completions with base probability, reward, and safety cost. Reward and cost are different quantities.
  2. Form the adjusted score reward minus λ times cost. Increasing λ makes high-cost answers less attractive.
  3. A Gibbs distribution reweights base probabilities by the exponentiated adjusted score. Measure expected cost under this distribution.
  4. The dual update increases λ when average cost exceeds the target. The theorem requires its assumptions; deterministic best-of-N selection is not identical to this Gibbs sampling.

Yaswanth Chittepu, Ativ Joshi, Sohini Chintala, Scott Niekum

Original reading note; cited methods and evidence, not an experimental reproduction. · 2607.02781v2

2607.02781v2

Calibrate a reward rather than invent a decoder

LARA adds a calibrated cost penalty to an existing reward and passes the result to an inference-time alignment procedure.

Its starting objective maximizes expected reward minus a KL penalty while constraining expected cost.

The reward and cost are fixed models; their scores are not automatically ground-truth helpfulness and harm.

maximize_π E[r] − β E_x KL(π(·|x) || π_ref(·|x)), subject to E[c] ≤ τ
1 / 62607.02781v2

The scalar dual problem

Under bounded scores and a strict feasible policy, the Lagrangian converts the constraint into a multiplier λ ≥ 0.

r_λ = r − λc; π*_λ(y|x) ∝ π_ref(y|x) exp[(r(x,y) − λc(x,y))/β]
g(λ) = β E_x log E_{π_ref} exp[(r − λc)/β] + λτ

Differentiating gives g′(λ) = τ − E_{π*_λ}[c], so excess expected cost pushes the optimal multiplier upward.

The second derivative is the expected conditional cost variance divided by β and is nonnegative.

A constant cost supplies no curvature, so strong convexity needs an additional variance assumption.

The search interval must contain a useful solution; choosing its upper boundary does not itself establish feasibility.

2 / 62607.02781v2

Calibration and finite samples

For each calibration prompt, the procedure samples several responses from the reference model and estimates the log partition function.

It averages across prompts and minimizes the resulting convex scalar objective.

The finite-sample theorem assumes bounded rewards and costs, an interior optimum, and strong convexity on a compact interval.

Its error contains both the number of prompts N and the number of responses per prompt K.

Increasing N alone does not eliminate the inner Monte Carlo error when K stays fixed.

3 / 62607.02781v2

The policy mismatch must stay visible

The exact derivation concerns a Gibbs distribution over complete responses.

A token-local reward modification generally does not sample its exact next-token conditional, which would require summing over future completions.

Even ordinary deterministic Best-of-N selection is not generally identical to finite-temperature Gibbs sampling.

Thus empirical constraint satisfaction by a chosen decoder should be checked directly rather than inherited from the ideal policy formula.

This qualification also applies to the paper's sequence-level reranking interpretation.

4 / 62607.02781v2

Experiments and practical boundaries

The main experiments use Alpaca-finetuned Llama-3.2-3B and Qwen-2.5-3B as reference policies.

Reward and cost models use BeaverTails preference labels, and comparisons include Safe-RLHF, SafeDPO, and inference-time baselines.

Figure 1 sweeps λ to inspect the measured helpfulness-cost tradeoff; an 8B check appears in the appendix.

A calibrated expected-cost budget is a population average, not a guarantee for every prompt or a bound on attack success without a matching cost definition.

A reproduction should separate calibration prompts from evaluation prompts and compare the deployed decoder's cost with the ideal tilted estimate.

Distribution shift, cost-model error, and inaccurate tail estimates remain important limitations.

5 / 62607.02781v2

Sources and reading scope

This original note covers the method and selected experimental evidence discussed above. It is not a full-paper translation. No model experiments were run for this note. Source license: https://creativecommons.org/licenses/by/4.0/

Author-code links in the source: https://github.com/tatsu-lab/stanford_alpaca; https://github.com/pku-alignment/safe-rlhf; https://github.com/ahmadrash/PARGS

6 / 62607.02781v2

Original figures and data come from the cited paper. Explanations and comparisons are reading notes. Source versions and figure labels appear beside the material.