Try a controlled experiment
Choose a challenge to load a fresh starting state, or explore freely below.
To share your settings, copy the page URL.
What kind of change did you make?
Moving an arrow changes the toy representation. Switching cosine to dot product changes the comparison rule. Applying metadata filters changes the admission rule. Normalisation transforms the vectors before comparison.
Optional: can the relevant record reach the next stage?
What to try: the default cosine order is A, then B, then C. C meets both metadata criteria but sits outside the first two. Apply both filters, then switch them between before and after the cut-off.
This toy scores all three records exactly. It illustrates a candidate boundary, not approximate nearest-neighbour search. Filtering after the cut-off does not refill the list here; real products may behave differently.
Comparison controls
Cosine compares direction and ignores length.
With unit-length vectors, cosine similarity and dot product are numerically identical.
The query asks for both. These are metadata constraints, not part of the similarity score. In the sandbox’s optional experiment, choose whether they act before or after the candidate cut-off. Excluded candidates stay listed so you can see what the rule removed.
Moving an arrow explores a hypothetical model output. It does not show how editing an abstract or retraining an embedding model would move a real vector.
0° means the same direction; 90° is perpendicular; 180° is exactly opposite, where cosine similarity reaches −1. Negative angles place the arrow on the other side of the query; only the size of the angle affects similarity.
Length affects dot product but not cosine similarity. Vector length is not article length, citation count, quality or confidence.
Toy vector space
Ranked candidates
Predict first; then the scores and order will appear here.
| Candidate | Rel. angle | Length | Cosine | Dot |
|---|
Metadata eligibility is not a final relevance judgement. C meets both stipulated metadata criteria. That does not establish methodological quality or fully answer the question. This lab assumes the date and study-type fields are accurate and complete; a librarian still assesses the evidence.
Dot product and cosine similarity: formulas and worked example
Multiply each pair of coordinates, then add. A longer vector can receive a larger score even when its direction is less closely aligned.
Divide the dot product by both vector lengths. This removes magnitude and leaves directional alignment. When both lengths are one, the denominator is one and the two scores are identical.
Worked example: combine coordinate products, then normalise
q = [1, 2] d = [3, 4]
- Dot product: q · d = (1 × 3) + (2 × 4) = 3 + 8 = 11.
- Vector lengths: ‖q‖ = √(1² + 2²) = √5, and ‖d‖ = √(3² + 4²) = 5.
- Cosine similarity: cos(q,d) = 11 ÷ (√5 × 5) ≈ 0.984.
Cosine similarity combines the dot product with the two vector lengths: the dot product is its numerator, and dividing by the lengths removes magnitude from the comparison.
This page avoids a zero-length vector because its cosine similarity is undefined: there is no direction to compare.
Lab appendix
How to read a two-dimensional picture of a high-dimensional space
Why does the picture have only two axes?
A two-dimensional vector has two coordinates, [x, y], so we can draw it as an arrow on a flat page. Add one more coordinate and it becomes [x, y, z]: the same kind of arrow in three-dimensional space. Keep adding coordinates and the pattern becomes [x1, x2, …, xn]. Real text embeddings commonly contain hundreds or thousands of coordinates, so we cannot draw their full spaces.
The comparison rule does not change as dimensions are added. Dot product multiplies each pair of matching coordinates and adds the results; cosine then divides that total by both vector lengths, which removes magnitude from the comparison. The horizontal and vertical axes here are anonymous drawing coordinates—not concepts such as “open access” or “citations”, and not a projection of a real embedding. This is a deliberately complete two-dimensional toy space in which every number can be inspected.
Can cosine or dot-product scores be negative?
Yes. Cosine similarity is 1 for the same direction, 0 at 90°, and negative when the angle is greater than 90°, reaching −1 for exactly opposite directions. Candidate C is in that negative region from tour step 2 onwards; step 1 starts it at 82°. A dot product can also be negative; without normalisation it has no fixed minimum or maximum because vector length also contributes.
Negative does not automatically mean “opposite in meaning”. It describes geometry in the representation the model learnt. Some text-embedding models produce mostly positive scores for ordinary inputs or occupy only a narrow part of the mathematical range. Even when every candidate scores below zero, the highest score is still the nearest or best available under that rule.
The safe interpretation: the axes make the arithmetic drawable; the embedding model gives the coordinates their operational meaning; the comparison rule turns those coordinates into a score; and a person or evaluation set supplies the relevance judgement.
Companion to “How Search Decides What You See”. Everything runs locally in this page; no query or vector is sent anywhere.