Autoencoding Improves Pre-trained Word Embeddings

Masahiro Kaneko, Danushka Bollegala

Abstract

Pre-trained word embeddings often suffer from anisotropy, clustering into narrow cones that hinder semantic performance. While previous methods like "All-But-The-Top" (ABTT) suggest removing dominant principal components to improve isotropy, this paper demonstrates that a simple self-supervised autoencoder is a more effective post-processing tool. By minimizing reconstruction error, autoencoders retain critical semantic information while naturally centering and spreading the embedding space.

Introduction: The Isotropy Problem

Pre-trained word embeddings such as Word2Vec, GloVe, and fastText are foundational to modern NLP. However, these embeddings are often "anisotropic," meaning they occupy a narrow cone in the vector space rather than being distributed evenly. This lack of isotropy can conflate word frequency with semantic meaning, reducing the effectiveness of the embeddings in downstream tasks.

A popular remedy, the "All-But-The-Top" (ABTT) method, involves calculating the Principal Component Analysis (PCA) of the embeddings and deleting the top few components. The assumption is that these dominant directions encode noise or frequency rather than meaning. This paper challenges that assumption, proposing that a standard autoencoder can improve embeddings more effectively by learning to reconstruct them rather than discarding parts of them.

Methodology and Theoretical Framework

The authors evaluate two types of autoencoders for post-processing:

  1. Linear Autoencoder (LAE): A model without non-linear activation functions.
  2. Non-linear Autoencoder (AE): A model utilizing a tanh activation function in the hidden layer.

The Reconstruction Paradox

The core theoretical contribution of this work is a proof regarding the relationship between linear autoencoders and PCA. To minimize squared $\ell_2$ reconstruction loss, an autoencoder must retain the largest principal components. This directly contradicts ABTT's strategy of removal. Furthermore, the authors prove that autoencoders automatically perform "centering" (mean subtraction), a prerequisite for high-quality embeddings.

Experimental Setup

The method was tested on three major embedding types: Word2Vec (300D, Google News), GloVe (300D, Common Crawl), and fastText (300D, Common Crawl). Evaluation spanned semantic similarity (e.g., SIMLEX-999, MEN), word analogy (Google, MSR), and concept categorization (BLESS).

Key Results and Insights

The non-linear autoencoder (AE) consistently outperformed both the original embeddings and the ABTT baseline across nearly all benchmarks. For instance, on the MEN similarity task, fastText embeddings improved from a score of 71.1 to 76.0.

Visualizing Isotropy

The post-processing significantly shifts the distribution of embeddings. As shown in Figure 3, the autoencoder effectively spreads the vectors, moving the distribution toward a more isotropic state (centered around 1.0) compared to the original embeddings.

Distribution of cosine similarities for Word2Vec, GloVe, and fastText embeddings before and after post-processing.

Quantitative Improvements

The measure of isotropy ($\gamma$), where 1.0 represents perfect isotropy, showed dramatic increases. For GloVe embeddings, $\gamma$ increased from a nearly-flat 0.018 to a much healthier 0.884 after autoencoding.

Isotropy scores ($\gamma$) for different embedding types and post-processing methods.

Key takeaways include:

  • Non-linearity Matters: While LAE is theoretically linked to PCA, the non-linear AE consistently yielded superior semantic accuracy, suggesting that word relationships benefit from non-linear transformations.
  • Efficiency: Autoencoders can be trained using mini-batches, making them more scalable than full-vocabulary PCA methods for massive datasets.

Conclusion and Future Directions

This research highlights that the dominant components of word embeddings contain vital information that should be preserved rather than discarded. While highly effective for static embeddings, future work could extend this autoencoding approach to contextual models like BERT, which also exhibit anisotropy in their hidden states.

Summary updated

BibTeX
@inproceedings{kaneko2020autoencoding,
  author = {Masahiro Kaneko and Danushka Bollegala},
  title = {{Autoencoding Improves Pre-trained Word Embeddings}},
  booktitle = {International Conference on Computational Linguistics},
  year = {2020},
  doi = {10.18653/v1/2020.coling-main.149},
}
Figure