Towards Incremental Transformers: An Empirical Analysis of Transformer Models for Incremental NLU

Patrick Kahardipraja, Brielen Madureira, David Schlangen

Abstract

Modern Natural Language Understanding (NLU) systems predominantly rely on Transformer architectures, which typically process complete sequences. However, interactive applications such as voice assistants require incremental processing. This paper evaluates the use of Linear Transformers (LT) to achieve efficient, word-by-word inference. By integrating recurrence and causal masking, the proposed models achieve up to a 14x speedup over standard restart-incremental methods while significantly improving output stability with minimal loss in final accuracy.

Introduction

The "global view" of standard Transformers, while beneficial for accuracy, presents a challenge for real-time interactive systems. Current incremental implementations often rely on "restart-incrementality," where the model re-processes the entire input prefix for every new token. This leads to $O(n^2)$ computational complexity and potential output instability, as the model may revise previous predictions upon seeing new context. This study explores whether Linear Transformers can provide the efficiency of Recurrent Neural Networks (RNNs) without sacrificing the performance characteristics of Transformers.

Methodology

The researchers investigated several configurations to bridge the gap between global attention and incremental efficiency:

  • Linear Attention: Replacing standard softmax attention with a kernel-based approximation allows the attention mechanism to be formulated as a recurrent state update.
  • Recurrence (+R): Leveraging the internal state of the Linear Transformer to predict labels at each time step, eliminating the need to re-process the entire history.
  • Causal Masking (+CM): Training the model with a unidirectional constraint, ensuring each token only attends to its predecessors. This mimics real-time constraints and encourages the learning of intermediate linguistic structures.
  • Delay Strategy (+D): Introducing a small look-ahead (1-2 tokens) to help resolve local ambiguities before committing to an output.

Experimental Setup

The models were evaluated on nine English-language datasets across two primary task categories:

  1. Sequence Tagging: Including slot filling (ATIS, SNIPS), chunking (CoNLL-2000), Named Entity Recognition (NER), and Part-of-Speech (PoS) tagging.
  2. Sequence Classification: Including intent detection (ATIS, SNIPS) and sentiment analysis (Pros/Cons, Positive/Negative reviews).

Results and Discussion

The empirical analysis focused on three key dimensions: efficiency, stability, and correctness.

Efficiency and Speed

The recurrent Linear Transformer (LT+R+CM) demonstrated a dramatic increase in inference speed, operating 11 to 14 times faster than the restart-incremental baseline. Unlike the baseline, which scales quadratically with sequence length, the recurrent LT scales linearly, making it far more suitable for long-form interactive dialogue.

Incremental Stability and Correctness

Stability was measured using Mean Edit Overhead (the frequency of prediction changes) and Mean Correction Time (the time required to reach a stable final decision). As shown in Figure 1, the recurrent configurations (LT+R and LT+R+CM) significantly reduced edit overhead and correction time for sequence classification tasks compared to the baseline. This "monotonicity" is vital for downstream systems that trigger actions based on NLU outputs.

Incremental performance metrics (Edit Overhead, Correction Time, and Relative Correctness) across model configurations and datasets.

While Linear Transformers involve a slight approximation of the softmax function, the Mean Relative Correctness remained high across all configurations. This indicates that the models' intermediate predictions are highly consistent with their final outputs after seeing the full sequence. Furthermore, the inclusion of a minimal delay (+D) was found to significantly boost accuracy by providing just enough "future" context to resolve linguistic ambiguities.

Conclusion

This work demonstrates that Linear Transformers, when combined with recurrence and causal masking, offer a compelling solution for incremental NLU. They provide a substantial speedup and improved stability over standard Transformers. Future research may focus on refining the softmax approximation and exploring more sophisticated methods for integrating limited look-ahead to further close the accuracy gap with non-incremental models.

Summary updated

BibTeX
@inproceedings{kahardipraja2021towards,
  author = {Patrick Kahardipraja and Brielen Madureira and David Schlangen},
  title = {{Towards Incremental Transformers: An Empirical Analysis of Transformer Models for Incremental NLU}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2021},
  url = {https://openreview.net/forum?id=s1AWzsO_bM},
}
Figure