PQuantML
PQuantML is an end-to-end library for training compressed machine learning models, developed at CERN as part of the Next Generation Triggers project.
It supports:
- Joint pruning + quantization
- Layer-wise precision configuration
- Flexible training pipelines
- PyTorch and TensorFlow backends
- Knowledge distillation
- HGQ library integration
- Integration with hardware-friendly toolchains (e.g., hls4ml)
PQuantML enables efficient deployment of compact neural networks on resource-constrained hardware such as FPGAs and embedded accelerators.
Installation
Install the base package via pip:
pip install pquant-ml
Install with a specific backend:
pip install "pquant-ml[tensorflow]" # TensorFlow backend
pip install "pquant-ml[torch]" # PyTorch backend
Supported layers
| Layer | Description |
|---|---|
PQConv*D |
Convolutional layers |
PQAvgPool*D |
Average pooling layers |
PQBatchNorm*D |
Batch normalization layers |
PQDense |
Linear (fully connected) layer |
PQActivation |
Activation layers: ReLU, Tanh, Leaky ReLU, GELU, Hard Tanh, or a user-provided activation function (Torch only) |
MultiHeadAttention |
Multi-head attention layer |
LayerNorm |
Layer normalization layer (currently Torch only) |
Training
Different pruning methods involve different training stages, such as pre-training and fine-tuning. PQuantML provides a generic training function: you supply your own training and validation functions along with the number of epochs, and PQuant handles the training loop while automatically triggering the appropriate stages for the chosen pruning method.
Quantization
PQuantML supports two quantization modes, each with several granularity options.
Fixed-point quantization (for weights):
- per-weight
- per-channel
- per-tensor
HGQ (High Granularity Quantization):
- per-weight
- per-tensor
Example
Example notebooks are available in the examples/ directory. It shows how to:
- Create a Torch model and data loaders.
- Create the training and validation functions.
- Load a default configuration for a pruning method.
- Train and compress the model by passing the configuration, model, and training/validation functions to PQuant's training function.
- Build a custom quantization and pruning configuration for a given model (e.g. disabling pruning for some layers, or using different quantization bit-widths per layer).
- Use the direct-layer and layer-replacement approaches.
- Use the HPO platform.
Documentation
Full documentation is available at pquantml.readthedocs.io.
Citation
The framework is described in PQuantML: A Tool for End-to-End Hardware-aware Model Compression (arXiv:2603.26595).
If you use PQuantML in your work, please cite:
@article{niemi2026pquantml,
title = {PQuantML: A Tool for End-to-End Hardware-aware Model Compression},
author = {Niemi, Roope and Petrovych, Anastasiia and Das, Arghya and
Lupi, Enrico and Sun, Chang and Danopoulos, Dimitrios and
Helbing, Marlon Joshua and Liu, Mia and Kagan, Michael and
Loncar, Vladimir and Pierini, Maurizio},
journal = {arXiv preprint arXiv:2603.26595},
year = {2026}
}
Authors
- Roope Niemi (CERN)
- Anastasiia Petrovych (CERN)
- Arghya Das (Purdue University)
- Enrico Lupi (CERN)
- Chang Sun (Caltech)
- Dimitrios Danopoulos (CERN)
- Marlon Joshua Helbing
- Mia Liu (Purdue University)
- Michael Kagan (SLAC National Accelerator Laboratory)
- Vladimir Loncar (CERN)
- Maurizio Pierini (CERN)
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 pquant_ml-0.1.0.tar.gz.
File metadata
- Download URL: pquant_ml-0.1.0.tar.gz
- Upload date:
- Size: 1.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1fe2c787750b32f5752797b1ce2ef4b84165c25a1c93654d47c0e5091be632b7
|
|
| MD5 |
5688c169b028aa8ae770c275e661505b
|
|
| BLAKE2b-256 |
2ca7bc58ebd99e6592c2079f80f2fbec2290dee0304b64936131a27870625061
|
Provenance
The following attestation bundles were made for pquant_ml-0.1.0.tar.gz:
Publisher:
python-publish.yml on cern-nextgen/PQuantML
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pquant_ml-0.1.0.tar.gz -
Subject digest:
1fe2c787750b32f5752797b1ce2ef4b84165c25a1c93654d47c0e5091be632b7 - Sigstore transparency entry: 2302552831
- Sigstore integration time:
-
Permalink:
cern-nextgen/PQuantML@216f36b23f4bc0e8c68f840e28ec2e03c04aacab -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/cern-nextgen
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@216f36b23f4bc0e8c68f840e28ec2e03c04aacab -
Trigger Event:
release
-
Statement type:
File details
Details for the file pquant_ml-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pquant_ml-0.1.0-py3-none-any.whl
- Upload date:
- Size: 169.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2ee28b52ee71175512ef69ca239f6dfbd45318d11d4ab7d12fbb14a2f4213146
|
|
| MD5 |
1a2bfff020b5c31321a0774d7c447a62
|
|
| BLAKE2b-256 |
91325ac3bc237c9547bab9e5dd4a0d61547cbe7cd58e1c59d37c7786924d1a84
|
Provenance
The following attestation bundles were made for pquant_ml-0.1.0-py3-none-any.whl:
Publisher:
python-publish.yml on cern-nextgen/PQuantML
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pquant_ml-0.1.0-py3-none-any.whl -
Subject digest:
2ee28b52ee71175512ef69ca239f6dfbd45318d11d4ab7d12fbb14a2f4213146 - Sigstore transparency entry: 2302553003
- Sigstore integration time:
-
Permalink:
cern-nextgen/PQuantML@216f36b23f4bc0e8c68f840e28ec2e03c04aacab -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/cern-nextgen
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@216f36b23f4bc0e8c68f840e28ec2e03c04aacab -
Trigger Event:
release
-
Statement type: