Vector

A set of numbers for several items, written in a fixed order

  • Basics
  • 5 min read
  • 3 diagrams

Key points

  • A vector is a set of numbers for several items, written in a fixed order. Reorder them and the meaning changes.
  • Because it's a bundle rather than a single number, it can describe one thing along several dimensions at once.
  • How many items it holds is called its dimension. Vectors used in AI usually run to a few hundred or a few thousand.
  • How alike two vectors are gets worked out by comparing matching positions, so they need the same number of items to be compared at all.
  • Inside an AI, text, pictures, and sound all get turned into bundles of numbers. The most basic unit of those is the vector.

The analogy

A business card packs information into fixed lines: company on the first line, department on the next, title below that, region at the bottom. Lay two cards side by side and comparing line by line gives a rough sense of how alike two people's positions are. A vector works the same way: it fixes the order of the items first, then just lists the values.

Order is what matters. If one card's second line is department and another's second line is region, laying them side by side proves nothing. A vector only makes sense for comparison when the first position means the same thing, and the second position means the same thing, for everyone involved.

Cards with different numbers of lines can't be compared either. A card with five fields and one with three don't line up no matter how you lay them side by side.

In detail

It's a number line with a fixed order

The first thing people miss about a vector is the order. Three values aren't just any three numbers — they're the value of the first item, the second item, and the third item, in that order. Shuffle the positions and you're pointing at something completely different.

That rule is exactly what makes the math simple. Adding two vectors just means adding first-to-first and second-to-second. Computers can run thousands of these additions at once precisely because the positions always line up.

The item count is the dimension

Two items and you can plot a single point on paper. Three, and it's a point inside a room. Past three items you can't draw it anymore, but the math works exactly the same — the limit is human eyesight, not mathematics.

Vectors used in AI usually run to a few hundred or a few thousand items. More items capture finer distinctions, but storage and computation grow right along with them. That's why lighter vectors with fewer items are sometimes built separately, depending on the use.

Adding and subtracting gives you a direction

A vector is a point, but it's also a direction. Draw an arrow from the origin to that point and you get both a direction and a length. Add two vectors and you land where the arrows would chain together; subtract one from the other and you get the direction from one point to the other.

This property is often brought up when explaining AI. Subtract one meaning-vector from another and the result is a direction standing for "the relationship between these two." Add that direction to a different vector and you can sometimes land near somewhere with a similar relationship. That's where the observation comes from that the direction from a country's name to its capital looks similar across many countries. It doesn't always work cleanly, though, so it's closer to an interesting observation.

Closeness gets measured as an angle

To judge how alike two vectors are, direction usually matters more than distance. A narrow angle between two arrows from the origin means similar; a wide one means different.

Why angle instead of length? For vectors built by counting words, a short retelling of a story and a long one produce arrows of very different length, but they still point roughly the same way. Looking only at direction keeps you from being thrown off by that kind of size difference, and lets you catch how alike the content actually is. Many modern embeddings are even scaled to length 1 outright.

Inside a model, the vector is the basic unit

A model can't handle letters or pictures directly. Text cut into pieces passes through an embedding and becomes a vector; a photo is split into small patches, and each patch becomes a vector of brightness values; sound becomes a vector of intensity values over time.

Every layer it passes through turns that vector into a different vector. What a model does, in the end, is repeatedly take in a vector and hand back another one. The letters we see on screen are just the final step, translated back for people to read.

More precisely

A vector is an array of same-type values listed in a single line, and its item count is its dimension. Stack several vectors and you get a matrix; stack matrices and you get a block with three or more axes. All of these are called tensors, and vectors and matrices are kinds of tensor too. Most of the computation inside a model comes down to multiplying vectors by matrices.

Measuring closeness by angle is called cosine similarity: two vectors pointing in exactly the same direction score close to 1, and two pointing in unrelated directions score close to 0. In real embedding models, though, texts with unrelated meanings can still score quite high, so people often look at which of two is closer rather than at the raw value. Straight-line distance gets used too, and which one works better depends on how the vectors were built.

The analogy has a limit. Each line on a business card carries a label like "department" or "region" that a person can read. Each position in a vector made by training carries no such label — it's an axis training happened to settle on, so it's hard to tell what a single position stands for. A feature vector whose items a person chose is the exception. A person fills in a business card by hand, too, while a vector made by training is a value that fell out of training on its own.

Try it yourself

Common misconceptions

  • It's easy to think that if the numbers are the same, the order doesn't matter, but actually the same numbers in a different order make a different vector. To compare vectors, the same position has to point to the same item.

  • It's easy to think more items is always better, but actually storage and computation cost grow right along with them, so picking a size that fits the job usually wins.

  • It's easy to think vectors from two different models can be compared, but actually their positions mean different things, so lining them up and measuring means nothing.

One-line summary

In short

A vector fixes the order of a set of items and simply lists their values, and it's the basic unit of the information moving through an AI.

Spotted an error or have a better analogy? Suggest an edit · Last updated 2026-10-17