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

Patrick Kahardipraja, Brielen Madureira, David Schlangen

Introduction

In interactive applications such as voice assistants and real-time dialogue agents, Natural Language Understanding (NLU) systems must process input incrementally. Ideally, a system should provide partial outputs as a user speaks or types, rather than waiting for the end of a sentence. However, standard Transformer models are inherently "global" processors, utilizing self-attention mechanisms that look at the entire sequence simultaneously.

To adapt Transformers for incremental tasks, the current standard is restart-incrementality: re-processing the entire prefix every time a new token is added. This approach is computationally inefficient, with processing time growing quadratically ($O(n^2)$) relative to sequence length. This paper explores the use of Linear Transformers (LT) to achieve RNN-like efficiency without sacrificing the representational power of the Transformer architecture.

Methodology: From Global to Recurrent

The core innovation lies in the Linear Transformer, which replaces the standard softmax attention with a linear kernel function. This change allows the Transformer's state to be updated incrementally using a recurrence mechanism, similar to an RNN. This enables constant-time updates per token ($O(1)$) and linear total processing time ($O(n)$).

The authors evaluate five primary configurations:

  • Baseline: Standard Transformer using restart-incrementality.
  • LT: Linear Transformer using restart-incrementality.
  • LT+R: LT utilizing its internal Recurrence for RNN-style inference.
  • LT+R+CM: LT with recurrence trained using Causal Masking to ensure the model only attends to previous tokens.
  • LT+R+CM+D: The recurrent model with a Delay strategy, where the system waits for 1 or 2 "future" tokens before finalizing a label to resolve local ambiguities.

Incremental Performance Metrics

Beyond standard F1 scores, the study employs specific metrics to measure incremental quality:

  • Relative Correctness (RC): The probability that a partial output matches the final output once the full sequence is processed.
  • Edit Overhead: A measure of how many times the model "changes its mind" about previous labels as more context arrives.
  • Correction Time: The average time it takes for a model to reach its final decision for a specific token.
Incremental performance metrics (Edit Overhead, Correction Time, and Relative Correctness) across different model configurations and datasets.

As shown in the figures above, the recurrent LT models (LT+R and LT+R+CM) demonstrate high Relative Correctness and lower Edit Overhead compared to the baseline in many scenarios. Notably, the recurrent models produce "monotonic" outputs in sequence tagging, meaning they do not revise previous labels, which provides a more stable input for downstream components.

Key Results: Speed and Scaling

The most significant advantage of the recurrent Linear Transformer is its computational efficiency. By avoiding the redundant calculations of the restart method, the LT+R+CM configuration achieves a 14x speedup on average over the baseline Transformer.

Comparison of processing time vs. sequence length for the Baseline, LT (restart), and LT+R+CM models.

While the baseline's processing time increases quadratically, the recurrent LT scales linearly with sequence length. This makes it uniquely suited for long-form dialogue where low latency is critical.

Discussion and Limitations

While the recurrent LT offers superior speed and stability, it incurs a "performance tax" in terms of absolute accuracy. Standard Transformers generally achieve higher full-sequence F1 scores (e.g., ~89.5 on NER vs. ~81.4 for the best LT variant). However, the authors found that a small "wait-and-see" delay (1-2 tokens) can significantly bridge this gap by providing just enough right-context to resolve linguistic ambiguities.

Future work may involve exploring more sophisticated feature maps or adding gating mechanisms (like those in LSTMs) to improve the representational capacity of Linear Transformers. Additionally, testing these models on morphologically rich languages remains an important next step.

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