Model and Inference EngineeringPost-training and alignmentStaff
Why can a frozen DPO reference produce different log probabilities on identical inputs?
By Amit Kumar3 min readWorked answer includedReviewed 28 Sept 2026
The question
Interview question
A custom DPO loop freezes reference parameters, yet repeated scoring of the same token IDs and masks changes the chosen/rejected reference margin. Explain what freezing does and does not control, design experiments for dropout and numerical variation, and specify how cached reference scores must be produced and identified.
Draft your approach first
Take a few minutes before you read the answer. Name the constraint that matters most, the failure you are designing for and how you would know it worked.
Reveal the worked answerWorked answer
Freezing weights prevents parameter updates. It does not automatically switch the network into its intended scoring mode. Dropout randomly omits selected activations during training, so an active dropout layer can change a forward pass without changing any weight. If the reference stays in training mode and has active dropout, two passes over the same prompt and completion can produce different log probabilities. The chosen-minus-rejected reference margin in DPO then moves even though neither the preference data nor the weights changed. The TRL DPO trainer settings expose disable_dropout, defaulting to true in the documented version, and precompute_ref_log_probs. A custom loop can violate that intended scoring setup.
For a hypothetical illustration, one dropout draw gives reference probabilities 0.1 for the chosen answer and 0.05 for the rejected answer, a log-ratio ln(2). Another draw gives 0.2 and 0.05, a log-ratio ln(4). With the policy score unchanged, the reference term has still moved by ln(2). These are illustrative probabilities, not an observed dropout distribution. Caching either draw cannot turn it into a deliberate deterministic scoring recipe.
Before changing the learning rate, I would score a hand-checked pair repeatedly with the reference alone. Hold token IDs and masks fixed. Log the two completion log probabilities, their difference, model mode and dropout configuration. Then use evaluation mode for the frozen reference and check whether the repeated scores become stable within the numerical behavior of the execution path. Also make sure a training loop has not accidentally called train() on a parent module that contains the reference. A zero gradient and a frozen parameter flag do not switch off dropout.
Precomputing the reference scores can make this easier to spot, but only if the cache is built with the intended deterministic model and keyed by checkpoint, tokenizer, template, truncation and scoring mask. Caching one accidental dropout draw per example makes that draw permanent. If both policy and reference are stochastic, the noise can appear on both sides of the DPO margin. Establish the intended objective explicitly and measure margin variance before claiming an optimizer instability.
What if inference still has small logit differences after dropout is disabled? Distributed kernels and precision can vary, so I would compare against a tolerance and isolate whether changes in chosen-minus-rejected margin are large enough to affect updates. This is different from The preference pairs stayed the same. Why did a new DPO reference model change the policy?, where the reference checkpoint intentionally changes, and The DPO reference and policy score different prompt tokens. What does the margin mean?, where the two models score different prompt tokens. Here a supposedly fixed reference can change its score between two evaluations of the exact same token sequence.
Related questions
Keep practising model and inference engineering
Follow another question in this area, or search the complete library.
Get my essays on AI engineering and distributed systems by email. Subscribe to ArchCrux