ElemedexA pocket encyclopedia of AI architectures

Glossary (TM) › Minimal mathematics

TM048

Vector

Also: rank-1 tensor

In Spanish: Vector

An ordered list of numbers; geometrically, a point or an arrow in a space with as many dimensions as the list has entries.

A vector is an ordered list of numbers: (3, −1, 2) has three components and lives in a three-dimensional space. Order matters — (3, −1, 2) and (2, −1, 3) are different vectors — and each position works as a coordinate axis. It can be read as a point (its coordinates) or as an arrow from the origin to that point; both readings are useful (Chollet, 2021, sec. 2.3.5; M. Mitchell, 2019, ch. 11).

Tiny example. With the vocabulary (the, cat, dog, eats), the sentence “the cat eats” is represented as (1, 1, 0, 1): a 1 for each word present, a 0 for each word absent. This is the bag-of-words representation, which already turns texts into points in a space (Alammar & Grootendorst, 2024, p. 7).

In machine learning almost everything ends up as a vector: an image, a sound, a word. Embeddings are learned vectors with hundreds or thousands of components; the text models Alammar and Grootendorst show use 384 or 768 (2024, pp. 60–62). Beware of the word “dimension”: a 5D vector has a single axis with five entries, whereas a 5D tensor has five axes (Chollet, 2021, sec. 2.2); see matrix and tensor.

For this audience there is a familiar bridge: conceptual or similarity spaces, in which each dimension is a discriminable quality and closeness between vectors measures resemblance (Gärdenfors, 2000; Buckner, 2024, p. 114). The disanalogy is that in learned vectors the dimensions almost never correspond to humanly identifiable properties: picturing one axis for “human” and another for “newborn” is a teaching simplification, not a description (Alammar & Grootendorst, 2024, p. 9). What turns this geometry into comparisons of meaning are operations such as the dot product and cosine similarity; what makes it strange is high dimensionality.

Sources

  • Alammar, J., & Grootendorst, M. (2024). Hands-on large language models: Language understanding and generation. O’Reilly Media. §
  • Buckner, C. J. (2024). From deep learning to rational machines: What the history of philosophy can teach us about the future of artificial intelligence. Oxford University Press. https://doi.org/10.1093/oso/9780197653302.001.0001 §
  • Chollet, F. (2021). Deep learning with Python (2nd ed.). Manning Publications. §
  • Gärdenfors, P. (2000). Conceptual spaces: The geometry of thought. MIT Press. https://doi.org/10.7551/mitpress/2076.001.0001 §
  • Mitchell, M. (2019). Artificial intelligence: A guide for thinking humans. Pelican Books. §