Introduction
Representing documents as fixed-length vectors is a fundamental task in Natural Language Processing (NLP). While simple methods like Bag-of-Words (BOW) or averaging word embeddings are computationally efficient, they often fail to capture semantic nuances and word alignments. The Word Mover’s Distance (WMD) addressed this by measuring the minimum cost to transform one document into another in a word embedding space. However, WMD's high computational complexity ($O(L^3 \log L)$) and lack of a vector representation limited its scalability. Word Mover’s Embedding (WME) overcomes these hurdles by transforming WMD into a fast, fixed-length document vector using a random features approach.
Methodology: Bridging Distance and Embeddings
WME leverages the theory of Random Features to approximate a positive-definite kernel based on WMD. Instead of calculating the distance between every pair of documents in a dataset, WME projects documents into a new feature space by comparing them to a set of $R$ "random documents" ($\omega$).
Each random document $\omega$ consists of a small number of word vectors (typically 1–6) sampled from the embedding space. The embedding for a document $x$ is a vector where each component is the WMD between $x$ and one of the $R$ random documents, transformed by an exponential kernel function. This approach effectively treats random word clusters as "hidden global topics," capturing the semantic alignment of the document against the broader embedding space. Because these random documents are extremely short, the computation is significantly faster than comparing two full-length real documents.
Experimental Evaluation
The researchers evaluated WME on nine text classification datasets (e.g., TWITTER, BBCSPORT, AMAZON) and 22 textual similarity tasks from the SemEval challenges. WME was compared against state-of-the-art unsupervised methods, including Skip-Thought vectors and averaged word embeddings.
Key Results and Performance
WME demonstrated significant improvements in both speed and accuracy:
- Efficiency: WME achieved speedups of 100x to 472x over KNN-WMD on large datasets like OHSUMED and 20NEWS. By shifting the complexity from quadratic (pairwise comparisons) to linear (comparison to $R$ random features), WME enables large-scale document analysis.
- Accuracy: WME consistently outperformed other unsupervised embeddings on similarity tasks and proved particularly robust for short texts, such as Tweets, where traditional topic models often struggle.
The performance of WME is influenced by hyperparameters such as the number of random features ($R$) and the maximum length of random documents ($D_{max}$). As shown in the evaluation on the TWITTER and CLASSIC datasets, increasing $R$ leads to higher accuracy, though it also increases the embedding dimensionality. The "aha moment" of the research is that comparing a document to completely random clusters of words provides enough signal to create a high-quality embedding.
Conclusion
Word Mover’s Embedding provides a powerful framework for document representation by combining the semantic depth of WMD with the efficiency of random feature approximations. By producing fixed-length vectors, WME allows the use of standard machine learning classifiers and similarity measures at scale. While the method relies on the quality of underlying word embeddings (like Word2Vec), it offers a generic framework that could potentially integrate contextual models like BERT in future iterations.
Summary updated