Xilinx/brevitas

Brevitas: neural network quantization in PyTorch

What it solves

Brevitas helps developers reduce the size and computational requirements of neural networks through quantization. By converting high-precision numbers into lower-precision formats, it makes models more efficient to run.

How it works

The library provides quantized versions of standard PyTorch layers (such as convolutional, attention, and recurrent layers). It supports two primary methods: Post-Training Quantization (PTQ), where an existing model is converted, and Quantization-Aware Training (QAT), where the model learns to adapt to quantization during the training process. Users can fine-tune settings like bit-width and scale granularity for individual tensors within these layers.

Who it’s for

It is designed for researchers and developers working with PyTorch who need to optimize deep learning models for deployment. It is a research-focused project and not an official product.

Highlights

  • Provides drop-in quantized replacements for common PyTorch layers (e.g., QuantConv2d, QuantLSTM).
  • Supports both Post-Training Quantization (PTQ) and Quantization-Aware Training (QAT).
  • Allows granular, per-tensor configuration of quantization settings.
  • Compatible with Windows, Linux, and macOS.
  • Includes reference examples for applying PTQ to standard image classification models.

Related

  • Project
  • Project
  • Project
  • Project
  • Project