Before we start, we need only ONE picture in our heads. Every sentence becomes an arrow (a vector) from the origin. "How similar are two sentences?" becomes "how close are two arrows in direction?" We measure that with the angle between them.
Read the figure above carefully — every exercise on this page lives inside it. The blue arrow is a and the pink arrow is b, both starting at the origin (the dot where the two dashed axes cross). Each arrow's length is its norm ∥a∥ / ∥b∥ (labelled along the shafts). The pale-yellow wedge between them is the angle θ — and that single angle is the whole game: a small wedge means the arrows point the same way (similar meaning), a right-angle wedge means unrelated, a straight-line wedge (180°) means opposite. The formula printed on the board, a⋅b=∥a∥∥b∥cosθ, is the bridge that lets us compute that angle from the raw numbers — which is exactly what every solution below does.
Cosine: 2∥a∥∥b∥2(a⋅b) — the two 2's cancel → unchanged.
Answer: (c) cosine similarity. This is the whole point of dividing by the norms: it strips out length so only meaning-direction remains.
Recall Solution
embedding = (i) function text→vector.
chunk = (ii) focused passage.
k-NN = (iii) exact k closest.
ANN = (iv) approximate but fast. See HNSW and ANN Indexes.
Recall Solution
Answer: −1. The angle is 180° and cos180°=−1. Semantically: opposite meaning-direction (as unrelated-and-then-some as this space allows). 0 = unrelated (right angle), 1 = same direction.
Dot=2⋅1+1⋅2+2⋅2=2+2+4=8. Why: the dot product is defined as "multiply matched components, then sum" — it measures how much the two arrows overlap direction-wise before we account for length.
Norms∥a∥=4+1+4=3, ∥b∥=1+4+4=3. Why: norm is root-of-sum-of-squares, which is just Pythagoras extended to 3 coordinates — the true length of the arrow.
Cosine3⋅38=98≈0.889. Why: dividing the overlap by both lengths cancels magnitude, leaving pure cosθ.
Angle ≈arccos(0.889)≈27° — quite similar.
Recall Solution
(a)6⋅3+8⋅4=18+32=50. Why: same dot-product definition — pair up components, multiply, add.
(b)∥a∥=36+64=10, ∥b∥=9+16=5 (root-of-sum-of-squares lengths), so Cosine =10⋅550=1. Why: dividing the "big-looking" dot (50) by both lengths reveals the arrows are the same direction scaled up → perfect cosθ=1. This is Vector Norms doing its job.
Recall Solution
Why this formula: for unit vectors, expand ∥a−b∥2=∥a∥2+∥b∥2−2a⋅b=1+1−2cosθ=2−2cosθ.
Plug in: 2−2(0.6)=2−1.2=0.8.
Take-away: on unit vectors, Euclidean distance and cosine give the same ranking — smaller distance ↔ larger cosine.
C3: dot =1+0+0=1; ∥C3∥=1; sim =2⋅11≈0.707.
Ranking:C1(1.0)>C3(0.707)>C2(0.5). Top-1 = C1, because it points in exactly the same direction as q (just longer).
Recall Solution
Not meaningful.M1 and M2 define different coordinate axes; "direction" in one space has no fixed relation to direction in the other. The cosine is essentially the angle between two arrows drawn on two different maps — you'd expect scores scattered near 0 (random orientation in high d), giving noise. Fix: embed query and documents with the same model. See Contrastive Learning for why each model carves its own space.
Recall Solution
(a)N⋅d=108×768=7.68×1010 ops.
(b)log2(108)≈26.6, so 768×26.6≈2.04×104 ops.
(c) Speedup ≈2.04×1047.68×1010≈3.8×106 — millions of times faster. This is why ANN exists: exact scan is O(Nd), ANN is ~O(logN).
Geometric picture: one 2,000-token chunk = one averaged arrow pointing toward the "center of mass" of five different topics. That average direction matches no single query well, so cosine to any specific question is lukewarm — the correct FAQ is diluted by four irrelevant ones.
Fix: chunk to coherent passages (~100–300 tokens, roughly one FAQ each) with slight overlap, so each arrow points cleanly at one idea. See Chunking Strategies.
Recall Solution
If ∥a∥=∥b∥=1, then sim=1⋅1a⋅b=a⋅b. So after a one-time normalization at insert time, every query does only a cheap dot product — no per-query square roots or divisions. Over billions of comparisons that's a large saving, and it's exactly what production indexes do.
Probability: the only failure mode is the true best chunk not being among the 50 ANN candidates — that's exactly the recall@50 miss, which happens 1−0.9=0.1 of the time. So success =0.9=90%. (Note this is recall@50, not recall@1 — we only need the true best to be somewhere in the 50, because the perfect reranker will then surface it.)
Why fetch 50: ANN is fast but approximate; casting a wide net (50 candidates) makes it very likely the true best is somewhere in the set even if it isn't ranked #1 by ANN. The exact reranker is slow, so we only run it on 50 items, not on all N. This combines ANN's speed with exact scoring's accuracy — the best of both.
Recall Solution
In high d, two random unit vectors are almost always nearly orthogonal, so cosθ≈0 and thus ∥a−b∥2≈2 for almost every pair. The distances (and cosines) bunch into a narrow band, so the gap between the true nearest neighbour and a mediocre one shrinks — exact search must compare tiny differences, and noise can flip the ranking. This is the Curse of Dimensionality; it's a big reason we lean on trained embeddings (which push meaningful pairs to distinctly higher cosine) plus ANN indexes.
Recall Solution
(a)∥q∥=0+9+16=5, so q^=(0,0.6,0.8).
(b)C1: dot =0+18+32=50; ∥C1∥=0+36+64=10; sim =5⋅1050=1.
C2: dot =0+0+0=0; sim =0.
(c)Retrieve C1. sim =1 → angle 0° (q and C1 are the same direction, C1=2q). sim =0 → angle 90° (C2 is orthogonal → semantically unrelated).