diffq
Differentiable quantization framework for PyTorch.
Decision gist · record as of 2026-08-14
No. The package is abandoned (last commit 2023-05-05) and licensed under CC-BY-NC 4.0, restricting use to non-commercial purposes only. Unless you are conducting non-commercial research and can tolerate no future updates, use an actively maintained quantization library instead.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.7 or later and PyTorch 1.7.1 ideally.
- Compiled dependencies (Cython, numpy, torch) must be installed; prebuilt wheels are available for common platforms but may not exist for all architectures.
- Medium install friction due to compiled dependencies (Cython, numpy, torch).
License · maintenance · safety
non-commercial license (noncommercial) — Licensed under CC-BY-NC 4.0 (noncommercial), which restricts use to non-commercial purposes only. Commercial deployment or integration into proprietary products is not permitted without explicit permission.
last release 2023-05-05 (1197 days) · last repo commit 2023-05-05 · 239 stars · archived
0 known vulnerabilities (OSV.dev, 2026-08-14) · 120,635 downloads/mo, #12,015 on PyPI
Alternatives
Verify before relying
pip install diffq
import torch
from diffq import DiffQuantizer
model = MyModel()
optim = torch.optim.Adam(model.parameters())
quantizer = DiffQuantizer(model)
quantizer.setup_optimizer(optim)
for batch in loader:
loss = criterion(model(x), y) + 1e-3 * quantizer.model_size()
optim.zero_grad()
loss.backward()
optim.step()
torch.save(quantizer.get_quantized_state(), "model.th")- Whether the package remains compatible with PyTorch versions released after 2023-05-05
- Whether TorchScript export (noted as experimental) is production-ready
- Whether int8 in-memory support mentioned as 'coming up' was ever implemented
What it is and what it does
DiffQ is a PyTorch quantization framework that reduces model size by automatically determining optimal bit-widths for individual weights or weight groups during training. It uses pseudo quantization noise injection to make the quantization process differentiable, allowing the bit allocation itself to be optimized as part of the training loop alongside model weights.
The package integrates with standard PyTorch training pipelines: you attach a DiffQuantizer to your model before creating the optimizer, then add a model-size penalty term to your loss function. During training, the quantizer learns which weights need more bits and which can use fewer, trading off compression against accuracy. At inference, it automatically switches to true quantized weights, and you can export the compressed model to disk or TorchScript format.
Use it for
- Compress large transformer or CNN models for deployment on memory-constrained devices while maintaining accuracy
- Automatically determine per-layer or per-group bit allocations during training without manual hyperparameter tuning
- Export quantized models to TorchScript for optimized inference with reduced memory footprint
- Research differentiable quantization methods and compare compression-accuracy tradeoffs across architectures
- Reduce model size for distributed training or inference in bandwidth-limited environments
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
No.
The package is abandoned (last commit 2023-05-05) and licensed under CC-BY-NC 4.0, restricting use to non-commercial purposes only. Unless you are conducting non-commercial research and can tolerate no future updates, use an actively maintained quantization library instead.
Install
diffq on PyPI
Before you install
Medium install friction due to compiled dependencies (Cython, numpy, torch). The package is abandoned as of 2023-05-05 with no recent maintenance, so expect no bug fixes or compatibility updates.
Requires Python 3.7 or later and PyTorch 1.7.1 ideally. Compiled dependencies (Cython, numpy, torch) must be installed; prebuilt wheels are available for common platforms but may not exist for all architectures.
License in practice
Licensed under CC-BY-NC 4.0 (noncommercial), which restricts use to non-commercial purposes only. Commercial deployment or integration into proprietary products is not permitted without explicit permission.
Quickstart
pip install diffq
import torch
from diffq import DiffQuantizer
model = MyModel()
optim = torch.optim.Adam(model.parameters())
quantizer = DiffQuantizer(model)
quantizer.setup_optimizer(optim)
for batch in loader:
loss = criterion(model(x), y) + 1e-3 * quantizer.model_size()
optim.zero_grad()
loss.backward()
optim.step()
torch.save(quantizer.get_quantized_state(), "model.th")
Verify before relying
- Whether the package remains compatible with PyTorch versions released after 2023-05-05
- Whether TorchScript export (noted as experimental) is production-ready
- Whether int8 in-memory support mentioned as 'coming up' was ever implemented
Package facts
| License | non-commercial license noncommercial |
| Python support | Supports the current Python release >=3.7.0 |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | 3 packagesCythonnumpytorch |
| Maintenance | Abandoned 1,197 days since the last release |
| Last repo commit | repository archived |
| First released | |
| Downloads | 120,635 / month, #12,015 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Topic :: Scientific/Engineering :: Artificial Intelligence |
Evidence: diffq-0.2.4-cp310-cp310-macosx_10_9_universal2.whl; diffq-0.2.4-cp310-cp310-macosx_10_9_x86_64.whl; diffq-0.2.4-cp310-cp310-macosx_11_0_arm64.whl; diffq-0.2.4-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl; diffq-0.2.4-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl; diffq-0.2.4-cp310-cp310-win32.whl; diffq-0.2.4-cp310-cp310-win_amd64.whl; diffq-0.2.4-cp37-cp37m-macosx_10_9_x86_64.whl; diffq-0.2.4-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl; diffq-0.2.4-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl; diffq-0.2.4-cp37-cp37m-win32.whl; diffq-0.2.4-cp37-cp37m-win_amd64.whl; diffq-0.2.4-cp38-cp38-macosx_10_9_universal2.whl; diffq-0.2.4-cp38-cp38-macosx_10_9_x86_64.whl; diffq-0.2.4-cp38-cp38-macosx_11_0_arm64.whl; diffq-0.2.4-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl; diffq-0.2.4-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl; diffq-0.2.4-cp38-cp38-win32.whl; diffq-0.2.4-cp38-cp38-win_amd64.whl; diffq-0.2.4-cp39-cp39-macosx_10_9_universal2.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “differentiable quantization”
- diffqDiffQ performs differentiable quantization of PyTorch models using…
- juliusJulius provides differentiable, GPU-accelerated digital signal…
- tensorflow-graphicsTensorFlow Graphics provides differentiable graphics and geometry…
Give your agent the search over MCP, or paste the wish link into any chat.
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to call 100+ LLM providers (OpenAI, Anthropic, Gemini, Bedrock, Azure, and others) using OpenAI-compatible API format, available as both a Python SDK and a self-hosted AI Gateway proxy server.
Install it if you need to work with multiple LLM providers or want to centralize LLM routing in your organization.
Client library and CLI tool for downloading, uploading, and managing models, datasets, and repositories on the Hugging Face Hub platform.
Install it if you work with Hugging Face Hub models or datasets.
LangChain provides a framework for building agents and LLM-powered applications by composing language models, tools, and memory through a unified API that abstracts over multiple model providers.
hf-xet provides chunk-based deduplication and efficient file transfer for the Hugging Face Hub, enabling faster uploads and downloads of large files with local disk caching.
Tokenizers converts raw text into token sequences for NLP models, with support for training custom vocabularies and using pre-built tokenizers (BPE, WordPiece) optimized for speed via Rust.
Transformers provides a unified framework for loading, fine-tuning, and running state-of-the-art pretrained models across text, vision, audio, video, and multimodal tasks using PyTorch, JAX, or TensorFlow.
Install it if you need to run or train any transformer-based model for NLP, vision, audio, or multimodal tasks.
See also optimum-quanto · ai-edge-quantizer · vector-quantize-pytorch · qonnx · aqtp · nvidia-modelopt · model-compression-toolkit · torchao · auto-gptq · qwix