{"record":{"id":"44ee100a3e68b53c","repo":"sgl-project/sglang","slug":"h3-conditioning-projection-mlp-outputs-width-laye","errorCode":null,"errorMessage":"H3 conditioning projection MLP outputs width {layer_input_dim}, expected {self.output_dim}","messagePattern":"H3 conditioning projection MLP outputs width (.+?), expected (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"critical","filePath":"python/sglang/multimodal_gen/runtime/models/encoders/minimax_h3_qwen3vl.py","lineNumber":154,"sourceCode":"                    f\"H3 conditioning projection {weight_name} cannot follow \"\n                    f\"width {layer_input_dim}: got {tuple(weight.shape)}\"\n                )\n            if bias is not None and tuple(bias.shape) != (int(weight.shape[0]),):\n                raise ValueError(\n                    f\"H3 conditioning projection {bias_name} has shape \"\n                    f\"{tuple(bias.shape)}, expected ({int(weight.shape[0])},)\"\n                )\n            layers.append(_FrozenLinear(weight, bias))\n            layer_input_dim = int(weight.shape[0])\n        if tensors:\n            raise ValueError(\n                \"H3 conditioning projection contains unsupported tensors: \"\n                f\"{sorted(tensors)}\"\n            )\n        if self.weight is None and not layers:\n            raise ValueError(\"H3 conditioning projection has neither W nor an MLP\")\n        if layers and layer_input_dim != self.output_dim:\n            raise ValueError(\n                f\"H3 conditioning projection MLP outputs width {layer_input_dim}, \"\n                f\"expected {self.output_dim}\"\n            )\n        if self.weight is not None and tuple(self.weight.shape) != (\n            self.input_dim,\n            self.output_dim,\n        ):\n            raise ValueError(\n                \"H3 conditioning projection W has shape \"\n                f\"{tuple(self.weight.shape)}, expected \"\n                f\"({self.input_dim}, {self.output_dim})\"\n            )\n        self.layers = nn.ModuleList(layers)\n\n    def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:\n        if int(hidden_states.shape[-1]) != self.input_dim:\n            raise ValueError(\n                f\"H3 conditioning projection expects width {self.input_dim}, \"","sourceCodeStart":136,"sourceCodeEnd":172,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/models/encoders/minimax_h3_qwen3vl.py#L136-L172","documentation":"An MLP chain was recognized in the conditioning projection tensors, but its final layer's output width (layer_input_dim after consuming all layers) does not equal the module's declared output_dim. The projected conditioning signal would then be the wrong width for the downstream model.","triggerScenarios":"Constructing MiniMaxH3ConditioningProjection where the last MLP weight's shape[0] != output_dim, e.g. passing a projection for a different model's hidden size.","commonSituations":"Mixing projection checkpoints across MiniMax H3 model sizes (e.g. 4096 vs 5120 hidden dims), or mis-specifying output_dim when the checkpoint defines it implicitly.","solutions":["Check the last MLP weight's shape[0] and compare with the expected output width (MINIMAX_H3_QWEN3VL_HIDDEN_DIM)","Use the projection checkpoint matching the target model's hidden size"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"out_w = [v for k, v in sd.items() if \"weight\" in k][-1]\nassert int(out_w.shape[0]) == expected_output_dim","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Match projection checkpoints to the target model's hidden size","Automate a shape smoke-test in CI for each model/projection pairing"],"tags":["minimax-h3","conditioning-projection","shape-mismatch","width-mismatch"],"backgroundTag":"weight-shape-mismatch","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}