Skip to main content

TurboQuant implementation

Project description

TorbuQuant banner

TorbuQuant

LLM KV-cache compression, vector quantization, cache accounting, and serving-path experiments.

A GinkgoQ research implementation for measuring when compressed KV storage helps real long-context inference workloads.


Purpose

TorbuQuant is a Python package for studying and implementing TurboQuant-style LLM KV-cache compression. The repository keeps the research path and serving path separate:

Path Role
Diagnostic path Reconstructs or compares dense tensors so logits, attention outputs, and generation behavior can be inspected.
Serving path Stores historical K/V in packed byte layouts and measures whether that storage can improve capacity under a memory bound.

The project is built around three measurable goals:

  1. Reduce KV-cache storage bytes while counting metadata and workspace.
  2. Preserve model behavior under explicit quality gates.
  3. Improve practical serving capacity when KV memory, context length, or batch size is the bottleneck.

What Is In This Repository

Area Status
Codebooks Exact Beta-sphere Lloyd-Max codebooks and Gaussian approximation.
Rotation QR and RHT modes.
Vector quantization MSE direction quantization with packed index storage.
QJL Residual sign projection for vector and inner-product experiments.
KV formats K16, K8, K4 and V8, V4, V3, V2 helpers.
Cache accounting Packed bytes, norms, scales, zeros, metadata, recent windows, and workspace reports.
Attention Dense, dequantized, direct-QK, packed-V, and selected Triton decode paths.
vLLM integration Metadata, page geometry, page cache, registry, runtime selection, and verification helpers.
HuggingFace integration Diagnostic DynamicCache wrapper and Qwen evaluation scripts.
Qwen A/B Controlled baseline-vs-TurboQuant evaluation script with isolated run directories.

Install

Create and activate a Python environment, then install the repository from the project root:

Install from source

python -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -e .

Install from PyPI

python -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install ginkgoq-turboquant

Quick Checks

Run the repository test suite:

python -m pytest tests -q

Build the documentation site:

python -m mkdocs build --strict

Run the Qwen A/B evaluator with explicit scenario settings before making any memory, quality, or speed statement:

python scripts/qwen_ab_eval.py --help

Repository Map

turboquant/
  core/          codebooks, rotations, MSE quantization, QJL
  packing/       bit packing and byte accounting helpers
  kv/            compressed cache formats and memory reports
  attention/     dense, diagnostic, and packed-reference attention paths
  triton/        update/decode kernels and reference wrappers
  integration/   HuggingFace and vLLM integration layers
  quality/       comparison, retrieval, and generation metrics
scripts/         metadata, verification, benchmark, and Qwen A/B entry points
docs/            MkDocs Material publication site
tests/           unit and integration tests

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ginkgoq_turboquant-0.1.0.post1.tar.gz (122.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ginkgoq_turboquant-0.1.0.post1-py3-none-any.whl (153.9 kB view details)

Uploaded Python 3

File details

Details for the file ginkgoq_turboquant-0.1.0.post1.tar.gz.

File metadata

  • Download URL: ginkgoq_turboquant-0.1.0.post1.tar.gz
  • Upload date:
  • Size: 122.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for ginkgoq_turboquant-0.1.0.post1.tar.gz
Algorithm Hash digest
SHA256 668667c9dea806593939ff241797c346727f68809c5ee118cf0883c9f42c59d9
MD5 cda5e736bc273a591974012fe1109f25
BLAKE2b-256 2196fc96a7afa4da7329aa445e951e46348cbd53cdfa7f829df46c921968f918

See more details on using hashes here.

File details

Details for the file ginkgoq_turboquant-0.1.0.post1-py3-none-any.whl.

File metadata

File hashes

Hashes for ginkgoq_turboquant-0.1.0.post1-py3-none-any.whl
Algorithm Hash digest
SHA256 7b7b81811a90636f995434a05d584c04f37d4c3074ba0c9e83e075a6a6671052
MD5 484a1fd3f88247557964852116093d17
BLAKE2b-256 e8ad714475b1ebfbba60a354212f6bb4965b30447abc54349b8e9a9e46ef9fc9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page