[GLM 5.3 Tests] Check trainer/inference LoRA logprob agreement - #2182
[GLM 5.3 Tests] Check trainer/inference LoRA logprob agreement#2182hershg wants to merge 12 commits into
Conversation
019e4bd to
147e2ff
Compare
|
Moved active review to hershg#2, which genuinely targets PR1’s branch and shows only the child diff. This closes the misleading combined-diff view, not the work. GitHub cannot target a contributor-fork branch from an upstream PR. After #2181 merges, rebase the child onto upstream main and reopen this PR for upstream landing. No code was merged; native GPU validation remains pending. |
Signed-off-by: Hersh Godse <hersh@trajectory.ai>
b10239a to
11b7005
Compare
Signed-off-by: Hersh Godse <hersh@trajectory.ai>
Signed-off-by: Hersh Godse <hersh@trajectory.ai>
There was a problem hiding this comment.
Code Review
This pull request introduces numerical checks and adapter-only perturbation utilities for GPU LoRA testing, along with standalone Megatron LoRA diagnostics and CPU tests. The reviewer's feedback provides valuable robustness improvements, including wrapping JSON serialization to prevent masking assertion errors, ensuring device alignment during log probability comparisons, generating random noise in float32 to avoid PyTorch compatibility issues on CPU, and casting response mask sums to long integers to prevent float-to-integer comparison issues.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
Reviewed by Cursor Bugbot for commit f9b1b1c. Configure here.
Signed-off-by: Hersh Godse <hersh@trajectory.ai>
Signed-off-by: Hersh Godse <hersh@trajectory.ai>
Signed-off-by: Hersh Godse <hersh@trajectory.ai>
Signed-off-by: Hersh Godse <hersh@trajectory.ai>
Signed-off-by: Hersh Godse <hersh@trajectory.ai>
Signed-off-by: Hersh Godse <hersh@trajectory.ai>
Signed-off-by: Hersh Godse <hersh@trajectory.ai>
j316chuck
left a comment
There was a problem hiding this comment.
Two remaining changes before this is a correctness check:
-
Add a localized-corruption regression and gate tail error. With 192 positions, set
zero/stale=-2.0,trainer_updated=-1.9everywhere, andupdated=trainer_updatedexcept one position at-10.9. Todaycheck_updated_adapter(report, 0.05)passes becausemean_abs=0.046875, despitemax_abs=9.0. Add this as a failing regression, then require an explicitmax_absbudget (for initial and updated parity) so one bad token cannot hide in the mean. -
Run publication through the public Tinker sync path. Make the live runner use
tinker.ServiceClient -> create_lora_training_client -> save_weights_and_get_sampling_client, apply a fixedforward_backward + optim_step, score the existing sampler while stale, then callsave_weights_and_get_sampling_clientagain and score the published model. Reuseskyrl/tinker/sdk_logprobs.py. The directbroadcast_to_inference_enginescall bypassesWorkerDispatch.save_weights_for_samplerbehavior such as adapter/model-id selection and weight-version/cache handling.
Already resolved on current head:
- The isolated pytest command now installs pytest with
--with pytest. - Native trainer and sampler paths reject NaN/Inf before inserting scores into the JSON receipt, with regression coverage for both.
j316chuck
left a comment
There was a problem hiding this comment.
Tentative approval based on a live Qwen/Qwen3.5-4B Megatron run against exact head 1e0eddb (TP4 trainer + 2xTP2 vLLM) through the public Tinker SDK path.
With one lr=1e-3 optimizer update, all 192 probe scores were finite: initial trainer/sampler mean_abs=0.01869, repeat and withheld-publication drift=0, stale mean_abs=1.099, and re-published mean_abs=0.00562. Image digest: sha256:fe8bc62b34b2cb28a5a42a39fa07cb6085e5fdd22dc658b2eb0004193f121de5; deployment XID: 1052900.
Caveat: a deliberately large 2x lr=1e-2 update exceeded the 0.05 absolute-parity budget (mean_abs=0.185, max_abs=1.172) despite cosine=0.99991. Please retain the max/tail-error follow-up; this approval is scoped to the realistic passing update path.

LoRA logprob agreement
Evidence
Columns A/B/C match the checks above. Each value is the mean absolute token-logprob difference between trainer and inference: A uses the zero-init trainer; B/C use the same updated trainer before/after sync. Update magnitude is fixed before the run; the runner does not use an optimizer.
GLM: 192 scored tokens; p99 diff 2.95165, max 5.83631. Inference base vs zero-init LoRA and each backend's repeat scores matched exactly. The unchanged retry completed scoring; the earlier collective timeout did not recur. The mismatch precedes the deliberate LoRA update, so this is not evidence of a weight-sync failure.
Testing / scope
CPU coverage: alignment, nonfinite scores, stale/wrong weights, insufficient updates, deterministic perturbation, cleanup. Qwen GPU evidence above. No batching, optimizer-stress or learning qualification; aggregate agreement does not prove every adapter target works.
Runner /
run(). Receipt revisions: Qwen8 and GLM1e0eddba; Qwen0.6e93939e9; held-outab5c8095. GLM retry:skyrl-glm53-pr2-sidecar-20260909-b, two B300 nodes, 2026-09-09.