Text Generation
GGUF
English
spiral
quantization
calibration-free
llama-cpp
qwen
qwen3.6
Mixture of Experts
apple-silicon
cuda
metal
conversational
Instructions to use Reinforce-ai/Qwen3.6-35B-A3B-Spiral with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use Reinforce-ai/Qwen3.6-35B-A3B-Spiral with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="Reinforce-ai/Qwen3.6-35B-A3B-Spiral", filename="Qwen3.6-35B-A3B-Spiral_4_5.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use Reinforce-ai/Qwen3.6-35B-A3B-Spiral with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf Reinforce-ai/Qwen3.6-35B-A3B-Spiral # Run inference directly in the terminal: llama cli -hf Reinforce-ai/Qwen3.6-35B-A3B-Spiral
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf Reinforce-ai/Qwen3.6-35B-A3B-Spiral # Run inference directly in the terminal: llama cli -hf Reinforce-ai/Qwen3.6-35B-A3B-Spiral
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf Reinforce-ai/Qwen3.6-35B-A3B-Spiral # Run inference directly in the terminal: ./llama-cli -hf Reinforce-ai/Qwen3.6-35B-A3B-Spiral
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf Reinforce-ai/Qwen3.6-35B-A3B-Spiral # Run inference directly in the terminal: ./build/bin/llama-cli -hf Reinforce-ai/Qwen3.6-35B-A3B-Spiral
Use Docker
docker model run hf.co/Reinforce-ai/Qwen3.6-35B-A3B-Spiral
- LM Studio
- Jan
- vLLM
How to use Reinforce-ai/Qwen3.6-35B-A3B-Spiral with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Reinforce-ai/Qwen3.6-35B-A3B-Spiral" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Reinforce-ai/Qwen3.6-35B-A3B-Spiral", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Reinforce-ai/Qwen3.6-35B-A3B-Spiral
- Ollama
How to use Reinforce-ai/Qwen3.6-35B-A3B-Spiral with Ollama:
ollama run hf.co/Reinforce-ai/Qwen3.6-35B-A3B-Spiral
- Unsloth Studio
How to use Reinforce-ai/Qwen3.6-35B-A3B-Spiral with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for Reinforce-ai/Qwen3.6-35B-A3B-Spiral to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for Reinforce-ai/Qwen3.6-35B-A3B-Spiral to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for Reinforce-ai/Qwen3.6-35B-A3B-Spiral to start chatting
- Pi
How to use Reinforce-ai/Qwen3.6-35B-A3B-Spiral with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf Reinforce-ai/Qwen3.6-35B-A3B-Spiral
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "Reinforce-ai/Qwen3.6-35B-A3B-Spiral" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use Reinforce-ai/Qwen3.6-35B-A3B-Spiral with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf Reinforce-ai/Qwen3.6-35B-A3B-Spiral
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default Reinforce-ai/Qwen3.6-35B-A3B-Spiral
Run Hermes
hermes
- Atomic Chat new
- OpenClaw new
How to use Reinforce-ai/Qwen3.6-35B-A3B-Spiral with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf Reinforce-ai/Qwen3.6-35B-A3B-Spiral
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "Reinforce-ai/Qwen3.6-35B-A3B-Spiral" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
- Docker Model Runner
How to use Reinforce-ai/Qwen3.6-35B-A3B-Spiral with Docker Model Runner:
docker model run hf.co/Reinforce-ai/Qwen3.6-35B-A3B-Spiral
- Lemonade
How to use Reinforce-ai/Qwen3.6-35B-A3B-Spiral with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull Reinforce-ai/Qwen3.6-35B-A3B-Spiral
Run and chat with the model
lemonade run user.Qwen3.6-35B-A3B-Spiral-{{QUANT_TAG}}List all available models
lemonade list
Commit Β·
f52bbda
1
Parent(s): 1c51ca5
release: Qwen3.6-35B-A3B Spiral 3-bit
Browse files- .gitattributes +2 -0
- README.md +162 -0
- qwen36-35b-a3b-codebooks.spiralcb +3 -0
- qwen36-35b-a3b.gguf +3 -0
- spiral_release_slide.svg +237 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
*.gguf filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
*.spiralcb filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model: Qwen/Qwen3.6-35B-A3B
|
| 4 |
+
base_model_relation: quantized
|
| 5 |
+
language:
|
| 6 |
+
- en
|
| 7 |
+
pipeline_tag: text-generation
|
| 8 |
+
library_name: spiral
|
| 9 |
+
tags:
|
| 10 |
+
- spiral
|
| 11 |
+
- quantization
|
| 12 |
+
- int3
|
| 13 |
+
- kv-cache-compression
|
| 14 |
+
- apple-silicon
|
| 15 |
+
- metal
|
| 16 |
+
- gguf
|
| 17 |
+
- llama-cpp
|
| 18 |
+
- qwen
|
| 19 |
+
- qwen3.6
|
| 20 |
+
- moe
|
| 21 |
+
- deltanet
|
| 22 |
+
---
|
| 23 |
+
|
| 24 |
+
# Qwen3.6-35B-A3B Spiral
|
| 25 |
+
|
| 26 |
+
**Geometric compression of Qwen3.6-35B-A3B.** 3.5 bits per weight. 7.1Γ K-cache compression. +0.113 nats vs bf16 on wikitext-2. Runs at 23β24 tok/s on Apple M2 Max.
|
| 27 |
+
|
| 28 |
+
This is a Spiral-compressed version of [Qwen/Qwen3.6-35B-A3B](https://huggingface.co/Qwen/Qwen3.6-35B-A3B) β the hybrid MoE + DeltaNet architecture from Qwen, compressed via Walsh-Hadamard rotation and Lloyd-Max INT3 weights with product-quantized K cache.
|
| 29 |
+
|
| 30 |
+

|
| 31 |
+
|
| 32 |
+
## Quality
|
| 33 |
+
|
| 34 |
+
Cross-method perplexity comparison on H100, identical methodology (HF AutoTokenizer, 131,008 wikitext-2 tokens, same NLL formula across all methods):
|
| 35 |
+
|
| 36 |
+
| Method | Bits/weight | Disk size | NLL (nats/token) | Gap vs bf16 |
|
| 37 |
+
|---|---|---|---|---|
|
| 38 |
+
| bf16 (reference) | 16.0 | 67.0 GB | 1.8968 | β |
|
| 39 |
+
| unsloth Q8_0 | 8.5 | 34.4 GB | 1.8962 | β0.0006 |
|
| 40 |
+
| unsloth Q4_K_XL | 5.2 | 20.8 GB | 1.8976 | +0.0008 |
|
| 41 |
+
| **Spiral 3-bit (this model)** | **3.5** | **14.2 GB** | **2.0101** | **+0.1133** |
|
| 42 |
+
|
| 43 |
+
Spiral is **1.46Γ smaller than Q4_K_XL** for +0.11 nats of additional perplexity β practically invisible in generation.
|
| 44 |
+
|
| 45 |
+
## KV cache compression
|
| 46 |
+
|
| 47 |
+
Spiral additionally compresses the K cache via product quantization (256 codewords Γ 4-dim subspaces). Unlike weight quantization, KV compression is online β every token at inference time encodes through PQ on write and decodes on read.
|
| 48 |
+
|
| 49 |
+
| Method | bytes / token | K compression | Combined K+V |
|
| 50 |
+
|---|---|---|---|
|
| 51 |
+
| f16 (default for Q8_0, Q4_K_XL, bf16) | 20,480 | 1Γ | 1Γ |
|
| 52 |
+
| **Spiral PQ K + f16 V** | **11,680** | **7.1Γ** | **1.75Γ** |
|
| 53 |
+
|
| 54 |
+
At 1M context, this saves 8.6 GiB β the difference between fitting on a 64 GB Mac or not.
|
| 55 |
+
|
| 56 |
+
## Total memory at 1M context
|
| 57 |
+
|
| 58 |
+
Weights + KV cache for Qwen3.6-35B-A3B:
|
| 59 |
+
|
| 60 |
+
| Method | Total at 1M | Fits 96 GB Mac? | Fits 64 GB Mac? |
|
| 61 |
+
|---|---|---|---|
|
| 62 |
+
| **Spiral 3-bit** | **25.6 GiB** | β comfortable | β comfortable |
|
| 63 |
+
| Q4_K_XL | 40.8 GiB | β | tight |
|
| 64 |
+
| Q8_0 | 54.4 GiB | tight | β |
|
| 65 |
+
| bf16 | 87.0 GiB | β | β |
|
| 66 |
+
|
| 67 |
+
Add ~1 GiB compute scratch for realistic peak.
|
| 68 |
+
|
| 69 |
+
## Files in this repo
|
| 70 |
+
|
| 71 |
+
| File | Size | Purpose |
|
| 72 |
+
|---|---|---|
|
| 73 |
+
| `qwen36-35b-a3b.gguf` | 14.0 GB | Quantized weights (INT3 + rotation) |
|
| 74 |
+
| `qwen36-35b-a3b-codebooks.spiralcb` | 11 MB | PQ codebooks + rotation seeds |
|
| 75 |
+
| `README.md` | β | This model card |
|
| 76 |
+
| `spiral_release_slide.svg` | 14 KB | Results visualization |
|
| 77 |
+
|
| 78 |
+
**Both the GGUF and the `.spiralcb` file are required.** The codebooks contain the Walsh-Hadamard rotation parameters and PQ codebook centroids β they are loaded at inference time alongside the weights.
|
| 79 |
+
|
| 80 |
+
## Quick start (Apple Silicon)
|
| 81 |
+
|
| 82 |
+
Spiral runs via a custom build of `llama.cpp` with Metal kernels for fused PQ flash attention.
|
| 83 |
+
|
| 84 |
+
### Install
|
| 85 |
+
|
| 86 |
+
```bash
|
| 87 |
+
brew install reinforceai/spiral/spiral
|
| 88 |
+
```
|
| 89 |
+
|
| 90 |
+
### Run
|
| 91 |
+
|
| 92 |
+
```bash
|
| 93 |
+
spiral-chat --model qwen-36-35b-spiral
|
| 94 |
+
```
|
| 95 |
+
|
| 96 |
+
The first run downloads this repo's files. Subsequent runs use the local cache.
|
| 97 |
+
|
| 98 |
+
### Manual download
|
| 99 |
+
|
| 100 |
+
```bash
|
| 101 |
+
hf download Reinforce-ai/Qwen3.6-35B-A3B-Spiral \
|
| 102 |
+
qwen36-35b-a3b.gguf qwen36-35b-a3b-codebooks.spiralcb \
|
| 103 |
+
--local-dir ./models/spiral-35b/
|
| 104 |
+
```
|
| 105 |
+
|
| 106 |
+
Then point `spiral-chat` at the local directory.
|
| 107 |
+
|
| 108 |
+
## Performance (Apple M2 Max)
|
| 109 |
+
|
| 110 |
+
| Configuration | Decode | Prefill |
|
| 111 |
+
|---|---|---|
|
| 112 |
+
| PQ KV + flash attention | 23β24 tok/s | 80 tok/s |
|
| 113 |
+
| f16 KV | 36 tok/s | β |
|
| 114 |
+
|
| 115 |
+
PQ KV trades ~30% decode speed for 7.1Γ K compression. For long-horizon agent tasks where context capacity is the binding constraint, the trade is favorable. Switch with `-ctk f16` at the CLI.
|
| 116 |
+
|
| 117 |
+
## How it works
|
| 118 |
+
|
| 119 |
+
Spiral applies multi-pass block Walsh-Hadamard rotation to weights before INT3 quantization. The rotation makes weight distributions near-Gaussian with equalized variance across all dimensions β outlier channels (the primary source of quantization error) vanish under rotation. Lloyd-Max scalar quantization in the rotated space is then optimal.
|
| 120 |
+
|
| 121 |
+
For the K cache, product quantization with learned codebooks compresses each 4-dim subspace independently into 8-bit codes. A fused Metal kernel decodes PQ codes, applies RoPE, and computes attention in a single pass β no intermediate decompressed tensor is materialized.
|
| 122 |
+
|
| 123 |
+
For the hybrid Qwen3.6-35B-A3B architecture (10 full attention layers + 30 DeltaNet linear attention layers, 256 MoE experts with 8 active per token), Spiral applies weight compression uniformly across all layer types, with KV compression specific to the 10 attention layers (DeltaNet has no KV cache).
|
| 124 |
+
|
| 125 |
+
Full method documentation, source, and reproduction scripts: https://github.com/ReinforceAI/spiral
|
| 126 |
+
|
| 127 |
+
## Methodology
|
| 128 |
+
|
| 129 |
+
The +0.1133 nats gap is measured with rigorous cross-method protocol on H100:
|
| 130 |
+
|
| 131 |
+
- HuggingFace AutoTokenizer applied to wikitext-2-raw-v1 validation, **single tokenizer source of truth** for all four methods
|
| 132 |
+
- 64 sequences Γ 2048 tokens = 131,008 tokens
|
| 133 |
+
- bf16 and Spiral evaluated via PyTorch `F.cross_entropy`
|
| 134 |
+
- Q8_0 and Q4_K_XL evaluated via `llama-cpp-python` with **pre-tokenized inputs** (logits_all=True) β the GGUF tokenizer is never invoked, eliminating tokenizer mismatch as a confound
|
| 135 |
+
- All numbers from the same H100 pod, same eval session
|
| 136 |
+
|
| 137 |
+
The eval script `eval_cross_method.py` is included in the [GitHub repo](https://github.com/ReinforceAI/spiral) for independent reproduction.
|
| 138 |
+
|
| 139 |
+
## Limitations
|
| 140 |
+
|
| 141 |
+
- Apple Silicon focus. CUDA kernels not yet shipped β Spiral models on Linux/CUDA require fp16 fallback for inference. Mac is the production target.
|
| 142 |
+
- PQ KV cache is currently K-only (V stays at fp16). Full K+V PQ is in development; would extend the 1.75Γ combined compression toward 7.1Γ.
|
| 143 |
+
- Brew formula installs a custom `llama.cpp` build with Spiral kernels. Standard llama.cpp builds will not load the SPIRAL_3BIT or SPIRAL_PQ2 GGUF types.
|
| 144 |
+
- This is a research preview. APIs may change before 1.0.
|
| 145 |
+
|
| 146 |
+
## Citation
|
| 147 |
+
|
| 148 |
+
```bibtex
|
| 149 |
+
@misc{spiral2026,
|
| 150 |
+
title={Spiral: Geometric Compression of Rotated Transformers},
|
| 151 |
+
author={Deshwal, Viraj},
|
| 152 |
+
year={2026},
|
| 153 |
+
publisher={ReinforceAI},
|
| 154 |
+
url={https://github.com/ReinforceAI/spiral}
|
| 155 |
+
}
|
| 156 |
+
```
|
| 157 |
+
|
| 158 |
+
## License
|
| 159 |
+
|
| 160 |
+
Inference engine: Based on llama.cpp (MIT)
|
| 161 |
+
Spiral compression framework: ReinforceAI
|
| 162 |
+
Model weights: Apache 2.0 (inherited from Qwen3.6-35B-A3B)
|
qwen36-35b-a3b-codebooks.spiralcb
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8b90f087b69b73905798ae0ee0ad55e474d6bab6c69da5908b96b383e1c123bb
|
| 3 |
+
size 11190440
|
qwen36-35b-a3b.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8a56745857654215b8bbc30afd64d7fde6d28727932d8c1f9159b9ca5a978b6b
|
| 3 |
+
size 15281584160
|
spiral_release_slide.svg
ADDED
|
|