Spherical Text Embedding: Closing the Gap Between Training and Evaluation
Unsupervised text embeddings are foundational in Natural Language Processing (NLP). Popular models like Word2Vec and GloVe are typically trained in "flat" Euclidean space. However, when these embeddings are evaluated or used in downstream tasks—such as finding similar words or clustering documents—researchers almost exclusively rely on directional metrics like cosine similarity.
This creates a fundamental mismatch: models are trained to minimize distance in one geometry (Euclidean) but are utilized in another (Spherical). Mathematically, an "optimal" solution in Euclidean space is rarely optimal once projected onto a sphere. Furthermore, Euclidean models often struggle to capture the purely directional nature of semantics, where the "angle" of a word vector relative to others is far more important than its magnitude.
To bridge this gap, researchers introduce JoSE (Joint Spherical Embedding), a model that learns word and paragraph embeddings directly on the surface of a unit hypersphere.
Methodology: Learning on the Sphere
The authors propose a generative model that operates entirely within spherical geometry to naturally capture directional semantics.
- The Spherical Generative Model: Text generation is modeled as a two-step process. First, a paragraph selects a "center word" based on its semantic direction. Then, that center word generates nearby "context words."
- The von Mises-Fisher (vMF) Distribution: Instead of the standard Gaussian distribution (which assumes a Euclidean space), JoSE uses the vMF distribution—essentially the "Gaussian of the sphere." This allows the model to calculate the probability of word co-occurrences based strictly on their angular similarity.
- Riemannian Optimization: Standard Stochastic Gradient Descent (SGD) cannot be used on a sphere because a straight-line update would push the vector off the surface. Instead, the authors employ Riemannian SGD, which ensures updates follow the curvature of the sphere.
To make training efficient, the complex exponential mappings typically required for spherical updates are replaced with a fast approximation called a "retraction." The authors also introduce a modified gradient that scales updates by the cosine distance, ensuring that vectors further from their target direction receive a stronger "push" during training.
Key Insights
- Closing the "Euclidean Gap": By forcing the model to live on the sphere from initialization, the embeddings naturally capture directional semantics more accurately than post-processed Euclidean vectors.
- Joint Learning is Key: Unlike Word2Vec, which focuses only on word-word relationships, JoSE jointly learns word and paragraph embeddings. This allows the model to exploit both local context (nearby words) and global context (the overarching theme of the paragraph).
- Efficiency through Simplicity: Because the objective function uses simple dot products (which represent cosine similarity on a unit sphere) rather than expensive exponential or logarithmic functions, JoSE achieves higher throughput than traditional models.
- The BERT Caveat: While BERT is a powerhouse for contextual tasks, it underperforms on static word similarity benchmarks. BERT produces dynamic embeddings (e.g., the vector for "bank" changes based on the sentence), whereas word similarity tasks require a single, stable representation.
Key Results
The authors evaluated JoSE across several standard benchmarks, training on a massive 2.4-billion-token Wikipedia dump.
Word Similarity: JoSE outperformed Word2Vec, GloVe, fastText, and BERT on all three evaluated benchmarks (WordSim353, MEN, and SimLex999). For example, on WordSim353, JoSE achieved a Spearman correlation of 0.739, beating Word2Vec’s 0.711.
Document Clustering: JoSE demonstrated massive improvements over Doc2Vec. On the 20 Newsgroups dataset, JoSE’s Normalized Mutual Information (NMI) reached 0.664, compared to Doc2Vec’s 0.630.
Training Speed: JoSE is remarkably efficient. It processed the Wikipedia dump in just 0.73 hours per iteration, making it faster than Word2Vec (0.81 hrs) and GloVe (0.85 hrs), and orders of magnitude faster than BERT (>5 days).
Limitations and Future Work
While JoSE sets a new standard for static embeddings, the authors note a few areas for future exploration:
- Fixed Concentration: The current model uses a constant "concentration" parameter ($\kappa=1$) for the vMF distribution. Learning a unique $\kappa$ for each word—representing how specific or broad its meaning is—could improve results.
- Subword Information: JoSE treats words as atomic units. Incorporating subword information (similar to fastText) could help the model handle rare or out-of-vocabulary words.
- Supervised Fine-tuning: These spherical constraints could potentially be applied to the first layer of deep neural networks to see if "spherical pre-training" benefits downstream supervised tasks.
Summary updated