Artificial intelligence · lesson 4 of 4
Embeddings, similarity and retrieval representations
An embedding represents an item as a vector learned or designed for a task. Nearby vectors reflect the representation’s notion of similarity, not universal meaning.
Learn the ideas
Prerequisites: Vectors, dot products and norms.
Embedding
An embedding represents an item as a vector learned or designed for a task. Nearby vectors reflect the representation’s notion of similarity, not universal meaning.
Cosine
For nonzero vectors, cosine similarity is u·v/(norm(u)norm(v)). It compares direction and differs from Euclidean distance.
Retrieval
An embedding search retrieves candidates. Relevance, factual correctness and permissions still need additional checks.
Evaluation
Test representations on the intended language, domain and retrieval tasks. A low-dimensional visual projection can distort relationships.
Worked examples
For nonzero identical vectors, find cosine similarity.
The dot product equals the product of their norms.
1
Find cosine similarity of (1,0) and (0,1).
The dot product is zero.
0
Check your understanding
8 questionsDecimals or fractions are accepted for numeric answers. Proofs and written responses use sample answers and require human marking. This is practice, not a protected examination.
Further reading and review references
These are reference links, not copied exercises, institutional endorsement or proof of independent review.