Skip to main content

PQuantML logo

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.

PQuantML overview

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.

Pruning methods overview.

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:

  1. Create a Torch model and data loaders.
  2. Create the training and validation functions.
  3. Load a default configuration for a pruning method.
  4. Train and compress the model by passing the configuration, model, and training/validation functions to PQuant's training function.
  5. 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).
  6. Use the direct-layer and layer-replacement approaches.
  7. 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

pquant_ml-0.1.0.tar.gz (1.8 MB view details)

Uploaded Source

Built Distribution

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

pquant_ml-0.1.0-py3-none-any.whl (169.0 kB view details)

Uploaded Python 3

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

Hashes for pquant_ml-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1fe2c787750b32f5752797b1ce2ef4b84165c25a1c93654d47c0e5091be632b7
MD5 5688c169b028aa8ae770c275e661505b
BLAKE2b-256 2ca7bc58ebd99e6592c2079f80f2fbec2290dee0304b64936131a27870625061

See more details on using hashes here.

Provenance

The following attestation bundles were made for pquant_ml-0.1.0.tar.gz:

Publisher: python-publish.yml on cern-nextgen/PQuantML

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for pquant_ml-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2ee28b52ee71175512ef69ca239f6dfbd45318d11d4ab7d12fbb14a2f4213146
MD5 1a2bfff020b5c31321a0774d7c447a62
BLAKE2b-256 91325ac3bc237c9547bab9e5dd4a0d61547cbe7cd58e1c59d37c7786924d1a84

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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