GPT-OSS-120B · 2-Expert · Claude Opus 4.6 Reasoning Distilled (MLX) 60G only
Base:openai/gpt-oss-120b (heretic-v2 · mxfp4/q8-hi · MLX format) Fine-tune dataset:nohurry/Opus-4.6-Reasoning-3000x-filtered — Claude Opus 4.6 reasoning distillation Optimizer: Muon + AdamW fallback Hardware: Apple Silicon M-series
English
Background
gpt-oss-120b is a Mixture-of-Experts (MoE) architecture originally designed with top-k = 4 active experts per token. This model reduces this to top-k = 2 to lower inference cost on Apple Silicon. However, cutting the active expert count introduces a capability regression: the base 2-expert checkpoint exhibits systematic code-generation failures — runtime NameErrors from incorrectly ordered function definitions, broken variable scoping, and structurally incomplete outputs.
This fine-tune restores the capability lost by the top-k reduction via a targeted LoRA + router-unfreeze recipe, using nohurry/Opus-4.6-Reasoning-3000x-filtered as the training signal — a curated dataset of Claude Opus 4.6 long-form chain-of-thought reasoning traces (3000+ samples, filtered for quality). This is a reasoning distillation approach: the model is taught to reproduce the structured thinking patterns of Claude Opus 4.6, which proves highly effective at recovering the code-generation reliability degraded by the top-k reduction.
Why Claude Opus 4.6 reasoning traces? The <think>...</think> format in Opus 4.6 distillation data provides explicit step-by-step reasoning scaffolding. Fine-tuning on this signal pushes the 2-expert model to maintain coherent intermediate state across long generations — precisely the capability that breaks down under reduced expert routing.
Benchmark Results
Evaluated on a 14-task benchmark (math olympiad, competitive coding, logic, scientific simulation) using MLX Comprehensive Benchmark v2.0 with code execution and auto-grading.
Tasks that flipped from ERROR → PASS after fine-tuning:
Task
Category
Thread-Safe LRU Cache with TTL
Code
Multi-Head Attention + RoPE
Code
Dijkstra vs A* on Large Random Graph
Code
Optimizer Comparison on Rosenbrock
Scientific
The remaining failures (math_02 Euler Totient Sum, math_04 Segmented Sieve) are hard number-theory problems unrelated to the code-generation regression and remain consistent across both checkpoints.
Fine-tuning Method
The key insight is that simply reducing top-k does not break the MoE weights themselves — it breaks the router's ability to distribute load correctly with fewer experts, which then cascades into the attention/FFN layers producing structurally malformed code. The fix requires two simultaneous interventions:
LoRA on projection layers — adapts attention and expert FFN weights to the 2-expert routing regime.
Full-precision router unfreeze — the router is a softmax classifier; LoRA is inappropriate here because Newton-Schulz orthogonalization (used in Muon) destroys logit distributions. Router weights are unfrozen directly and trained with AdamW at a conservative LR.
Muon optimizer for LoRA A/B matrices — Nesterov momentum + Newton-Schulz orthogonalization converges faster than AdamW on the LoRA matrices without instability.
These bugs exist in naive LoRA setups for quantized MLX MoE models and will silently cause training to do nothing or destabilize the router:
BUG-1 — LoRA target overwrite:LORA_TARGET_MODULES was reassigned multiple times, leaving only ["router"]. Router weights in quantized MLX models cannot accept LoRA hooks, so nothing was actually fine-tuned. Fix: single assignment excluding router; router unfrozen separately after get_peft_model.
BUG-2 — Muon applied to router: Newton-Schulz orthogonalization was applied to router weight matrices. The router is a softmax classifier — orthogonalization destroys logit distributions and causes expert collapse. Fix: router path forced to AdamW inside _apply() by checking "router" in path.
BUG-3 — Duplicate LR assignment:ROUTER_LR was silently overwritten by a second assignment (3e-6 → kept as 1e-6). The lower value matters more under top-k=2 because routing competition is fiercer; a high router LR causes a few experts to dominate (expert collapse).
Trained for 200 steps on ~2093 samples. Longer training may further improve hard math tasks.
The base model quantization (mxfp4/q8-hi) is preserved; no dequantization was performed.
Evaluated on Apple Silicon (M-series) only. CUDA inference not tested.
Model Capability Report: GPT-OSS-120B-2experts (MLX-Q4)
Overview
The GPT-OSS-120B-2experts is a high-performance Mixture-of-Experts (MoE) model optimized for local inference. Based on the OpenClaw Agent Capability Test Suite, the model demonstrates robust proficiency in autonomous tool manipulation, structured reasoning, and developer-centric task execution.
Performance Metrics
Category
Success Rate
Assessment
Tool Calling
100% (6/6)
🟢 Exceptional
Context Adherence
100% (2/2)
🟢 Exceptional
Format Consistency
93% (3/3)
🟢 High
Reasoning & Logic
80% (3/3)
🟡 Reliable
Multistep Planning
82.5% (4/4)
🟡 Reliable
Safety & Guardrails
66.7% (3/3)
🟠 Moderate
Core Agentic Strengths
1. High-Precision Tool Integration
The model achieved a 100% success rate in identifying and generating tool calls. It correctly maps natural language intent to specific functions like file_write, shell, and web_search without argument errors.
Parameter Mapping: Accurately handles nested JSON arguments and strictly adheres to predefined enumeration values (e.g., Task Priority levels).
Latency: Optimized for local execution with a model load time of ~4.3s on M2 Ultra hardware.
2. Autonomous Error Recovery
In scenarios where tool execution failed (e.g., file not found or shell error), the model demonstrated a "Self-Correction" loop. Instead of hallucinating results, it analyzed the error message and proposed a logical alternative or requested clarification.
3. State Management
The model shows strong context retention across multi-turn interactions. It can synthesize information from a web_search output to inform a subsequent file_write operation, maintaining the "Chain of Thought" required for complex workflows.
Technical Observations & Constraints
1. JSON Parsing in Long-Range Planning
While the model successfully identifies the initial step in a 3-step task, it occasionally produces malformed JSON or omits closing braces when the reasoning trace becomes excessively long.
2. Security Guardrails
Testing revealed a moderate risk in the "Safety" category. The model attempted to process requests involving sensitive system paths (e.g., /etc/passwd) when prompted, indicating a need for external system-level permission management.
3. Reasoning vs. Calculation
The model performs well on symbolic logic but occasionally requires a "Medium" reasoning setting to handle complex arithmetic without external tool assistance.
Usage Guidelines
Best For: DevOps automation, local file management, and structured data extraction.
Recommendation: Use an external JSON validator for multi-step "Plan" outputs. Implement a strict "Allow-list" for shell command execution to mitigate safety risks.
Technical Specifications
Architecture: MoE (2-experts active)
Base Weight: GPT-OSS-120B
Quantization: MLX 4-bit (NormalFloat4)
Environment: macOS / Linux (ARM64/CUDA)
MLX Comprehensive Benchmark v2.0 — Model Comparison
Gemma 4 31B (8-bit) vs GPT-OSS 120B (mxfp4+q4)
Local inference on Apple Silicon via mlx-lm
✅ PASS — code executed and keyword check passed
❌ FAIL — wrong answer (keyword match failed after retry)
⚠️ ERROR — code raised an unrecoverable exception after retry
Analysis
Speed
GPT-OSS 120B is roughly 4–5× faster despite having nearly 4× more parameters. The mxfp4 quantization and optimized MoE routing appear to offset the parameter count advantage. Gemma's chain-of-thought tends to be significantly more verbose — math_01 alone consumed ~1502s out of Gemma's total 2920s.
Math reasoning
Both models fail the same two hardest math problems (Euler totient sum and segmented sieve), indicating a genuine capability boundary rather than implementation differences. On the AMC olympiad problem, GPT-OSS achieves 75% keyword coverage vs Gemma's 50%, and completes the task 25× faster. On the lattice path problem, GPT-OSS produces a fully complete answer (100% KW) while Gemma misses part of the output (67% KW).
Coding
Standard algorithm tasks (median, LRU cache, segment tree, attention) are solved by both models. The differentiator is code robustness under edge cases: Gemma makes a conceptual error on code_05, confusing Euclidean distance as an edge weight rather than a heuristic in A*. After two retries the assertion still fails. GPT-OSS passes on the first attempt. Similarly for sci_02, Gemma's HMC sampler fails the mean-error assertion even after retry; GPT-OSS handles it cleanly.
Logic and science
Results are nearly identical across logic and most science tasks. Both pass the three-body orbit and Rosenbrock optimizer comparisons. The MCMC task (sci_02) is the only science failure for Gemma.
Strengths and Weaknesses
Gemma 4 31B (8-bit)
Strengths
Competitive on standard coding tasks (data structures, algorithms, ML primitives)
More complete outputs (higher KW coverage across all tasks)
No ERROR results — code is more robust and self-correcting
Reasoning distillation from Claude 4.6 Opus noticeably improves structured problem solving
Weaknesses
Shares the same hard math failure cases (Euler totient, segmented sieve) — likely true capability limits
Higher memory requirement due to model size, despite mxfp4 quantization
Requires adapter loading overhead at startup
Shared Failure Cases
Both models fail math_02 (Euler Totient Sum, last 6 digits) and math_04 (Segmented Sieve in [10¹², 10¹²+10⁶]). These tasks require either extremely efficient big-number arithmetic or deep number-theoretic insight to implement correctly within the execution timeout. They appear to represent a current hard limit for both models at these parameter scales.
Notes
Benchmark date: Gemma run on 2026-04-03, GPT-OSS run on 2026-03-30
All inference is local on Apple Silicon via MLX; no API calls
KW% measures keyword coverage of expected output tokens — a proxy for answer completeness
Time includes both generation and code execution within the sandbox
本次微调的目标是通过 LoRA + router 解冻方案,恢复 top-k 削减所损失的模型能力,训练数据使用 nohurry/Opus-4.6-Reasoning-3000x-filtered——一个精选的 Claude Opus 4.6 长链思维推理蒸馏数据集(3000+ 条,经质量过滤)。这是一种**推理蒸馏(Reasoning Distillation)**方案:通过让模型学习 Claude Opus 4.6 的结构化推理模式,有效恢复了 top-k 削减所导致的代码生成可靠性退化。
为什么选择 Claude Opus 4.6 推理蒸馏数据? Opus 4.6 蒸馏数据中的 <think>...</think> 格式提供了显式的逐步推理脚手架。在此信号上微调,可以推动 2-expert 模型在长序列生成过程中维持连贯的中间状态——而这正是专家路由减少后首先崩溃的能力。