caiovicentino1/Qwen3.5-9B-EOQ-v3

Model

1

stars

11

commits

4

linked in READMEs

Apr 6, 2026

updated

8-bit
awq
conversational
endpoints_compatible
entropy-optimal
eoq
hadamard
image-text-to-text
llm-compression
lloyd-max
polar-quant
quantization
qwen3.5
qwen3_5
safetensors
text-generation
transformers
Browse cluster: Quantized Qwen Language Models β†’

README

πŸ† EOQ v3 -- Qwen3.5-9B (PolarQuant + AWQ)

Near-lossless quantization: PPL 6.43 -- only +0.06 from FP16 6.37. The best quality result in the PolarQuant family.

EOQ v3 combines PolarQuant (Hadamard + Lloyd-Max) with AWQ (Activation-Aware Weight Quantization) to achieve 93% reduction in quantization error vs standard absmax. This is practically indistinguishable from the full-precision model.


🎯 Key Results

MetricValue
MethodPolarQuant Q5 + AWQ
Perplexity (WikiText-2)6.43
FP16 Baseline6.37
Delta from FP16+0.06 (near-lossless!)
Download Size~5 GB (3.6x compression)
Load Time9s (5x faster than FP16's 53s)
Throughput45.8 tok/s (identical to FP16)
GPU Dequant3.5s (one-time)

πŸ“Š Quality Evolution

Version Evolution

VersionTechniquePPLDeltaImprovement
v1Absmax uniform Q57.31+0.94Baseline
v2AWQ + mixed-bit7.05+0.6828% better
v3PolarQuant + AWQ6.43+0.0694% better

From v1 to v3: 93% reduction in quality loss (0.94 -> 0.06 PPL delta). PolarQuant + AWQ is the key combination.

Cross-Model Results

ModelFP16 PPLEOQ v3 PPLDelta
Qwen3.5-9B6.376.43+0.06
Qwen3.5-35B-A3B (MoE)5.195.36+0.17

πŸ”¬ How It Works

EOQ v3 combines two complementary techniques:

1. AWQ (Activation-Aware Scaling)

Protects important weight channels by pre-scaling them before quantization. Channels that carry more activation energy get higher precision.

2. PolarQuant (Hadamard + Lloyd-Max)

Transforms weight blocks to Gaussian via Hadamard rotation, then applies MSE-optimal Lloyd-Max quantization.

                              AWQ Pre-Scaling
                                    |
                                    v
Original Weights --> Scale Important Channels --> Normalize --> Hadamard Rotate
                                                                      |
                                                                      v
                                                            Lloyd-Max Quantize
                                                                      |
                                                                      v
                                                               Store Codes +
                                                              AWQ Scales +
                                                             Block Norms +
                                                            Centroid Table

Why They Combine Well

  • AWQ operates on channels (column-level scaling)
  • PolarQuant operates on blocks (128-element sub-vectors)
  • They address orthogonal sources of error: AWQ handles channel sensitivity, PolarQuant handles within-block distribution

πŸš€ Quick Start

from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained(
    "caiovicentino1/Qwen3.5-9B-EOQ-v3",
    dtype="bfloat16", device_map="auto", trust_remote_code=True
)
tokenizer = AutoTokenizer.from_pretrained("caiovicentino1/Qwen3.5-9B-EOQ-v3")

output = model.generate(
    **tokenizer("Write a detailed explanation of neural network quantization:", return_tensors="pt").to("cuda"),
    max_new_tokens=300
)
print(tokenizer.decode(output[0], skip_special_tokens=True))

With torchao INT4 (for maximum speed)

from torchao.quantization import quantize_, Int4WeightOnlyConfig

# After loading EOQ v3 model (already dequanted to BF16):
quantize_(model, Int4WeightOnlyConfig(group_size=128))
# Now runs at 43+ tok/s with 6.5 GB VRAM

πŸ”§ Technical Details

ComponentDetails
QuantizationPolarQuant Q5 + AWQ (5-bit, block_size=128)
AWQActivation-aware per-channel scaling (FP16 scales stored)
Rotation128x128 Walsh-Hadamard (self-inverse, deterministic)
CentroidsPre-computed MSE-optimal for N(0,1), stored in metadata (no scipy needed)
StorageBit-packed uint8 codes + fp16 norms + fp16 AWQ scales + fp32 centroids
GPU Dequantunpack -> centroid lookup -> inverse Hadamard -> scale by norm -> undo AWQ
Dequant Time3.5s (100x faster than CPU numpy)
Compression3.6x (17.9 GB -> ~5 GB)

Storage Format

{layer_name}.packed     -- bit-packed uint8 quantization codes
{layer_name}.norms      -- fp16 per-block normalization factors
{layer_name}.awq_scales -- fp16 per-channel AWQ importance scales
metadata:
  centroids             -- fp32 Lloyd-Max optimal centroid table (shared)
  bits_per_tensor       -- quantization bits (5 for Q5)

πŸ“Š Ablation

Ablation : Why Both Components Matter

ConfigurationPPLDelta
Absmax Q5 (baseline)7.31+0.94
AWQ only7.05+0.68
PolarQuant only6.56+0.19
PolarQuant + AWQ6.43+0.06

AWQ alone reduces error by 28%. PolarQuant alone reduces error by 80%. Together they reduce error by 94% -- the effects are complementary, not redundant.



πŸ“– Citation

@article{vicentino2026polarquant,
  title={PolarQuant: Optimal Gaussian Weight Quantization via Hadamard Rotation for LLM Compression},
  author={Vicentino, Caio},
  journal={arXiv preprint arXiv:2603.7424577},
  year={2026}
}

πŸ™ Acknowledgements

Built with PyTorch, torchao, AWQ methodology from MIT HAN Lab, and the Qwen team's open-weight models.

Contributors

caiovicentino1

11 commits

caiovicentino1/Qwen3.5-9B-EOQ-v3

Model

1

stars

11

commits

4

linked in READMEs

Apr 6, 2026

updated

8-bit
awq
conversational
endpoints_compatible
entropy-optimal
eoq
hadamard
image-text-to-text
llm-compression
lloyd-max
polar-quant
quantization
qwen3.5
qwen3_5
safetensors
text-generation
transformers
Browse cluster: Quantized Qwen Language Models β†’

README

πŸ† EOQ v3 -- Qwen3.5-9B (PolarQuant + AWQ)

Near-lossless quantization: PPL 6.43 -- only +0.06 from FP16 6.37. The best quality result in the PolarQuant family.

EOQ v3 combines PolarQuant (Hadamard + Lloyd-Max) with AWQ (Activation-Aware Weight Quantization) to achieve 93% reduction in quantization error vs standard absmax. This is practically indistinguishable from the full-precision model.


🎯 Key Results

MetricValue
MethodPolarQuant Q5 + AWQ
Perplexity (WikiText-2)6.43
FP16 Baseline6.37
Delta from FP16+0.06 (near-lossless!)
Download Size~5 GB (3.6x compression)
Load Time9s (5x faster than FP16's 53s)
Throughput45.8 tok/s (identical to FP16)
GPU Dequant3.5s (one-time)

πŸ“Š Quality Evolution

Version Evolution

VersionTechniquePPLDeltaImprovement
v1Absmax uniform Q57.31+0.94Baseline
v2AWQ + mixed-bit7.05+0.6828% better
v3PolarQuant + AWQ6.43+0.0694% better

From v1 to v3: 93% reduction in quality loss (0.94 -> 0.06 PPL delta). PolarQuant + AWQ is the key combination.

Cross-Model Results

ModelFP16 PPLEOQ v3 PPLDelta
Qwen3.5-9B6.376.43+0.06
Qwen3.5-35B-A3B (MoE)5.195.36+0.17

πŸ”¬ How It Works

EOQ v3 combines two complementary techniques:

1. AWQ (Activation-Aware Scaling)

Protects important weight channels by pre-scaling them before quantization. Channels that carry more activation energy get higher precision.

2. PolarQuant (Hadamard + Lloyd-Max)

Transforms weight blocks to Gaussian via Hadamard rotation, then applies MSE-optimal Lloyd-Max quantization.

                              AWQ Pre-Scaling
                                    |
                                    v
Original Weights --> Scale Important Channels --> Normalize --> Hadamard Rotate
                                                                      |
                                                                      v
                                                            Lloyd-Max Quantize
                                                                      |
                                                                      v
                                                               Store Codes +
                                                              AWQ Scales +
                                                             Block Norms +
                                                            Centroid Table

Why They Combine Well

  • AWQ operates on channels (column-level scaling)
  • PolarQuant operates on blocks (128-element sub-vectors)
  • They address orthogonal sources of error: AWQ handles channel sensitivity, PolarQuant handles within-block distribution

πŸš€ Quick Start

from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained(
    "caiovicentino1/Qwen3.5-9B-EOQ-v3",
    dtype="bfloat16", device_map="auto", trust_remote_code=True
)
tokenizer = AutoTokenizer.from_pretrained("caiovicentino1/Qwen3.5-9B-EOQ-v3")

output = model.generate(
    **tokenizer("Write a detailed explanation of neural network quantization:", return_tensors="pt").to("cuda"),
    max_new_tokens=300
)
print(tokenizer.decode(output[0], skip_special_tokens=True))

With torchao INT4 (for maximum speed)

from torchao.quantization import quantize_, Int4WeightOnlyConfig

# After loading EOQ v3 model (already dequanted to BF16):
quantize_(model, Int4WeightOnlyConfig(group_size=128))
# Now runs at 43+ tok/s with 6.5 GB VRAM

πŸ”§ Technical Details

ComponentDetails
QuantizationPolarQuant Q5 + AWQ (5-bit, block_size=128)
AWQActivation-aware per-channel scaling (FP16 scales stored)
Rotation128x128 Walsh-Hadamard (self-inverse, deterministic)
CentroidsPre-computed MSE-optimal for N(0,1), stored in metadata (no scipy needed)
StorageBit-packed uint8 codes + fp16 norms + fp16 AWQ scales + fp32 centroids
GPU Dequantunpack -> centroid lookup -> inverse Hadamard -> scale by norm -> undo AWQ
Dequant Time3.5s (100x faster than CPU numpy)
Compression3.6x (17.9 GB -> ~5 GB)

Storage Format

{layer_name}.packed     -- bit-packed uint8 quantization codes
{layer_name}.norms      -- fp16 per-block normalization factors
{layer_name}.awq_scales -- fp16 per-channel AWQ importance scales
metadata:
  centroids             -- fp32 Lloyd-Max optimal centroid table (shared)
  bits_per_tensor       -- quantization bits (5 for Q5)

πŸ“Š Ablation

Ablation : Why Both Components Matter

ConfigurationPPLDelta
Absmax Q5 (baseline)7.31+0.94
AWQ only7.05+0.68
PolarQuant only6.56+0.19
PolarQuant + AWQ6.43+0.06

AWQ alone reduces error by 28%. PolarQuant alone reduces error by 80%. Together they reduce error by 94% -- the effects are complementary, not redundant.



πŸ“– Citation

@article{vicentino2026polarquant,
  title={PolarQuant: Optimal Gaussian Weight Quantization via Hadamard Rotation for LLM Compression},
  author={Vicentino, Caio},
  journal={arXiv preprint arXiv:2603.7424577},
  year={2026}
}

πŸ™ Acknowledgements

Built with PyTorch, torchao, AWQ methodology from MIT HAN Lab, and the Qwen team's open-weight models.

Contributors

caiovicentino1

11 commits