Speeding up Context-based Sentence Representation Learning with Non-autoregressive Convolutional Decoding

Shuai Tang, Hailin Jin, Chen Fang, Zhaowen Wang, Virginia R. de Sa · DOI

Speeding up Context-based Sentence Representation Learning with Non-autoregressive Convolutional Decoding

Abstract

Context plays an important role in human language understanding, thus it may also be useful for machines learning vector representations of language. In this paper, we explore an asymmetric encoder-decoder structure for unsupervised context-based sentence representation learning. We carefully designed experiments to show that neither an autoregressive decoder nor an RNN decoder is required. After that, we designed a model which still keeps an RNN as the encoder, while using a non-autoregressive convolutional decoder. We further combine a suite of effective designs to significantly improve model efficiency while also achieving better performance. Our model is trained on two different large unlabelled corpora, and in both cases the transferability is evaluated on a set of downstream NLP tasks. We empirically show that our model is simple and fast while producing rich sentence representations that excel in downstream tasks.

Introduction

Unsupervised sentence representation learning aims to map sentences into fixed-length vectors that capture semantic meaning without requiring labeled data. A prominent approach is the encoder-decoder framework, such as the Skip-thoughts model, which learns representations by predicting the surrounding context of a given sentence. However, Skip-thoughts is computationally expensive and slow to train, largely due to its use of autoregressive RNN decoders. These decoders generate text sequentially, word-by-word, which is a significant bottleneck during training. This paper investigates whether such a complex decoder is necessary for learning high-quality encoder representations and proposes a significantly faster alternative.

Architecture: The RNN-CNN Model

The authors propose an asymmetric architecture that prioritizes encoder quality while simplifying the decoder for maximum training efficiency.

  1. RNN Encoder: The model uses a bi-directional Gated Recurrent Unit (bi-GRU) to process input sentences.
  2. Composition Function: Instead of relying solely on the final hidden state, the model employs global mean and max pooling over all hidden states. Concatenating these two pooling results captures both the general semantic "gist" and specific salient features (keywords).
  3. CNN Decoder: The core innovation is a non-autoregressive 3-layer CNN decoder. Using a "predict-all-words" strategy, it predicts the entire subsequent context window (e.g., 30 words) simultaneously from the sentence vector.
The proposed RNN-CNN architecture featuring a bi-directional RNN encoder and a non-autoregressive CNN decoder.

Key Insights: Rethinking the Decoder

The primary finding is that the decoder's role is merely to provide a training signal (gradients) to the encoder. The authors demonstrate that the quality of the generated text is secondary to the quality of the learned latent representation.

  • Non-Autoregressive Sufficiency: Experiments show that a "predict-all-words" CNN provides a sufficient training signal. It forces the encoder to compress all necessary contextual information into the sentence vector without the overhead of sequential generation.
  • Decoder Ablation: As shown in the performance comparison, replacing an autoregressive RNN with a non-autoregressive CNN does not degrade performance on downstream tasks; in some cases, it even improves it.
Comparison of different decoder architectures across various downstream tasks, showing that non-autoregressive CNN decoders are competitive with more complex RNN decoders.

Key Results and Performance

The RNN-CNN model achieves a remarkable balance between speed and performance:

  • Training Speed: The model offers a significant speedup over traditional methods. A "small" version trained in just 20 hours on a single GPU, compared to the 336 hours reported for the original Skip-thoughts—a roughly 16x improvement in training time.
  • Downstream Performance: Despite its simplicity, the model outperforms Skip-thoughts on nearly all benchmarks. For instance, on the SICK-R semantic relatedness task, the large RNN-CNN achieved a correlation of 0.8698, surpassing Skip-thoughts' 0.8580.
  • Scalability: Performance scales effectively with larger datasets, such as the Amazon Book Review corpus, particularly for sentiment analysis and classification tasks.

Conclusion

This work demonstrates that expensive autoregressive decoders are not required for context-based sentence representation learning. By utilizing a simple, non-autoregressive CNN decoder and effective pooling strategies, the proposed RNN-CNN model achieves state-of-the-art results while being orders of magnitude faster to train than previous encoder-decoder models. This paves the way for more efficient unsupervised learning on even larger unlabelled corpora.

Summary updated

BibTeX
@misc{tang2017speeding,
  author = {Shuai Tang and Hailin Jin and Chen Fang and Zhaowen Wang and Virginia R. de Sa},
  title = {{Speeding up Context-based Sentence Representation Learning with Non-autoregressive Convolutional Decoding}},
  year = {2017},
  eprint = {1710.10380},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1710.10380},
}
Figure