Low-bit vector and KV-cache compression research toolkit for PyTorch
Project description
Tiny TurboQuant
Tiny TurboQuant is a lightweight PyTorch research toolkit for low-bit vector compression and KV-cache compression experiments.
It includes:
- real
uint8bit-packing for low-bit indices - MSE-style scalar quantization
- product / inner-product-oriented quantization experiments
- outlier-split quantization
- a Hugging Face-compatible KV-cache prototype
- demos for ANN search, embedding compression, and KV-cache memory measurement
Important limitation
This package demonstrates packed memory compression. It is not a production compressed-attention engine. The KV-cache wrapper still dequantizes tensors before attention. Real latency gains require fused CUDA/Triton kernels or integration with an inference engine such as vLLM or TensorRT-LLM.
Install from local wheel
pip install tiny_turboquant-0.1.0-py3-none-any.whl
Basic usage
import torch
from tiny_turboquant import TurboQuantMSE, TurboQuantKVCache
x = torch.randn(128, 64)
x = x / x.norm(dim=-1, keepdim=True)
q = TurboQuantMSE.build(d=64, bits=4)
idx = q.quant(x)
x_hat = q.dequant(idx)
cache = TurboQuantKVCache(bits=4)
Run tests
python -m pytest
Run demos from source checkout
python -m demos.demo1_distortion_vs_theory
python -m demos.demo2_ann_vs_pq
python -m demos.demo3_real_embeddings
python -m demos.demo4_kv_cache
Scope
Use this package for:
- compressed vector-search experiments
- RAG embedding compression experiments
- KV-cache memory/quality tradeoff experiments
- educational or research benchmarking
Do not claim it provides production-speed LLM inference. It reduces packed storage; speed requires optimized compressed-attention kernels.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tiny_turboquant-0.1.0.tar.gz.
File metadata
- Download URL: tiny_turboquant-0.1.0.tar.gz
- Upload date:
- Size: 31.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc7d30c35af2b9b6430b021b8d7f51311079c0d6e4f5463b6a3fd56df81b6922
|
|
| MD5 |
c79efc71be210e3012ce28d743e26ab6
|
|
| BLAKE2b-256 |
becc6916e9539d99fb8e177592d0c544be8953136d72ec7904bb22b97481bd28
|
File details
Details for the file tiny_turboquant-0.1.0-py3-none-any.whl.
File metadata
- Download URL: tiny_turboquant-0.1.0-py3-none-any.whl
- Upload date:
- Size: 35.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d5254c00287e66ec7be5e066ecc3dc0cf2c711811fae055a33afb69d8fb0985
|
|
| MD5 |
82be29d4a429c0c335961054b693a26d
|
|
| BLAKE2b-256 |
cd73d24133454f352219ad9688c627d9bf8630004c14f475c549298f32a3f582
|