Learning Universal Sentence Representations with Mean-Max Attention Autoencoder

Minghua Zhang, Yunfang Wu, Weikang Li, Wei Li 0101

Introduction

Universal sentence representations—fixed-length vectors that encapsulate the semantic essence of a sentence—are foundational to modern Natural Language Processing (NLP). These embeddings enable downstream performance across diverse tasks such as sentiment analysis, paraphrase detection, and semantic similarity without task-specific retraining. However, traditional approaches have faced two significant bottlenecks: computational inefficiency and the "teacher forcing" weakness.

Historically, models like skip-thoughts relied on Recurrent Neural Networks (RNNs). Because RNNs process tokens sequentially, training on massive unlabeled datasets like the Toronto Books Corpus is prohibitively slow, often requiring weeks of computation. Furthermore, standard autoencoders trained with "teacher forcing" frequently develop decoders that ignore the global latent representation in favor of local word patterns, failing to truly capture sentence-level semantics.

The Mean-Max Attention Autoencoder (mean-max AAE) addresses these challenges by replacing recurrence with parallelizable self-attention and introducing a dual-pooling strategy to capture a richer semantic profile.

Architecture and Methodology

The core of the mean-max AAE is a Transformer-based architecture optimized for unsupervised representation learning.

The Encoder

Unlike standard Transformers, the encoder utilizes MultiHead self-attention without the typical residual connections in the attention layer. This design choice allows the model to expand hidden dimensions more freely, facilitating the extraction of complex features from the input sentence $S$. Every word in the sentence attends to every other word simultaneously, enabling a global contextual understanding that is fully parallelizable.

Mean-Max Pooling

To condense the variable-length hidden states ($h_1^e, \dots, h_N^e$) into a fixed-length vector $z$, the authors employ a hybrid pooling strategy. Max pooling is used to identify the most salient, "sharp" features (e.g., specific keywords), while mean pooling captures the broader, "smooth" semantic context. These two vectors are concatenated to form the final latent representation $z = [z_{max}; z_{mean}]$.

The architecture of the Mean-Max Attention Autoencoder, showing the flow from the encoder through mean-max pooling to the decoder.

The Decoder and Mean-Max Attention

To combat the "lazy decoder" issue, the authors introduce a mean-max attention mechanism. Instead of providing the latent vector $z$ only at the start of decoding, the decoder performs attention over $z$ at every time step. This forces the model to dynamically retrieve information from the global summary to guide the reconstruction of each word $w_t$, ensuring the latent space is semantically dense and informative.

Experimental Results

The model was trained on the Toronto Books Corpus (70 million sentences) and evaluated using the SentEval framework across ten transfer tasks.

Performance Benchmarks

As shown in the performance data, the mean-max AAE consistently outperforms or matches state-of-the-art unsupervised single models. Notably, it exceeds the performance of skip-thoughts+LN across most benchmarks, including sentiment classification (SST), question type classification (TREC), and entailment (SICK-E).

Performance comparison of mean-max AAE against various unsupervised and supervised baselines across ten transfer tasks.

Efficiency and Semantic Richness

The shift from RNNs to self-attention yielded dramatic improvements in training speed. While skip-thoughts models can take weeks to train, the mean-max AAE reached convergence in less than 5 hours on a single GTX 1080 GPU.

Furthermore, the model demonstrates superior semantic intuition. On the STS14 Semantic Textual Similarity task, it achieved a Pearson score of 0.58, a significant leap over the 0.44 achieved by skip-thoughts+LN. This suggests that the combination of mean and max pooling creates a more nuanced representation space that aligns better with human judgment of similarity.

Conclusion

The Mean-Max Attention Autoencoder represents a significant step forward in unsupervised sentence representation learning. By leveraging the parallel nature of self-attention and a dual-pooling strategy, the model achieves state-of-the-art results with a fraction of the training time required by previous recurrent architectures. Future work may explore adapting this framework to low-resource languages, where the ability to learn from raw, unlabeled text is most critical.

Summary updated

BibTeX
@inproceedings{zhang2018learning,
  author = {Minghua Zhang and Yunfang Wu and Weikang Li and Wei Li},
  title = {{Learning Universal Sentence Representations with Mean-Max Attention Autoencoder}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2018},
}
Figure