jasontitus/loopedqwen
Recurrent Qwen3.8-27B inference that trades extra layer passes for shorter answers
Automated SPDX check for reference only — not legal advice. Disclaimer
GitHub Star History
Tracked from daily D1 telemetry snapshots. Hover any data point for exact daily star counts.
Evidence-Backed Technical Brief
AI Deep ReviewArchitecture & Core Mechanics
Looped Qwen reuses the Qwen3.8-27B checkpoint and applies a gated workspace adapter to rerun layers 24–39, a 16-block span that combines GatedDeltaNet and gated attention. The 62.85M-parameter adapter occupies about 240 MB and lets successive passes refine the 5,120-dimensional hidden state before output. T=1 is the non-looped reference; higher T values repeat the core. LoopCD-Hidden is optional guidance, distinct from the MTP head used for speculative decoding.
The Python MLX path starts at scripts/run_mlx.py; requirements.txt selects mlx>=0.32.0 and mlx-lm>=0.31.0 on Darwin arm64 and includes Hugging Face Hub, SafeTensors, Transformers and NumPy. The mlx-serve integration uses a native Zig plugin under plugins/looped_qwen38/. The CUDA integration under vllm_looped_qwen38/ registers through vllm.general_plugins and uses a custom model architecture. Training entrypoints, train_loop.py and train_drafter.py, sit alongside serving code and standalone invariant tests.
Key Capabilities & Differentiators
At the same 80k token cap, unguided T=3 scored 78.9% on 175 LiveCodeBench v6 tasks versus 72.6% for T=1, while token use fell from 31,566 to 15,117. That gain is not uniform: on HumanEvalFix, T=3 with LoopCD scored 97.0% versus 98.8% for T=1, though it used 223 versus 2,289 tokens. The separate 85.0% LiveCodeBench result used 60 tasks and a 64k cap, so it should not be read as a direct improvement over the full 175-task run.
The Apple Silicon path covers 8-bit, 4-bit and 1.76-bit ternary Bonsai weights. With plugin v0.3.5, a 24 GB M4 Pro Mac mini ran Bonsai at 32k context with MTP in 12.5 GB peak unified memory; the Bonsai fix delivered 71.8%–79.3% draft acceptance and a 41% decode speedup in the reported configuration. A separate six-stream result used 16k context, 8-bit KV quantization and MTP disabled. Those two measurements are not interchangeable capacity targets.
Trade-offs & Limitations
Compared with stock Qwen3.8-27B on a standard runtime, this design puts more compute into each generated token in the hope of generating fewer tokens overall. On the M2 Max Hard-18 set at 8-bit, unguided T=2 reduced throughput from 12.73 to 10.96 tok/s but cut time per question from 278.3s to 185.8s. With LoopCD, T=4 scored 12/18 versus 11/18 for T=2, yet took 221.7s versus 148.6s per question. Depth is a quality–latency control, not a universal upgrade; the curated 18-task set is useful for tuning, not for predicting production performance.
The custom plugin and matched artifacts add upgrade and capacity-planning work relative to an unmodified checkpoint. The current vLLM plugin requires TP=1, and CUDA-graph MTP integration is listed as future work, so do not budget for Mac MTP speedups on NVIDIA. The repository code is MIT-licensed; review terms for the base weights, adapters, sidecar and third-party quantizations separately before redistribution.
Hardware & Deployment Guide
On Apple Silicon, choose the mlx-serve installer or DMG for browser chat and a local API, or use the Python/MLX runner. The Mac installer can reuse cached base weights, and the OpenAI-compatible endpoint is http://127.0.0.1:11234/v1 by default. On Linux/NVIDIA, use the CUDA installer, install the vLLM plugin into an existing environment, or build docker/vllm_looped/Dockerfile. The documented single-GPU targets are 48 GB for FP8 and 80 GB or more for BF16; context and concurrency still determine usable headroom.
The vLLM path fetches the adapter from Hugging Face on first launch unless it is already staged. For an offline deployment, prepare the runtime dependencies and model artifacts in advance; the miniature invariant suites can run without the 27B download. Release v3.1.2 added overlap and stale-symlink safeguards to MLX pack exports, atomic two-phase adapter reload, TP=1 validation and packed thinking-mask isolation for LoopCD-Hidden.
Local coding and math evaluation on Apple Silicon or a single large NVIDIA GPU, where you can tune depth and quantization against task accuracy, latency and memory.
You need multi-GPU tensor parallelism, a stock-checkpoint serving path, or predictable speedups without validating your own workload.
Quick Start & Installation
curl -fsSL https://raw.githubusercontent.com/jasontitus/loopedqwen/main/install_mac.sh | bash
Comparison vs. Top LLMs & Inference Alternatives
Full comparison →| Repository | Stars | 7d Trend | Stack | License | Core Positioning |
|---|---|---|---|---|---|
| loopedqwen ★ | 233 | +232 | Python | MIT | Recurrent Qwen3.8-27B inference that trades extra layer passes for shorter answe |
| minimind | 75.4k | +3.1k | Python | Apache-2.0 | Native PyTorch dense and MoE models for end-to-end LLM training on local GPUs |
| autoresearch | 101k | +342 | Python | — | Single-GPU nanochat harness for agent-led, five-minute training experiments |
| LlamaFactory | 76.4k | +86 | Python | Apache-2.0 | A unified Python framework for LLM and VLM fine-tuning with pluggable inference |
AI Context Briefing (for Claude / Cursor / Windsurf)
Standardized architecture summary & quickstart commands ready to paste into coding agents.
curl -sL https://repoforai.com/repo/jasontitus/loopedqwen.md
Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).
Frequently Asked Questions about loopedqwen
Can I add the adapter to an unchanged Qwen serving stack?
How much memory should I budget?
Does MIT cover commercial self-hosting and redistribution of the full model bundle?
How should I choose between this and stock Qwen3.8-27B?
Upstream README & Documentation
This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.
Top 10 Breakout Open-Source AI Repos, Every Thursday
Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.
Zero spam · 1-click unsubscribe · Privacy Policy