Skip to content

fix(gpt-oss): resident-load MXFP4 experts, biases, sinks & router - #136

Merged
drunkcoding merged 2 commits into
devfrom
fix/gpt-oss-resident-experts
Aug 10, 2026
Merged

fix(gpt-oss): resident-load MXFP4 experts, biases, sinks & router#136
drunkcoding merged 2 commits into
devfrom
fix/gpt-oss-resident-experts

Conversation

@drunkcoding

Copy link
Copy Markdown
Contributor

Problem

GPT-OSS base inference produces incoherent output on main/dev. The offload loader offloads the real expert weights into the Archer store but never materializes GPT-OSS's resident _PackedExperts params, leaving them as [1] zero placeholders: expert weights = zeros, biases = NaN, self_attn.sinks and router = garbage.

Root cause

GPT-OSS is intentionally excluded from the C++ expert dispatcher and runs a resident Python expert loop in SyncGptOssMLP.forward. Unlike shared experts, there was no resident-load pass for GPT-OSS, so the live params were never filled. Additionally, _expert_forward_mxfp4 applied an erroneous .t() that did not match the checkpoint's MXFP4 packed layout.

Fix

  • Add _load_resident_gpt_oss (mirrors _load_resident_shared_experts): load the real MXFP4 blocks/scales (uint8, output-major [E,N,K//2]/[E,N,K//32]), biases, router.{weight,bias}, and self_attn.sinks into the live params on device, mark them resident, and drop them from name_id_map.
  • Remove the erroneous .t() in _expert_forward_mxfp4 (checkpoint is already output-major [N, K//2]; verified rel-err 0.0 vs reference dequant).

Validation (real gpt-oss-120b, SM120)

  • Base output now coherent: "The capital of France is Paris." (clean EOS).
  • DFlash agreement 0.95 -> 1.00, mean acceptance 1.0 -> 6.57, ~21x decode speedup.
  • 103 DFlash unit tests pass; gpt-oss + mxfp4 unit tests pass; MXFP4 layout verified numerically (rel-err 0.0 gate_up, 0.003 down).

Fixes GPT-OSS base-model correctness; also unblocks native DFlash (#135).

GPT-OSS is excluded from the C++ expert dispatcher and runs a resident
Python expert loop in SyncGptOssMLP.forward, but the loader never
materialized the _PackedExperts params: expert weights stayed zeros,
biases NaN, attention sinks and router garbage, producing incoherent
output. Add _load_resident_gpt_oss to load the real MXFP4 blocks/scales
(uint8, output-major [E,N,K//2]/[E,N,K//32]), biases, router, and
self_attn.sinks into the live params and drop them from name_id_map.

Fix _expert_forward_mxfp4 to feed packed weights without the erroneous
.t() (checkpoint is already output-major; verified rel-err 0.0 vs
reference dequant on gate_up and down proj).

Real 120B: base output now coherent ('The capital of France is Paris.');
DFlash agreement 0.95->1.00, mean acceptance 1.0->6.57, ~21x decode
speedup. 103 dflash tests pass.
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant