Metadata-Version: 2.4
Name: hlwq
Version: 0.0.1
Summary: Hadamard-Lloyd Weight Quantization for LLMs (placeholder reservation)
Author: Caio Vicentino
License: Apache-2.0
Project-URL: Homepage, https://arxiv.org/abs/2603.29078
Keywords: quantization,llm,compression,hadamard,lloyd-max
Classifier: Development Status :: 1 - Planning
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# HLWQ — Hadamard-Lloyd Weight Quantization

**Status: name reservation (v0.0.1).** The full implementation will land in subsequent releases.

HLWQ is a post-training weight quantization technique for large language models. It compresses each block of weights via three steps:

1. **Per-block normalization** to the unit hypersphere
2. **Walsh-Hadamard rotation** to transform coordinates into approximately Gaussian random variables
3. **Lloyd-Max scalar quantization** with centroids matched to the post-rotation Gaussian distribution

The combination achieves near-lossless compression at 5 bits per weight on Qwen3.5-9B (PPL 6.40 vs FP16 baseline 6.37), without any calibration data.

## Reference

Vicentino, C. *PolarQuant: Optimal Gaussian Weight Quantization via Hadamard Rotation for LLM Compression.* arXiv:2603.29078, 2026.

## Naming history

This technique was originally published under the name **PolarQuant** in the arxiv paper above. It is being rebranded to **HLWQ (Hadamard-Lloyd Weight Quantization)** to disambiguate from an unrelated, earlier algorithm also named PolarQuant published by Google Research:

> Han, I., Kacham, P., Karbasi, A., Mirrokni, V., and Zandieh, A. *PolarQuant: Quantizing KV Caches with Polar Transformation.* arXiv:2502.02617, 2025.

Han et al.'s PolarQuant addresses **KV cache compression** with a random rotation (polar transformation). HLWQ addresses **weight compression** with a deterministic Walsh-Hadamard rotation. The applications and rotation mechanisms differ; only the historical name overlapped, and HLWQ is the disambiguated brand going forward.

## License

Apache-2.0
