Context is Everything: Finding Meaning Statistically in Semantic Spaces

Eric ZelikmanarXiv 2018

Context is Everything: Finding Meaning Statistically in Semantic Spaces

Introduction

Creating accurate vector representations of sentences—sentence embeddings—is a cornerstone of modern Natural Language Processing (NLP). These embeddings power applications ranging from sentiment analysis to document classification. However, researchers often face a frustrating trade-off. Simple methods like bag-of-words or tf-idf are fast and interpretable but "context-blind," treating word distances as equally important regardless of the topic. Conversely, deep learning models like SkipThought capture context well but are "black boxes," slow to train, and require massive datasets.

This paper introduces Contextual Salience (CoSal), a fast and unsupervised method for creating sentence vectors. CoSal addresses a specific flaw in traditional word-vector approaches: the implicit assumption that distances in an embedding space are equally important in every direction. In reality, the significance of a word is deeply tied to its context; a word like "cardinal" carries different weight in a document about Stanford research than it does in a text about ornithology.

The CoSal Methodology

The core of the CoSal approach is a measure of word importance that uses the distribution of context vectors to normalize distances.

The CoSal pipeline: from raw words to a context-aware sentence vector using Mahalanobis distance and sigmoidal weighting.

Instead of standard Euclidean or Cosine distance, CoSal utilizes Mahalanobis distance (M-distance). This can be thought of as a multi-dimensional z-score; it measures how many standard deviations a word vector is away from the "average" meaning of the context, accounting for correlations between different dimensions of the embedding space.

Furthermore, the authors discovered a "sigmoidal" relationship between a word's salience and its contribution to a phrase's meaning. Words that are only slightly more salient than average contribute disproportionately more to the sentence's overall vector. By combining M-distance with this sigmoidal weighting, CoSal acts as a "semantic tf-idf" that relies on the geometry of word vectors rather than simple frequency counts.

Insights: Unusualness and Interpretability

The central insight of CoSal is that "unusual" word vectors—those that deviate significantly from the local context's distribution—carry the most information. By mathematically "punishing" common or expected words, the model automatically focuses on the keywords that define a sentence.

Visualization of word salience in a biographical text. Higher scores (green) indicate words that are more 'unusual' relative to the general context, effectively identifying key entities and concepts.

Because CoSal is based on a single covariance calculation, it is highly transparent. Unlike the hidden states of a neural network, researchers can see exactly which words are being weighted and why. This interpretability allows for a clear understanding of how the model identifies salient information in a document.

Performance and Efficiency

CoSal was evaluated using the SentEval suite across various tasks, including sentiment analysis (MR, SST), paraphrase detection (MRPC), and question-type identification (TREC). Utilizing pre-trained GloVe and fastText vectors, the results were striking:

  • Speed: On a standard 2015 MacBook Pro without a GPU, the model "trains" in just 22ms per thousand sentences and evaluates most datasets in under 200ms.
  • Data Efficiency: Unlike deep learning models requiring thousands of examples, CoSal reaches 99% of its ultimate accuracy on the MRPC dataset with only 60 sentences of context.
  • Robustness: By relying on the underlying vector space rather than exact word matches, CoSal handles out-of-vocabulary words better than frequency-based models.

Conclusion

While CoSal is a powerful tool, it does have limitations. As a bag-of-words derivative, it does not inherently account for word order or complex syntax. Future work may involve integrating CoSal as a "salience-aware" layer within deep learning architectures like RNNs or combining it with dynamic embeddings like ELMo. Nevertheless, CoSal demonstrates that significant semantic meaning can be captured through efficient, unsupervised statistical normalization of existing semantic spaces.

Summary updated

BibTeX
@misc{zelikman2018context,
  author = {Eric Zelikman},
  title = {{Context is Everything: Finding Meaning Statistically in Semantic Spaces}},
  year = {2018},
  eprint = {1803.08493},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1803.08493},
}
Figure