File size: 12,320 Bytes
48d8650
0d94125
 
 
 
 
 
 
 
 
 
 
45d8764
 
0d94125
 
 
 
 
45d8764
 
 
0fc5a98
0d94125
48d8650
0d94125
 
 
 
 
45d8764
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4fc37ea
 
 
 
 
 
 
 
 
 
 
 
 
 
45d8764
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48d8650
0d94125
45d8764
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0d94125
45d8764
0d94125
45d8764
0d94125
45d8764
0d94125
45d8764
 
 
 
 
 
0d94125
45d8764
0d94125
95d7aaa
45d8764
 
 
 
 
 
73da5c4
 
 
 
 
45d8764
95d7aaa
 
45d8764
95d7aaa
 
45d8764
95d7aaa
45d8764
95d7aaa
45d8764
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
---
language:
  - en
  - zh
base_model:
  - Qwen/Qwen3.6-27B
tags:
  - gguf
  - llama.cpp
  - qwen
  - qwen3
  - qwen3.6
  - mtp
  - speculative-decoding
  - yarn
  - long-context
  - 1m-context
  - imatrix
  - quantized
  - distillation
  - agent
  - react
  - 1M-context
pipeline_tag: text-generation
license: apache-2.0
library_name: gguf
inference:
  parameters:
    temperature: 0.6
    top_p: 0.95
model-index:
  - name: Opus-DeepSeek-Distilled-Q4M
    results:
      - task:
          type: text-generation
        dataset:
          type: benchlocal
          name: BenchLocal 6-pack
        metrics:
          - type: benchlocal-score
            value: 86.5
            name: 6-pack Total
      - task:
          type: question-answering
        dataset:
          type: gpqa
          name: GPQA-Diamond-198
        metrics:
          - type: accuracy
            value: 83.84
            name: Accuracy
      - task:
          type: question-answering
        dataset:
          type: mmlu
          name: MMLU-500 (5-shot)
        metrics:
          - type: accuracy
            value: 91.80
            name: Accuracy
---

# 🧠 Qwen3.6-27B-Claude-Opus-DeepSeek-Distilled β€” YaRN 1M Context

> A distilled Qwen3.6-27B GGUF with **YaRN 4Γ— context extension** to 1,048,576 tokens, optimized for local agentic reasoning, tool use, and long-chain task execution.

[![BenchLocal](https://img.shields.io/badge/BenchLocal-86.5-8A2BE2)](https://github.com/brianyin/BenchLocal)
[![GPQA](https://img.shields.io/badge/GPQA--Diamond--198-83.84%25-blue)](https://github.com/brianyin/BenchLocal)
[![MMLU](https://img.shields.io/badge/MMLU--500-91.80%25-green)](https://github.com/brianyin/BenchLocal)
[![License](https://img.shields.io/badge/License-Apache--2.0-orange)](https://www.apache.org/licenses/LICENSE-2.0)
[![GGUF](https://img.shields.io/badge/Format-GGUF-ff69b4)](https://github.com/ggml-org/llama.cpp)
[![Context](https://img.shields.io/badge/Context-1M-8A2BE2)](https://arxiv.org/abs/2305.13298)

---

## ⚠️ Sampling Parameters

> **Please ensure `temperature = 0.6` and `top_p = 0.95` when using this model.**
>
> This model was trained and validated at these specific parameters. Both too high and too low temperatures cause problems:
>
> πŸ”₯ **Too high (> 0.6)** β†’ Output becomes divergent as token probabilities flatten. This causes malformed tool calls, function name hallucinations, unstable parameter generation, and uncontrollable agent behavior.
>
> 🧊 **Too low (< 0.3)** β†’ The model almost always picks the highest-probability token. In tool-calling scenarios this manifests as: repeating the same failed tool call instead of trying alternatives, shortened thinking traces leading to insufficient reasoning depth, and reduced robustness to edge cases.
>
> This is an **important recommendation** based on extensive real-world testing. Please verify these parameters in your inference framework.

---

## πŸ“’ Highlights

| Area | Score | vs Qwen3.6-27B q4_k_m |
|------|-------|----------------------|
| **BenchLocal 6-pack** πŸ† | **86.5** | **+8.3** |
| **GPQA-Diamond-198** πŸ”¬ | **83.84%** | +10.14% |
| **BugFind-15** πŸ› | **80** | **+20** |
| **ToolCall-15** πŸ”§ | **97** | +4 |
| **InstructFollow-15** πŸ“‹ | **94** | **+17** |
| **StructOutput-15** πŸ“Š | **88** | **+11** |
| **MMLU-500 (5-shot)** πŸ“š | **91.80%** | ~tied (+0.2%) |
| **DataExtract-15** πŸ“„ | 81 | -2 |
| **Context window** πŸ›οΈ | **1,048,576** | **4Γ—** (262K β†’ 1M) |

> πŸš€ **Output speed**: `~60 tok/s` on A100 40GB Β· `~100 tok/s` on RTX PRO 6000 (q4_k_m + mtp=3)

---

## πŸ”₯ Why This Model?

The original `Qwen3.6-27B` has solid foundational capabilities, but its **agent behavior falls short** β€” prone to infinite loops when thinking, lacks structured agent design, and has room to improve in math reasoning.

This variant tackles all three through targeted distillation:

1. βœ… **Infinite loops β†’ Eliminated.** ReAct-style reasoning-action orchestration fixes the root cause.
2. βœ… **Agent behavior β†’ Structured.** Distilled Claude Opus's systematic thinking and organization.
3. βœ… **Math reasoning β†’ Strengthened.** Absorbed capabilities from strong math/logic models.

**Additionally**, all quantized variants in this repo include **YaRN 4Γ— context extension** (native 262K β†’ 1,048,576 tokens), enabling processing of book-length documents, long codebases, and extended multi-turn conversations.

The result is a local agent that doesn't just score high on benchmarks β€” it *works* reliably in real engineering tasks like BugFind, and now handles **1 million tokens of context**.

> ⚠️ **Note**: Side-by-side GLM5.2 comparisons were evaluated using Opus 4.8 as a judge. Opus-as-judge has inherent biases β€” results are indicative, not definitive.

---

## 🎯 Design Philosophy

**Core insight**: `Qwen3.6-27B` doesn't lack capability β€” it lacks *good agent behavior*. That makes it worth iterating on.

We followed the **[ReAct](https://arxiv.org/abs/2210.03629)** paradigm (Yao et al., ICLR 2023) β€” unifying reasoning and action into an alternating, constrained, executable loop β€” rather than just making the model "think longer" or "call tools better."

| Teacher Model | Capability Distilled |
|---------------|---------------------|
| **Claude Opus** 🎯 | Systematic thinking, structured organization, concise reasoning |
| **DeepSeek** 🧭 | Stable agent behavior, tool orchestration, task closure |
| **Math/Logic models** βž— | Mathematical reasoning, logical deduction |

### Context Extension

The 1M context window is achieved via **YaRN (Yet another RoPE extensioN)** method ([Peng et al., 2023](https://arxiv.org/abs/2305.13298)), a state-of-the-art approach for extending LLM context windows without fine-tuning. YaRN adjusts the rotary position encoding (RoPE) by interpolating frequencies and applying a neural tangent kernel (NTK)-aware scaling, enabling **4Γ— extension** from the native 262K to 1,048,576 tokens while preserving the model's existing capabilities.

---

## πŸ“Š Performance

### BenchLocal 6-pack

| Pack | `q4_k_m` (ours) | `Qwen/Qwen3.6-27B q4_k_m` | Delta |
|------|:-:|:-:|:-:|
| **BugFind-15** πŸ› | **80** | 60 | **+20** |
| **ToolCall-15** πŸ”§ | **97** | 93 | +4 |
| **DataExtract-15** πŸ“„ | 81 | **83** | -2 |
| **InstructFollow-15** πŸ“‹ | **94** | 77 | **+17** |
| **ReasonMath-15** βž— | 79 | 79 | 0 |
| **StructOutput-15** πŸ“Š | **88** | 77 | **+11** |
| **Total** πŸ† | **86.5** | 78.2 | **+8.3** |

### Extended Evals

| Benchmark | Ours | Baseline | Notes |
|-----------|:----:|:--------:|-------|
| **GPQA-Diamond-198** πŸ”¬ | **83.84%** | 73.7% | +10.14%, all 198 graded locally |
| **MMLU-500 (5-shot)** πŸ“š | **91.80%** | 91.6% | Approximately tied |

---

## πŸ“¦ Files

All GGUFs include YaRN 1M context scaling baked into the metadata β€” no extra flags needed.

| File | Size | Quant |
|------|:----:|:-----:|
| `...GGUF-Q2_K-YaRN-1M.gguf` | 11 GB | Q2_K (imatrix) |
| `...GGUF-Q3_K_M-YaRN-1M.gguf` | 13 GB | Q3_K_M (imatrix) |
| `...GGUF-Q4_K_M-YaRN-1M.gguf` | 16 GB | Q4_K_M (imatrix) |
| `...GGUF-Q5_K_M-YaRN-1M.gguf` | 19 GB | Q5_K_M (imatrix) |
| `...GGUF-Q6_K-YaRN-1M.gguf` | 21 GB | Q6_K (imatrix) |

### YaRN Parameters Embedded

| Parameter | Value |
|-----------|:-----:|
| `rope.scaling.type` | `yarn` |
| `rope.scaling.factor` | `4.0` |
| `rope.scaling.original_context_length` | `262144` |
| `rope.scaling.yarn_ext_factor` | `1.0` |
| `rope.scaling.yarn_attn_factor` | `1.0` |
| `rope.scaling.yarn_beta_fast` | `32.0` |
| `rope.scaling.yarn_beta_slow` | `1.0` |
| `context_length` | `1048576` |

---

## πŸ› οΈ Usage

### Recommended Stack

```
🧩 OpenCode + LM Studio / llama.cpp
πŸ“ Temperature: 0.6 Β· Top-p: 0.95
⚑ q4_k_m + mtp=3
🧠 Context: -c 1048576
```

### Quick Start (llama.cpp)

```bash
# Download (choose your quantization)
huggingface-cli download Brian6145/Qwen3.6-27B-Claude-Opus-DeepSeek-Distilled-Imatrix-MTP-1M-GGUF \
  <QUANT>-YaRN-1M.gguf --local-dir ./models

# Run with 1M context β€” YaRN params baked in
./llama-cli -m ./models/<QUANT>-YaRN-1M.gguf \
  --temp 0.6 --top-p 0.95 \
  -c 1048576 \
  -p "Your prompt here"

# Example with Q4_K_M:
./llama-cli -m ./models/Qwen3.6-27B-Claude-Opus-DeepSeek-Distilled-Imatrix-MTP-1M-GGUF-Q4_K_M-YaRN-1M.gguf \
  --temp 0.6 --top-p 0.95 \
  -c 1048576 \
  -p "Explain the entire codebase in this repository:"
```

> ⚠️ **1M context requires substantial memory.** At Q4_K_M, KV cache alone is ~15-20 GB. A100-80GB or equivalent recommended. For smaller GPUs, reduce `-c` to 128K or 256K.

### Via LM Studio

1. Load the GGUF file in LM Studio
2. Set backend to llama.cpp
3. Set context length to 1048576 (or your hardware limit)
4. Enable MTP (set depth=3) under inference options
5. Set `temperature = 0.6`, `top_p = 0.95`
6. Start the local API server
7. Connect via OpenCode or any OpenAI-compatible client

> πŸ’‘ **Pro tip**: For coding tasks, the `temp 0.6 / top_p 0.95` combo delivers the best balance of creativity and correctness.

---

## ⚠️ Known Limitations

### Evaluation Methodology
- **Opus-as-judge biases**: GLM5.2 comparisons are judge-evaluated, not absolute rankings
- **MMLU**: Single-run 5-shot result; variations in shot selection may cause fluctuation

### Capability Boundaries
- **DataExtract**: Scores 81 vs 83 baseline β€” extraction tasks may have slight regression from distillation
- **Closed-source teachers**: Risks include inherited biases and TOS compliance β€” assess for your use case
- **27B scale ceiling**: May still hit capacity limits on extremely complex long-chain reasoning

### Context Extension
- **YaRN is inference-only**: The 1M context window is achieved through RoPE scaling, not fine-tuning. Performance at extreme lengths may degrade gracefully rather than maintain full fidelity
- **Hardware requirements**: 1M KV cache at Q4_K_M requires ~15-20 GB VRAM just for the cache, plus ~16 GB for model weights. A100-80GB or multi-GPU setup recommended

### Deployment Notes
- **MTP=3**: Boosts throughput but adds VRAM overhead β€” disable or reduce on <24GB hardware
- **Imatrix**: Uses importance-matrix quantization, not standard k-quant β€” better parameter preservation at low bit widths
- **All quants included**: Unlike the base repo which only ships q4_k_m, this release includes Q2 through Q6 for flexibility

---

## πŸ”— YaRN: Yet another RoPE extensioN Method

This release uses **YaRN** ([Peng et al., 2023](https://arxiv.org/abs/2305.13298)) to extend the native 262K context window to 1M tokens. YaRN is a state-of-the-art context extension method that:

- **Preserves existing capabilities** β€” no fine-tuning needed, the model retains all original knowledge
- **Uses NTK-aware scaling** β€” better allocation of frequency dimensions than linear interpolation
- **Adds a temperature ramp** β€” smooth transition between trained and extrapolated positions
- **Achieves strong perplexity** β€” outperforms linear and NTK-aware scaling at extended contexts

The parameters are baked directly into each GGUF file's metadata β€” llama.cpp reads them automatically at load time.

---

## πŸ“ Citation

```bibtex
@article{peng2023yarn,
  title = {YaRN: Efficient Context Window Extension of Large Language Models},
  author = {Bowen Peng and Jeffrey Quesnelle and Honglu Fan and Enrico Shippole},
  journal = {arXiv preprint arXiv:2305.13298},
  year = {2023}
}

@misc{opus-deepseek-distilled-q4m,
  title = {Opus-DeepSeek-Distilled-Q4M: A Distilled Agentic GGUF for Local Deployment},
  author = {Yin, Brian and BenchLocal Contributors},
  year = {2026},
  url = {https://github.com/brianyin/BenchLocal}
}
```

---

## πŸ™ Acknowledgements

- **[Qwen](https://github.com/QwenLM/Qwen)** team β€” excellent foundational model
- **[Unsloth](https://github.com/unslothai/unsloth)** β€” efficient training infrastructure
- **[Merkyor](https://github.com/Merkyor)** β€” identified ReAct as the key to solving agent infinite loops
- **Community** β€” built on existing open-source exploration and practical experience

> *It is because of this work that came before that we can continue pushing forward, arriving at today's more stable, more practical, and more complete agent β€” and helping us get closer to the era of local agent AI.*