Lecture 14 : Word Vectors: Other Extensions
GloVe vectors
https://github.com/stanfordnlp/GloVe
How to Learn Phrase Embeddings?
Other kinds of static embeddings
fastText [Bojanowski et al, 2017]
5
So, how does fastText work?
6
For a word at position t and a chosen context position c, using the binary logistic loss, we obtain the following negative log-likelihood:
Negative samples
However, this formulation ignores the internal structure of the word
fastText denotes each word as a bag of character n-grams
Image source: https://amitness.com/posts/fasttext-embeddings
So, how does fastText work?
7
For the word, all character n-grams between 3 to 6 characters are used
Image source: https://amitness.com/posts/fasttext-embeddings
We also include the word w itself in the set of its n-grams: <eating>
So, how does fastText work?
8
https://aclanthology.org/Q17-1010.pdf
How to calculate s(w,c)?
So, how does fastText work?
9
Image source: https://amitness.com/posts/fasttext-embeddings
But the unique n-grams can be huge!
Apply hashing to bound the memory requirements.
Instead of learning an embedding for each unique n-gram, we learn total B embeddings where B denotes the bucket size. The paper used a bucket of a size of 2 million.
How does fastText handle OOV words?
10
Image source: https://aclanthology.org/Q17-1010.pdf
Illustration of the similarity between character n-grams in out-of-vocabulary words. The OOV word is shown on the x axis. Red indicates positive cosine, while blue negative.
Simply average the vector representation of its n-grams
Beyond words: Sentence and documents
11
Le and Mikolov, “Distributed Representations of Sentences and Documents”, 2014
word2Vec
doc2Vec
Hierarchical Representations
https://github.com/facebookresearch/poincare-embeddings
Node embeddings
https://web.stanford.edu/class/cs224w/
Graph Representation Learning
https://web.stanford.edu/class/cs224w/
Graph Representation Learning
https://web.stanford.edu/class/cs224w/
Graph Representation Learning: DeepWalk
https://web.stanford.edu/class/cs224w/
Knowledge Graph Embeddings
https://web.stanford.edu/class/cs224w/
Knowledge Graph Embeddings
https://web.stanford.edu/class/cs224w/
Knowledge Graph Embeddings: TransE
https://web.stanford.edu/class/cs224w/
TransE: How to Learn?
https://web.stanford.edu/class/cs224w/
Daniel Jurafsky and James H. Martin. 2024. Speech and Language Processing: An Introduction to Natural Language Processing, Computational Linguistics, and Speech Recognition with Language Models, 3rd edition. Online manuscript released August 20, 2024. [Chapter 6]