{"record":{"id":"40b49d2cdad85df9","repo":"sgl-project/sglang","slug":"checkpoint-provides-gate-weight-name-r-but-the-m","errorCode":null,"errorMessage":"Checkpoint provides gate weight {name!r} but the model built no g_proj (gating is disabled in the config). Set gating to True, \"per-head\", or \"per-element\" to load this checkpoint.","messagePattern":"Checkpoint provides gate weight (.+?) but the model built no g_proj \\(gating is disabled in the config\\)\\. Set gating to True, \"per-head\", or \"per-element\" to load this checkpoint\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"critical","filePath":"python/sglang/srt/models/laguna.py","lineNumber":823,"sourceCode":"                param.weight_loader(\n                    param,\n                    loaded_weight,\n                    name,\n                    shard_id=shard_id,\n                    expert_id=expert_id,\n                )\n                if layer_id is not None:\n                    loaded_expert_shards.add((layer_id, expert_id, shard_id))\n                matched_expert = True\n                break\n            if matched_expert:\n                continue\n\n            if name.endswith(\".bias\") and name not in params_dict:\n                continue\n            if name not in params_dict:\n                if \".g_proj.\" in name:\n                    raise RuntimeError(\n                        f\"Checkpoint provides gate weight {name!r} but the model built no \"\n                        \"g_proj (gating is disabled in the config). Set gating to True, \"\n                        '\"per-head\", or \"per-element\" to load this checkpoint.'\n                    )\n                logger.warning(\"Parameter %s not found in params_dict\", name)\n                continue\n            param = params_dict[name]\n            weight_loader = getattr(param, \"weight_loader\", default_weight_loader)\n            weight_loader(param, loaded_weight)\n\n        # If any routed-expert tensor was silently dropped (e.g. a future\n        # checkpoint renaming `gate_proj`, or a ckpt-vs-mapping shape mismatch),\n        # fail loud here instead of generating garbage.\n        expected = {\n            (layer_id, expert_id, shard_id)\n            for layer_id in moe_layer_ids\n            for expert_id in range(self.config.num_experts)\n            for shard_id in (\"w1\", \"w2\", \"w3\")","sourceCodeStart":805,"sourceCodeEnd":841,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/models/laguna.py#L805-L841","documentation":"During weight loading, Laguna found a checkpoint tensor whose name contains .g_proj. but for which the built model has no parameter (laguna.py:823). The model was constructed with gating disabled, yet the checkpoint contains gate weights, so the load would silently drop them; the code raises to prevent a numerically-wrong model from serving.","triggerScenarios":"Loading a gated Laguna checkpoint into a runtime whose config disables gating (gating=False/None) while the safetensors contain g_proj weights.","commonSituations":"Mismatched config.json and weight files (config from a non-gated variant, weights from a gated one); hand-editing the gating config field.","solutions":["Set the model config's gating to True, \"per-head\", or \"per-element\" to match the checkpoint","Re-fetch the matching config.json that shipped with the weights","Alternatively strip g_proj tensors from the checkpoint (not recommended - changes model numerics)"],"exampleFix":"// before (config.json)\n\"gating\": false\n// after\n\"gating\": true","handlingStrategy":"validation","validationCode":"ckpt_names = list_checkpoint_keys(path)\nif any(\".g_proj.\" in n for n in ckpt_names):\n    assert cfg.gating in (True, \"per-head\", \"per-element\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pair a checkpoint with its original config.json","Treat gating mismatches as fatal, not skippable"],"tags":["laguna","weight-loading","config-mismatch","gating"],"backgroundTag":"checkpoint-config-mismatch","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}