Vector

In AI, a vector is an ordered list of numbers that represents something, such as the features of an example or the meaning of a word or image, so a computer can store, compare and calculate with it.

Google's machine learning glossary calls vector a very overloaded term whose meaning varies across fields. In machine learning it has two properties: it holds numbers, usually floating-point numbers, and it has a length, also called its dimension. Almost anything can be written as a vector. A place on Earth is a two-dimensional vector of latitude and longitude. The current prices of 500 shares make a 500-dimensional vector. A classifier choosing between red, green and yellow might output the vector (0.3, 0.2, 0.5), meaning a 30 per cent chance of red, 20 per cent green and 50 per cent yellow.

A feature vector is how a single example is fed into a model: a list of the values that describe it. A model with two numeric features might receive [0.92, 0.56] for one example and [0.73, 0.49] for the next. Categories are often encoded as one-hot vectors, all zeros except a single 1 marking the category, so a choice from five options might become [0, 0, 1, 0, 0].

The vectors that make modern AI news are mostly embeddings: vectors a model learns so that similar things get similar numbers. In Google's example, related tree species such as redwoods and sequoias end up with more similar vectors than unrelated ones. Word vectors became famous in January 2013, when Tomas Mikolov and colleagues described methods that learned them from 1.6 billion words in under a day and captured both grammatical and semantic similarities between words.

Once things are vectors, they can be compared mathematically. The most common measure is cosine similarity, which looks at the angle between two vectors: pointing the same way scores 1, at right angles scores 0, and opposite directions score minus 1, regardless of length. This is how semantic search and vector databases find documents with similar meaning to a query, even when the words differ.

Vectors also explain AI hardware. Neural networks spend most of their time multiplying vectors and matrices, and a vector is simply a tensor of rank one. Chips such as Google's TPUs and Nvidia's GPUs are built to do these operations in bulk, which is why so much AI computing runs on them.

Common questions

What is a vector in AI?

A vector is an ordered list of numbers representing something, such as a data point, a word, an image or a document. Representing things as vectors lets a computer compare them and process them with the mathematics neural networks are built on.

What is the difference between a vector and an embedding?

Vector is the general term for any list of numbers. An embedding is a particular kind of vector learned by a model so that similar items have similar values. All embeddings are vectors, but not all vectors are embeddings; a list of raw measurements is a vector but not an embedding.

What does the dimension of a vector mean?

It is the number of values in the vector. A map coordinate has two dimensions; an embedding from a modern language model typically has hundreds or thousands. More dimensions can capture finer distinctions but take more memory and computation.

What is a vector database?

A vector database stores large numbers of vectors, usually embeddings, and quickly finds the ones most similar to a query vector. It is commonly used for semantic search and for retrieval-augmented generation, where relevant documents are fetched and passed to a language model.

Finding more

Search for "vectors in machine learning", "feature vector", "word embeddings" or "cosine similarity" to understand how data is represented. Reliable sources include machine learning glossaries and courses from major providers, linear algebra textbooks and research papers on arXiv. Vendor material on vector databases is useful for practical detail but tends to present its own product as the default choice.

Working out what this means for your business?

Aileron Shift builds the systems behind this site: AI newsrooms that research, write and publish on their own, marketing automation and WordPress hosting for companies that need to move faster than their competitors.