What is a vector, in the context of search and machine learning?

A vector is an ordered list of numbers representing something like a word, image, or product as a point in a mathematical space, positioned so similar things end up close together.
Created: Updated: 3 min read

A vector, in the context of search and machine learning, is an ordered list of numbers used to represent something — a word, an image, a product, a user — as a point in a mathematical space, positioned so that things a model judges as similar end up close together and things it judges as different end up far apart.

How does a vector actually represent something like a word, image, or product?

A machine learning model doesn’t work with words, pixels, or product listings directly; it works with numbers. An embedding model is trained to convert a piece of input into a fixed-length list of numbers — the vector — chosen specifically so that the geometric relationships between vectors reflect something meaningful about the relationships between the original inputs. Two product descriptions that mean similar things end up as vectors positioned near each other in this numerical space, even though the original text shared few or no exact words, because the model learned to encode meaning into position rather than into the literal input itself.

Why does the number of dimensions in a vector matter?

Each individual number in a vector is one dimension, and the total count — a vector might have 768 dimensions, or 1,536, or some other fixed size depending on the model that produced it — determines how much information the vector can potentially encode, at the cost of more computation needed to compare vectors against each other. As covered in this site’s page on why high-dimensional geometry breaks traditional search structures, dimensionality also has geometric consequences beyond storage and computation cost: distances between vectors behave differently, and often less intuitively, as the number of dimensions grows large, which is a large part of why specialized search structures like HNSW exist in the first place rather than relying on simpler methods that work fine in two or three dimensions.

How is a vector different from just a list of numbers with no particular meaning?

Any list of numbers is technically a vector in the mathematical sense, but what makes a vector useful for search specifically is that its position was chosen deliberately, usually by a trained model, so that distance and similarity between vectors correspond to something meaningful about the real-world things they represent. A list of arbitrary, unrelated numbers is still a vector mathematically, but comparing distances between such vectors wouldn’t tell you anything useful, since nothing about how those numbers were assigned reflects genuine similarity. This is why the quality of the embedding model producing a set of vectors matters enormously for how well any downstream search system built on top of those vectors will actually perform.

Vectors are the raw material every technique on this site operates on — distance functions measure the relationship between two vectors, and HNSW’s entire graph structure exists to search a large collection of them efficiently. From here, the pages on what an embedding is and how distance and similarity between vectors are measured are the most natural next steps for building on this definition.