Vector Space Representations

Imagine trying to organize a massive library where books are sorted by their meaning rather than by their titles or authors. If you place books about space near books about stars, you create a map where related ideas naturally cluster together in physical space. Large language models use this same logic to turn human language into a complex map of numbers that computers can actually read and process. By converting words into long lists of numbers, these systems create a structure where the distance between two points represents how similar those words are to each other in meaning.
Mapping Language into Numerical Space
When a model processes text, it assigns each word a specific coordinate in a multidimensional space known as a vector. A vector is essentially a list of numbers that acts like a GPS coordinate for the meaning of a word within the model's internal world. If you look at the words 'king' and 'queen', the model assigns them coordinates that are very close to each other because they appear in similar contexts. This process allows the computer to treat language as a mathematical landscape where it can navigate between concepts using simple geometry instead of guessing the meaning.
Key term: Vector — a mathematical object represented as a list of numbers that defines the position and direction of a word within a high-dimensional space.
To understand how this works, think about organizing a grocery store where items are grouped by their use in recipes. You would place flour near sugar because they are often used together in baking, just as the model places 'bread' near 'butter' because they appear in similar sentences. This spatial arrangement helps the model predict which word should follow another, because it knows that words appearing in the same context often share the same neighborhood in its numerical map. The math behind this involves calculating the distance between these points to determine how likely one word is to follow another.
Measuring Semantic Relationships
Once words are placed into this space, the model must calculate the distance between them to understand how they relate to one another. The most common way to do this involves measuring the angle between two vectors, which tells the system if the words point in a similar direction. If the angle is small, the words share a strong relationship, whereas a large angle suggests the words have very little in common. This geometric approach turns the abstract concept of meaning into a concrete calculation that computers can perform with incredible speed and accuracy.
Consider the following ways that mathematical distances influence how a model interprets the connections between different types of words:
- Semantic proximity occurs when two words occupy the same neighborhood, which allows the model to swap them without changing the core meaning of a sentence.
- Vector arithmetic allows the model to perform logic, such as taking the vector for 'king', subtracting 'man', and adding 'woman' to find a point near 'queen'.
- Contextual drift happens when a word changes its position based on the surrounding words, which forces the model to constantly update its spatial map for every new sentence.
By using these methods, the model builds a dynamic understanding of language that goes far beyond simple dictionary definitions. It learns that words are not static labels but are instead fluid points that move and shift based on the company they keep. This ability to map relationships spatially is the secret behind how machines capture the nuance of human speech and generate responses that feel natural and coherent to us.
Meaning is represented as a spatial coordinate, allowing machines to calculate relationships between concepts by measuring the distance between points in a multidimensional map.
But what does it look like when these machines use that map to actually guess the next word in a sentence?