liveBook · Manning

Vector space

As explained in Generative AI in Action

A vector space is a mathematical set of vectors that supports operations such as addition and scalar multiplication.

A vector space represents words, phrases, or documents as mathematical vectors: ordered numbers that machine-learning systems can compare. In embedding-based applications, nearby vectors indicate stronger semantic relatedness, while distant vectors indicate weaker relatedness. section 2.8.4 section 10.4.2

Embedding workflows use vector spaces to:

  • Represent contextual meaning rather than only dictionary definitions. section 10.4.2
  • Compare text chunks through distances or similarity scores. section 2.8.4
  • Provide numerical inputs for text classification, sentiment analysis, machine translation, search, and code-related tasks. section 2.8.4
  • Support preprocessing and retrieval architectures when text is chunked, embedded, and managed as vectors. section 10.4.2

Simple embedding representation

A toy representation might encode “cat” as [0.2, 0.3, -0.1] and “dog” as [0.4, 0.1, 0.2]. Their positions can then be compared to estimate relatedness. In practice, an embedding model generates vectors from context, and an OpenAI API call returns the resulting values for application use. section 2.8.4

How Generative AI in Action covers it

How deep it goes
Defines vectors, distances, and contextual meaning with examples, but defers detailed similarity algorithms and mathematical derivation.
Examples
Uses cat and dog vectors, embedding distances, an OpenAI Python call, and contextual representations of text and code.
What you can do after
Apply it via an embeddings API to convert text into vectors and inspect their dimensions and values.
How it connects
Connects embeddings with semantic similarity, machine learning, text search, code search, RAG, chunking, and vector management.

Also explained in

Compare how 4 books explain vector space →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Generative AI in Action. The section links point to the parts of the book it draws on.