Non-autoregressive Sequence-to-Sequence Vision-Language Models

Kunyu Shi, Qi Dong, Luis Goncalves, Zhuowen Tu, Stefano Soatto

TL;DR

State-of-the-art vision-language models are notoriously slow at inference because they generate text tokens one by one (autoregressively). This paper introduces NARVL, a non-autoregressive vision-language model that decodes entire sequences in parallel, achieving up to a 12.7x speedup with virtually no loss in performance thanks to a novel Query-CTC loss function.

What Problem Does This Paper Address?

Autoregressive (AR) Transformers have become the standard for "All-in-One" vision-language models, handling everything from image captioning to visual question answering (VQA). However, their sequential nature means that to generate an output sequence of length $T$, the model must be executed $T$ times. This linear time complexity ($O(T)$) creates a massive bottleneck for real-time applications.

While non-autoregressive (NAR) methods exist, they typically rely on set-to-set bipartite matching (like DETR). This works well for orderless visual tasks like object detection, but struggles with language-focused tasks where the strong sequential correlation between words is crucial. The authors set out to design a non-autoregressive model capable of constant-time ($O(1)$) joint inference without sacrificing language modeling quality.

Methods

The authors present NARVL (Non-Autoregressive Vision-Language Model), which modifies the standard encoder-decoder architecture in two primary ways:

  1. Parallel Transformer Decoder with Learnable Query Tokens (LQT): Instead of feeding previously generated tokens back into the decoder during inference, NARVL uses a fixed-length sequence of constant, learnable query tokens. Absolute position embeddings are added to these queries to force structural order onto the output sequence.
  2. Query Connectionist Temporal Classification (Q-CTC) Loss: Standard cross-entropy loss severely penalizes a model if its output is shifted by even a single token position. To fix this, the authors introduce Q-CTC loss. Inspired by speech recognition, Q-CTC marginalizes over multiple valid decoding paths from the LQTs to the target tokens. During inference, a "path collapse" operation removes blank and repetitive tokens to produce the final text.
Figure 2. The overview of NARVL. NARVL borrows the encoder from OFA [45], where the embedding sequence of input text and image CNN (ResNet) feature are concatenated in the input token sequence. Unlike the standard transformer decoder that generates outputs sequentially, conditioning on the generated sequence, our non-autoregressive decoder takes a sequence of tokens that are learnable weights, and generates outputs for all tokens in parallel. As the output sequence length is unknown, we set the number of of learnable query tokens to a value (hyperparameter) larger than the largest target sequence length. The loss used, Q-CTC, is described in Eq. 1.

To stabilize training against the massive solution space inherent to non-autoregressive generation, the authors also employ Knowledge Distillation (KD), using a standard AR Transformer as a teacher model to provide more deterministic targets for complex language tasks.

Datasets

NARVL was evaluated across a diverse suite of standard vision-language benchmarks:

  • Visual Grounding (VG): RefCOCO, RefCOCO+, and RefCOCOg
  • Visual Entailment (VE): SNLI-VE
  • Visual Question Answering (VQA): VQA v2
  • Image Captioning (IC): MSCOCO (Karpathy split)

Key Insights and Ideas

  • The Power of Bidirectional Attention: Surprisingly, NARVL actually outperforms its autoregressive counterpart on visual grounding tasks. The authors attribute this to the bidirectional attention of the parallel decoder. In an AR model, early tokens cannot attend to later tokens; in NARVL, early coordinate tokens can leverage context from the entire generated sequence.
  • Sequence vs. Set: By treating the decoder queries as an ordered sequence rather than an orderless set, NARVL successfully bridges the gap between purely visual tasks (like object detection) and highly structured language tasks (like captioning).
  • Q-CTC Over Cross-Entropy: Standard cross-entropy is too rigid for parallel generation. Q-CTC loss allows the model to explore multiple alignment paths during training, which drastically improves performance on longer text sequences.

Key Results

NARVL achieves massive inference speedups while maintaining competitive accuracy across all tasks:

Figure 1. Comparison of inference speed and performance be- tween NARVL (non-autoregressive) and its autoregressive coun- terpart on four vision-language tasks: Visual entailment (VE), Vi- sual grounding (VE), Visual Question Answering (VQA), and Im- age captioning (IC). From (a), we see that NARVL speeds up the inference of AR by a factor between 1.4 and 12.7, while achieving on-par performance.
  • Visual Question Answering: NARVL achieved a staggering 12.7x speedup, cutting inference time from 645.1 ms down to just 50.7 ms, with only a minor drop in accuracy (75.59% vs 77.48% for the base model).
  • Visual Grounding: On the RefCOCO dataset, NARVL outperformed the AR baseline in accuracy (88.78% vs 88.15%) while running 2.4x faster (54.8 ms vs 133.6 ms).
  • Image Captioning: NARVL delivered a 7.2x speedup (51.2 ms vs 366.0 ms) while maintaining highly competitive CIDEr scores.

Limitations and Future Work

Despite its success, NARVL has a few notable limitations:

  • Optimization Complexity: Training NAR models remains difficult. Achieving top-tier performance on language-heavy tasks like VQA and Image Captioning still relies heavily on knowledge distillation from a pre-trained autoregressive teacher model.
  • Conditional Independence Assumption: Because the decoder tokens are generated independently in parallel, the model can occasionally suffer from "multimodality bugs"—for instance, blending two equally valid answers into a single, nonsensical output sequence (e.g., merging "Red" and "White" into "White and White").

Summary updated

BibTeX
@misc{shi2024non,
  author = {Kunyu Shi and Qi Dong and Luis Goncalves and Zhuowen Tu and Stefano Soatto},
  title = {{Non-autoregressive Sequence-to-Sequence Vision-Language Models}},
  year = {2024},
  eprint = {2403.02249},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2403.02249},
}
Figure