A vector is a mathematical representation of an object, chosen so that similar objects get representations that are close to each other.
A large language model gets documents, a query and a prompt. All three are context, and the context is converted to a mathematical representation that the model can use. A vector is on the input side of the model.
The representation works like a hash:
- Each object gets a number. An apple is 36, a banana is 56 and a triangle is minus 3073. The fruits are closer to each other.
- A new object falls near similar ones. An orange is close to 36 and 56.
- The function is a neural net. The number does not say what is a fruit: a cat may be at 46.
- A vector has many dimensions. On an animal dimension the banana is at 37 and the cat is far away.
The total distance between similar vectors is low, and between dissimilar vectors it is high.