Abstract
We present paired learning and inference algorithms for significantly reducing computation and increasing speed of the vector dot products in the classifiers that are at the heart of many NLP components. This is accomplished by partitioning the features into a sequence of templates which are ordered such that high confidence can often be reached using only a small fraction of all features. Parameter estimation is arranged to maximize accuracy and early confidence in this sequence. We present experiments in left-to-right part-of-speech tagging on WSJ, demonstrating that we can preserve accuracy above 97% with over a five-fold reduction in run-time.
Introduction
Many Natural Language Processing (NLP) tasks rely on linear classifiers where the primary computational cost involves calculating dot products between high-dimensional, sparse feature vectors and dense weight vectors. In standard models, the full suite of features is extracted and computed for every token, regardless of the difficulty of the classification task. This creates a significant bottleneck for real-time applications. However, many tokens are "easy" to classify; for instance, identifying the word "the" as a determiner rarely requires complex contextual features. The goal of this work is to develop a method that dynamically selects features, stopping computation as soon as a sufficient level of confidence is reached.
Methodology
The proposed approach pairs a dynamic inference algorithm with a specialized training objective. Features are grouped into a sequence of "templates" (e.g., current word, previous tag). During inference, the model calculates scores template-by-template. After each template, the "margin"—the difference between the top two label scores—is compared against a threshold $m$. If the margin is sufficient, the model stops early and predicts the current top label.
To support this early stopping, the model is trained using a modified structured max-margin loss (stagewise training) that encourages high accuracy and confidence as early as possible in the template sequence. The order of these templates is determined via a greedy search to maximize development set performance at each step.
Experimental Results
The method was evaluated on the Penn Treebank WSJ corpus for part-of-speech tagging. The results demonstrate a significant speedup with minimal loss in accuracy. As shown in the performance table, the dynamic model can achieve a 5.22x speedup while maintaining 97.02% accuracy, compared to the 97.22% baseline.
Key findings include:
- Efficiency of Easy Cases: Over 40% of tokens were correctly tagged using only the first feature template, and 75% required four or fewer.
- Dynamic vs. Fixed Selection: The dynamic stopping criterion significantly outperformed fixed baselines that used a set number of templates for all tokens.
- Single Model Advantage: Unlike cascade methods, this approach uses a single model that accumulates scores, reducing management overhead.
Discussion and Future Work
While the greedy ordering of templates is effective, it may not be globally optimal. Additionally, while the method excels at local sequential tasks like POS tagging, future work should explore its applicability to more complex structured prediction tasks, such as dependency parsing or machine translation, where dependencies are longer and the search space is larger. Finally, while relative speedups are hardware-independent, absolute performance would be significantly higher on modern computing architectures.
Summary updated