liveBook · Manning

Vector

As explained in Retrieval Augmented Generation, The Foundational Ideas

A vector is an ordered list of numbers representing a position or direction in a mathematical space.

A vector is an ordered list of numbers that defines a position or direction in high-dimensional space. In retrieval systems, direction represents semantic meaning more than magnitude. section 2.2.1

Cosine similarity compares normalized vectors by their direction:

  • 1.0 indicates identical direction, usually near-duplicate text rather than synonymy. section 2.2.1
  • 0.0 indicates right angles and no relationship detected by the model. section 2.2.1
  • -1.0 indicates opposite directions, although text embeddings almost never produce this value. section 2.2.1

Magnitude is discarded

A query and two documents can point in the same direction even when one vector is twice as long; after normalization, they receive the same cosine score. section 2.2.1

Figure 2.2 What cosine similarity measures and discards. Top left: the query and doc A sit at angle θ, and doc B, twice as long and pointing the same way, scores identically, because normalizing removes magnitude before the dot product. The other three panels draw the values listed above: identical direction scores 1.0, right angles score 0.0, and opposite directions score −1.0, which text embeddings almost never produce.

Use the figure to visualize how angle determines cosine similarity while normalization removes vector length. section 2.2.1

How Retrieval Augmented Generation, The Foundational Ideas covers it

How deep it goes
Defines vector geometry and cosine similarity, but stops short of embedding training details.
Examples
Uses numeric vectors, document-direction comparisons, and normalized vectors with equal cosine scores.
What you can do after
Evaluate vector direction, magnitude effects, and cosine-similarity scores in semantic retrieval.
How it connects
Connects vectors to embeddings, dot products, cosine similarity, and approximate nearest neighbor algorithms.

Also explained in

Compare how 3 books explain vector →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Retrieval Augmented Generation, The Foundational Ideas. The section links point to the parts of the book it draws on.