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

  1. Inspect missing_params (first name is in the message) and extend the name-rewriting/mapping logic
  2. Ensure the draft checkpoint includes all draft-model weights (embed/lm_head/shared towers)
  3. 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

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


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/53cc3c2b0b37eb43. Report an issue: GitHub.