Qwen3.8-27B-pi-adapted-oQ4e-mtp

harness-hub/Qwen3.8-27B-pi-adapted (a LoRA trained with RL inside the pi coding agent) merged into Qwen/Qwen3.8-27B and quantized to oMLX's oQ4e format with the MTP head kept, for oMLX on Apple Silicon. 16.3 GiB on disk. The vision tower is included but was not tested.

On a 36 GB M3 Max under pi it solved 33/34 Aider polyglot Python exercises with thinking off in 41 minutes, against 27/34 in 74 minutes for Jundot/Qwen3.8-27B-oQ4e-mtp, at the same decode speed. Details, caveats and raw numbers are below.

How it was built

  1. Merge. Each LoRA pair (r=32, alpha=64, scale 2.0; q/k/v/o on the 16 full-attention layers and the MLP in all 64 layers, 256 pairs) was added to the BF16 weights as W + 2·B@A, computed in float32 and written as float16. Writing the merged tensors back as BF16 loses most of the adapter: its deltas are around 1e-4 against weights around 0.3, below BF16's resolution there, so only 65–82% of the delta survived (relative error 0.61–0.73). In float16 99.9–100% survived (relative error 0.10–0.16). The script is included as merge_lora.py.
  2. Quantize. oMLX 0.8.0's omlx.oq.quantize_oq_streaming(oq_level=4, enhanced=True, preserve_mtp=True), with an imatrix from its oqe_code_multilingual calibration set (quant.py). Base 4-bit affine, group size 64; 236 sensitive tensors at 5 bits, 4 at 6 and 6 at 8. About 35 minutes on the M3 Max.
  3. Checks. Spot-checked tensors the adapter does not touch are byte-identical to the base. The tokenizer, chat template and configs are the base model's; the adapter repo ships the same chat template and the same vocabulary, merges and special tokens.

Not oQh: the Splash engine (below) cannot read oQh weights.

Use with oMLX

Put the folder in ~/.omlx/models/ and restart oMLX. Fastest setup found, on oMLX 0.8.0 built --with-custom-kernel:

  • Engine: Splash 1.7.0 (brew install incoai/tap/splash), per-model setting external_engine: "splash", with the incoai/Qwen3.8-27B-DFlash2 draft in ~/.omlx/models/. Without Splash it runs on oMLX's own MTP speculative decoding.
  • Thinking off (chat_template_kwargs: {"enable_thinking": false}). The adapter was trained and evaluated with thinking off; see the medium-thinking row below for what thinking adds on hard tasks.
  • Sampling used in every run here: temperature 0.8, top_p 0.95, top_k 20.

A pi provider entry (~/.pi/agent/models.json). 64K context needs oMLX's sampling.max_context_window raised to 65536; Splash already reserves KV for ~86–94K tokens on this machine, so it costs no extra memory.

{
  "id": "Qwen3.8-27B-pi-adapted-oQ4e-mtp",
  "reasoning": true,
  "input": ["text", "image"],
  "contextWindow": 65536,
  "maxTokens": 8192,
  "samplingParams": { "temperature": 0.8, "top_p": 0.95, "top_k": 20 },
  "compat": {
    "thinkingFormat": "chat-template",
    "chatTemplateKwargs": { "enable_thinking": { "$var": "thinking.enabled" } },
    "supportsDeveloperRole": false,
    "maxTokensField": "max_tokens"
  }
}

Benchmarks

Hardware: MacBook Pro 14", M3 Max (30-core GPU, ~280 GB/s), 36 GB, on AC power. Software: oMLX 0.8.0 (custom kernels), Splash 1.7.0, pi 1.5.2. All builds were served the same way (Splash, same oMLX per-model settings, 32K context unless stated).

Agentic coding under pi

Aider polyglot Python, all 34 exercises (revision 7e0611e). Each exercise is copied into a fresh directory and given to vanilla pi (pi -p, isolated config, default tools) with the exercise instructions and this instruction:

Implement the solution in <stub>.py in the current directory. The tests are in <test>.py; run them with python -m pytest -q. Use only the Python standard library, keep the whole solution in <stub>.py without creating other modules, and do not modify the test files.

The stub file alone is then graded in an offline Docker container (python 3.12, pytest 8.3.5, --network none, read-only, original tests mounted read-only) against calibrated expected pass counts. 20-minute limit per exercise. One run per build.

Build (oQ4e-mtp and thinking off unless stated) Solved Wall time Tool calls Output tokens
This model 33/34 41 min 200 54k
Jundot/Qwen3.8-27B-oQ4e-mtp 27/34 74 min 570 99k
Qwen3.8-27B without the adapter, quantized the same way as this model 26/34 (1 timeout) 110 min 663 121k
Jundot/Qwen3.6-35B-A3B-oQ4e-mtp (a different, MoE model, for scale; its quant before the 2026-11-19 re-upload) 30/34 38 min 267 112k
Jundot/Qwen3.6-35B-A3B-oQ4e-mtp, its 2026-11-19 re-quant (other jobs were loading the CPU, so time is approximate) 31/34 42 min 298 107k
LiquidAI/LFM2.5-24B-A2B-MLX-4bit (always thinks; Liquid's sampling, 6144-token thinking budget) 10/34 164 min 303 505k

Paired against Jundot's build: this model solved 6 exercises Jundot's failed (bottle-song, forth, pov, sgf-parsing, transpose, zipper) and lost none (two-sided sign test p ≈ 0.03). On the 27 exercises both solved it used 143 tool calls to Jundot's 222. The plain base quantized with the same recipe did no better than Jundot's, so the gain comes from the adapter, not the quantization.

The stock Qwen3.6-35B-A3B decodes about 4× faster (~145 vs ~33 tok/s) but takes more steps, so it finished only 3 minutes sooner. It solved nothing this model missed and failed three it solves (connect, pov, sgf-parsing); both failed bowling with thinking off. Jundot's re-quant solved 31/34: bowling, which this model misses, but not book-store, pov or zebra-puzzle, which it solves. On the 30 exercises both solved it used 211 tool calls and 27 minutes to this model's 168 and 32.

On the 12 hardest exercises for the base model (book-store, bowling, connect, dominoes, hangman, paasio, poker, pov, scale-generator, sgf-parsing, transpose, two-bucket):

Build Thinking Solved Wall time Tool calls Output tokens
This model off 11/12 21 min 83 29k
This model medium (6144-token budget) 12/12 52 min 62 87k
Jundot/Qwen3.8-27B-oQ4e-mtp off 8/12 36 min 289 53k
Jundot/Qwen3.6-35B-A3B-oQ4e-mtp (from the 34-exercise run) off 8/12 30 min 128 70k
Base, same recipe off 6/12 65 min 413 73k
Unmerged adapter on llama.cpp (Q4_K_XL GGUF + F16 LoRA) off 12/12 85 min 80 n/a
Per-exercise results (tool calls in brackets)
Exercise This model Jundot oQ4e Base, same recipe
affine-cipher pass (3) pass (6) pass (3)
beer-song pass (3) pass (6) pass (3)
book-store pass (5) pass (5) timeout (17)
bottle-song pass (4) fail (72) pass (3)
bowling fail (7) fail (29) fail (11)
connect pass (3) pass (9) fail (61)
dominoes pass (7) pass (10) pass (8)
dot-dsl pass (4) pass (4) pass (9)
food-chain pass (5) pass (7) pass (7)
forth pass (10) fail (15) fail (43)
go-counting pass (5) pass (3) pass (4)
grade-school pass (3) pass (7) pass (4)
grep pass (11) pass (5) pass (7)
hangman pass (10) pass (7) pass (10)
list-ops pass (5) pass (7) pass (3)
paasio pass (4) pass (7) pass (10)
phone-number pass (9) pass (11) pass (4)
pig-latin pass (3) pass (6) pass (3)
poker pass (3) pass (6) fail (20)
pov pass (10) fail (27) fail (100)
proverb pass (4) pass (5) pass (3)
react pass (6) pass (13) fail (40)
rest-api pass (5) pass (5) pass (17)
robot-name pass (5) pass (5) pass (6)
scale-generator pass (10) pass (29) pass (50)
sgf-parsing pass (12) fail (93) pass (21)
simple-linked-list pass (5) pass (5) pass (7)
transpose pass (8) fail (59) fail (97)
tree-building pass (6) pass (7) pass (4)
two-bucket pass (4) pass (8) pass (8)
variable-length-quantity pass (5) pass (5) pass (7)
wordy pass (6) pass (9) pass (16)
zebra-puzzle pass (4) pass (25) pass (23)
zipper pass (6) fail (53) pass (34)

Speed

Runs interleaved with the control (control, this model, base, control, ...), Splash engine, thinking off. c1 decode is the median of 6 single-stream generations of 512 tokens on mixed prompts; speculative decoding makes it prompt-dependent (ranges in brackets).

Metric This model (2 runs) Jundot oQ4e (3 runs)
c1 decode, tok/s 32.2 [23–45], 32.6 [24–51] 44.1 [34–70], 34.2 [26–51], 32.4 [26–48]
4 concurrent, aggregate tok/s 59.5, 57.7 67.2, 58.4, 58.8
Prefill 4K, tok/s 256, 248 253, 248, 249
Prefill 16K, tok/s 237, 233 215, 232, 232
Time to first token, short prompt 337 ms, 328 ms 195, 309, 195 ms
Needle retrieval at ~24K tokens 3/3, 3/3 3/3 ×3

The first control run was faster than every later run of either build, so take decode as equal within noise. Thinking budgets of 512 and 2048 tokens were honoured exactly.

64K context

With max_context_window at 65536 (3 c1 runs each, single run of each prefill):

Metric This model Jundot/Qwen3.6-35B-A3B-oQ4e-mtp
Prefill ~32K, tok/s 175 936
Prefill ~57K, tok/s 146 721
Needle retrieval at ~59K tokens 3/3 3/3
c1 decode, tok/s 33.5 [21–47] 145 [100–207]

A nearly full 64K prompt takes about 6½ minutes to prefill on this model; usable, but slow. Splash's splash_activations: auto showed no consistent difference from bf16 over two interleaved rounds.

For reference, Splash against oMLX's built-in MTP on the same base architecture (Jundot's 27B, measured earlier on oMLX 0.8.0rc1): 55–87% faster prefill and about 50 vs 29 tok/s on long generations.

GPU power cap

oMLX 0.8.0 has a per-model gpu_power_limit_w. On this machine it had no useful effect (4 single-stream runs of 1024 tokens and a 16K prefill per setting, in this order):

Cap c1 decode, tok/s Prefill 16K, tok/s GPU W, average GPU W, peak System W GPU temperature, max
none 41.5 224 18.9 28.9 75.1 95.8 °C
20 W 42.5 206 17.3 28.3 71.7 95.4 °C
15 W 38.6 226 17.0 27.2 71.3 94.9 °C
10 W 36.8 228 16.2 25.3 68.5 94.0 °C
none 38.8 239 17.1 26.8 70.9 94.2 °C

oMLX logged each cap as set, but the GPU kept averaging 16–19 W, with fans at maximum: under sustained load the 14" chassis already holds the GPU near its thermal limit. Larger machines may behave differently.

Limitations

  • One run per configuration on 34 Python exercises. The 6–0 split against Jundot's build is unlikely to be chance, but treat the absolute scores as indicative, not as a leaderboard number.
  • Only Python was tested, and only through pi. The adapter was trained for pi's tools and loop; gains under other harnesses are not established.
  • Thinking on is outside the adapter's training. Medium thinking solved one more hard exercise at 2.5× the time; higher levels were not tested.
  • Quantization effects were not isolated from the merge: there is no unquantized merged reference here.

Files

  • model-*.safetensors, configs, tokenizer and chat template: the model.
  • oq_imatrix_report.json: the quantizer's imatrix coverage report.
  • merge_lora.py, quant.py: the merge and quantization scripts used. Both run in oMLX's Python (/opt/homebrew/opt/omlx/libexec/bin/python).

Credits and licence

Base model by the Qwen team; pi adapter by harness-hub; oQ quantization and serving by oMLX; Splash by incoai. Qwen3.8-27B and the adapter are Apache-2.0, and so is this derivative.

Downloads last month
705
Safetensors
Model size
28B params
Tensor type
U32
·
BF16
·
MLX
Hardware compatibility
Log In to add your hardware

4-bit

Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for dawidvdh/Qwen3.8-27B-pi-adapted-oQ4e-mtp

Base model

Qwen/Qwen3.8-27B
Quantized
(22)
this model