Word Embedding Visualization Via Dictionary Learning

Juexiao Zhang, Yubei Chen, Brian Cheung, Bruno A. OlshausenarXiv 2019

Abstract

Co-occurrence statistics based word embedding techniques have proved to be very useful in extracting the semantic and syntactic representation of words as low dimensional continuous vectors. In this work, we discovered that dictionary learning can open up these word vectors as a linear combination of more elementary word factors. We demonstrate many of the learned factors have surprisingly strong semantic or syntactic meaning corresponding to the factors previously identified manually by human inspection. Thus dictionary learning provides a powerful visualization tool for understanding word embedding representations. Furthermore, we show that the word factors can help in identifying key semantic and syntactic differences in word analogy tasks and improve upon the state-of-the-art word embedding techniques in these tasks by a large margin.

Introduction

Word embeddings like Word2vec and GloVe are fundamental to modern Natural Language Processing, transforming words into high-dimensional vectors. Despite their utility, these vectors are notoriously opaque—individual dimensions rarely have a clear meaning, and standard visualization techniques like t-SNE often distort the linear relationships that make embeddings powerful.

Researchers from UC Berkeley and Tsinghua University propose Dictionary Learning as a solution. By decomposing word vectors into a sparse combination of "elementary word factors," they provide a method to "open up" these vectors and inspect their underlying semantic and syntactic components.

Methodology: Non-negative Overcomplete Sparse Coding

The core of this approach is Non-negative Overcomplete Sparse Coding (NSC). A word vector $x$ is modeled as $x \approx \Phi \alpha$, where $\Phi$ is a dictionary of word factors and $\alpha$ is a sparse vector of non-negative coefficients.

The use of non-negativity ensures that word meanings are constructed by adding factors together, which is more intuitive for human interpretation than allowing subtractions. By using an overcomplete dictionary (e.g., 1,000 factors for 300-dimensional vectors), the model captures a diverse range of concepts. To handle redundancy and group related factors (like various "past tense" components), spectral clustering is applied to create robust "factor groups." The optimization problem is solved efficiently using the FISTA algorithm.

Key Insights and Visualization

Dictionary learning allows for several novel ways to analyze, visualize, and debug word embeddings.

Polysemy Separation

One of the most powerful applications is the decomposition of polysemous words. Instead of a single point in space representing multiple meanings, dictionary learning breaks a word down into its constituent parts. For example, the word "apple" can be seen as a combination of factors like fruit (16.2%), mobile&IT (22.3%), and organism (10.9%). This allows researchers to see how a model balances different meanings of the same word.

Decomposition of polysemous words into elementary semantic factors.

Model Diagnosis and Corpus Bias

The method also serves as a diagnostic tool for detecting corpus bias and model artifacts. In GloVe, the "king" vector shows high activation for a "bedding" factor (likely due to "king-sized" beds), a bias absent in Wikipedia-trained models.

Furthermore, it reveals how subword-based models like fastText can be misled by character n-grams. For instance, the word "sing" shows abnormally high activation in a "present participle" factor group simply because it contains the string "ing," even though it is a base form verb.

Activation of the 'present participle' factor group, highlighting how 'sing' is miscategorized due to its subword structure.

Improving Word Analogies

Beyond visualization, these factors can be used to improve performance on downstream tasks. The authors introduced Factor Group Selection for word analogies. Instead of just taking the nearest neighbor to a vector arithmetic result (e.g., $king - man + woman$), they required the answer to have a higher activation in the relevant factor group (e.g., the "female" group for gender analogies).

This simple filtering led to consistent improvements across almost all subtasks. For GloVe, total analogy accuracy rose from 72.69% to 77.96%, with even larger gains on specific tasks like "Profession" analogies, where accuracy jumped from 36.26% to 53.80%.

Conclusion

By treating word embeddings as a "bag of factors" rather than opaque points in space, this research provides a powerful lens for both understanding and improving NLP models. While currently focused on static embeddings, the success of this dictionary learning approach suggests a promising path for interpreting more complex, context-dependent models in the future.

Summary updated

BibTeX
@misc{zhang2019word,
  author = {Juexiao Zhang and Yubei Chen and Brian Cheung and Bruno A. Olshausen},
  title = {{Word Embedding Visualization Via Dictionary Learning}},
  year = {2019},
  eprint = {1910.03833},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1910.03833},
}
Figure