Abstract
Training neural networks with discrete variables is challenging due to the non-differentiability of "hard" choices. The standard Straight-Through Estimator (STE) uses a single temperature parameter to balance exploration and gradient flow, often leading to sub-optimal performance. We present Decoupled ST, a modification that employs separate temperatures for the forward and backward passes. This decoupling allows independent control over exploration and gradient shaping, consistently outperforming standard methods across various discrete optimization tasks.
Introduction
In deep learning, discrete choices—such as selecting a word from a vocabulary or a logic gate in a circuit—are common but non-differentiable. The Straight-Through Estimator (STE) family addresses this by using a surrogate gradient during the backward pass. Typically, a single temperature parameter $\tau$ is used. However, this parameter is burdened with two conflicting roles: controlling randomness for exploration in the forward pass and shaping the gradient signal in the backward pass. Tying these together forces a compromise that limits model performance.
Methods: Decoupling the Temperature
Decoupled Straight-Through (Decoupled ST) introduces a minimal yet effective change to the STE framework. Instead of a single $\tau$, it uses:
- Forward Temperature ($\tau_f$): Scales logits before sampling to control the entropy of selection (exploration).
- Backward Temperature ($\tau_b$): Used to calculate the Jacobian of the softmax surrogate, controlling gradient dispersion across categories.
This separation allows researchers to independently tune the exploration-variance and magnitude-dispersion trade-offs. Implementation is simple, requiring only different constants for forward and backward operations in a custom autograd function.
Experiments and Key Insights
The method was evaluated on three tasks: Stochastic Binary Networks (FashionMNIST), Categorical Autoencoders (MNIST), and Differentiable Logic Gate Networks (CIFAR10).
Exploration vs. Stability
The authors found that optimal configurations for all tasks lie off the "diagonal" where $\tau_f = \tau_b$. A high $\tau_f$ encourages better latent space utilization (higher perplexity), but can destabilize training if too high. Decoupled ST allows for high exploration without the associated gradient noise by keeping $\tau_b$ at a more stable value.
Latent Space Utilization
In categorical autoencoders, Decoupled ST achieved near-maximum utilization of available codes. While baseline methods often suffered from code collapse, Decoupled ST maintained high perplexity throughout training.
Reviving "Dead" Categories
In binary networks, neurons often become "dead" and stop learning because they receive zero gradients. A higher $\tau_b$ helps by spreading the gradient to these inactive neurons, effectively reviving them without introducing excessive noise into the forward pass. On FashionMNIST, Decoupled ST reduced inactive neurons to 11%, compared to 47% for Softmax STE.
Conclusion
Decoupled ST demonstrates that separating forward and backward temperatures significantly improves the training of discrete neural networks. While it introduces an additional hyperparameter, its performance gains and robustness across tasks make it a compelling alternative to standard STEs. Future work will explore adaptive temperature schedules and scalability to larger discrete models like VQ-VAEs.
Summary updated