TQ4_1S Weight Compression

April 4, 2026 · View on GitHub

Post-training weight compression for llama.cpp. No retraining, no calibration data. One command.

Code: TheTom/llama-cpp-turboquant (merged to main). PR #45 has the full testing log. Paper: weight-compression-tq4.md Getting Started: getting-started.md

At a Glance

MetricValue
Independent testers14+
GPUs tested14+ across 5 families
Models tested13+ across 7 families
Compression from Q8_028–42% smaller
PPL impact (Qwen/Phi)+0.4–3.9%
PPL impact (Llama Hybrid)+1.3–16% (depth dependent)
Regressions on uncompressed modelsZero
Weight + KV stacking penaltyNone measured

Models Tested

ModelParamsFamilyConfigCompressed SizePPL Delta
Qwen2.5-1.5B1.5BQwenConfig I1.28G+1.7–1.9%
Qwen2.5-3B3BQwenConfig I2.32G+1.73%
Qwen2.5-7B7.6BQwenConfig I5.17G+1.71%
Qwen3.5-27B26.9BQwenConfig I19.1G+1.3–2.5%
Qwen3.5-35B MoE34.7BQwenConfig I21.6G+1.4%
Qwen2.5-72B72.7BQwenConfig I45.8G+3.9%
Phi-414.7BPhiConfig I9.9G+0.76–1.0%
Llama 3.1 70B70.6BLlamaHybrid40.2G+16%
Llama 3.1 70B70.6BLlamaPremium49.8G+5.8%
Llama 3.2-3B3.2BLlamaHybrid2.10G+1.9%
Mistral 7B v0.37.2BMistralHybrid4.40G+1.28%
Mistral 7B v0.37.2BMistralPremium5.46G+0.41%
Gemma 4 31B30.7BGemmaConfig I18.9GTBD
Gemma 4 26B A4B MoE26BGemmaConfig I24.4G-2.3% (better)

Will This Run on My GPU?

This table shows the largest compressed model each GPU has successfully run. It's not a full model-per-GPU matrix because "will it fit" depends on your source quant, compression config, KV cache type, and context length. The Model Results section below has the exact before/after sizes so you can do the math for your setup.

GPUVRAMLargest TestedStatusDecode vs Q8_0Tester
RTX PRO 6000 Blackwell96GB27B109% (Config I faster than Q8_0)Community (CUDA)
RTX 509032GB27B107% (load-time conversion)Community (CUDA)
RTX 409024GB14B Config I, 27B+KV63–67% (fused), 100% (load-time)Community (CUDA)
RTX 4070 Ti12GB9B (KV only so far)2.25x faster with turbo3 KVCommunity (CUDA)
RTX 309024GB7B29% (fused kernel)Community (CUDA)
2x L40S96GB27B+81%Community (CUDA)
Dual 409048GB27B+71%Community (CUDA)
4090 + 4060mixed27B82%Community (CUDA)
M5 Max128GB72B94–102%Internal (Metal)
M4 Max64GB27B85–99%Community (Metal)
M2 Pro32GB7B~85%Internal (Metal)
M1 Max64GB27B63%Community (Metal)
2x V10040GB27B109% (Config I faster than Q8_0)Community (CUDA)
GTX 1080 Ti11GB7B106–111% (Config I faster than Q8_0)Internal (CUDA)
AMD RX 9070 XT16GB1.5B130% (Config I faster than Q8_0)Internal (HIP, Windows)
RTX 30506GB35B MoE (CPU offload)APEX-I-Quality, Windows CUDA 12.9Community (CUDA)
AMD RX 66008GB1.1B (CPU fallback)⚠️GPU matmul broken (not our bug)Community (HIP)

Note: CUDA decode speed varies by kernel version. Load-time TQ4_1S→q8_0 conversion (Community contributor) gives 100% native q8_0 speed at compressed file size.


Model Results

Qwen — Config I (full support)

ModelSourceCompressedReductionPPL DeltaDecode %Tested By
Qwen2.5-1.5B1.76G1.28G-27%+1.7–1.9%96% (Metal), 70% (4090)Multiple testers
Qwen2.5-3B3.37G2.32G-31%+1.73%67% (4090)Community (CUDA)
Qwen2.5-7B7.54G5.17G-31%+1.71%64% (4090), 99% (M4 Max)Community (CUDA), Community (Metal)
Qwen3.5-27B26.6G19.1G-28%+0.05% (PRO 6000), +1.3% (Metal), +2.5% (L40S)109% (PRO 6000), 99% (M5), 85% (M4), 81% (L40S), 107% (5090)Multiple testers
Qwen3.5-35B MoE34.4G21.6G-37%+1.4%102% (Metal)Internal (Metal)
Qwen2.5-72B72.0G45.8G-38%+3.9% (8ch)95% (Metal)Internal (Metal)

Phi — Config I (full support)

ModelSourceCompressedReductionPPL DeltaDecode %Tested By
Phi-4 14B14.5G9.9G-32%+0.76–1.0%254% (Metal), 67% (4090)Multiple testers

Llama — Hybrid/Premium (FFN sensitive to WHT)

Do not use Config I on Llama. Use Hybrid (Q4_K for all FFN) or Premium (Q5_K/Q6_K for FFN).

ModelConfigSourceCompressedReductionPPL DeltaDecode %Tested By
Llama 3.1 70BHybrid69.8G40.2G-42%+16%133% (Metal)Internal (Metal)
Llama 3.1 70BPremium69.8G49.8G-29%+5.8%fastInternal (Metal)
Llama 3.2-3BHybrid3.19G2.10G-34%+1.9%98% (4090)Community (CUDA)
Llama 3.2-3BPremium3.19G2.52G-21%+0.78%93% (4090)Community (CUDA)

Why Llama is different: Llama amplifies per-layer quantization error 6–8x more than Qwen/Phi in FFN layers. The effect scales with depth — 3B Llama is fine, 70B needs Premium. See paper Section 5.7 for the full investigation.

Mistral — Hybrid/Premium (better than expected)

ModelConfigSourceCompressedReductionPPL DeltaDecode %Tested By
Mistral 7B v0.3Hybrid7.17G4.40G-39%+1.28%108% (4090)Community (CUDA)
Mistral 7B v0.3Premium7.17G5.46G-24%+0.41%99% (4090)Community (CUDA)

Mistral extends LlamaModel but quality impact is much lower than Llama 70B. Premium at +0.41% is effectively free.

Gemma — Working (MoE limits weight compression benefit)

ModelSourceCompressedReductionPPL DeltaDecode %Tested By
Gemma 4 26B A4B MoE25.0G24.4G-2.3%-2.3% (better)100%Community (RTX 5090)

Minimal weight compression benefit on Gemma 4 because it's MoE with very few dense attention layers. KV cache compression is the real win here:

Gemma 4 KV memory (RTX 5090, Q4_K_XL, 128k context):

KV ConfigKV SizeSavings
q8_0/q8_01,519 MiB
q8_0/turbo41,140 MiB-380 MiB (-25%)
q8_0/turbo31,039 MiB-480 MiB (-32%)

Savings are smaller than dense models because Gemma 4's hybrid sliding-window architecture limits full-context KV to 5 of 30 layers.

Note: ffn_down requested q4_k but fell back to q5_0 on incompatible tensor shapes.

Pre-Quantized APEX-I-Quality (Community GGUFs)

mudler's APEX collection provides pre-quantized Config I GGUFs. Tested on RTX 3050 6GB (Windows, CUDA 12.9, CPU offload for experts):

ModelBaseline PPLAsymmetric turbo3 PPLPPL DeltaKV Savings
Qwen3.5-35B-A3B-APEX-I-Quality6.586.62+0.62%-132 MiB
Qwen3-Coder-30B-APEX-I-Quality10.1510.28+1.27%-633 MiB

Stacking: Weights + KV Cache

Weight compression and TurboQuant KV compression stack with no additional penalty.

SetupConfirmed ByNotes
Config I + turbo3 KV (35B MoE, 32K ctx)Internal (Metal) (M5 Max)59% of baseline total memory, +1.4% PPL
Config I + turbo4 KV (27B)Community (CUDA) (2x L40S)No additional penalty from stacking
Config I + turbo4 KV (all 10 models)Community (RTX 4090)Stacks across every model tested
Config I + turbo4 KV (27B)Community (CUDA) (dual 4090)Confirmed independently
Config I + turbo3 KV (27B, 32K ctx)Community (RTX PRO 6000)Config I+turbo3 beats Q8_0+turbo3 by 7% decode, -2.5 GiB working set
TQ4_1S + turbo3 KV (8B, 100K ctx)Community (RTX 4090)5.8 GiB total, turbo3 actually faster than f16 at long ctx

Independent Validation — TurboQuantDC (662 tests, RTX 4090)

An independent implementation built from scratch in Python/PyTorch (MIT license) tested TQ4_1S weight compression + TurboQuant KV stacking and ran a 600+ configuration sweep. This is the most comprehensive independent validation of the approach.

TQ4_1S Weight + turbo3 KV Stacking (Llama 3.1 8B, RTX 4090)

WeightContextKV ConfigDecode t/sNotes
TQ4_1S8,192f1678.4
TQ4_1S8,192turbo386.5turbo3 faster (less VRAM pressure)
TQ4_1S48,000f1672.9near f16 ceiling
TQ4_1S56,000f16OOMf16 cannot allocate
TQ4_1S65,536turbo385.8turbo3 still running
TQ4_1S100,000turbo372.7
TQ4_1S112,000turbo3OOMturbo3 ceiling

turbo3 extends max context from ~48K to ~100K (2.1x) on the same GPU.

VRAM Budget (Llama 3.1 8B)

ConfigWeightKV @ 32KTotalMax Context
Q4_K_M + f16 KV4.58G~4.0G~8.6G~48K
TQ4_1S + f16 KV4.77G~4.0G~8.8G~48K
TQ4_1S + turbo34.77G~1.0G~5.8G~100K
TQ3_1S + turbo33.90G~1.0G~4.9G~110K+ (est)

70B on Single RTX 4090 (KV compression only, Q2_K weights)

Contextf16 KVturbo3 KVNotes
2,0481.94 t/s2.87 t/sturbo3 48% faster
8,192OOM2.68 t/sf16 cannot allocate
16,384OOM2.83 t/sturbo3 still running

turbo3 extends 70B max context from ~4K to ~16K (4x) on a single 4090.

PPL (wikitext-2, Llama 3.1 8B)

WeightKV ConfigPPLKV Delta
Q4_0f167.50baseline
Q4_0q8_0/turbo37.55+0.67%
Q4_0q8_0/turbo47.53+0.36%
TQ3_1Sf169.46baseline (TQ3)
TQ3_1Sq8_0/turbo39.58+1.22%

Research Findings (600+ config sweep)

FindingDetail
Boundary layer protectionFirst 2 + last 2 layers at higher precision recovers ~90% of quality gap. Confirmed independently.
QJL harmfulPaper's QJL stage hurts autoregressive quality. Random projection variance compounds across decode steps.
ResidualQuantDrop-in replacement for QJL: store sign(r_rotated) directly. Same 1-bit budget, no random projection. Matches f16 quality.
Per-head bit allocationHigh-entropy attention heads need +1 bit. Uniform bits waste budget on low-entropy heads.
FP16 hot windowKeeping last 64–128 tokens at f16 eliminates error accumulation. ~0% cost at long context (128/32K = 0.4%).

Note: TQ4_1S PPL evaluation crashed on this tester's setup (ggml_backend_tensor_copy assert). Speed benchmarks work fine. Under investigation.

Independent Validation -- WaveboSF (RTX 4090 + RTX 5090, spiritbuun fork)

WaveboSF tested KV cache compression on Llama 3.1 8B Instruct Q4_K_M using spiritbuun's fork with FA flags enabled on two GPUs: RTX 4090 24GB (Ada Lovelace, SM 89) and RTX 5090 32GB (Blackwell, SM 120, CUDA 12.8).

RTX 4090 (Ada Lovelace, SM 89)

KVpp512 vs f16tg128 vs f16Notes
q8_0turbo4+8.4%-6.2%Best config on Ada
turbo4turbo4+3.4%-16.8%Symmetric decode penalty

RTX 5090 (Blackwell, SM 120, CUDA 12.8)

KVLApp512 vs f16tg128 vs f16Notes
q8_0turbo41-3.2%-25.2%Asymmetric still wins
turbo4turbo41-8.0%-37.8%Symmetric decode penalty

Key findings:

  • Asymmetric q8_0-K/turbo4-V is the clear winner on both GPUs: better prefill and decode than symmetric
  • Symmetric turbo4/turbo4 decode penalty is nearly 3x worse than asymmetric on Ada, and ~1.5x worse on Blackwell
  • Blackwell decode regression is structural, not a bug. Ada uses dp4a integer tensor cores, Blackwell uses fp8/fp4 tensor cores. The architecture mismatch causes significant decode overhead for turbo dequant paths on Blackwell vs Ada
  • LA=1 (boundary layers at higher precision) improves decode speed on both GPUs in addition to its quality benefit
  • Confirms the asymmetric recommendation holds across both Ada (SM 89) and Blackwell (SM 120)
  • First spiritbuun fork validation with FA flags on Ada and Blackwell

Decode Speed by Hardware

HardwareBackendDecode vs Q8_0Notes
M5 Max 128GBMetal94–102%V2.1 fused kernel, NR0=8
M4 Max 64GBMetal85–99%99% on 7B, 85% on 27B
M2 Pro 32GBMetal~85%
M1 Max 64GBMetal63%Lower bandwidth (400 GB/s)
RTX 5090CUDA Blackwell107%Load-time conversion, Community tester
2x L40SCUDA Ada81%Datacenter
Dual 4090CUDA Ada71%Community (CUDA)
RTX 4090CUDA Ada63–67%Pre-NR0 fused kernel
RTX 3090CUDA Ampere29%Fused kernel only

Why CUDA varies: Metal uses V2.1 fused kernel with NR0=8 (amortizes WHT rotation across 8 rows). CUDA fused kernel is newer and still being optimized. Load-time TQ4_1S→q8_0 conversion sidesteps this entirely, giving 100% native speed.


Regression Checks

Zero regressions on uncompressed models across all tested hardware.

HardwareBaseline DeltaTested By
M5 Max+0.04% (noise)Internal (Metal)
M2 Prowithin noiseInternal (Metal)
2x L40S-0.2% pp, +0.04% tg (noise)Community (CUDA)
RTX 5090Q2_K and Q4_0 zero impactCommunity (CUDA)
RTX 4090 (Windows)all standard types within noiseCommunity (CUDA)
RTX 4090 (WSL2)Q4_0 through Q6_K all within noiseCommunity (CUDA)

Known Issues

IssueStatusImpact
GCC 13.3 extern build error✅ Fixed (e9c54d5)Build only
GCC 13/14 double extern in ops.cppKnown, fix pendingBuild only
Upstream attn_rot graph overflow (Phi-4)✅ Disabled by defaultNo user impact
CPU assert n>4096✅ Fixed (21110eb)CPU fallback only
Gemma 4 head_dim=256 crash✅ FixedPull latest PR head
TQ4_1S PPL eval crashUnder investigationSpeed benchmarks work, PPL path crashes on some configs
HIP gfx1032 matmul abortUpstream rocBLAS issueNot TQ-specific

Common Pitfalls

MistakeWhat HappensFix
Q4_K_M source instead of Q8_0Model gets BIGGERTQ4_1S (5.0 BPW) > Q4_K (4.5 BPW). Use Q8_0 source.
Loading compressed GGUF with standard llama.cppfailed to read tensor infoBuild from PR #45 branch. Standard llama.cpp doesn't know type IDs 44/45.
Missing --allow-requantize flagrequantizing from type q8_0 is disabledAdd --allow-requantize to quantize command.
Config I on Llama FFN+16% PPLUse Hybrid or Premium config for Llama family.
Mixing TQ and Q8_0 in same layer's attentionGarbage outputAll 4 attention tensors must be same type per layer.
Windows CUDA runtime errorDLL not foundAdd C:\CUDA\bin\x64 to PATH.

Confidence Rating

AreaConfidenceBasis
Runs on MetalHigh4 Apple Silicon chips, 6+ models, zero failures
Runs on CUDA AdaHigh4090, L40S, 5090, Windows + WSL2 + Linux
Runs on CUDA AmpereMedium3090 tested, 3070 KV-only
Runs on AMD HIPMediumRX 9070 XT (RDNA 4) works, 30% faster than Q8_0. RX 6600 (gfx1032) GPU matmul broken upstream
Compression ratio (28–42%)HighConsistent across all models and hardware
Quality (Qwen/Phi)High+0.4–3.9% PPL across 6 models, 5+ testers
Quality (Mistral)Medium1 model tested, +0.41–1.28%
Quality (Llama)MediumConfig-dependent, 3B fine but 70B needs Premium
Weight + KV stackingHigh4+ independent confirmations
No regression on uncompressedHigh6 hardware platforms, all pass

How to Contribute

Test on your hardware and post results on PR #45.

Model:
Params:
Source quant: Q8_0
Hardware:
VRAM:
Setup (single/multi GPU):

Before (size, BPW):
After (size, BPW):
Compression %:
Config (Config I / Hybrid / Premium):

Speed:
  Baseline pp512:
  Baseline tg128:
  Compressed pp512:
  Compressed tg128:
  Compressed + turbo4 KV tg128:

PPL (if measured):
  Baseline:
  Compressed:
  Delta:

Issues:
Verdict (works / partial / broken):

Important: source must be Q8_0. Include both baseline and compressed runs. Label whether weight-only or weight+KV stacked. Crashes and failures are equally valuable.


This is a living document. Results will be updated as new community data comes in. Last updated: 2026-04-04. Data sourced from PR #45 comments, X/Twitter community testing, and direct contributor reports.