Learning to Speed Up Structured Output Prediction

Xingyuan Pan, Vivek Srikumar

Predicting structured outputs is a notoriously computationally onerous task in machine learning due to combinatorially large output spaces. This paper offers a clever solution to this persistent bottleneck by introducing a "speedup classifier." This classifier learns to mimic a slow, high-accuracy "black-box" solver by framing inference as a search problem, allowing it to navigate search trees faster and even skip expensive feature extractions entirely without sacrificing accuracy.

The Bottleneck of Structured Output

In fields like Natural Language Processing (NLP) and Computer Vision, models frequently need to predict "structured" outputs—such as parse trees, sequences, or relationship graphs. Because the number of possible outputs is combinatorially large, finding the absolute "best" one is incredibly slow.

Currently, researchers face a difficult trade-off:

  1. Exact Solvers: Use an exact solver (like Integer Linear Programming, or ILP), which is highly accurate but prohibitively slow.
  2. Greedy Search: Use a fast "greedy" search, which often violates structural constraints. For example, a greedy model might accidentally predict that a person "lives in" another person instead of a location.
Example of structural constraints in entity relation prediction.

The authors argue that treating every new input as a "fresh" optimization problem is wasteful. Over time, a system should learn the "shape" of valid outputs and use that knowledge to take computational shortcuts.

Proposed Method: The Speedup Classifier

The authors frame the inference process as a graph search problem, treating a pre-trained, high-quality model (the "black-box") as a teacher.

  1. Imitation Learning: A secondary, inexpensive "speedup classifier" is trained to mimic the decisions of the black-box solver. This utilizes a mistake-bound algorithm that updates the speedup classifier whenever its search path diverges from the teacher's optimal path.
  2. Lagrangian Heuristic: To ensure the speedup classifier respects structural constraints, the authors use the dual form of the ILP (Lagrangian relaxation) to justify a linear heuristic function. This function helps the search algorithm prioritize paths likely to lead to valid, high-scoring structures.
  3. Feature Skipping: Feature extraction (analyzing the raw input data) is often the slowest part of prediction. The authors mathematically prove that if the "heuristic gap" between the best and second-best search options is large enough, the system can safely ignore the input features for that step and rely solely on the learned heuristic.

Key Insights

  • The "Statistical Cache": The speedup classifier essentially acts as a statistical cache of past decisions. If the model has seen a similar structural situation before, it doesn't need to recalculate everything from scratch.
  • Outputs Have Regularity: While inputs (like sentences) vary wildly, the relationships between outputs are often very predictable. If the model has already decided the first word is a "Person" and the relationship is "LivesIn," the next entity is almost certainly a "Location."
  • Confidence Allows for Laziness: By identifying "safe" situations where the heuristic is dominant, the model can stop doing expensive feature extraction and just follow its learned "intuition."

Experimental Results

The authors evaluated their method on an Entity and Relation Extraction task using the Roth & Yih (2004) dataset and the Gigaword Corpus. The speedup classifier was tested against the Gurobi ILP solver, an industry-standard, highly optimized black-box.

Performance comparison of the ILP baseline, standard search, and the proposed speedup models.
  • Speed: The speedup classifier was significantly faster. While the Gurobi ILP took ~239ms per sentence, the speedup version with a beam size of 1 took only 136ms. When applying the "feature skipping" trick (shown in extended ablation studies), the time dropped as low as 39ms.
  • Accuracy: Despite the massive speedup, the model maintained high accuracy. With a beam size of 2, the speedup classifier actually matched or slightly exceeded the F1 score of the original ILP model.
  • Constraint Satisfaction: The "validity ratio" (how often the model followed structural rules) was over 95% for the speedup models, compared to a dismal 29% for standard greedy search.

Limitations and Future Work

  • Dependency on a Teacher: The method requires a pre-trained, high-quality black-box model to act as a teacher. If the original model is poor, the speedup classifier will simply learn to make mistakes faster.
  • Linear Heuristics: The authors used a linear model for the speedup classifier for theoretical simplicity. They suggest that using Deep Neural Networks as the heuristic function could lead to even better pruning of the search space.
  • Implementation Overhead: While the theory shows massive potential for speedup, the authors noted that their object-heavy JVM implementation carried some overhead. A lower-level implementation (like C++) would likely yield even more dramatic real-world gains.

Summary updated

BibTeX
@inproceedings{pan2018learning,
  author = {Xingyuan Pan and Vivek Srikumar},
  title = {{Learning to Speed Up Structured Output Prediction}},
  booktitle = {International Conference on Machine Learning},
  year = {2018},
  url = {https://openreview.net/forum?id=SkZbAiWObS},
}
Figure