Backpropagating through Structured Argmax using a SPIGOT

Hao Peng, Sam Thomson, Noah A. Smith

Abstract

We introduce the structured projection of intermediate gradients optimization technique (SPIGOT), a new method for backpropagating through neural networks that include hard-decision structured predictions (e.g., parsing) in intermediate layers. SPIGOT requires no marginal inference, unlike structured attention networks and some reinforcement learning-inspired solutions. Like so-called straight-through estimators (STE), SPIGOT defines gradient-like quantities associated with intermediate nondifferentiable operations, allowing backpropagation before and after them; SPIGOT's proxy aims to ensure that, after a parameter update, the intermediate structure will remain well-formed. We experiment on two structured NLP pipelines: syntactic-then-semantic dependency parsing, and semantic parsing followed by sentiment classification. We show that training with SPIGOT leads to a larger improvement on the downstream task than a modularly-trained pipeline, the straight-through estimator, and structured attention, reaching a new state of the art on semantic dependency parsing.

Introduction

Modern NLP has largely moved toward end-to-end differentiable models. However, traditional "pipelines"—where a sentence is first tagged, then parsed, and finally analyzed semantically—still offer significant benefits in terms of interpretability and the injection of linguistic knowledge.

The challenge lies in the "hard" decisions these pipelines require, such as selecting the single most likely parse tree using an argmax operation. In a neural network, argmax is a mathematical dead end: its gradient is zero almost everywhere, making it impossible to use standard backpropagation to train the components before the decision based on the loss after the decision. Existing workarounds like Reinforcement Learning can be high-variance, while Structured Attention replaces hard choices with "soft" averages that are computationally expensive and less interpretable.

Methodology: The SPIGOT Approach

The authors propose the Structured ProjIection of Intermediate Gradients OpTimization (SPIGOT). Instead of ignoring the structure or softening it, SPIGOT defines a proxy gradient that respects the constraints of the intermediate task.

Comparison of SPIGOT (left) and the Straight-Through Estimator (right). SPIGOT projects the virtual update back onto the valid structure polytope, ensuring the gradient is 'aware' of structural constraints.

The procedure for the backward pass involves a three-step trick:

  1. Virtual Update: Take the current discrete output ($\hat{z}$) and apply a standard gradient update to it based on the downstream loss, resulting in a point ($\hat{p}$) that likely violates structural constraints.
  2. Projection: Project that point back onto the nearest valid point ($\tilde{z}$) within the relaxed set of valid structures (the convex polytope).
  3. Proxy Gradient: Define the gradient for the previous layer as the difference between the original discrete output and this new projected point ($\hat{z} - \tilde{z}$).

Essentially, SPIGOT asks how to change the input to the argmax so that the resulting discrete structure moves toward a better downstream result while remaining a valid structure. To maintain efficiency, the authors show that projecting onto a subset of constraints is often sufficient to provide a high-quality training signal.

Experiments

The authors evaluate SPIGOT on two complex pipeline tasks:

  • Syntactic-to-Semantic Parsing: Using the Penn Treebank (PTB) for syntactic dependencies and the SemEval 2015 Task 18 dataset (DM and PSD formalisms) for semantic dependency parsing.
  • Semantic Parsing to Sentiment Classification: Using the Stanford Sentiment Treebank (SST) for binary sentiment classification.

Key Results

SPIGOT demonstrates superior performance across both tasks. On semantic dependency parsing, it established a new state-of-the-art at the time of publication, outperforming modularly trained pipelines, STE, and models using Structured Attention.

Performance comparison on semantic dependency parsing tasks. SPIGOT achieves the highest scores (bolded) on the DM task and competitive results on PSD.

In the sentiment classification task, SPIGOT achieved 86.3% accuracy, significantly higher than the Straight-Through Estimator (85.4%) and the fixed pipeline (85.7%). Crucially, while joint training often degrades the "purity" of intermediate tasks, SPIGOT was much better at maintaining high parsing accuracy compared to STE, which saw intermediate performance drop significantly as gradients ignored structural logic.

Conclusion

SPIGOT provides a robust framework for training pipelines with discrete intermediate steps. By ensuring that gradients are "aware" of structural constraints, it allows the downstream task to "nudge" the intermediate parser without breaking its internal logic. While it requires the intermediate task to be expressible as a constrained maximization problem over a convex polytope, it covers a wide range of critical NLP tasks and offers a path toward more interpretable, linguistically-informed neural models.

Summary updated

BibTeX
@inproceedings{peng2018backpropagating,
  author = {Hao Peng and Sam Thomson and Noah A. Smith},
  title = {{Backpropagating through Structured Argmax using a SPIGOT}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2018},
  url = {https://openreview.net/forum?id=rJbKYoedZH},
}
Figure