liveBook · Manning

Flat

As explained in Generative AI in Action

FLAT is a brute-force vector search approach that compares a query with every indexed vector.

FLAT is a brute-force vector search technique: it compares a query vector with every indexed vector, favoring accuracy over speed. section 8.3

FLAT’s main implementation characteristics are:

  • Stores vectors in a single tree or list structure rather than organizing them into an HNSW graph. section 8.3
  • Finds nearest neighbors by computing distance from the query to the other indexed vectors. section 8.3
  • Delivers higher accuracy but becomes computationally intensive and slower as the search considers every vector. section 8.3

Vector search configuration

A Redis vector field can specify FLOAT32 embeddings, a dimension matching the embedding model, and COSINE distance; the documented example uses HNSW rather than FLAT. section 8.3

How Generative AI in Action covers it

How deep it goes
Explains brute-force indexing and distance comparisons, but stops short of showing a FLAT-specific schema or query.
Examples
Uses Redis VectorField configuration with FLOAT32, 1536 dimensions, and COSINE distance, while selecting HNSW in the example.
What you can do after
Evaluate brute-force vector search against HNSW by comparing accuracy, computational cost, and retrieval speed.
How it connects
Connects vector similarity search with embeddings, HNSW, nearest-neighbor search, and distance metrics.

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.