Hindsight Network Credit Assignment: Efficient Credit Assignment in Networks of Discrete Stochastic Units

Kenny Young

Abstract

Training neural networks containing discrete stochastic units, such as Bernoulli variables, is notoriously difficult due to the high variance of unbiased gradient estimators like REINFORCE. We introduce Hindsight Network Credit Assignment (HNCA), a novel algorithm that leverages the local causal structure of a network to provide unbiased gradient estimates with significantly lower variance. HNCA maintains a computational cost comparable to traditional backpropagation, addressing the scalability issues of previous low-variance estimators.

Introduction

The integration of discrete stochastic variables—such as "hard" binary switches—into neural networks enables modeling of complex, non-differentiable processes. However, these units cannot be trained using standard backpropagation. While the REINFORCE estimator provides an unbiased solution, its high variance often leads to slow and unstable training. Existing alternatives either introduce bias through continuous relaxations (e.g., Gumbel-Softmax) or suffer from high computational complexity that scales poorly with network depth (e.g., DisARM). HNCA bridges this gap by offering an unbiased, low-variance estimator that scales linearly with the number of layers.

Methods

HNCA is inspired by Hindsight Credit Assignment (HCA) from reinforcement learning. The core principle is to assign credit to a stochastic unit based on how its specific output influences its immediate children in the computational graph, rather than relying solely on a global reward signal.

Computational graph of HNCA illustrating local credit assignment and Markov blankets.

Key technical components include:

  • Local Expectations: HNCA calculates a "relative counterfactual probability," asking how likely the observed outputs of a unit's children would be if the unit had chosen a different value.
  • Markov Blankets: By utilizing Markov blankets, the algorithm isolates units, allowing for local gradient calculations that avoid the need to re-sample the entire graph.
  • Efficiency Identity: For Bernoulli units, the authors derived a mathematical identity that allows counterfactual probabilities to be computed in constant time. This ensures the backward pass remains $O(\text{edges})$, matching the efficiency of standard backpropagation.
  • $f$-HNCA: This extension for known objective functions (like the ELBO in VAEs) decomposes the function to assign credit only to downstream components.

Experimental Evaluation

The authors evaluated HNCA on two tasks using the MNIST dataset:

  1. Contextual Bandit MNIST: A classification task where the model receives a binary reward (1 for correct, 0 for incorrect) based on dynamically binarized input pixels.
  2. Discrete Hierarchical VAE: A Variational Auto-Encoder with 1, 2, or 3 layers of discrete latent variables, evaluated on its ability to reconstruct MNIST digits.

Key Results and Insights

HNCA demonstrates that "local expectation" gradients are not only computationally feasible for deep networks but also highly effective at reducing noise. By focusing on immediate neighbors, the algorithm naturally filters out global variance.

Training ELBO and log gradient variance for hierarchical VAEs across 1, 2, and 3 layers.
  • Variance Reduction: In contextual bandit tasks, HNCA reduced log gradient variance drastically compared to REINFORCE (e.g., from ~-6.0 to ~-13.0 in a 1-layer network).
  • State-of-the-Art Performance: In multi-layer hierarchical VAEs, $f$-HNCA combined with a baseline achieved the highest Evidence Lower Bound (ELBO), outperforming strong baselines like DisARM and REINFORCE Leave-One-Out (LOO).
  • Linear Scaling: Unlike competing unbiased estimators that require additional partial forward passes per layer, HNCA requires only a single forward and backward pass, making it practical for large-scale models.
  • Stability: Training curves for HNCA showed tighter confidence intervals, indicating more stable convergence across different random seeds.

Conclusion and Future Work

HNCA provides a scalable solution for training discrete stochastic units. While the current implementation relies on units being linear transformations followed by activations for maximum efficiency, future work could extend this to more complex, non-linear child sub-networks. Additionally, while HNCA currently focuses on immediate children, propagating credit across multiple steps could further reduce variance at the cost of increased tracking complexity. Exploring the interaction between HNCA and mixed continuous-discrete architectures remains a promising direction for future research.

Summary updated

BibTeX
@inproceedings{young2022hindsight,
  author = {Kenny Young},
  title = {{Hindsight Network Credit Assignment: Efficient Credit Assignment in Networks of Discrete Stochastic Units}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2022},
  doi = {10.1609/aaai.v36i8.20874},
}
Figure