liveBook · Manning

Vector database

As explained in Domain-Specific Small Language Models

A database designed to store vectors and support similarity search, typically using approximate nearest neighbor methods for retrieval.

A vector database stores fixed-length numerical vectors together with associated data and retrieves records whose vectors are closest to a query vector. It typically uses approximate nearest neighbor algorithms to make similarity search practical at scale. For a few hundred thousand local embeddings, disk persistence may be sufficient; larger collections call for a vector database. section 13.3

A vector database usually participates in a retrieval-augmented generation workflow:

  • Process documents into smaller chunks and convert those chunks into embeddings. section 13.2
  • Store embeddings and metadata, then build indexes to speed up search. section 13.2
  • Embed each incoming query and retrieve semantically similar document chunks. section 13.2
  • Pass retrieved context to a generator model so it can produce an informed response. section 13.2

Vector databases are domain-specific alternatives to general-purpose persistence when semantic retrieval is central. Implementations may also provide filtering, full-text search, SQL, persistent storage, versioning, and distributed deployment. RAG remains useful for current information and source traceability, but large collections add database infrastructure and pipeline maintenance costs. section 13.3 section 2.5

Searching a LanceDB embedding table

A LanceDB workflow creates a persistent local database, defines an embedding table with metadata and 768-value float vectors, adds a cosine-similarity IVF_FLAT index, and searches the table with an embedded query such as "blocked KV-cache". The returned records contain similarity scores and matching text chunks.

How Domain-Specific Small Language Models covers it

How deep it goes
Explains storage, approximate search, indexing, schemas, and retrieval, but defers detailed ANN algorithm internals.
Examples
Uses LanceDB tables, cosine IVF_FLAT indexing, and a "blocked KV-cache" query returning matching document passages.
What it assumes
Assumes embeddings and RAG fundamentals while showing document chunking, embedding storage, indexing, and query retrieval in context.
What you can do after
Operate/configure LanceDB to persist embeddings, define a schema, build an index, and retrieve matching records.
How it connects
Connects embeddings, approximate nearest neighbor search, vector indexes, cosine similarity, and retrieval-augmented generation.

Also explained in

Compare how 26 books explain vector database →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Domain-Specific Small Language Models. The section links point to the parts of the book it draws on.