Last week I shared Looped Qwen3.8-27B, where looping the middle layers of a frozen 27B model boosted coding accuracy while cutting <think> tokens in half. The #1 question people asked afterward was whether looping only helps smaller models — or whether it can actually lift a top frontier open model too.

So I tested it on DeepSeek-V4.1-Flash-1017 (552B MoE) — keeping 100% of the 552B base weights frozen and training a tiny 35M-parameter (~135 MB FP32 / ~71 MB BF16, 0.006%) recurrent loop adapter over 12 middle decoder layers (L24–35) on a single GPU (< $50 total compute).

DeepSeek-V4.1 Gets Smarter and More Concise with Looping

What a 35M-parameter loop adapter did for 552B DeepSeek-V4.1:

  • Lifts Full-Precision accuracy (75.8% → 84.8%): Across 33 Medium & Hard LiveCodeBench v6 competitive programming problems (graded against official unit tests at a 32,768-token limit), every looped configuration (2 or 3 passes, with or without contrastive decoding) outperformed Stock Full-Precision — jumping +9.1 pts overall and 61.5% → 84.6% (+23.1 pts) on the 13 hardest AtCoder & LeetCode Hard problems.
  • Cuts thinking tokens 27% — paying for the extra pass: Looping 12 layers runs 52 layer-passes per token instead of 40 (+30%), yet shrinks <think> output from 16,979 → 12,436 tokens (-26.8%), resulting in ~5% fewer total layer-passes per answer (647k vs. 679k) and 27% less KV-cache memory.
  • Brings 1.75-bit local Macs ALL the way back to Cloud Full-Precision parity (57.6% → 75.8%): Compressing 552B routed experts 9.1× to 1.75 bits (~111 GB of experts) drops overall coding accuracy -18.2 pts (19/33 vs. 25/33) and causes 20k+-token proofs to spin into the 32k limit (1/4 solved). Plugging in my cloud-trained adapter + contrastive decoding (LoopCD) lifts all 33 problems to 75.8% (25/33, +18.2 pts) — tying Stock Cloud Full Precision (25/33) right on a MacBook Pro (~24 tok/s) — and solves 4/4 (100%) of the 20k+-token proofs in 21,486 tokens.

Try It Out (64 GB+ Apple Silicon Mac on macOS 26.2+ — or an Adventurous 48 GB Mac)

curl -fsSL https://raw.githubusercontent.com/jasontitus/dsv41-loop-eval/main/install_mac.sh | bash
  • Zero Re-Downloading: Runs on @beamivalice’s sushi engine (PR #280). If you already have beamster’s STQ-1.75bpw or STQ-2.7bpw pack in ~/.sushi/models/ or ~/.cache/huggingface/, 0 GB of base weights are re-downloaded — it grabs the adapter, lets sushi’s live free-RAM planner size your expert cache (48 GB to 512 GB), and starts :11434. (Downloading fresh requires ~330 GiB free on NVMe — ~120 GiB 1.75-bit transformer + 189 GiB SSD-streamed Engram lookup tables, which use 0 GB of RAM; set STQ_PACK_DIR=/Volumes/<ExternalSSD>/dsv41-stq on smaller internal drives.)
  • Connect instantly once :11434 is up:
    • Browser Chat UI: open http://127.0.0.1:11434
    • Claude Code: ANTHROPIC_BASE_URL=http://127.0.0.1:11434 ANTHROPIC_API_KEY=sushi claude --model DeepSeek-V4.1-Flash-1017-Sushi-STQ-1.75bpw
    • Local OpenAI Agents (Cline, Roo Code, OpenCode, curl): http://127.0.0.1:11434/v1 (Running NVIDIA CUDA (vLLM) or DGX Sparks? Jump to 1-line CUDA setup ↓)

1. Full-Precision Coding Benchmarks (Cloud vLLM on 4× RTX PRO 6000)

To make sure there were no cherry-picked settings, I ran the full 2 × 2 grid — 2 passes and 3 passes, both with and without LoopCD contrastive decoding — for checkpoint R5-A@300 in native MXFP4 full precision via vLLM against unmodified Stock DeepSeek-V4.1-Flash-1017.

Every problem is a competitive programming task from LiveCodeBench v6 (LeetCode & AtCoder Medium + Hard, evaluated against official unit test suites at --effort high, temperature=1.0, top_p=1.0, seed=42, and a 32,768-token limit):

LiveCodeBench v6 Test Set (32,768 Token Limit)Stock 1.75-Bit Mac (1p)Looped 1.75-Bit Mac (2p+CD)Stock Full Precision (1p)Looped FP (2 passes)Looped FP (2p + LoopCD)Looped FP (3 passes)Looped FP (3p + LoopCD)*
All 33 Medium + Hard Problems57.6% (19/33)75.8% (25/33)75.8% (25/33)84.8% (28/33, +9.1 pts)81.8% (27/33, +6.1 pts)81.8% (27/33, +6.1 pts)78.1% (25/32, +3.1 pts*)
13 Hardest Problems (AtCoder / LeetCode Hard)30.8% (4/13)53.8% (7/13)61.5% (8/13)84.6% (11/13, +23.1 pts)69.2% (9/13, +7.7 pts)69.2% (9/13, +7.7 pts)58.3% (7/12, ties Stock*)
20-Problem Standard Split (8 Med + 12 Hard)75.0% (15/20)75.0% (15/20)75.0% (15/20)80.0% (16/20, +5.0 pts)80.0% (16/20, +5.0 pts)80.0% (16/20, +5.0 pts)80.0% (16/20, +5.0 pts)
4 Long-Chain Hard Problems (20k+-token proofs)25.0% (1/4)100.0% (4/4)100.0% (4/4)100.0% (4/4)100.0% (4/4)100.0% (4/4)100.0% (4/4)
Average Thinking + Output Tokens (all 33)~20,500 tok17,324 tok (-15%)16,979 tok12,436 tok (-27%)11,953 tok (-30%)13,997 tok (-18%)13,003 tok (-23%)
Average Tokens on Solved Problems—12,677 tok~13,200 tok10,270 tok8,898 tok (-33%)11,186 tok9,203 tok (-30%)

*Notes: The 33 unique problems combine the 20-problem stratified split (8 Medium + 12 Hard), 13 hardest problems (4 shared with the 20-problem split), and 4 long-chain Hard problems. Stock Full Precision ran via DeepInfra (MXFP4/BF16), while Looped FP ran on 4× RTX PRO 6000 via vLLM (MXFP4 MoE + FP8 MLA KV cache, concurrency=33). In 3 passes + LoopCD, 1 item (#3701) dropped on a transient HTTP disconnect (32/33 completed; matched 32-item Stock FP is 24/32 = 75.0% overall and 7/12 = 58.3% on the hardest split).

Why 2 passes is the Full-Precision sweet spot (84.8%, zero losses on the 13 hardest problems): On multi-step algorithmic problems where Stock Full Precision either spins into the 32,768-token wall (3 separate AtCoder/LeetCode Hard timeouts flipped to clean 14k–21k-token passes) or commits early to a buggy recurrence, a second pass through layers 24–35 resolves the derivation inside continuous hidden state instead of rambling in text.


2. Why Shorter Thinking Chains Pay for the Extra Loop Pass

Shorter Thinking Chains Pay for the Extra Loop Pass

A natural concern with looping is per-token compute: running 12 middle layers (L24–35) twice executes 52 layer-passes per token instead of 40 (+30% layers).

In reasoning models, total work per question is tokens multiplied by compute per token:

Layer-Passes per Question = (Tokens Generated) × (Layer-Passes per Token)

Across all 33 coding problems, +30% layers per token cuts <think> length by -26.8% (16,979 → 12,436 tokens):

12,436 × 52 = 646.7k layer-passes vs. 16,979 × 40 = 679.2k (~5% less total compute per answer!)

Running all 33 competitive programming problems concurrently (concurrency=33) on a single 4× RTX PRO 6000 node finished the entire 2-pass benchmark in 54.2 minutes (126.1 tok/s batch throughput) while jumping +9.1 pts in accuracy and cutting KV-cache footprint by 27%.


3. Rescuing 1.75-Bit Local Mac Inference Back to Full-Precision Quality

Running a 552B model locally on a Mac requires extreme compression — beamster’s 1.75-bpw STQ (Sushi Trellis Quant) pack squeezes the 552B routed experts into ~111 GB (plus ~10 GB trunk/DSpark and two SSD-streamed Engram tables that use 0 GB of RAM), served by @beamivalice’s sushi engine.

That 9.1× expert compression from BF16 holds up well on medium tasks (75.0% on the 20-problem standard split), until the model has to sustain a 20,000-token mathematical proof. Tiny quantization errors accumulate across thousands of steps, causing <think> chains to second-guess themselves until they hit the 32,768-token limit:

  • Across all 33 LiveCodeBench problems, Stock 1.75-bit drops -18.2 pts below Cloud Full Precision (57.6% vs. 75.8%).
  • On the 4 longest-chain Hard problems (24,334 mean tokens in Full Precision), Stock 1.75-bit collapses from 100% (4/4) → 25% (1/4), timing out at 32,768 tokens on 3 of the 4 problems.

Adding a loop adapter on an M5 Max MacBook Pro (~24 tok/s, $0 API cost) recovers 100% of that -18.2 pt quantization loss across all 33 problems:

Configuration (32,768 Token Limit)Engine & HardwareAll 33 Coding Problems13 Hardest Problems4 Long-Chain Hard ProblemsMean Tokens (All 33)
Stock 1.75-Bit (1 pass)sushi · Mac (128 GB RAM)57.6% (19/33)30.8% (4/13)25.0% (1/4 · 3 hit 32k cap)~20,500 tok
Looped 1.75-Bit (2 passes, R4-B'@200 STQ-trained)sushi · M5 Max MacBook Pro66.7% (22/33, 69.7% lenient)46.2% (6/13 lenient)75.0% (3/4, 4/4 lenient)19,380 tok
Looped 1.75-Bit (2 passes + LoopCD, R5-A@250 cloud-trained)sushi · M5 Max MacBook Pro75.8% (25/33, +18.2 pts!)53.8% (7/13, +23.0 pts)100.0% (4/4 · 0 cap hits!)17,324 tok
Stock Full Precision (1 pass Reference)Cloud MXFP4/BF16 Cluster75.8% (25/33)61.5% (8/13)100.0% (4/4)16,979 tok

Look at the third and fourth rows: my R5-A adapter was trained purely on cloud MXFP4 weights — it never saw 1.75-bit quantization noise during training. On 1.75-bit weights alone (ω=0), quantization drift still holds all33 to 63.6% (21/33, 2/4 on long-chain Hard); turning on Loop-Contrastive Decoding (LoopCD, ω=0.3) — nudging hidden states along (pass_2 − pass_1) right before coda layer 36 — cancels that drift, lifting 1.75-bit Mac accuracy +18.2 pts (19/33 → 25/33) to match Stock Cloud Full Precision (25/33 = 75.8%) across all 33 problems while solving 4/4 (100%) of the long-chain proofs in 21,486 tokens. That is why install_mac.sh enables LoopCD (ω=0.3) by default on 1.75-bit Macs while install_cuda.sh defaults to ω=0.0 on Full-Precision GPUs.

Independent Reproduction by @beamivalice (sushi Author)

Shortly after I published the release kit, @beamivalice independently benchmarked loop=2 vs. loop=2 + LoopCD (ω=0.3) on Apple Silicon (sushi 1.8.1, 95 GiB streamed budget with DSpark) on AtCoder abc392_d (a baseline-failing probability problem from the fast4 canary suite):

Arm (sushi 1.8.1, STQ-1.75bpw)Loop / LoopCDCompletion TokensReasoning CharsWall TimeDecode (DSpark)Unit Tests (1e-8 tol)
T2loop=2, omega=0.02,2366,354103.4 s22.5 tok/s (1.18/rnd)42 / 42 PASS
T2_cdloop=2, omega=0.31,373 (-38.6%)3,604 (-43.3%)66.0 s (-36.2%)22.1 tok/s (1.26/rnd)42 / 42 PASS

Turning on LoopCD-Hidden (ω=0.3) cut reasoning length by 43.3% and wall-clock answer time by 36.2% (103.4 s → 66.0 s) with exact 42/42 mathematical accuracy. (Bonus catch by @beamivalice: my bench_data/lcb_eval.py grader was originally comparing stdin outputs as exact strings, rejecting 1/13 printed to 15 decimals 0.076923076923077 against 0.076923076923 (|diff| = 7.7e-14); fixed with LiveCodeBench’s 1e-6 float-token tolerance in 1d16922, which also flipped abc392_d to PASS on my saved fast4 run without changing any of the 33 integer/string problems in all33.)


4. How the Loop Is Wired (and Trained on a Single GPU for < $50)

DeepSeek-V4.1-Flash-1017 uses a Causal Encoder-Decoder layout: layers 0–20 act as an encoder producing shared KV states, while consumer layers 21–39 read from that boundary alongside local 128-token sliding-window KV caches over a 4-stream HyperConnection highway:

Token Embeddings + Engram
  └─> Frozen Encoder + Prelude (L0–L23) ──> Anchor a (4-Stream HyperConnection)
                                                │
                   ┌────────────────────────────┘
                   ▼
        Zero-Init Gated Workspace Entry  <──────┐
                   │                            │ Extra Pass (p < T)
                   ▼                            │
        Recurrent Core (L24–L35 + Core LoRA) ───┘
                   │
                   ▼ Final Pass (optional LoopCD contrastive step)
        Coda Readout (L36–L39 + Coda LoRA) ──> Frozen LM Head
  • Bit-Exact 1-Pass Compatibility: Pass 0 runs with zero adapters and workspace gates initialize to zero, so 1 pass is bit-for-bit identical to stock DeepSeek-V4.1, and sushi / vLLM allocate isolated per-pass 128-token SWA KV slots so recurrent passes never overwrite context.
  • Training 552B on a Single GPU (< $50): My training codebase started as an MLX port inspired by UnstableLlama/exl3-qlora (built on Turboderp’s ExLlamaV3 trellis quantization and Hadamard QLoRA math). Precomputing frozen Layer-20 states (40 KB/token) and streaming official MXFP4 routed experts from host DDR5 RAM through MLX’s fused 4-bit mx.gather_qmm kernel (95× faster MoE layers) let all 300 SFT steps run on a single GPU (96 GB RTX PRO 6000 for steps 0–100 and 141 GB H200 for 100–300 with all 12 core layers pinned, ~$44 total compute).

Engines and How to Run It Yourself

Everything — adapters (R5-A@300 & R4-B'@200), one-line Mac and CUDA installers, zero-fork vLLM plugin, sushi Metal integration, and unit-test evaluation kit — is open source:

Hardware TierInference EngineBase Weights (0 GB re-downloaded if cached)How to Run
Apple Silicon 64 GB–128 GB (or adventurous 48 GB, macOS 26.2+)beamivalice/sushi (PR #280) w/ NVMe expert streamingbeamster/DeepSeek-V4.1-Flash-1017-Sushi-STQ-1.75bpw (~330 GiB on NVMe incl. Engram)curl -fsSL https://raw.githubusercontent.com/jasontitus/dsv41-loop-eval/main/install_mac.sh | bash
Apple Silicon 256 GB–512 GB (M3 Ultra, macOS 26.2+)beamivalice/sushi (100% RAM-pinned)STQ-1.75bpw or higher-precision STQ-2.7bpw (~450 GiB on NVMe)QUANT=2.7bpw curl -fsSL https://raw.githubusercontent.com/jasontitus/dsv41-loop-eval/main/install_mac.sh | bash
NVIDIA CUDA (4× >=94 GB or 8× 80 GB GPUs)vLLM (>= 0.34.1rc1 nightly) + dsv41_loop plugin (MXFP4 + FP8 MLA)deepseek-ai/DeepSeek-V4.1-Flash-1017curl -fsSL https://raw.githubusercontent.com/jasontitus/dsv41-loop-eval/main/install_cuda.sh | bash (or see vllm_loop/README.md)
Merged 4× / 8× NVIDIA DGX Sparks (200 GbE)vLLM Ray TP=4/8 + NVMe Engram offloaddeepseek-ai/DeepSeek-V4.1-Flash-1017./run_sparks_vllm_cluster.sh 2-3 in jasontitus/dsv41-loop-eval

Code, Weights & Credits

Next up: testing STQ-2.7bpw on Apple Silicon, expanding full-precision evaluation across 104 LiveCodeBench problems, GPQA Diamond, AIME 2025/2026, and SWE-bench Verified-mini, and exploring RLVR so the model learns when to spend an extra recurrent pass.