BANG: Bridging Autoregressive and Non-autoregressive Generation with Large Scale Pretraining

Weizhen Qi, Yeyun Gong, Jian Jiao, Yu Yan, Dayiheng Liu, Weizhu Chen, Kewen Tang, Houqiang Li, Jiusheng Chen, Ruofei Zhang, Ming Zhou, Nan Duan

In the landscape of Natural Language Generation (NLG), researchers have long grappled with a fundamental trade-off: the high accuracy of sequential Autoregressive (AR) models versus the high speed of parallel Non-autoregressive (NAR) models. AR models, such as the GPT series, generate text token-by-token, ensuring strong contextual coherence but suffering from significant latency. Conversely, NAR models generate all tokens simultaneously, offering massive speedups but often at the cost of linguistic quality due to the "multimodality" problem—where the model struggles to coordinate parallel predictions without sequential dependencies.

BANG (Bridging Autoregressive and Non-autoregressive Generation) introduces a unified pretraining framework designed to reconcile these two paradigms. By treating AR and NAR generation as ends of a single spectrum, BANG enables a single model to perform across various generation modes with high efficiency and competitive accuracy.

The BANG Architecture

The core innovation of BANG is its Cross-stream Visible n-stream Self-attention mechanism. Unlike standard Transformers that utilize a single stream for processing, BANG's decoder architecture employs multiple streams during the pretraining phase to simulate different levels of contextual visibility.

The BANG architecture illustrating the spectrum from Autoregressive (AR) to Non-autoregressive (NAR) generation through multiple predicting streams.

As illustrated in Figure 1, the architecture consists of a Main Stream (M-S) and several Predicting Streams (P-S). The Main Stream processes the ground-truth tokens, while the Predicting Streams attempt to reconstruct the target sequence with varying constraints:

  • Main Stream (M-S): Receives the correct ("golden") tokens to build the internal representation.
  • 1st Predicting Stream: Acts like a traditional AR model, seeing all previous golden tokens to predict the next one.
  • Intermediate Streams: Act as a "bridge," seeing a mix of golden tokens and masks.
  • Last Predicting Stream: Acts as a pure NAR model, seeing only [MASK] tokens and relying entirely on the encoder's context.

This multi-stream approach creates a training "curriculum" where the bridging streams help the NAR components learn from the high-accuracy AR components. This allows the same pretrained weights to be finetuned for AR, NAR, or semi-NAR tasks.

Cross-stream Visible N-stream Self-attention

The technical implementation of this multi-stream approach is detailed in the algorithm below. By splitting the Query, Key, and Value matrices and managing a cache for keys and values, the model efficiently computes attention across streams without a linear increase in computational overhead.

Algorithm 1: Cross-stream Visible N-stream Self-attention.

Key Results and Performance

BANG was pretrained on a 16GB English corpus (Wikipedia and BookCorpus) and evaluated on diverse NLG tasks, including question generation (SQuAD 1.1), extreme summarization (XSum), and dialogue (PersonaChat). The results demonstrate that BANG effectively bridges the performance gap:

  • Massive NAR Gains: In pure NAR mode, BANG achieved an 11.01-point improvement on SQuAD 1.1 compared to the best non-pretrained NAR baselines.
  • High Efficiency: The model delivered a 10.2x speedup over traditional AR Transformers (15.69ms vs 159.49ms per sample) while maintaining competitive accuracy.
  • Versatility: In AR mode, BANG performs comparably to state-of-the-art models like BART and Pegasus, proving that its NAR-focused training does not degrade its sequential generation capabilities.
  • Semi-NAR Excellence: BANG’s semi-NAR mode—which generates a prefix sequentially before switching to parallel generation—showed a 14.01-point absolute improvement over existing semi-NAR methods on the SQuAD dataset.

Conclusion

BANG represents a significant step toward unified language generation. By framing AR and NAR as a structural spectrum rather than distinct architectures, it provides a flexible foundation for high-performance, low-latency text generation. While future work may further optimize hybrid generation strategies, BANG successfully demonstrates that large-scale pretraining can bring the speed of NAR models to the accuracy standards of AR generation.

Summary updated

BibTeX
@inproceedings{qi2021bang,
  author = {Weizhen Qi and Yeyun Gong and Jian Jiao and Yu Yan and Dayiheng Liu and Weizhu Chen and Kewen Tang and Houqiang Li and Jiusheng Chen and Ruofei Zhang and Ming Zhou and Nan Duan},
  title = {{BANG: Bridging Autoregressive and Non-autoregressive Generation with Large Scale Pretraining}},
  booktitle = {International Conference on Machine Learning},
  year = {2021},
  url = {https://openreview.net/forum?id=QDiB2IrKpHE},
}
Figure