![]() |
Signet Forge 0.1.0
C++20 Parquet library with AI-native extensions
|
DEMO |
Parameters that fully describe a quantization mapping. More...
#include <quantized_vector.hpp>
Public Member Functions | |
| std::string | serialize () const |
| Serialize to a compact key-value string for Parquet metadata. | |
| size_t | bytes_per_vector () const |
| Storage size per vector in bytes. | |
Static Public Member Functions | |
| static QuantizationParams | compute (const float *data, size_t num_vectors, uint32_t dim, QuantizationScheme scheme) |
| Compute optimal quantization parameters from a batch of vectors. | |
| static expected< QuantizationParams > | deserialize (const std::string &s) |
| Deserialize from the key-value string produced by serialize(). | |
Public Attributes | |
| QuantizationScheme | scheme |
| Quantization scheme (symmetric/asymmetric, INT8/INT4). | |
| float | scale = 0.0f |
| Scale factor (float units per quantization step). | |
| float | zero_point = 0.0f |
| Offset (used by ASYMMETRIC_INT8 only). | |
| uint32_t | dimension = 0 |
| Vector dimension (number of float elements). | |
Parameters that fully describe a quantization mapping.
Holds the scheme, scale factor, zero point, and vector dimension needed to quantize float32 vectors to INT8/INT4 and dequantize them back.
Definition at line 76 of file quantized_vector.hpp.
|
inline |
Storage size per vector in bytes.
dim bytes.ceil(dim / 2) bytes.Definition at line 540 of file quantized_vector.hpp.
|
inlinestatic |
Compute optimal quantization parameters from a batch of vectors.
Scans all float values to determine min/max, then derives scale (and zero_point for asymmetric) accordingly.
| data | Pointer to num_vectors * dim contiguous floats. |
| num_vectors | Number of vectors in the batch. |
| dim | Dimensionality of each vector. |
| scheme | Desired quantization scheme. |
Definition at line 372 of file quantized_vector.hpp.
|
inlinestatic |
Deserialize from the key-value string produced by serialize().
| s | The serialized parameter string. |
Definition at line 454 of file quantized_vector.hpp.
|
inline |
Serialize to a compact key-value string for Parquet metadata.
Format: "scheme=0;scale=0.001234;zero_point=0.0;dimension=768".
Definition at line 440 of file quantized_vector.hpp.
| uint32_t signet::forge::QuantizationParams::dimension = 0 |
Vector dimension (number of float elements).
Definition at line 80 of file quantized_vector.hpp.
| float signet::forge::QuantizationParams::scale = 0.0f |
Scale factor (float units per quantization step).
Definition at line 78 of file quantized_vector.hpp.
| QuantizationScheme signet::forge::QuantizationParams::scheme |
Quantization scheme (symmetric/asymmetric, INT8/INT4).
Definition at line 77 of file quantized_vector.hpp.
| float signet::forge::QuantizationParams::zero_point = 0.0f |
Offset (used by ASYMMETRIC_INT8 only).
Definition at line 79 of file quantized_vector.hpp.