Skip to main content

statequant

PyPI License

Recurrent-state quantization for linear-attention and SSM hybrid language models. statequant implements published state-quantization methods (PACE, DAMP, STEPQuant, Q-Mamba DSQ, LRB + BDR, LeapQuant, decay-weighted allocation, ...) behind one interface and runs them on every recurrent-state family with open-weight LLMs: Gated DeltaNet, KDA, Mamba2 / SSD, MiniMax lightning and RWKV-6 / RWKV-7.

  • Reference path (transformers / fla): every method on every supported model, for evaluation.
  • Packed Triton kernels: int4 / int8 / bf16 state storage with a decode buffer, for Gated DeltaNet, Mamba2 and KDA.
  • vLLM plugin: serve Qwen3.5 / Qwen3-Next, OLMo-Hybrid, Nemotron-H-style Mamba2 hybrids and Ling-3.0 with a packed recurrent state.

Installation

pip install statequant              # core (torch)
pip install "statequant[hf]"        # + transformers, for the reference path
pip install "statequant[hf,fla]"    # + flash-linear-attention kernels (GPU)
pip install "statequant[vllm]"      # + vLLM, for the serving plugin

Quickstart

import statequant as sq

q = sq.pace4()                           # or sq.pace48(), sq.damp_int8(), sq.lrb_bdr(), sq.leapquant(8), ...
sq.calibrate(model, q, calib_ids)        # only for methods with a fitted allocation
with sq.apply(model, q):                 # the method's published rounding schedule
    out = model.generate(ids, max_new_tokens=256)
print(sq.report(model, q))               # bits per state value, MiB per sequence

Serving with vLLM:

STATEQUANT_VLLM=pace4 vllm serve Qwen/Qwen3.5-4B --no-enable-prefix-caching

Implemented methods

method preset reference
PACE-4, PACE-4/8 pace4(), pace48() Haller et al., arXiv 2610.29545
DAMP (paper recipe) damp_paper_int8(), damp_paper_int4() Zhang et al., arXiv 2608.27513
DAMP (PACE evaluation variant) damp_int8(), damp_int4() as configured in PACE
STEPQuant stepquant(4), stepquant(6) Yao et al., arXiv 2609.38169; code
Q-Mamba DSQ qmamba_dsq() Chen et al., Findings of ACL 2025
LRB + BDR (Low-Rank Bypass, Bounded Directional Rounding) lrb_bdr(), bdr_int4() Li et al., arXiv 2610.15709
LeapQuant leapquant(8|6|4) Pan et al., arXiv 2609.38166
Decay-weighted (Gramian) bit allocation gramian(bits) arXiv 2609.30950
fp16 + stochastic rounding (Nemotron 3) nemotron() NVIDIA, arXiv 2604.12374
Round to nearest (baseline) rtn(bits, axis, group), int4_g128()

Formats, schedules and how to compose your own: docs/methods.md. Per-model quality of every method: docs/results.md.

Supported models

family models reference path packed kernels vLLM plugin
Gated DeltaNet Qwen3.5, Qwen3-Next, Qwen4-Exp, OLMo-Hybrid ✓ ✓ Qwen3.5 / Qwen3-Next, OLMo-Hybrid
KDA Ling-3.0, Kimi Linear, GLM-5-Next ✓ ✓ Ling-3.0
Mamba2 / SSD Nemotron-H / Nemotron-3, Falcon-H1, Granite-4.0-H, Bamba, Zamba2, Mamba2 ✓ ✓ MambaMixer2 models
lightning MiniMax ✓
RWKV-7 / RWKV-6 fla models ✓

Details per family, method coverage and model-specific notes: docs/models.md.

Results

vLLM 0.32 end to end, packed state vs stock:

vLLM concurrency and decode loss

Decode-step latency of the packed kernels:

decode step latency

Full tables and setups: docs/results.md.

Documentation

Citation

If you use statequant, please cite:

@article{haller2026pace,
  title   = {{PACE}: Periodic and Channel-Aligned Encoding of Four-Bit Recurrent States},
  author  = {Haller, Patrick and Laitenberger, Filipe and Akbik, Alan},
  journal = {arXiv preprint arXiv:2610.29545},
  year    = {2026}
}

@software{haller2026statequant,
  title   = {statequant: Recurrent-State Quantization for Hybrid Language Models},
  author  = {Haller, Patrick},
  url     = {https://github.com/HallerPatrick/StateQuant},
  version = {0.1.0},
  year    = {2026}
}

Please also cite the papers of the methods you use (listed in docs/methods.md).

License

Apache-2.0. See LICENSE.

Metadata

Release files for statequant 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for statequant 0.1.0
File Size Uploaded Provenance Actions
statequant-0.1.0.tar.gz 163.0 kB Without provenance Details for statequant-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for statequant 0.1.0
File Interpreter ABI Platform Actions
statequant-0.1.0-py3-none-any.whl Python 3 none any Details for statequant-0.1.0-py3-none-any.whl

Total release size: 296.9 kB

Release files / statequant-0.1.0.tar.gz

Download URL statequant-0.1.0.tar.gz
Size 163.0 kB
Tags Source
SHA-256 checksum
How to use checksums
8fab657f81256e18b7c8ab0138bb58f7cebcb111d8c27a7f6eb07a3a159992bf
BLAKE2b-256 checksum
How to use checksums
9bb19be92ef11b41e649e3adad143e0124a256c36d4b175392c6afc5226a8595
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Release files / statequant-0.1.0-py3-none-any.whl

Download URL statequant-0.1.0-py3-none-any.whl
Size 133.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ceb9197da4db7fa1c82b4ae6e420e04f44bfa404123250db4c93ff1fc27dd603
BLAKE2b-256 checksum
How to use checksums
adb565e36cf7e6ba613ecda430e2445dcde5e6e9aeaf471c0dd97498de98d9ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Security for statequant 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page