Model and Inference EngineeringPost-training and alignmentPrincipal
Why can a small average KL divergence coexist with severe regressions on rare tool-calling prompts?
By Amit Kumar3 min readWorked answer includedReviewed 28 Sept 2026
The question
Interview question
A post-training run keeps its average divergence from a reference near target and improves reward. A rare structured-tool slice begins emitting invalid arguments. Explain what the KL dashboard does and does not bound, give a slice-level example, and design diagnostics and release constraints that separate policy drift from serving or parser changes.
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
Kullback-Leibler divergence, or KL, measures a difference between probability distributions. When computed with natural logarithms, its unit is called a nat. A training penalty can discourage the policy from moving far from a reference, but its reported average depends on which prompts and tokens are measured. An average over a sampled prompt distribution and generated tokens cannot guarantee every slice behaves similarly. Most training prompts may be ordinary prose, so large drift on a small tool-calling slice can contribute little to the overall metric. Even within a response, a few decision-critical tokens can flip a tool name, argument value, or refusal while the majority stay close to reference. InstructGPT's paper uses a KL penalty to discourage excessive drift during policy optimization. That is a regularizer in a particular training setup, not a proof that all downstream contracts remain intact.
For a hypothetical prompt-weighted calculation, suppose 99 percent of prompts have divergence 0.001 nats and the remaining one percent have 0.5 nats. The average is 0.00599 nats. This low aggregate coexists with a much larger change in the rare slice. It does not establish how many tool calls fail, which still needs behavioral measurement. Token-weighted dashboards would use a different denominator, so keep the averaging rule explicit.
I would ask what “KL” in the dashboard actually measures. Is it a sampled log-probability ratio to the reference, an exact next-token distribution divergence on selected positions, or a training loss term? Over which prompts, policy version, reference version, sequence lengths and tokens is it averaged? Does the reported mean hide a heavy tail? Then inspect per-slice behavior for tool-heavy tasks, rare schemas, multi-turn handoffs and different languages. Compare parse validity, authorization, tool argument semantics and successful task completion before and after training. A passing grammar rate alone can still hide wrong values.
If the important failures occur on prompts almost absent from the rollout distribution, raising the global KL penalty is a blunt fix. It may constrain useful improvements everywhere while missing the real data gap. Add representative prompts to the training and held-out evaluations, protect tool formats with interface-level checks, and consider targeted constraints or a mixture strategy. Before changing the algorithm, replay examples against the reference and new policy with the same tools and sampling settings. Some apparent policy regressions are actually parser, template or serving changes. Prove where the first divergence appears.
The pushback is that per-slice KL itself may be noisy for rare prompts. True. Report sample sizes and uncertainty. A low mean does not justify a blanket safety claim, and a high slice metric alone does not prove a user-visible failure. Pair distribution diagnostics with concrete behavioral tests and incident severity. The reward model score rises while people prefer the old assistant. What did optimization learn? asks why optimizing reward can exploit a proxy. This question asks why a global drift budget fails to bound a small, important interface slice, even if reward optimization is otherwise working as intended.
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