TL;DR
This paper introduces SemGloVe, a novel method that enhances GloVe word embeddings by distilling semantic co-occurrence information from BERT. By leveraging BERT's self-attention weights and masked language model capabilities, SemGloVe overcomes GloVe's limitations of local context windows and heuristic weighting, leading to more semantically rich and accurate word representations.
What Problem Does This Paper Address?
Traditional word embedding methods like GloVe rely on word co-occurrence matrices derived from a fixed, local context window. This approach has two main drawbacks: 1) it's limited to word pairs that appear within this small window, potentially missing important semantic relationships, and 2) the relevance of co-occurring words is often measured by a simple positional distance, which doesn't directly capture semantic similarity. This can lead to "semantically irrelevant" word pairs being included, diluting the quality of the embeddings. The paper aims to address these limitations by tapping into the richer, contextualized understanding of language provided by BERT.
Methods
SemGloVe proposes two primary methods to extract semantic co-occurrences from BERT:
- Semantic Co-occurrences from Multi-Head Self-Attention (SemGloVesd): This method utilizes the self-attention weights from BERT's Transformer layers. Instead of relying on positional distance, it uses these attention weights to measure the semantic relationship between word pairs. The process involves aggregating attention weights across all heads and layers, then converting BPE-level attention to word-level attention. The semantic distance is then calculated based on these attention weights, and these values are used to build a co-occurrence matrix.
- Semantic Co-occurrences from Masked Language Model (SemGloVemd): This approach leverages BERT's Masked Language Model (MLM) task. It masks tokens in a sequence and uses BERT's predictions for the masked token to identify context words. This allows for the extraction of word pairs beyond the strict local window constraint. The logits of BERT's output for predicted words are used to calculate the semantic distance, which then informs the co-occurrence matrix.
Both methods aim to generate a more accurate and semantically relevant co-occurrence matrix than GloVe, which is then used to train GloVe-style static word embeddings.
Datasets
- Training: Wikipedia dump corpus (57 million sentences, 1.1 billion tokens), filtered to keep words appearing more than five times.
- Intrinsic Evaluation: WordSim-353, SimLex-999.
- Extrinsic Evaluation: Chunking, POS tagging, and Named Entity Recognition (NER) tasks using CoNLL-2000, WSJ (Penn Tree Bank), and CoNLL-2003 datasets.
Key Insights and Ideas
- BERT's Attention as a Semantic Measure: The self-attention weights in BERT are shown to be a more effective indicator of semantic similarity between word pairs than GloVe's positional distance. This allows for capturing relationships that might be missed by purely positional metrics.
- MLM for Broader Context: BERT's MLM task enables the identification of semantically relevant word pairs even if they don't appear in close proximity within a sentence, overcoming the local window limitation of traditional methods.
- Static Embeddings Still Relevant: Despite the rise of contextualized embeddings, SemGloVe demonstrates that static embeddings can still be highly effective, especially when enriched with semantic information distilled from powerful models like BERT.
- Efficiency Gains: SemGloVe embeddings are significantly faster to train and test compared to full contextualized models like BERT, offering a good trade-off between performance and computational cost.
Key Results
- Intrinsic Evaluation: SemGloVesd achieved a 5.6% average absolute increase in performance over GloVe on word similarity datasets. SemGloVemd showed a substantial 33.4% average absolute increase, highlighting the benefit of MLM-based context. SemGloVemd outperformed all other baseline methods.
- Extrinsic Evaluation: SemGloVe demonstrated competitive performance against contextualized embeddings like BERTbase on Chunking, POS tagging, and NER tasks, achieving a 0.47% average absolute increase over GloVe.
- Visualization: t-SNE visualizations showed that SemGloVemd produced clearer clusters and boundaries for different word classes compared to GloVe and SemGloVesd, indicating richer semantic representations.
Limitations and Future Work
- Window Size Impact: While SemGloVesd benefits from a smaller window size, SemGloVemd's performance decreases with a reduced window, suggesting that the MLM approach requires a broader context.
- Computational Cost: While faster than full BERT, SemGloVe is still more computationally intensive than basic GloVe.
- Future Work: The paper suggests that SemGloVe can be further improved by exploring other BERT components or different distillation strategies. The authors also highlight the potential for SemGloVe to enrich the toolbox for computational linguistics research requiring static word representations.
Summary updated