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

Course: [Neural networks, attention and embeddings](https://studybrix.com/en/courses/deep-learning/index.md)
Level: university
Prerequisites: Vectors, dot products and norms.

## Notes

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

## Practice questions

### 1. For nonzero identical vectors, find cosine similarity.

Answer: 1

Explanation: The dot product equals the product of their norms.

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

Answer: 0

Explanation: The dot product is zero.

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

A. No
B. Yes, always minus one
C. Only in two dimensions
D. Yes, always one

Answer: No

Explanation: The norm product denominator is zero.

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

Answer: 5

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

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

Sample answer / marking guidance: Similarity measures the modelled representation relationship, while support requires reading the relevant content and checking its meaning and reliability.

Explanation: Credit similarity versus evidence.

### 6. What can a two-dimensional embedding plot hide?

A. Distortion introduced by dimensionality reduction
B. All uncertainty permanently
C. Every exact original distance by definition
D. Only the legend

Answer: Distortion introduced by dimensionality reduction

Explanation: Projection can change or obscure high-dimensional relationships.

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

Sample answer / marking guidance: Training coverage, tokenization and domain usage can differ across languages, so performance need not transfer uniformly.

Explanation: Credit concrete sources of variation.

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

Answer: 5

Explanation: sqrt(9+16)=5.

## Further reading

- https://developers.google.com/machine-learning/crash-course
- https://cs229.stanford.edu/

Original AI-assisted educational draft; not independently teacher-reviewed. References support further study, not copied exercises, affiliation or curriculum accreditation.
