GloVe › Bias Terms in GloVe

Michael BrenndoerferApril 10, 20253 min read
Language AI HandbookAll chapters
Part 4 of 67Word Embeddings
Chapter 25GloVe › Bias Terms in GloVe
Reading section 5 of 13 · Bias Terms in GloVe · 3 minSection 5 of 13 · 3 min

Book contents

Section 5 of 13 · 3 min read

GloVe › Bias Terms in GloVeOne section · Sections in this chapter5 / 13 ↓
Reading tools Definitions & inline links

Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.

Article links

Make inline references clickable

The bias terms bib_i and b~j\tilde{b}_j play an important and often underappreciated role in making the objective symmetric and absorbing word-frequency effects.

What the Biases Capture

Recall that the derivation gave us w⃗iTw⃗~j=log⁡Xij−log⁡Xi\vec{w}_i^T \tilde{\vec{w}}_j = \log X_{ij} - \log X_i. The term log⁡Xi\log X_i (the log total context count for word ii) depends only on how frequent word ii is overall. Very frequent words like "the" have large XiX_i regardless of the specific context word. If we did not include a bias term, this frequency effect would be absorbed into the dot product, corrupting the relational structure the vectors are supposed to capture. The bias bib_i absorbs this word-frequency effect, freeing the dot product to represent purely relational information.

Similarly, b~j\tilde{b}_j absorbs the frequency effect for word jj in its role as a context word. Together, bi+b~jb_i + \tilde{b}_j accounts for both the target and context word's marginal frequencies, letting the dot product w⃗iTw⃗~j\vec{w}_i^T \tilde{\vec{w}}_j focus on the residual: how much more or less often ii and jj co-occur than we would predict from their individual frequencies alone. This residual is precisely what PMI measures, as we will see in the next section.

The bias terms are simple scalars, so they add very few parameters (only 2V2V additional values) while providing a significant modeling benefit. In practice, the biases converge quickly during training because they are solving a simple regression problem: fit the word's average log-count across all its context partners.

Symmetry and the Dual Embedding Trick

An elegant consequence of the bias terms is that the objective behaves consistently when we swap the roles of target and context words. In the co-occurrence matrix X\mathbf{X}, entry XijX_{ij} counts word jj in word ii's context, and XjiX_{ji} counts word ii in word jj's context. For symmetric windows, Xij=XjiX_{ij} = X_{ji}. The GloVe objective with bias terms naturally accommodates this symmetry: both (w⃗iTw⃗~j+bi+b~j−log⁡Xij)2(\vec{w}_i^T \tilde{\vec{w}}_j + b_i + \tilde{b}_j - \log X_{ij})^2 and (w⃗jTw⃗~i+bj+b~i−log⁡Xji)2(\vec{w}_j^T \tilde{\vec{w}}_i + b_j + \tilde{b}_i - \log X_{ji})^2 are minimized simultaneously.

GloVe's symmetric design means that after training, the word vector w⃗i\vec{w}_i and its context vector w⃗~i\tilde{\vec{w}}_i capture similar but not identical information. They have learned from the same co-occurrence data, just from different roles in the objective. A common and empirically validated practice is to use w⃗i+w⃗~i\vec{w}_i + \tilde{\vec{w}}_i as the final word representation, combining the two complementary views for slightly improved performance. This is analogous to ensemble averaging: the two vectors have seen the same data from different angles, and combining them reduces variance in the final representation.

Why do the two vectors differ at all if they see the same data? Because the objective is not symmetric in the parameters, even though it is symmetric in the data. The gradients with respect to w⃗i\vec{w}_i depend on w⃗~j\tilde{\vec{w}}_j, and vice versa. So although both vectors converge toward representations that encode the same underlying statistics, the optimization path is different, and the resulting vectors are slightly different directions in the embedding space. Summing them gives a representation that combines both views.