Skip to main content

quantize_rows

Function quantize_rows 

Source
pub fn quantize_rows(x: &[f32], head_dim: usize) -> (Vec<i8>, Vec<f32>)
Expand description

Quantise rows head-vectors of head_dim into stored integers plus one scale each — the same layout V3Cache holds internally.

The batched prefill path needs this so it can attend through exactly the arithmetic crate::v3::attend_step uses on the stored cache. Attending over dequantised f32 instead is algebraically the same and numerically is not, which would make a prefilled session disagree with a stepped one.