FlowSeq: Non-Autoregressive Conditional Sequence Generation with Generative Flow

Xuezhe Ma, Chunting Zhou, Xian Li, Graham Neubig, Eduard H. Hovy

Abstract: Xuezhe Ma, Chunting Zhou, Xian Li, Graham Neubig, Eduard Hovy. Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP).

2019.

FlowSeq is a novel non-autoregressive sequence-to-sequence model that uses generative flows to generate entire sentences in a single parallel pass. By modeling complex dependencies through a latent variable space, it achieves translation quality comparable to state-of-the-art non-autoregressive models while offering up to a 6x speedup over traditional Transformers during inference.

What Problem Does This Paper Address?

Most modern translation models, such as the Transformer, are autoregressive: they generate text one word at a time, from left to right. Each new word depends on all preceding words, creating a bottleneck at inference time with $O(T)$ decoding time, where $T$ is the sequence length.

Non-autoregressive (NAR) models attempt to break this bottleneck by generating all tokens simultaneously ($O(1)$ time). However, they face a "multi-modality problem": generating all words at once without inter-token coordination can lead to inconsistent or repetitive outputs (e.g., "Thank you" and "Thanks" merging into "Thank thanks"). Previous NAR models struggled to capture these complex relationships without losing significant accuracy compared to autoregressive counterparts.

Conceptual comparison of (a) autoregressive, (b) standard non-autoregressive, and (c) latent variable non-autoregressive models.

Methods

The authors introduce FlowSeq, which uses a latent variable model to bridge the gap. Instead of predicting words directly, the model predicts a sequence of continuous latent variables $z$, which are then transformed into words. The core innovation is the use of Generative Flows (inspired by the Glow architecture) to model the distribution of these latent variables. A flow is a series of invertible mathematical transformations that turns a simple distribution (like a standard Gaussian) into a complex one capable of capturing linguistic structure.

The FlowSeq architecture, illustrating the interaction between the source encoder, target encoder, prior flow, and target decoder.

Key components of the FlowSeq architecture include:

  • Source Encoder: A standard Transformer encoder that processes the input sequence.
  • Prior Flow: A multi-scale flow architecture consisting of Actnorm for stable training, Invertible Multi-head Linear Layers to allow latent dimension interaction, and Affine Coupling Layers that use Transformer-based networks for reversible transformations.
  • Decoder: A non-causal Transformer that maps latent variables to final word probabilities.
  • Length Predictor: A module to predict the target sequence length before generation begins.

Datasets and Evaluation

The model was evaluated on three standard Neural Machine Translation (NMT) benchmarks:

  1. WMT2014 DE-EN: Large-scale (~4.5M sentence pairs).
  2. WMT2016 RO-EN: Medium-scale (~610K sentence pairs).
  3. IWSLT2014 DE-EN: Small-scale (~150K sentence pairs).

The authors utilized "Knowledge Distillation"—training the NAR model on the outputs of a pre-trained autoregressive Transformer—to simplify the data distribution, a standard practice for NAR models.

Key Insights and Ideas

  • Flows as a "Global Coordinator": By using a flow to model the latent space, the model captures the joint distribution of the entire sentence. The flow ensures that latent variables for different positions remain consistent with one another.
  • Constant-Time Decoding: Unlike autoregressive models, FlowSeq’s decoding time remains relatively flat regardless of sentence length, making it highly efficient for long sequences.
  • Token Dropout: To prevent the model from "cheating" (where $z_t$ only encodes $y_t$), the authors used token dropout during training, randomly hiding words from the posterior network to force the learning of contextual dependencies.
  • Robustness to Raw Data: FlowSeq showed stronger performance on "raw" data (without distillation) than previous NAR methods, suggesting its flow-based prior handles the inherent noise of natural language more effectively.

Key Results

  • Inference Speed: At a batch size of 128, FlowSeq-base achieved a 5.94x speedup over a standard Transformer. The larger FlowSeq-large maintained a 4.03x speedup.
  • Accuracy: On WMT14 EN-DE, FlowSeq achieved a BLEU score of 25.31 (with Noisy Parallel Decoding), competitive with state-of-the-art NAR models like CMLM.
  • Scaling: The relative speedup compared to the Transformer increases linearly with target sequence length.

Limitations and Future Work

While FlowSeq is significantly faster, a gap remains in raw translation quality compared to the best autoregressive Transformers (e.g., ~25.3 BLEU vs ~27.3 BLEU on WMT14 EN-DE). Additionally, the use of Noisy Parallel Decoding (sampling and re-ranking) to improve quality slightly reduces the speed advantage. Future work may explore iterative refinement to close the accuracy gap further while maintaining the benefits of the flow-based architecture.

Summary updated

BibTeX
@inproceedings{ma2019flowseq,
  author = {Xuezhe Ma and Chunting Zhou and Xian Li and Graham Neubig and Eduard H. Hovy},
  title = {{FlowSeq: Non-Autoregressive Conditional Sequence Generation with Generative Flow}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2019},
  url = {https://openreview.net/forum?id=kAOwit4Op7},
}
Figure