179 questions
No questions match those filters.
In quantization-aware training, the rounding operation...
This is one of the questions in the full AI/ML interview bank. Pro unlocks all 1789 questions; Premium includes the same bank plus the highest daily Practice limit.
See plansThe honest observation — that rounding is piecewise constant and its true derivative is zero everywhere it’s differentiable at all — is correct and also a dead end if you stop there. If you use that real derivative during backpropagation, every gradient reaching the underlying learnable weights is zero, and the model never updates in response to quantization error. You’d be simulating inference precision correctly while training nothing.
The Straight-Through Estimator resolves this by deliberately decoupling what happens on the forward pass from what happens on the backward pass. Forward, you apply the real quantization — round to the nearest representable int8 value — so the loss the model sees genuinely reflects the error quantization introduces; the model “feels” the discretization. Backward, instead of differentiating the rounding function honestly, you pretend it was the identity function and pass the incoming gradient through unchanged, as if no rounding had happened at all. This produces a gradient that technically doesn’t correspond to the forward computation you actually ran — it’s a controlled approximation, not a correct derivative — but it’s non-zero and points in roughly the right direction, which is what actually matters for optimization.
The mental model that holds up: you accept a small, structured gradient mismatch in exchange for keeping the learning signal alive at all. It’s the standard trick anywhere a discrete or non-differentiable operation sits inside an otherwise differentiable pipeline — vector quantization in VQ-VAEs uses the identical idea — and it’s worth naming explicitly as “we approximate the backward pass, not because we don’t know the true derivative, but because the true derivative is useless.”