Vector Representation

How does a search engine know that 'car' and 'automobile' are essentially the same, even though they're different words? This is achieved through vector representation, which transforms words into numerical data that captures their semantic meaning.

Computers process text as sequences of characters, not as concepts. For a machine to understand that 'car' and 'automobile' are related, or that 'king' and 'queen' share a common theme of royalty, it needs a way to quantify these relationships. This is where the challenge of machine understanding truly begins.

The Challenge of Machine Understanding

A naive approach to representing words might involve assigning each unique word a simple numerical ID. For instance, 'car' could be ID 100, and 'automobile' could be ID 101. While this provides a unique identifier, it fails to capture any inherent relationship between these words.

The machine has no way of knowing that ID 100 and ID 101 are semantically similar, or that ID 50 ('king') and ID 51 ('queen') belong to a related category. This lack of relational information makes simple IDs useless for tasks requiring an understanding of meaning, context, or similarity.

Words as Points in Space

Vector Representation
A method of mapping words or phrases to a list of numbers (a vector), where each number represents a coordinate in a high-dimensional space.
Example: The word 'king' might be represented as a vector like [0.5,0.2,0.8,...][0.5, -0.2, 0.8, ...], where each value is a coordinate in a multi-dimensional space. The length of this vector (number of dimensions) can range from tens to hundreds.

Instead of arbitrary IDs, imagine representing each word as a point in a multi-dimensional space. Each dimension in this space corresponds to some abstract feature of the word's meaning. A word's position in this space is determined by its vector coordinates.

The intuitive idea is that words with similar meanings will be located 'close' to each other in this vector space. Conversely, words with very different meanings will be 'far apart'. This spatial arrangement allows machines to quantify and understand semantic relationships.

Mapping Semantic Relationships

Words in a 2D Semantic Space
This vector diagram visualizes how different words are positioned in a simplified two-dimensional vector space. Words with similar meanings, such as 'king' and 'queen', or 'apple' and 'orange', are clustered closely together, demonstrating their semantic relationship.
Loading chart...
Key Insight: Words that are semantically similar are represented by vectors that are close to each other in the vector space.

The visualization clearly shows that words with related meanings naturally cluster together. For example, all words related to royalty form one group, while fruits form another, and vehicles a third. This spatial proximity is not arbitrary; it's a direct consequence of how these vector representations are learned.

This arrangement allows a machine to infer relationships. If a new word appears near 'car' and 'truck', the machine can deduce it's likely a type of vehicle. This transforms the abstract concept of 'meaning' into a quantifiable distance in a numerical space.

What Each Dimension Captures

While we can visualize word vectors in two or three dimensions, real-world word vectors often have hundreds of dimensions. Each of these dimensions, though not directly interpretable as a simple label, contributes to the overall meaning of a word.

Think of each dimension as capturing a latent semantic feature. One dimension might subtly reflect 'gender' (e.g., higher values for 'king', 'man', lower for 'queen', 'woman'), another 'royalty', and yet another 'edibility'. The combination of values across all dimensions forms a unique semantic fingerprint for each word.

Word Embedding
A learned vector representation of words, typically derived from large text corpora, where words with similar meanings have similar vector representations.
Example: Models like Word2Vec, GloVe, or FastText process vast amounts of text data to generate these dense vectors. For instance, after training, 'cat' might have an embedding that is numerically very close to 'kitten' but far from 'rock'.
Check Your Understanding
If the vector for 'doctor' is very close to the vector for 'surgeon', what does this primarily imply?

Beyond Proximity: Vector Arithmetic

The power of vector representation extends beyond simply measuring proximity. Because words are represented as numerical vectors, we can perform mathematical operations on them. This allows us to uncover complex semantic relationships and analogies.

The famous example is the analogy: 'King is to Man as Queen is to Woman'. In vector space, this relationship can be expressed as:

vector(king)vector(man)+vector(woman)vector(queen)\text{vector}(\text{king}) - \text{vector}(\text{man}) + \text{vector}(\text{woman}) \approx \text{vector}(\text{queen})
This demonstrates how vector arithmetic can capture and manipulate the nuanced differences and similarities between words, enabling machines to reason about language in a sophisticated way.

Key Takeaways
  • Word vectors represent words as numerical points in a multi-dimensional space.

  • Semantic similarity between words is captured by the proximity of their corresponding vectors in this space.

  • Each dimension in a word vector contributes to the word's overall meaning, capturing latent semantic features.

  • Word embeddings enable machines to understand context, relationships, and nuances in human language.

  • By representing words like 'car' and 'automobile' as similar vectors, search engines can intelligently match related queries and understand user intent.

← All lessons in Word Embeddings

Ready to keep this from fading?

Bitelrn turns lessons like this into a full course — quizzes, a knowledge map, and spaced review.

Get started free