Welcome to QKerasV3 documentation!
QKerasV3 is a Keras 3 compatible continuation of QKeras, focused on quantization-aware training and model compression.
Important
QKerasV3 supports TensorFlow, JAX and PyTorch as backend (default is TensorFlow). Set the backend before importing:
export KERAS_BACKEND=tensorflow/jax/torch
In the current version v1.2.x AutoQKeras and Pruning are not working. There will be an update in the the future to support this feature again.
QKerasV3 Layer Backend Support Matrix
The following matrix tracks multi-backend framework support for quantization-aware training (QAT) layers in qkerasV3.
Layer Name |
TensorFlow |
JAX |
PyTorch |
Implementation Notes & Constraints |
|---|---|---|---|---|
|
✅ |
✅ |
✅ |
|
|
✅ |
✅ |
✅ |
|
|
✅ |
✅ |
✅ |
|
|
✅ |
✅ |
✅ |
|
|
✅ |
✅ |
✅ |
|
|
✅ |
✅ |
✅ |
|
|
✅ |
✅ |
✅ |
MobileNet-specific; explicitly quantizes activation values immediately after the depthwise step. TODO: needs a test. |
|
✅ |
✅ |
✅ |
|
|
✅ |
✅ |
✅ |
|
|
✅ |
✅ |
✅ |
|
|
✅ |
✅ |
⚠️ |
Combines |
|
⚠️ |
⚠️ |
⚠️ |
Experimental Stage: Stochastic activation functions often offset its regularization needs. JAX/Torch rely on Keras 3 epoch variable updates. |
|
✅ |
⚠️ |
⚠️ |
Multi-frequency feature extraction relies on complex tensor splitting and slicing across backends. TODO: needs a test. |
|
✅ |
✅ |
✅ |
|
|
✅ |
✅ |
✅ |
|
|
✅ |
✅ |
✅ |
|
|
✅ |
✅ |
✅ |
Legend:
✅ Supported: Tested and functions smoothly natively across the backend via Keras 3.
⚠️ Partial / Experimental / Conditional: Functions, but exhibits structural constraints, layout edge cases, or relies on features currently in testing.
QKerasV3 Activation Function Backend Support Matrix
The following matrix tracks multi-backend framework support for quantization activation functions in qkerasV3.
Activation Function |
TensorFlow |
JAX |
PyTorch |
Implementation Notes & Constraints |
|---|---|---|---|---|
|
✅ |
✅ |
✅ |
|
|
✅ |
✅ |
✅ |
|
|
✅ |
✅ |
✅ |
|
|
✅ |
✅ |
✅ |
|
|
✅ |
✅ |
✅ |
|
|
✅ |
✅ |
✅ |
|
|
✅ |
✅ |
✅ |
|
|
✅ |
✅ |
✅ |
|
|
✅ |
✅ |
✅ |
|
|
✅ |
✅ |
✅ |
|
|
✅ |
✅ |
✅ |
|
|
✅ |
✅ |
✅ |
|
|
✅ |
✅ |
✅ |
|
|
✅ |
✅ |
✅ |
|
|
✅ |
✅ |
✅ |
|
|
✅ |
✅ |
✅ |
|
|
✅ |
✅ |
✅ |
Legend:
✅ Supported: Tested and functions smoothly natively across the backend via Keras 3.
⚠️ Partial / Experimental / Conditional: Functions, but exhibits structural constraints, layout edge cases, or relies on features currently in testing.
Getting started
Guides
- Tutorials
- Activation and Quantization Functions Tutorial
- Image Autoencoder Training Tutorial
- Algorithmic Fairness: Invariant Representations via QKeras Bernoulli Activation
- CIFAR-10 Network with Ultra-Low Precision PO2 Quantization
- Quantized CNN
- High/Low Spatial Frequency Decoupling with QOctaveConv2D
- Codebook based quantization
- Divide and Conquer (DnC) Hardware Cost Modeling
- Keras Model Quantization
- QTools: Energy Profiling and Hardware DataType Statistics
- Quantized RNN
- Stochastic Rounding Simulations for Ternary Quantization
- MNIST Dense Multilayer Perceptron (MLP)
- MNIST with Binary Weight Export and Quantized Save Utilities
- MNIST Model with BinaryToThermometer
- MNIST with Power-of-Two (PO2) Quantization
- MNIST with Batch Normalization as a Learned Scale Factor
Reference
Unsupported Keras 3 Layers & Activations
``MultiHeadAttention`` / ``GroupQueryAttention`` (Layer)
``ConvLSTM1D`` / ``ConvLSTM2D`` / ``ConvLSTM3D`` (Layer)
``LayerNormalization`` / ``GroupNormalization`` / ``RMSNormalization`` (Layer)
``PReLU`` / ``ELU`` / ``LeakyReLU`` (Layer)
``AlphaDropout`` / ``GaussianNoise`` / ``GaussianDropout`` (Layer)
``mish(x)`` (Activation)
``swish(x)`` / ``gelu(x)`` (Activation)
``exponential(x)`` (Activation)
``silu(x)`` (Activation)