Word Analogy › The 3CosMul Method
Language AI HandbookAll chapters Word Analogy › The 3CosMul MethodOne section · Sections in this chapter4 / 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
While 3CosAdd is the standard approach, it has a known vulnerability related to the subtraction operation. The term penalizes words that are similar to , but when cosine similarity values are small and near zero, the arithmetic can amplify noise in unpredictable ways. A word that is slightly negatively correlated with for unrelated reasons will receive a spurious bonus. Conversely, a word that is the correct answer but happens to have mild positive similarity to will be penalized unfairly.
Levy, Goldberg, and Dagan (2014) proposed 3CosMul as an alternative that multiplies similarities rather than adding and subtracting them. The intuition is that multiplication is less sensitive to near-zero values: a word with low similarity to anything will score low overall, rather than getting an arbitrary bonus from a negative subtraction.
where:
- : a small constant (typically 0.001) to prevent division by zero when the denominator is near zero
- : the numerator rewards words with high joint similarity to both and . Multiplication means both conditions must be satisfied simultaneously; a word that is highly similar to but unrelated to will score poorly.
- : the denominator penalizes similarity to . Words very similar to are divided out, reducing their score.
The multiplicative structure has an important consequence: the formula requires all cosine similarity values to be non-negative. Cosine similarity ranges from -1 to 1, and negative values in the numerator or denominator would produce undefined or sign-flipped results. The standard implementation shifts all cosine values to the range before applying the formula, using the transformation .
This shift means 3CosMul and 3CosAdd are not directly comparable on the raw scale: they use different transformations of the same underlying similarity values. But both aim to rank the correct answer highest, and empirically both often succeed.
def three_cos_mul(a, b, c, embeddings, epsilon=0.001, exclude=None):
"""
Solve analogy a:b :: c:? using 3CosMul.
Uses multiplicative combination of cosine similarities.
"""
if exclude is None:
exclude = {a, b, c}
scores = {}
for word, vec in embeddings.items():
if word not in exclude:
# Shift cosine to [0, 1] range
cos_b = (cosine_similarity(vec, embeddings[b]) + 1) / 2
cos_a = (cosine_similarity(vec, embeddings[a]) + 1) / 2
cos_c = (cosine_similarity(vec, embeddings[c]) + 1) / 2
scores[word] = (cos_b * cos_c) / (cos_a + epsilon)
return sorted(scores.items(), key=lambda x: x[1], reverse=True)
results_mul = three_cos_mul("man", "woman", "king", embeddings_2d)3CosMul: man is to woman as king is to ? 1. princess score=3.0689 2. queen score=2.9206 3. aunt score=2.5540 4. prince score=1.5782 5. uncle score=0.5822
When 3CosMul Outperforms 3CosAdd
The performance difference between 3CosAdd and 3CosMul is subtle and dataset-dependent. Levy et al. (2014) found that 3CosMul performs better on syntactic analogies such as plurals and verb tenses, while 3CosAdd is competitive on semantic analogies such as capitals and currency pairs. The practical recommendation is to try both when evaluating embeddings on a new dataset and to report whichever performs better (or both).
The intuitive explanation for 3CosMul's advantage on syntactic analogies relates to the noise properties of those relationships. Syntactic patterns are encoded through large numbers of morphologically similar examples. The word "dogs" differs from "dog" in ways that affect many contextual words: it appears with plural verbs, with plural determiners, and in contexts where "dog" appears with singular forms. This creates many weak cosine similarity signals in many directions. The additive method's subtraction can amplify these weak signals into noise. The multiplicative method's requirement for joint similarity to both the target and the query word handles these diffuse signals more reliably.


Both methods correctly identify "queen" as the top-ranked answer. The key difference is visible in the score distributions: 3CosAdd produces signed scores where some candidates fall below zero, while 3CosMul keeps all candidates positive. The gap between the top answer and the rest also differs: the multiplicative formulation tends to create sharper distinctions when the correct answer has strong joint similarity to both and .