A gradient trick enabling backpropagation through non-differentiable discrete operations in neural networks.
The straight-through estimator (STE) is a practical technique for training neural networks that contain non-differentiable operations — most commonly discrete or step-function activations — where standard backpropagation would otherwise fail. In ordinary gradient-based training, the chain rule requires every operation in the forward pass to have a well-defined derivative so that error signals can flow backward through the network. When a function is discontinuous or piecewise constant, its true gradient is either zero or undefined almost everywhere, making weight updates impossible through conventional means.
The STE resolves this by substituting a surrogate gradient during the backward pass while leaving the forward pass unchanged. In its simplest form, the estimator treats the non-differentiable function as if it were the identity function during backpropagation — passing the upstream gradient straight through to the layer below without modification. More refined variants use smooth approximations, such as a clipped linear function, as the surrogate. The key insight is that a biased but informative gradient signal is far more useful for learning than no signal at all, and in practice the approximation error rarely prevents convergence.
The STE became particularly important with the rise of binary and quantized neural networks, where weights and activations are constrained to discrete values (e.g., {−1, +1}) to reduce memory and compute costs on edge hardware. Without the STE, training such networks from scratch would be intractable. It also underpins modern vector-quantized architectures like VQ-VAE, where a discrete codebook lookup sits in the middle of an otherwise differentiable encoder-decoder pipeline. Yoshua Bengio and colleagues helped formalize and popularize the approach around 2013, giving practitioners a principled vocabulary for what had sometimes been applied informally.
Beyond quantization, the STE has influenced research into reinforcement learning, neural architecture search, and any setting where a model must make hard discrete choices within a differentiable learning framework. Its elegance lies in its simplicity: rather than redesigning the architecture to avoid non-differentiability, the STE embraces it and provides a lightweight workaround that scales to large models with minimal overhead.