{"record":{"id":"de4311f4857e275a","repo":"sgl-project/sglang","slug":"kimi-expert-pack-physical-role-order-is-unsupporte","errorCode":null,"errorMessage":"Kimi expert-pack physical role order is unsupported","messagePattern":"Kimi expert-pack physical role order is unsupported","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"critical","filePath":"python/sglang/srt/layers/moe/expert_pack.py","lineNumber":766,"sourceCode":"            int(model[\"num_experts_per_token\"]),\n        )\n        expected_dimensions = (expected_layers, expected_experts, expected_top_k)\n        if dimensions != expected_dimensions or expected_top_k != 16:\n            raise ValueError(\n                f\"Kimi expert-pack dimensions {dimensions} != {expected_dimensions}; \"\n                \"Top-K is immutable at 16\"\n            )\n        active_layers = tuple(int(value) for value in model[\"active_moe_layer_ids\"])\n        if active_layers != tuple(range(1, 93)):\n            raise ValueError(\"Kimi active routed MoE layers must be exactly 1..92\")\n\n        pack_manifest = self.manifest[\"expert_pack\"]\n        if Path(pack_manifest[\"path\"]).resolve() != self.path:\n            raise ValueError(\"Kimi manifest expert-pack path does not match pack_path\")\n        if int(pack_manifest[\"size\"]) != self.path.stat().st_size:\n            raise ValueError(\"Kimi expert-pack size does not match its manifest\")\n        if pack_manifest.get(\"physical_role_order\") != list(KIMI_PHYSICAL_ROLES):\n            raise ValueError(\"Kimi expert-pack physical role order is unsupported\")\n        roles = pack_manifest[\"roles\"]\n        expected_roles = {\n            \"up\": (\"Q2_K\", 10),\n            \"gate\": (\"Q2_K\", 10),\n            \"down\": (\"Q3_K\", 11),\n        }\n        for role, (dtype, dtype_id) in expected_roles.items():\n            if (\n                roles[role][\"dtype\"] != dtype\n                or int(roles[role][\"dtype_id\"]) != dtype_id\n            ):\n                raise ValueError(f\"Kimi expert-pack {role} quant type is unsupported\")\n\n        expected_entry_count = len(active_layers) * expected_experts * len(ROLE_NAMES)\n        index_digest = hashlib.sha256()\n        self.entries: dict[tuple[int, int, int], ExpertPackEntry] = {}\n        self.object_offsets: dict[tuple[int, int], int] = {}\n        object_payload_bytes = int(pack_manifest[\"object_bytes\"])","sourceCodeStart":748,"sourceCodeEnd":784,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/layers/moe/expert_pack.py#L748-L784","documentation":"The manifest's expert_pack.physical_role_order does not equal the fixed KIMI_PHYSICAL_ROLES tuple. The pack format stores each expert's up/gate/down tensors in a fixed physical order, and the loader only implements that one layout.","triggerScenarios":"A pack written with a different physical tensor ordering (e.g. down, gate, up), or a manifest hand-edited or produced by a third-party quantizer that permutes roles.","commonSituations":"See trigger scenarios.","solutions":["Re-pack the weights using the official packing tool so physical_role_order equals list(KIMI_PHYSICAL_ROLES)","Inspect KIMI_PHYSICAL_ROLES in expert_pack.py and compare with your manifest to see the expected order"],"exampleFix":"// before\n\"physical_role_order\": [\"down\",\"gate\",\"up\"]\n// after\n\"physical_role_order\": list(KIMI_PHYSICAL_ROLES)","handlingStrategy":"validation","validationCode":"from sglang.srt.layers.moe.expert_pack import KIMI_PHYSICAL_ROLES\nassert manifest['expert_pack']['physical_role_order'] == list(KIMI_PHYSICAL_ROLES)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only use packs from the official packer","Never hand-edit physical_role_order"],"tags":["kimi","moe","expert-pack","role-order"],"backgroundTag":"unsupported-layout-configuration","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}