Views
No views yet
[!IMPORTANT] Naming notice (2026-04-10). The "HLWQ" technique used in this model is being rebranded to HLWQ (Hadamard-Lloyd Weight Quantization). The change is only the name; the algorithm and the weights in this repository are unchanged.The rebrand resolves a name collision with an unrelated, earlier KV cache quantization method also named HLWQ (Han et al., arXiv:2502.02617, 2025). HLWQ addresses weight quantization with a deterministic Walsh-Hadamard rotation and Lloyd-Max scalar codebook; Han et al.'s HLWQ addresses KV cache quantization with a random polar rotation. The two methods are technically distinct.Existing loaders that load this repository by ID continue to work without changes. Future model uploads will use the HLWQ name.Reference paper for this technique: arXiv:2603.29078 (v2 in preparation; v1 still uses the old name).
| Component | Method | Result |
|---|---|---|
| Weights | HLWQ Q5 + torchao INT4 | 62.5 GB → 21.5 GB |
| KV Cache | HLWQ Q3 (Hadamard + Lloyd-Max) | 5.3x compression |
| Metric | Value |
|---|---|
| VRAM | 21.5 GB (streaming loader) |
| Speed | 24.9 tok/s |
| Dequant time | 37s (per-module GPU-accelerated) |
| Compression | BF16 62.5 GB → 21.5 GB (2.9x) |
Note: WikiText-2 PPL is not reported — Gemma 4 is a multimodal instruct model where raw-text PPL is not meaningful (BF16 baseline PPL = 1002). Generation quality is excellent (see examples below).
| Notebook | Description | GPU |
|---|---|---|
| ▶️ Inference Chat | Gradio chat UI, streaming loader | L4 / RTX 4090 (24 GB) |
| Quantization | How this model was quantized | A100 80 GB |
| GPU | VRAM | Fits? |
|---|---|---|
| RTX 4090 | 24 GB | ✅ Yes (2.5 GB headroom) |
| RTX 5090 | 32 GB | ✅ Comfortable |
| L4 | 24 GB | ✅ Yes |
| A6000 | 48 GB | ✅ Plenty |
| A100 40/80 GB | 40-80 GB | ✅ Full headroom |
| T4 | 16 GB | ❌ Too small for 31B |
| Method | Bits | Compression | tok/s |
|---|---|---|---|
| FP16 (baseline) | 16 | 1.0x | 24.9 |
| HLWQ Q4 | 4 | 4.0x | 24.8 |
| HLWQ Q3 | 3 | 5.3x | 24.8 |
| HLWQ Q2 | 2 | 8.0x | 24.8 |


To understand quantum computing, you first have to understand how a regular computer works... A classical bit is like a coin lying on a table — it's either Heads (1) or Tails (0). A qubit is like a coin spinning on the table — it is effectively both at the same time. This state of being in multiple states at once is called Superposition...
Correct implementation with proper docstring, O(log n) complexity, edge case handling.
The aurora borealis is caused by charged particles from the sun colliding with Earth's magnetic field...
nn.Sequential wrapper (vLLM pattern)1@article{polarquant2025,
2 title={HLWQ: Hadamard-Rotated Lloyd-Max Quantization for LLM Compression},
3 author={Vicentino, Caio},
4 journal={arXiv preprint arXiv:2603.29078},
5 year={2025},
6 url={https://arxiv.org/abs/2603.29078}
7}pip install git+https://github.com/caiovicentino/polarengine-vllm.git1from polarengine_vllm import HLWQModel
2
3model = HLWQModel.from_pretrained("caiovicentino1/Gemma-4-31B-it-HLWQ-Q5")
4print(model.generate("Hello, how are you?", max_new_tokens=100))1model = HLWQModel.from_pretrained("caiovicentino1/Gemma-4-31B-it-HLWQ-Q5", kv_cache_nbits=3)
2# KV cache now uses 5.3x less memory — fit longer conversations!
3print(model.generate("Explain quantum computing in detail.", max_new_tokens=500))polarquant bench caiovicentino1/Gemma-4-31B-it-HLWQ-Q5 --ppl --chartpolarquant demo caiovicentino1/Gemma-4-31B-it-HLWQ-Q5 --shareHLWQ Q5 (cos_sim > 0.996) > GGUF Q5_K_M (~0.99) at same size