CoolFace
Modelpublic

samuelcardillo/Qwen3-Coder-Next-Opus-4.6-Reasoning-Distilled

sourceHugging Faceapache-2.0updated 6mo agoView on Hugging Face
12likes92downloads
Model Card

Qwen3-Coder-Next — Opus 4.6 Reasoning Distilled (Full Fine-Tune)

Full parameter fine-tune of Qwen/Qwen3-Coder-Next (~80B total / ~3B active, MoE) with Claude Opus 4.6 reasoning distillation. Trained on 8x NVIDIA H100 80GB SXM with DeepSpeed ZeRO-3.

Model Details

PropertyValue
Base ModelQwen/Qwen3-Coder-Next
Architectureqwen3_next (Mixture of Experts)
Total Parameters~80B
Active Parameters~3B per token (10 of 512 experts)
Expert Config512 experts, 10 active per token, intermediate=512
Shared ExpertYes (intermediate=512)
AttentionHybrid: linear attention + full attention every 4th layer
Hidden Size2048
Layers48
Attention Heads16 (2 KV heads, GQA)
Intermediate Size5120
Vocab Size151,936
Max Context262,144 tokens (256K)
RoPEPartial rotary (0.25), theta=5M
PrecisionBF16

Benchmark Results

Evaluated by Claude Opus 4.6 across 26 tests in 6 categories, scored 1-10 on correctness, completeness, clarity, and adherence to instructions.

CategoryBase ModelOpus DistilledWinnerDelta
Coding8.28.5Opus Distilled+0.3
Bug Detection8.49.0Opus Distilled+0.6
Probability8.68.0Base-0.6
Tool Calling3.47.2Opus Distilled+3.8
Logic8.57.5Base-1.0
Instruction Following7.77.0Base-0.7
Overall7.357.73Opus Distilled+0.38

Detailed Test Results

Coding (6 tests)
TestBaseOpusWinnerNotes
Python: Trie Implementation99TieBoth correct and complete
Python: Async Web Scraper89OpusOpus uses cleaner class-based design with semaphore rate limiting
Rust: Custom Iterator89OpusOpus adds idiomatic impl Iterator<Item = u64> convenience function
TypeScript: Event Emitter88TieBoth implement type-safe emitters with different valid approaches
SQL: Complex Query78OpusBase has a bug: references window function in WHERE of same SELECT
Python: Graph BFS/DFS98BaseBase covers more methods within token budget
Bug Detection (5 tests)
TestBaseOpusWinnerNotes
Off-by-one in binary search99TieBoth find all 4 bugs
Race condition in Go89OpusOpus adds deadlock diagram + 3 solutions vs 2
Memory leak in C++99TieBoth identify Rule of Three/Five violations
Security bugs in JavaScript89OpusOpus adds severity table, catches JWT forgery and missing rate limiting
Deadlock in Python threading89OpusOpus provides step-by-step timeline diagram + Coffman conditions
Probability (5 tests)
TestBaseOpusWinnerNotes
Bayes' Theorem99TieBoth correct (~1.94%)
Birthday Problem Variant98BaseBase more mathematically rigorous
Monty Hall Extended99TieBoth correctly derive P(switch)=2/5
Markov Chain86BaseOpus made computation error, had to restart
Combinatorics: Card Hands99TieBoth correct on completed sections
Tool Calling (5 tests) — Largest improvement
TestBaseOpusWinnerNotes
Weather API planning27OpusBase outputs single call (37 tokens). Opus chains all 3 tools.
Database CRUD operations38OpusBase: 1 tool call (119 tokens). Opus: complete 4-step workflow.
Multi-step file operations43BaseBoth perform poorly on this test
API orchestration27OpusBase outputs malformed tool call. Opus plans 3 clear steps.
Complex reasoning with tools67OpusBase batches lookups correctly but stops. Opus completes reasoning.
Logic (2 tests)
TestBaseOpusWinnerNotes
Sudoku Solver Explanation98BaseBase explains constraint propagation more clearly within token budget
Einstein's Riddle87BaseBase makes more deduction progress within token budget
Instruction Following (3 tests)
TestBaseOpusWinnerNotes
Structured JSON output106BaseBase: clean JSON only (453 tokens). Opus: 2048 tokens, ignored "ONLY JSON" constraint
Code with exact constraints56OpusBoth struggle. Base self-corrects mid-response.
Multi-format output88TieBoth truncated, similar quality

Key Findings

  • —Tool Calling: Largest improvement (+3.8). Base model outputs only the first tool call and stops. Opus Distilled plans full multi-step tool chains with reasoning between steps.
  • —Bug Detection: Opus Distilled provides more structured analysis with severity tables, timeline diagrams, and catches more edge cases (+0.6).
  • —Coding: Opus Distilled favors class-based architectures with better design patterns. Caught a SQL bug (window function in WHERE clause) that Base missed.
  • —Probability: Base is more concise and made fewer computation errors. Opus Distilled made an error on a Markov Chain steady-state calculation.
  • —Logic: Base makes better progress within token budgets — Opus Distilled spends more tokens on preamble.
  • —Instruction Following: Base adheres more strictly to output format constraints (e.g., "output ONLY valid JSON").

Verdict

Opus-Distilled wins overall driven by massively better tool calling and slightly better bug detection and coding. Base wins on math/probability (fewer errors), logic (better token efficiency), and instruction following (better constraint adherence). For coding assistant use cases where tool calling matters, Opus-Distilled is clearly superior.

Performance

Both models run at comparable speeds on RTX PRO 6000 Blackwell (96GB):

MetricBaseOpus Distilled
Tokens/sec100.5102.5
Avg response length1,085 tokens1,464 tokens

Training Details

Hardware & Infrastructure

  • —GPUs: 8x NVIDIA H100 80GB SXM with NVLink
  • —System RAM: 2 TB DDR5
  • —Distribution: DeepSpeed ZeRO-3 (parameters sharded across all 8 GPUs)
  • —Optimizer Offload: AdamW optimizer states offloaded to CPU RAM (~700GB)
  • —Platform: RunPod

Hyperparameters

ParameterValue
MethodFull fine-tune (all parameters)
FrameworkHuggingFace TRL 1.0.0 + DeepSpeed 0.18.9
Transformers5.4.0
OptimizerAdamW (CPU offloaded via DeepSpeed ZeRO-3)
Learning Rate2e-5 (cosine schedule)
Warmup5% of steps
Weight Decay0.01
Gradient Clipping1.0
Epochs3
Effective Batch Size32 (1 per GPU x 4 grad accum x 8 GPUs)
Max Sequence Length8192 (training context window)
Gradient CheckpointingEnabled (non-reentrant)
PrecisionBF16
Total Steps303
Seed42

Training Progression

MetricStep 1Step 50Step 114Step 150Step 214Step 303 (Final)
Loss0.8700.4980.2440.2100.1150.062
Token Accuracy78.0%84.4%91.5%93.5%96.5%98.1%
Learning Rate01.94e-51.51e-51.29e-54.66e-65.99e-10
Epoch0.010.501.111.332.103.00

Datasets

3,204 examples after quality filtering (required <think> tags and >200 characters of assistant content):

DatasetExamplesDescription
nohurry/Opus-4.6-Reasoning-3000x-filtered2,321Claude Opus 4.6 reasoning traces (thinking + solution)
TeichAI/claude-4.5-opus-high-reasoning-250x250High-quality Claude reasoning conversations
Jackrong/Qwen3.5-reasoning-700x633Qwen reasoning conversations

Data Format

Each training example follows this structure:

<|im_start|>user
{problem}<|im_end|>
<|im_start|>assistant
<think>
{chain-of-thought reasoning}
</think>

{final answer}<|im_end|>

Quality Filter

Examples were filtered to require:

  1. 1.At least one assistant message containing <think> tags
  2. 2.Assistant content longer than 200 characters

This removed low-quality or non-reasoning examples from the combined dataset.

Reasoning Format

The model produces reasoning inside <think>...</think> tags:

<think>
Let me analyze this step by step...
1. First consideration
2. Second consideration
3. Conclusion
</think>

Here is the final answer based on my analysis.

When serving with llama.cpp, use --reasoning-format deepseek with a thinking-aware chat template to separate reasoning from visible output.

GGUF Quantizations

See samuelcardillo/Qwen3-Coder-Next-Opus-4.6-Reasoning-Distilled-GGUF for quantized GGUF versions (Q4KM, Q6K, Q80, BF16).

Usage

python
from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained(
    "samuelcardillo/Qwen3-Coder-Next-Opus-4.6-Reasoning-Distilled",
    torch_dtype="bfloat16",
    trust_remote_code=True,
)
tokenizer = AutoTokenizer.from_pretrained(
    "samuelcardillo/Qwen3-Coder-Next-Opus-4.6-Reasoning-Distilled",
    trust_remote_code=True,
)

messages = [{"role": "user", "content": "Implement a thread-safe LRU cache in Python"}]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(text, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=2048, temperature=0.6)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))