StudyBrixFree worksheets, study guides and courses

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.

University8 practice questionsNotes + worked examples

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

Example 1

For nonzero identical vectors, find cosine similarity.

The dot product equals the product of their norms.

1

Example 2

Find cosine similarity of (1,0) and (0,1).

The dot product is zero.

0

Check your understanding

8 questions

Decimals 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.

1 For nonzero identical vectors, find cosine similarity.

Show answer and explanation

1

The dot product equals the product of their norms.

2 Find cosine similarity of (1,0) and (0,1).

Show answer and explanation

0

The dot product is zero.

3 Is ordinary cosine similarity defined for a zero vector without an extra convention?

Show answer and explanation

No

The norm product denominator is zero.

4 Find the dot product of (2,3) and (4,−1).

Show answer and explanation

5

2×4+3×(−1)=5.

5 Why does a high embedding similarity not prove that a document supports a factual claim?

Sample answer and marking guidance

Similarity measures the modelled representation relationship, while support requires reading the relevant content and checking its meaning and reliability.

Credit similarity versus evidence.

6 What can a two-dimensional embedding plot hide?

Show answer and explanation

Distortion introduced by dimensionality reduction

Projection can change or obscure high-dimensional relationships.

7 Why should multilingual retrieval be evaluated in each intended language?

Sample answer and marking guidance

Training coverage, tokenization and domain usage can differ across languages, so performance need not transfer uniformly.

Credit concrete sources of variation.

8 For u=(3,4), calculate its Euclidean norm.

Show answer and explanation

5

sqrt(9+16)=5.

Further reading and review references

These are reference links, not copied exercises, institutional endorsement or proof of independent review.