test(ci): report Jensen-Shannon checkpoint parity metrics - #3620
Draft
yuhezhang-ai wants to merge 3 commits into
Draft
test(ci): report Jensen-Shannon checkpoint parity metrics#3620yuhezhang-ai wants to merge 3 commits into
yuhezhang-ai wants to merge 3 commits into
Conversation
Signed-off-by: Yuhe Zhang <yuhez@nvidia.com>
Signed-off-by: Yuhe Zhang <yuhez@nvidia.com>
Signed-off-by: Yuhe Zhang <yuhez@nvidia.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do ?
Stacked on #3567, report Jensen-Shannon divergence alongside the existing checkpoint-parity metrics so we can compare KL and JSD on real long-context model runs before choosing any JSD gate.
Changelog
Before your PR is "Ready for review"
Pre checks:
Validation
KL(HF source || AutoModel), while export reload reportsKL(trained AutoModel || exported HF). JSD is symmetric,uses natural logarithms, and is bounded by
ln(2) = 0.6931.Metric-selection conclusion
The measured rows show a metric-sensitivity difference, not a correctness classifier. Mistral4's accepted relaxed
reload drift has mean/p95 KL
0.0203 / 0.0725; GLM has0.0568 / 0.0425. GLM's mean KL is 2.8x larger eventhough its p95 is lower because fewer than 5% of its tokens form an extreme directional-KL tail. JSD compresses that
tail: GLM's mean JSD (
0.00552) is only 14% above Mistral4 (0.00483), while GLM's p95 JSD (0.0103) is lowerthan Mistral4 (
0.0181). This demonstrates KL's greater sensitivity to rare, severe probability differences; it doesnot by itself establish which result is a correctness bug.
Follow-up GLM diagnosis changes how its failed row should be interpreted:
0.018.Replacing only the catastrophic tail with that floor predicts mean KL
0.0486, close to the trained-export result0.0568.sustained route bifurcations after export.
The GLM output divergence is therefore real and deterministic, but it is not evidence of checkpoint load/export
corruption. Small cross-kernel numerical differences are amplified by near-tied MoE routing over a long sequence.
Independent GLM model-semantics discrepancies still warrant focused fixes, but controlled variants show that those
fixes alone do not remove the long-sequence routed tail.
Neither KL nor JSD can distinguish checkpoint corruption, wrong model math, and sensitive numerical routing without
state, component, and router diagnostics. Directional KL assigns more weight to rare severe probability changes; JSD
is symmetric and bounded, making its scale easier to interpret while saturating the most divergent tokens. Mean and
p95 aggregation determine how much of either distribution becomes gating evidence, while cosine guards overall logit
geometry.
For this PR, JSD therefore remains report-only. The existing mean/p95 KL and cosine gates remain unchanged, and max
JSD is not introduced as a universal gate. A follow-up harness change can retain the fixed 2,048-token forward for
diagnostics while using a shorter blocking cross-framework prefix for route-sensitive models and optionally reporting
top-k boundary margins and sustained router bifurcations.
Repeatability remains useful for separating nondeterminism from deterministic cross-implementation divergence, but it
does not identify the root cause by itself. Gemma4's original HF source is unstable (self-repeat KL
11.1 / 19.1 / 28.0and JSD0.621 / 0.693 / 0.693), whereas GLM's fixed-shape self-repeats are exact.Scoped pipelines: Qwen3 MoE,
Mistral4,
LLM cohort, and
VLM cohort.
The phase-specific Mistral4 profile confirmation is queued in
NeMo-CI 63966458.
Additional Information