Run this model with HF Jobs

Run sliderforthewin/Looped-Qwen3.8-Flash-Next on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs to fine-tune https://huggingface.co/sliderforthewin/Looped-Qwen3.8-Flash-Next. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/sliderforthewin/Looped-Qwen3.8-Flash-Next on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
File size: 9,756 Bytes
b663ed7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f20f46a
b663ed7
f20f46a
b663ed7
f20f46a
 
b663ed7
f20f46a
b663ed7
 
 
f20f46a
b663ed7
f20f46a
b663ed7
f20f46a
 
 
 
 
 
 
b663ed7
f20f46a
 
 
 
 
 
 
 
 
b663ed7
f20f46a
b663ed7
 
 
e494c4d
b663ed7
e494c4d
b663ed7
e494c4d
b663ed7
 
e494c4d
b663ed7
 
e494c4d
f20f46a
e494c4d
f20f46a
 
e494c4d
b663ed7
e494c4d
b663ed7
 
e494c4d
b663ed7
 
e494c4d
 
 
 
 
b663ed7
 
 
f20f46a
b663ed7
f20f46a
 
 
 
 
 
 
 
 
 
 
 
 
b663ed7
f20f46a
 
 
 
 
 
 
 
 
 
 
b663ed7
 
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
---
license: mit
base_model:
  - Qwen/Qwen3.8-Flash-Next
  - Qwen/Qwen3.8-Flash-Next-FP8
tags:
  - mlx
  - vllm
  - apple-silicon
  - cuda
  - looped-transformer
  - recurrent-depth
  - speculative-decoding
  - dflash
  - moe
  - qwen3.8
  - qwen4_exp
  - coding
  - math
library_name: mlx
---

# Looped Qwen3.8-Flash-Next (Unified Merged Adapter + Pre-Folded `MLX` Sidecars)

**A smarter `Qwen3.8-Flash-Next` at the exact same base memory footprint β€” combining Alexey's ([`@superalesha`](https://x.com/superalesha)) GSPO RLVR `<think>` recurrence scaffold with our readout-protected `Direct` continual tuning into a single `268 MB` (`132 MB` BF16 on Mac `MLX`) drop-in adapter.**

- **Code, `vLLM` Plugin, PyTorch Engine, & `MLX` Helper:** [`jasontitus/loopedqwen-next`](https://github.com/jasontitus/loopedqwen-next) (MIT)
- **Built Upon & Cross-Compatible With:** [`alesha-pro/Looped-Qwen3.8-Flash-Next`](https://huggingface.co/alesha-pro/Looped-Qwen3.8-Flash-Next) & [`alesha-pro/Strata`](https://github.com/alesha-pro/Strata) (MIT)

![Better Together: Merging Open-Source Recurrent-Depth Adapters on Qwen3.8-Flash-Next](assets/01_merged_collaboration_hero.png)

---

## Key Results (`336`-Problem Paired Greedy Scorecard)

Looping only the middle 16 layers (`L16..31`) **twice** (`T = 2` default) while keeping Prelude `L0..15` (including the `51.2B` 3-gram PLE table) and Coda `L32..47` single-pass delivers major `<think>` reasoning gains in a third fewer tokens **and** preserves clean non-thinking (`Direct`) code generation:

- **`AIME 2025` (`n = 30`, `<think> @ 24k`):** `63.33%` (`Stock T=1`) $\rightarrow$ `80.00%` (`@superalesha v3`) $\rightarrow$ **`86.67%` (`26/30`, `+23.33 pp` vs. `Stock T=1`, `p = 0.016`; `+6.67 pp` over `v3`)** with **`-31.5%` fewer tokens** (`9,438` vs. `13,771`).
- **`GPQA-Diamond` (`n = 50`, `<think> @ 24k`):** `80.00%` (`Stock T=1`) $\rightarrow$ `90.00%` (`@superalesha v3`) $\rightarrow$ **`92.00%` (`46/50`, `+12.00 pp` vs. `Stock T=1`, `p = 0.031`; `+2.00 pp` over `v3`)** with **`-36.0%` fewer tokens** (`5,798` vs. `9,057`).
- **`LiveCodeBench v6` (`n = 40`, `<think> @ 24k`):** `57.50%` (`Stock T=1`) $\rightarrow$ **`80.00%` (`32/40`, `+22.50 pp` vs. `Stock T=1`, `p = 0.012`)** with **`-38.3%` fewer tokens** (`9,212` vs. `14,927`).
- **Fixes Non-Thinking (`Direct`) Code Regressions:**
  - **`HumanEval+ Direct` (`n = 164`, `direct @ 2k`):** Recovers `91.46%` (`150/164`) $\rightarrow$ **`93.90%` (`154/164`, `+4` wins / `0` losses over `v3`)**, verified identically on `vLLM 0.34.0` Cutlass FP8 (`470.6 tok/s`) and PyTorch FP8.
  - **`LCB Medium Direct52` (`n = 52`, `direct @ 4k`):** Erases 100% of `v3`'s `Direct52` drop at `T=3` (`51.92%` $\rightarrow$ **`55.77%`, `-67.4%` fewer tokens**), while our included **`sft_v21_direct/ckpt_0024.safetensors`** specialist reaches **`61.54%` (`32/52`, `+5.77 pp` over `Stock T=1`)**.
- **`556.6 tok/s` Batched `vLLM 0.34.0` Throughput on `1Γ— NVIDIA H200`** (`Qwen/Qwen3.8-Flash-Next-FP8` with `51.2B` PLE in pinned host RAM + CUDA Graphs).

| Benchmark Suite (`temperature=0.0` Greedy) | Stock `Qwen3.8-Flash-Next` (`T=1`) | Our `SFT` Adapter (`sft_v21_direct`, `T=3`) | `@superalesha`'s RLVR Adapter (`v3`, `T=2`) | **Merged Adapter (`ckpt_final`, `T=2`)** | Merged Token $\Delta$ vs `T=1` |
|---|---:|---:|---:|---:|---:|
| **`AIME 2025`** (`n=30`, `<think> @ 24k`) | `63.33%` (`19/30`) | β€” | `80.00%` (`24/30`) | **`86.67%` (`26/30`, `p=0.016`)** | **`-31.5%`** (`9,438` vs `13,771`) |
| **`GPQA-Diamond`** (`n=50`, `<think> @ 24k`) | `80.00%` (`40/50`) | `86.67%`* (`26/30`) | `90.00%` (`45/50`) | **`92.00%` (`46/50`, `p=0.031`)** | **`-36.0%`** (`5,798` vs `9,057`) |
| **`LiveCodeBench v6`** (`n=40`, `<think> @ 24k`) | `57.50%` (`23/40`) | β€” | **`80.0%` / `82.5%`** (`32`–`33/40`) | **`80.00%` (`32/40`, `p=0.012`)** | **`-38.3%`** (`9,212` vs `14,927`) |
| **`HumanEval+ Direct`** (`n=164`, `direct @ 2k`) | **`95.12%`** (`156/164`) | β€” | `91.46%` (`150/164`) | **`93.90%` (`154/164`, `+4/-0` vs `v3`)** | **`-11.3%`** (`224` vs `252`) |
| **`LCB Medium Direct52`** (`n=52`, `direct @ 4k`) | `55.77%` (`29/52`) | **`61.54%` (`32/52`)** | `51.92%` (`27/52`) | **`55.77%` (`29/52`, `T=3`)** / `53.85%` (`T=2`) | **`-67.4%`** (`531` vs `1,630`) |
| **Pooled `<think>` Suites (`120` problems)** | `68.33%` (`82/120`) | β€” | `84.17%`–`85.00%` (`101`–`102`) | **`86.67%` (`104/120`, `+23/-1` vs `T=1`)** | **`-35.8%`** (`556.6 tok/s` H200) |
| **Pooled All `336` Problems** | `79.46%` (`267/336`) | β€” | `82.74%`–`83.04%` (`278`–`279`) | **`85.12%` (`T=2`) / `85.42%` (`T=3/2`)** | β€” |

*\*Our `sft_v21_direct` GPQA guard was evaluated on the 30-item `xhigh @ 20,480` subset (`Stock T=1 = 27/30 = 90.0%`).*

---

## Quickstart (One Command)

### 1. Apple Silicon Mac (`64 GB+` Unified Memory β€” Browser Chat UI + OpenAI API)

Auto-detects your Mac's RAM (`64–95 GB` $\rightarrow$ `3.3-bpw` `~54 GB` RAM; `96–191 GB` $\rightarrow$ `4.7-bpw` `~75 GB` RAM; `192 GB+` $\rightarrow$ `8-bit` `~138 GB` RAM β€” with the `32 GB` PLE table SSD-mmapped so it uses **0 GB of RAM**), reuses any existing `Qwen3.8-Flash-Next` MLX pack in `~/.mlx-serve/models` or `~/.cache/huggingface/hub` with **0 GB re-downloaded**, sets up an isolated `MLX` runtime (`0` PyTorch needed), downloads this `268 MB` Merged Adapter (`T=2`), and launches a local Browser Chat UI + OpenAI `/v1` server at `http://127.0.0.1:11235`:

```bash
curl -fsSL https://raw.githubusercontent.com/jasontitus/loopedqwen-next/main/install_mac.sh | bash
```

* Or run a one-shot terminal test prompt (`<think>` + `tok/s`) or interactive terminal chat:
  ```bash
  curl -fsSL https://raw.githubusercontent.com/jasontitus/loopedqwen-next/main/install_mac.sh | bash -s -- --test
  ```

### 2. NVIDIA GPU (`CUDA` + `vLLM 0.34+` β€” `557 tok/s` on `1Γ— H200` or `2Γ— GPU`)

Auto-detects NVIDIA GPU count & VRAM, installs `vLLM 0.34.0` (`cu130` wheel) + [`jasontitus/loopedqwen-next`](https://github.com/jasontitus/loopedqwen-next), pre-caches `ckpt_final.safetensors` (`T=2`), and starts `vllm serve` (`--engram-config '{"cpu_offload": true}'`):

```bash
curl -fsSL https://raw.githubusercontent.com/jasontitus/loopedqwen-next/main/install_cuda.sh | bash
```

* **Already using [`alesha-pro/Strata`](https://github.com/alesha-pro/Strata)?** `ckpt_final.safetensors` + `ckpt_final.json` (`version: 3`, `num_passes: 2`, `dflash_bridges.*` preserved) is a 100% drop-in replacement:
  ```bash
  hf download sliderforthewin/Looped-Qwen3.8-Flash-Next ckpt_final.safetensors ckpt_final.json --local-dir ./merged_loop
  VLLM_LOOPED_CKPT=./merged_loop/ckpt_final.safetensors vllm serve Qwen/Qwen3.8-Flash-Next-FP8 ...
  ```

---

## Included Files

| Path | Size | Format | When to Use |
|---|---:|---|---|
| **`ckpt_final.safetensors`** + `ckpt_final.json` | `268 MB` | `version: 3` (`alesha_v3` schema, `T=2` default, `dflash_bridges.*` preserved) | **Default Unified Merged Adapter** β€” drop-in for `vLLM 0.34+`, `Strata`, and `loopedqwen-next`. |
| **`mlx/default_t2/`** (`loop_adapter_mlx.safetensors` + `.json`) | `131.8 MB` | Pre-folded BF16 `MLX` sidecar (`T=2`) | **Default Apple Silicon Mac Sidecar (`T=2`)** β€” zero PyTorch required. |
| **`mlx/default_t3/`** (`loop_adapter_mlx.safetensors` + `.json`) | `157.1 MB` | Pre-folded BF16 `MLX` sidecar (`T=3`) | **3-Pass Apple Silicon Mac Sidecar (`T=3`)**. |
| **`sft_v21_direct/ckpt_0024.safetensors`** + `.json` | `127 MB` | `looped-qwen4-exp-v1` (`T=3`) | **Optional Non-Thinking (`Direct`) Competitive-Coding Specialist** (`61.54%` on `LCB Medium Direct52`). |
| **`mlx/sft_v21_t3/`** | `83.0 MB` | Pre-folded BF16 `MLX` sidecar (`T=3`) | **Apple Silicon Mac `Direct`-Code Specialist Sidecar**. |
| **`v1/ckpt_merged_v1.safetensors`** + `.json` | `264 MB` | `looped-qwen4-exp-v1` | Merged Adapter in native `looped-qwen4-exp-v1` layout. |
| `mlx_sidecar.py` / `export_mlx_serve_loop.py` | `18 KB` | Python | Standalone `mlx.core` runtime helper & custom-`T` sidecar exporter. |

---

## How the Merge Works

Averaging weights `(W_ours + W_theirs) / 2` across two independently trained looped adapters fails because low-rank `WorkspaceEntry` / `CrossPassMixer` bases live in arbitrary rotated coordinate systems and use different stream-RMS normalizations (`mul_ref_rms` + 16 `core_exit` mixers vs. `rms_match` + 4 `layer_tap` mixers).

Instead, we froze **100%** of `@superalesha`'s RLVR recurrence scaffold (`workspace_entry.*`, all 16 `cross_pass_mixers.*`, `lora_pass_delta_raw`, and `dflash_bridges.*`, `max_diff == 0.0`) and ran 24 steps of readout-protected continual merging (`L40..47` frozen beneath `lm_head`) in the Core `L16..31` + Coda `L32..39` LoRA subspace β€” pairing verified `Direct` code supervision (`sqrt` doc-CE) 50/50 with online `<think>` teacher-KL (`0.0014` nats/tok) against unmodified `@superalesha v3`.

---

## Credits & License

- **Alexey ([`@superalesha`](https://x.com/superalesha) / [`alesha-pro`](https://huggingface.co/alesha-pro)):** Huge credit for training and open-sourcing [`alesha-pro/Looped-Qwen3.8-Flash-Next`](https://huggingface.co/alesha-pro/Looped-Qwen3.8-Flash-Next) (MIT) and [`Strata`](https://github.com/alesha-pro/Strata), whose 1,200-step SFT + 200-step GSPO RLVR scaffold forms the frozen recurrence backbone of this merged adapter.
- **Qwen Team:** For open-sourcing `Qwen3.8-Flash-Next` and `Qwen3.8-Flash-Next-FP8`.
- **[`@beamivalice`](https://github.com/beamivalice), `mlx-serve` (`@ddalcu`), & Apple `LoopCD` Authors (`arXiv:2610.02185`):** For `Sushi` STQ quantization, `LoopCD` contrastive decoding (`ddalcu/mlx-serve#1348`), and the Apple Silicon / MLX community pushing fast local MoE + recurrent-depth inference forward.

MIT β€” see [`LICENSE`](LICENSE).