How does the GloVe objective J=∑i,jf(Xij)(wi⊤w~j+bi+b~j−log⁡Xij)2 arise from the idea that meaning is carried by ratios of co-occurrence probabilities? What is the role of f?

Sequence models and transformers, Word embeddings
Level L3 Intermediate. Length Long. Nature Th+Mat Both.

What's being asked

Whether you can walk from the ratio property to the log-bilinear form, and justify the weighting function.

Key idea

If F((wi−wj)⊤w~k)=Pik/Pjk and F turns differences into ratios, then F=exp⁡ and wi⊤w~k=log⁡Pik=log⁡Xik−log⁡Xi.

Steps

  1. Let Xik be how often word k appears in the context of word i, Xi=∑kXik, and Pik=Xik/Xi. For words i= ice, j= steam, the ratio Pik/Pjk is large for k= solid, small for k= gas, and near 1 for unrelated k.
  2. Ask that vectors encode this: F((wi−wj)⊤w~k)=Pik/Pjk. The argument is linear in the vectors.
  3. The map from differences to ratios requires F(a−b)=F(a)/F(b). This is satisfied by F=exp⁡, so wi⊤w~k=log⁡Pik=log⁡Xik−log⁡Xi.
  4. The term log⁡Xi does not depend on k, so absorb it into a bias bi. Add b~k to keep symmetry between i and k. This gives wi⊤w~k+bi+b~k=log⁡Xik.
  5. Fit this by weighted least squares. The weight is f(x)=(x/xmax⁡)3/4 for x<xmax⁡ and 1 otherwise, with f(0)=0.
  6. Why f: log⁡0 is undefined, so f(0)=0 drops unseen pairs. Rare pairs are noisy, so f gives them low weight. Very frequent pairs (such as "the") are capped so they do not dominate. For example, with xmax⁡=100, a count of 10 gets weight 0.10.75=0.178.

Common mistakes

How long your answer should be

One page; 6–8 minutes.

Last checked on 4 December 2026.

Read this

Previous in Sequence models and transformers: In skip-gram with a full softmax, P(o∣c)=exp⁡(uo⊤vc)∑wexp⁡(uw⊤vc) and the loss is J=−log⁡P(o∣c). Show that ∂J/∂vc=∑wP(w∣c) uw−uo. For a three-word vocabulary with u1=(1,0), u2=(0,1), u3=(−1,0), centre vector vc=(1,1) and true context word o=1, what is the gradient?
Next in Sequence models and transformers: For a GRU with ht=(1−zt)⊙ht−1+zt⊙h~t, what is the direct term in ∂ht/∂ht−1, and why does a small zt let gradients survive many steps? If zt=0.01 at every step, what does that direct path contribute over 100 steps?