Compress frontier MoE models to sub-4-bit with validated performance
Sub-4-bit quantization plus on-policy distillation recovery for any Hugging Face model - one ModelAdapter per family.
Why it matters
Deploy large mixture-of-experts models on constrained hardware by quantizing them to 3-bit precision while maintaining benchmark performance through reproducible validation harnesses and optional on-policy distillation.
Outcomes
What it gets done
Quantize 122B parameter MoE models from 245GB to 47GB using per-expert 3-bit and backbone 4-bit compression
Validate compressed model performance against baselines across knowledge, reasoning, multilingual, and multimodal benchmarks
Package quantized models as deployable GGUF artifacts that run on single 80GB GPUs with expert offloading
Apply optional Lightning-OPD on-policy distillation to recover capability gaps in code and math domains
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/general-instinct-instinctrazor | bash Overview
InstinctRazor
InstinctRazor quantizes any Hugging Face model to sub-4-bit precision (INT3 experts, INT4 backbone) and recovers most of the resulting quality loss with on-policy distillation into a per-expert LoRA, at no extra footprint. Supporting a new model family needs only one ModelAdapter, not a fork. Use it to deploy a large Hugging Face model, especially MoE, below 4 bits per weight with recovered accuracy; not needed for standard 4-bit-or-above quantization where AWQ/GPTQ/RTN already suffice.
What it does
InstinctRazor quantizes any Hugging Face model to sub-4-bit precision and then recovers the resulting quality loss with on-policy distillation, OPD, distilling the original BF16 teacher's completed generation trajectories into a per-expert LoRA on the quantized student, re-quantizing afterward so the footprint stays unchanged. Supporting a new model family requires writing one ModelAdapter, not forking the whole pipeline; per-model code is keyed on the model's config.model_type, and coverage is validated against transformers 5.9 in tests/test_adapter_coverage.py.
Its default quantization recipe uses INT3 for expert weights and INT4 for the backbone, in groups of 128 with symmetric clip-search, no calibration data needed, while protecting the router, norms, and vision components in BF16, yielding an effective bit-width of about 3.05. It also supports comparing against AWQ, GPTQ, RTN, and ParoQuant at matched bit-widths, deploying either as a llama.cpp GGUF file or a dequantized-BF16 checkpoint for clean evaluation, and evaluating against MMLU-Pro, GPQA, MMMLU, MATH-500, AIME, LiveCodeBench, HumanEval, MBPP, HLE, and multimodal benchmarks. It handles fused-expert MoE, separate-expert MoE, and dense model layouts with shape-agnostic quantization math; quantization is universal since transformers 5.x already batches every MoE family into fused expert tensors, but OPD recovery needs the model's experts to share a common reference forward pass, gate_up_proj and down_proj, chunk(2), routing-in-parent, validated on qwen3_moe, while families with different expert math, such as gpt_oss's bias-plus-clamp-plus-interleaved-GLU, need a small per-family expert-compute hook for OPD, quantization itself still works universally.
./razor --model <any-hf-model> --quant instinct-iq3 --recover opd --eval mmlu_pro,gpqa,math500
Two worked results: quantizing Qwen3.5-122B-A10B produces a 47 GB GGUF that runs on a single 80 GB GPU, and the shipped 122B IQ3_XXS artifact, 48 GiB, scores MMLU-Pro 90.7 and GPQA 80.8 at 115.9 tokens per second on one H100, 45.7 tokens per second with expert offload, beating a footprint-matched Gemma-4-26B-A4B on MMLU-Pro, 88.5 vs 85.6, GPQA-Diamond, 84.8 vs 79.3, and MMMU-Pro, 80.8 vs 73.8, though the BF16 teacher and Gemma both edge it out on LiveCodeBench v6. Applying OPD recovery to a 3-bit Qwen3.6-35B-A3B student raises MATH-500 accuracy from 81.7 to 89.2, versus a 90.0 BF16 teacher, and GPQA accuracy from 68.7 to 77.3, versus 84.3 for the teacher, with most of the gap traced to answer truncation, which OPD sharply reduces, from 19 out of 120 to 1 out of 120 truncated on MATH-500 and 64 out of 198 to 30 out of 198 on GPQA.
When to use - and when NOT to
Use this when you need to shrink a Hugging Face model below 4 bits per weight while recovering most of the resulting quality loss, especially for MoE models where per-expert quantization and OPD apply cleanly. It is not needed if a model only requires standard 4-bit-or-above quantization, AWQ, GPTQ, and RTN are supported as comparison baselines, not replaced, and OPD recovery specifically only works out of the box on fused-MoE families sharing the standard expert forward pass, atypical expert math needs a custom hook first.
Inputs and outputs
Input is any Hugging Face model identifier plus a quantization recipe, instinct-iq3, a GGUF type like Q4_K_M, or a dequant recipe like clip, awq, gptq, or rtn, and, for recovery, a --recover opd flag with a --student checkpoint. Output is a quantized GGUF file or a dequantized-BF16 evaluation checkpoint, optionally recovered via OPD, plus evaluation scores on the requested benchmark set.
Integrations
Hugging Face Transformers, 5.x, adapter keyed on config.model_type, llama.cpp for writing and serving GGUF files, and a separate training virtual environment with a different torch build specifically for OPD recovery.
Who it's for
ML engineers who need to deploy large Hugging Face models, especially large MoE models, at sub-4-bit precision on limited GPU memory while recovering most of the accuracy lost to quantization.
Source README
InstinctRazor
Sub-4-bit quantization + on-policy recovery for any Hugging Face model.
Point it at any model - InstinctRazor quantizes it sub-4-bit, then recovers the loss with on-policy
distillation. A new family is one ModelAdapter, not a fork.
./razor --model <any-hf-model> --quant instinct-iq3 --recover opd --eval mmlu_pro,gpqa,math500
- Qwen3.5-122B-A10B → 47 GB GGUF, runs on one 80 GB GPU
- Qwen3.6-35B + OPD → MATH-500 81.7 → 89.2, at the same footprint
GGUF release on Hugging Face. Worked examples below.
Features
- Any model - fused-expert MoE, separate-expert MoE, and dense layouts (shape-agnostic quant math)
- Quantize - INT3 experts / INT4 backbone / BF16 protected (router, norms, vision); group-128 clip-search, no calibration data
- Recover (OPD) - distill the BF16 teacher into a per-expert LoRA, re-quantize; footprint unchanged
- Compare - AWQ / GPTQ / RTN / ParoQuant at matched bits
- Deploy - llama.cpp GGUF, or a dequantized-BF16 checkpoint for clean eval
- Eval - MMLU-Pro, GPQA, MMMLU, MATH-500, AIME, LiveCodeBench, HumanEval, MBPP, HLE, multimodal
Install
python3.12 -m venv vllm_venv && source vllm_venv/bin/activate && pip install -r requirements.txt
MOE_LOWBIT_VENV=$PWD/vllm_venv source env.sh
That core install is enough to quantize and evaluate. Two extra pieces, each needed only for one feature:
llama.cpp - the tool that writes .gguf files (used by both razor --quant <gguf-type> and the deploy
script). Skip it if you only do --recipe ... --no-gguf eval. Build once (CPU build is enough):
git clone https://github.com/ggml-org/llama.cpp && cd llama.cpp
cmake -B build -DGGML_CUDA=OFF && cmake --build build -j --target llama-quantize llama-server
export LLAMA_CPP=$PWD
train venv - only for OPD recovery (--recover opd); it needs a different torch:
python3.12 -m venv train_venv && train_venv/bin/pip install -r requirements-train.txt
Usage
./razor --model Qwen/Qwen3.6-35B-A3B --quant instinct-iq3 --out runs/q36
./razor --model meta-llama/Llama-3.1-8B-Instruct --quant Q4_K_M --eval mmlu_pro,gpqa
./razor --model Qwen/Qwen3.6-35B-A3B --recover opd --student models/q36_ptq3b_clip
./razor --model Qwen/Qwen3-0.6B --quant Q4_K_M --eval mmlu_pro --eval-n 16 --dry-run
| Flag | Meaning |
|---|---|
--quant |
GGUF type (Q4_K_M, IQ3_XXS, …) or InstinctRazor recipe (instinct-q3, instinct-iq3) → .gguf |
--recipe |
clip / awq / gptq / rtn → dequant-BF16 eval checkpoint (no GGUF) |
--recover opd |
recover a quantized --student via OPD (--recover-smoke = FSDP smoke only) |
--eval |
comma-separated benchmarks; --budget 32k|64k, --eval-n to cap samples |
--dry-run |
print the plan, run nothing |
Supported models
Same pipeline for all; one adapter (keyed on config.model_type) is the only per-model code. Coverage is validated against transformers 5.9 in tests/test_adapter_coverage.py.
| Family | model_type |
Quantize | OPD |
|---|---|---|---|
| Qwen3.5 / 3.6 MoE | qwen3_5_moe |
✅ | ✅ |
| Fused MoE | mixtral, qwen2_moe, qwen3_moe, olmoe, qwen3_next, deepseek_v3 |
✅ | ✅ |
| Fused MoE (quant-only) | deepseek_v2, phimoe, gpt_oss, minimax, jamba |
✅ | hook* |
| Atypical MoE | dbrx, granitemoe |
✅ | hook* |
| Dense | llama, mistral, qwen2, qwen3, gemma2, gemma3, phi3 |
✅ | - |
| Anything else | generic fallback | ✅ | hook* |
* Quantize is universal - transformers 5.x batches every MoE family into fused expert tensors, and the gate/router is auto-protected. OPD recovery works for any fused MoE whose experts share the reference forward (gate_up_proj/down_proj, chunk(2), routing-in-parent) - validated on qwen3_moe. Families with a different expert math (e.g. gpt_oss: bias + clamp + interleaved GLU) need a small per-family expert-compute hook; the FSDP training, recipe, merge, and eval are all shared.
Quantization recipe
The default recipe applied to any model:
| Experts | Backbone | Group | Method | Protected (BF16) | Effective bits |
|---|---|---|---|---|---|
| INT3 | INT4 | 128 | symmetric clip-search | router, norms, vision | ~3.05 |
Examples
Quantize - Qwen3.5-122B-A10B
InstinctRazor (~47 GB) vs. footprint-matched Gemma-4-26B-A4B and the BF16 teacher.
| Benchmark | Teacher | InstinctRazor | Gemma-4-26B-A4B |
|---|---|---|---|
| MMLU-Pro | 87.6 | 88.5 | 85.6 |
| GPQA-Diamond | 83.8 | 84.8 | 79.3 |
| MMMLU | 88.8 | 87.2 | 85.4 |
| MMMU-Pro | - | 80.8 | 73.8 |
| LiveCodeBench v6 | 65.5 | 57.0 | 66.0 |
| HLE (no tools) | 18.0 | 13.3 | 12.3 |
Pack the deployable GGUF (reproduces the shipped 122B IQ3_XXS protected artifact - tensor-type recipe + imatrix; needs llama.cpp from Install):
BASE_TYPE=IQ3_XXS bash pipelines/pack_gguf.sh
122B IQ3_XXS (48 GiB): MMLU-Pro 90.7, GPQA 80.8, 115.9 tok/s on 1×H100 (45.7 with expert offload).
Recover - Qwen3.6-35B-A3B
OPD on the 3-bit student (matched 32k eval). The gap is mostly truncation; distilling completed teacher trajectories recovers it at no extra footprint.
| GPQA acc | trunc | MATH-500 acc | trunc | |
|---|---|---|---|---|
| baseline (3b) | 68.7 | 64/198 | 81.7 | 19/120 |
| + OPD | 77.3 | 30/198 | 89.2 | 1/120 |
| teacher (BF16) | 84.3 | 11/198 | 90.0 | 1/120 |
Citation
@software{instinctrazor2026,
title={InstinctRazor}, author={General Instinct}, year={2026},
url={https://github.com/General-Instinct/InstinctRazor}
}
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.