sgl-project/sglang · critical · RuntimeError
Some parameters like {param_name_example} are not in the che
Error message
Some parameters like {param_name_example} are not in the checkpoint and will falsely use random initialization What it means
step3p5_mtp.load_weights verifies that every model parameter received checkpoint data; if any parameter was never loaded it raises RuntimeError instead of silently using random init (which would produce garbage draft predictions).
Source
Thrown at python/sglang/srt/models/step3p5_mtp.py:290
if "shared_head" in name:
name = name.replace("shared_head.output", "shared_head.head")
if "embed_tokens" in name:
assert (
hasattr(self.config, "num_nextn_predict_layers")
and self.config.num_nextn_predict_layers > 0
)
name = "model.embed_tokens.weight"
param = params_dict[name]
weight_loader = getattr(
param, "weight_loader", default_weight_loader
)
weight_loader(param, loaded_weight)
loaded_params.add(name)
params_need_to_load = set(params_dict.keys())
if params_need_to_load != loaded_params:
missing_params = list(params_need_to_load - loaded_params)
param_name_example = missing_params[0]
raise RuntimeError(
f"Some parameters like {param_name_example} are not in the checkpoint and will falsely use random initialization"
)
return loaded_params
def _rewrite_spec_layer_name(self, spec_layer: Optional[int], name: str) -> str:
"""
Rewrite the weight name to match the format of the original model.
Add .mtp_block for modules in transformer layer block for spec layer
"""
if spec_layer is None:
return name
# Some checkpoints place MTP weights under "model.layers.<id>.transformer.*".
# Our modules use "model.layers.<id>.*", so drop the ".transformer." segment.
transformer_prefix = f"model.layers.{spec_layer}.transformer."
if name.startswith(transformer_prefix):
name = name.replace(".transformer.", ".", 1)
View on GitHub (pinned to 0132848349)
Solutions
- Inspect missing_params (first name is in the message) and extend the name-rewriting/mapping logic
- Ensure the draft checkpoint includes all draft-model weights (embed/lm_head/shared towers)
- Verify the draft architecture (spec config) matches the checkpoint
Example fix
// before
params_need_to_load = set(params_dict.keys())
if params_need_to_load != loaded_params:
raise RuntimeError(...)
// after: allow intentionally-shared params to be resolved from the target model
shared = {n for n in params_need_to_load - loaded_params if 'lm_head' in n or 'embed' in n}
if params_need_to_load - loaded_params - shared:
raise RuntimeError(...) Defensive patterns
Strategy: validation
Validate before calling
model_keys = {n for n,_ in draft_model.named_parameters()}
ck_keys = {k for k,_ in iter_checkpoint(draft_weights)}
assert model_keys <= ck_keys, f"missing: {sorted(model_keys - ck_keys)[:5]}" Try / catch
try:
model.load_weights(w)
except RuntimeError as e:
if 'falsely use random initialization' in str(e):
log_missing_and_reexport_checkpoint()
raise Prevention
- Diff draft params vs checkpoint keys pre-load
- Include lm_head/embeddings in exported draft weights
- Test-load drafts in CI
When it happens
Trigger: Loading a draft checkpoint that is missing keys (e.g. shared/repacked embeddings, renamed head) so some parameter is never visited by the weight loop.
Common situations: Mismatched draft checkpoint format, missing lm_head in the draft file, renamed spec layer prefixes not covered by _rewrite_spec_layer_name.
Related errors
- Only 1 nextn layer is supported for Step3p5 checkpoints.
- expected q/k shape {expected_shape}
- expected v/g shape {expected_shape}
- expected beta shape {(1, T, H)}
- DSpARK KDA MTP requires a fixed 1 + num_spec dense tokens pe
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/53cc3c2b0b37eb43.
Report an issue: GitHub.