Skip to content

[Refactor] Add opt-in loader-side weight completeness verification - #28962

Closed
EazyReal wants to merge 1 commit into
sgl-project:mainfrom
EazyReal:vmax/loader-weight-completeness
Closed

EazyReal wants to merge 1 commit into
sgl-project:mainfrom
EazyReal:vmax/loader-weight-completeness

Conversation

@EazyReal

@EazyReal EazyReal commented Jun 22, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

Some model load_weights methods both copy tensors and check full-checkpoint completeness. Partial update paths call the same methods with only a slice of tensors, so the completeness check belongs in the full-checkpoint loader path instead.

Changes

  • Add _load_and_verify_weights for full checkpoint load paths.
  • Add unloaded_required_params for required-minus-loaded set computation.
  • Gate verification behind verify_weights_on_load.

No model opts in here, so this PR is behavior-preserving. Model migrations can land separately after RFC #28585 is accepted.

Verification

  • Added test/registered/unit/model_loader/test_load_and_verify_weights.py.
  • Ran git diff --check, py_compile on touched files, and focused Ruff checks for the new helper/test.

Full final-state implementation for context: #29323.


CI States

Latest PR Test (Base): ❌ Run #28888248116
Latest PR Test (Extra): ❌ Run #28888247861

@EazyReal
EazyReal requested a review from b8zhong as a code owner June 22, 2026 21:08
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@EazyReal
EazyReal force-pushed the vmax/loader-weight-completeness branch from ad065c7 to fcd62fb Compare June 25, 2026 18:09
@EazyReal EazyReal changed the title [Refactor] Move checkpoint-completeness check into the loader (dormant mechanism) [Refactor] Add dormant loader-side checkpoint-completeness verifier Jun 25, 2026
@EazyReal EazyReal changed the title [Refactor] Add dormant loader-side checkpoint-completeness verifier [Refactor] Add opt-in loader-side weight completeness verification Jun 25, 2026
@EazyReal
EazyReal force-pushed the vmax/loader-weight-completeness branch from fcd62fb to 8fff69d Compare June 30, 2026 08:35
@EazyReal

EazyReal commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

@b8zhong could you take a look at this smaller loader-verification slice if you have bandwidth? It adds the opt-in full-checkpoint check without changing model behavior, so it can land ahead of the broader cleanup; a run-ci label would also help.

Separate "load the weights" from "verify the checkpoint was complete". A new
`_load_and_verify_weights` runs after a full load and fails fast on any required
parameter that was left uninitialized -- computed as pure set algebra
(`unloaded_required_params`), with legitimately-absent params (PP-distributed,
quant/kv scales, role-specific) excluded by an optional per-model
`is_optional_weight(name)` predicate.

Gated by a per-model `verify_weights_on_load` flag (default off): no model opts in
here, so this is dormant -- zero behavior change. It is the mechanism for moving the
"weights are not initialized from checkpoints" diagnostic out of individual models'
`load_weights` (where it false-positives when the online/RL weight-update path reuses
`load_weights` with partial tensor slices) and into the loader, which runs it only on
full checkpoint loads. See RFC sgl-project#28585.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@EazyReal
EazyReal force-pushed the vmax/loader-weight-completeness branch from 8fff69d to 51aac28 Compare July 7, 2026 18:10
@github-actions

Copy link
Copy Markdown
Contributor

Thanks @EazyReal. Closing this because you have 20 PRs open and none updated in 7 days, over our soft cap of 5 for idle PRs.

Reopen the two or three you most want reviewed - a short active set moves faster than a long idle one.

Some directories moved recently, so an older branch may need retargeting:
sgl-kernel/ -> python/sglang/kernels/aot/, python/sglang/jit_kernel/
-> python/sglang/kernels/jit/, docs/ -> docs/docs/ (.mdx),
bench_serving.py -> benchmark/serving.py, test/srt/ -> test/registered/.

@github-actions github-actions Bot closed this Sep 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant