fix(gpt-oss): resident-load MXFP4 experts, biases, sinks & router - #136
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_PackedExpertsparams, leaving them as[1]zero placeholders: expert weights = zeros, biases = NaN,self_attn.sinksandrouter= 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_mxfp4applied an erroneous.t()that did not match the checkpoint's MXFP4 packed layout.Fix
_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}, andself_attn.sinksinto the live params on device, mark them resident, and drop them fromname_id_map..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)
Fixes GPT-OSS base-model correctness; also unblocks native DFlash (#135).