Skip to content

feat(gpt-oss): expert offloading Phase 1 — per-expert identity for packed MXFP4 tensors - #151

Merged
drunkcoding merged 7 commits into
devfrom
feat/gpt-oss-offload-phase1
Aug 14, 2026
Merged

feat(gpt-oss): expert offloading Phase 1 — per-expert identity for packed MXFP4 tensors#151
drunkcoding merged 7 commits into
devfrom
feat/gpt-oss-offload-phase1

Conversation

@drunkcoding

Copy link
Copy Markdown
Contributor

Implements Phase 1 of RFC #137 (gpt-oss expert offloading). Stacked on #136 (resident-correctness prerequisite).

Changes:

  • parse_expert_id (hf_config.py) now yields (layer_id, expert_idx) for gpt_oss packed keys
  • register-expert loop splits the packed [E,...] tensors into 128 per-expert contiguous views/layer (no copy) and populates expert_tensor_map; drops the model_type != "gpt_oss" exclusion
  • resident path (_load_resident_gpt_oss) unchanged; dispatch wiring is Phase 3

Tests: new tests/test_gpt_oss_offload_topology.py — Phase 1 suite 14 passed, ruff + LSP clean.

Part of plan docs/superpowers/plans/2026-08-14-gpt-oss-expert-offloading.md. Phase 2 (MXFP4 dequant-on-copy) in progress on a stacked branch.

drunkcoding and others added 5 commits August 6, 2026 14:33
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>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
@drunkcoding
drunkcoding changed the base branch from fix/gpt-oss-resident-experts to dev August 14, 2026 19:35
drunkcoding added 2 commits August 14, 2026 19:43
@drunkcoding
drunkcoding merged commit 921180f into dev Aug 14, 2026
8 checks passed
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