MXFP4Quantizer<T, TInput, TOutput>
Models & Types · AiDotNet.Deployment.Optimization.Quantization.Formats
MXFP4 (Microscaling FP4) quantizer - uses shared exponents for efficient 4-bit floating point. Part of the OCP (Open Compute Project) Microscaling specification.
Implements: IQuantizer<T, TInput, TOutput>
For Beginners
MXFP4 is a 4-bit floating point format where groups of numbers share a common scale (exponent). This allows better representation of values across different magnitudes while staying compact.
How It Works
How It Works:
Format Details:
Key Features:
Reference: OCP Microscaling Formats Specification (2023)
Constructors
| Constructor | Summary |
|---|---|
MXFP4Quantizer(QuantizationConfiguration config, int blockSize) |
Initializes a new instance of the MXFP4Quantizer. |
Properties
| Property | Summary |
|---|---|
QuantizationMode Mode { get; } |
|
bool IsCalibrated { get; set; } |
Gets whether the quantizer has been calibrated. |
int BitWidth { get; } |
|
int BlockSize { get; } |
Gets the block size used for shared scaling. |
Methods
| Method | Summary |
|---|---|
IFullModel<T, TInput, TOutput> Quantize(IFullModel<T, TInput, TOutput> model, QuantizationConfiguration config) |
|
double DecodeFromMXFP4(int encoded) |
Decodes a 4-bit MXFP4 representation to its value. |
double GetScaleFactor(string layerName) |
|
int EncodeToMXFP4(double value) |
Encodes a value to its 4-bit MXFP4 representation. |
int GetZeroPoint(string layerName) |
|
void Calibrate(IFullModel<T, TInput, TOutput> model, IEnumerable<TInput> calibrationData) |