Understanding the Mechanics of SPIGOT: Surrogate Gradients for Latent Structure Learning

Tsvetomila Mihaylova, Vlad Niculae, André F. T. Martins

Abstract

Training neural networks with discrete latent structures, such as syntactic trees or categorical tags, is challenging due to the non-differentiable nature of the argmax operation. While surrogate gradient methods like SPIGOT have shown empirical success, they often lack a rigorous theoretical foundation. This paper introduces the "pulled-back loss" framework, reinterpreting SPIGOT as a single step of optimization toward a pseudo-label derived from the downstream task. This perspective enables the development of more stable variants, such as SPIGOT-CE and SPIGOT-EG, and provides insights into the trade-offs between model accuracy and the interpretability of induced latent structures.

Introduction

Deep learning models frequently benefit from discovering latent structures within data. Discrete latent variables are particularly desirable because they offer interpretability and can constrain model capacity in a linguistically or logically meaningful way. However, the standard backpropagation algorithm fails when encountering discrete bottlenecks like argmax, as the gradient is zero almost everywhere.

Existing solutions typically involve continuous relaxations (e.g., Softmax) or surrogate gradients (e.g., the Straight-Through Estimator). While relaxations are easy to optimize, they often fail to produce the "hard" structures needed for true interpretability. Surrogate methods, conversely, lack the theoretical clarity required for systematic improvement. This work bridges that gap by formalizing the mechanics of SPIGOT.

The Pulled-Back Loss Framework

The authors propose that surrogate gradients can be viewed as a "pull-back" mechanism. In the absence of ground-truth latent labels, the error from the final task is used to estimate what the latent structure should have been. This "pseudo-supervision" then guides the update of the structure-proposing components of the model.

Comparison of gradient flow in (a) standard backpropagation, (b) supervised latent learning, and (c) the SPIGOT surrogate gradient approach.

As illustrated in the figure above, standard backpropagation (a) is blocked by the discrete argmax. In a supervised setting (b), a direct loss on the latent variable $z$ would update the parameters $\phi$. SPIGOT (c) approximates this by pulling back the task loss $L$ to create a surrogate loss $\ell$ based on a target $\mu$.

Theoretical Contributions

A key finding of this work is that the original SPIGOT algorithm is mathematically equivalent to a single step of projected gradient descent toward the pulled-back target using a Perceptron loss. Building on this, the authors introduce:

  • SPIGOT-CE: Utilizes Cross-Entropy or CRF loss for more stable updates.
  • SPIGOT-EG: Employs Exponentiated Gradient updates, allowing for multiple optimization steps per iteration.
  • Unified View of STE: The authors demonstrate that the Straight-Through Estimator (STE) is a special case of this framework where structural constraints are ignored.

Experimental Evaluation

The proposed methods were tested across three domains: synthetic clustering, Sentiment Analysis (SST), and Natural Language Inference (SNLI). These tasks evaluate the model's ability to recover known latent categories and induce useful syntactic structures for downstream reasoning.

Key Results and Insights

In synthetic tasks, SPIGOT-CE demonstrated superior performance in latent structure discovery, achieving a V-measure (clustering quality) of 97%, compared to only 67% for relaxed models. This confirms that discrete surrogates are significantly better at disentangling latent variables than their continuous counterparts.

On the Stanford Sentiment Treebank (SST), SPIGOT achieved a test accuracy of 84.8%, outperforming both BiLSTM baselines and other surrogate methods. Qualitative analysis revealed that while many models produce "flat" trees, SPIGOT-CE induces deeper, more linguistically plausible structures.

However, on the larger SNLI dataset, continuous relaxations like SparseMAP maintained a slight edge in raw accuracy (~85.3%). This suggests a fundamental trade-off: while discrete structures are more interpretable and better at category discovery, "soft" relations can be more robust for high-dimensional downstream tasks.

Conclusion

By formalizing SPIGOT through the pulled-back loss framework, this work provides both a theoretical justification for surrogate gradients and a path toward more stable latent structure learning. While challenges remain in consistently outperforming continuous relaxations on large-scale tasks, the improved interpretability and structural discovery of SPIGOT-CE mark a significant step forward for symbolic-neural hybrid models.

Summary updated

BibTeX
@inproceedings{mihaylova2020understanding,
  author = {Tsvetomila Mihaylova and Vlad Niculae and André F. T. Martins},
  title = {{Understanding the Mechanics of SPIGOT: Surrogate Gradients for Latent Structure Learning}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2020},
  doi = {10.18653/v1/2020.emnlp-main.171},
}
Figure