Chapter 2: Representing Meaning Using Vectors

2.1 Introduction

Computers process numerical information. Therefore, language must be converted into mathematical form before machines can analyze it.

2.2 What is a Vector?

A vector is an ordered list of numbers representing features.

Example:

King → [0.2, 0.8, 0.5]

Queen → [0.21, 0.79, 0.52]

Observation: Small numerical differences correspond to similar meanings.

2.3 Geometric Interpretation

Vectors can be visualized as points in multi-dimensional space. Distance between points measures similarity.

Similarity Measures

2.4 Word Relationships

Vector arithmetic captures semantic relationships:

King − Man + Woman ≈ Queen

2.5 Embeddings in Modern AI

Large language models convert entire sentences into high-dimensional vectors known as embeddings.

2.6 Applications

2.7 Extended Example

Suppose we map the words Dog, Cat, Lion, and Car into 2D space. Dog, Cat, and Lion cluster together (animals), while Car is positioned far away.

2.8 Chapter Summary

Vectors allow computers to mathematically represent meaning. Similarity in vector space corresponds to similarity in language.

Exercises

1. Define vector representation.
2. Explain cosine similarity.
3. Why must words be converted into numbers?
4. Illustrate how King − Man + Woman results in Queen.
5. Provide real-world examples of embeddings.