RAG & Vector Lab

Eight interactive labs: text chunking, embeddings, semantic search, vector databases, the RAG pipeline, advanced retrieval, chat with your documents and evaluation, plus an assistant builder for your own documents and experiments that run in the browser.

44interactive experiments

Vector Databases Lab

Run real Flat, IVF, HNSW and SQ8 indexes and measure recall, time and memory; see the status of the available vector stores.

  • 5Experiments
  • 3Lessons
  • 10Algorithms & concepts

Every experiment is labelled by its nature: "Real local execution" is genuinely computed in your browser or on your site's server, "Educational simulation" explains an idea without claiming to measure a real system, and "External integration" needs a service the site administrator configures. The local vectors here are lexical hashed vectors (not semantic embeddings) and are labelled as such.

Experiments

Real local execution L2

Index comparison

Flat, IVF, HNSW and SQ8: recall, time, comparisons, build time and memory.

Real local execution L3

IVF: the effect of nprobe

Recall curve against the number of clusters probed.

Real local execution L3

HNSW: the effect of ef and M

Recall curve against ef and the graph structure (layers and edges).

Real local execution L3

8-bit quantisation

Save about four times the memory and measure the recall lost.

External integration L2

Vector store status

The active store and what is configured on the server, with no claim of any other connection.

Lessons

Concept

Approximate nearest-neighbour search

Exhaustive comparison (Flat) is exact but slows as data grows. ANN indexes give up some accuracy (recall) in return for more speed and less memory.

Read the lesson
Algorithm

The HNSW index

HNSW is a multi-layer graph: sparse upper layers for fast jumps and a dense bottom layer for precise search. It starts at the top and descends, following the nearest nodes.

Read the lesson
Algorithm

IVF and quantisation

IVF splits vectors into clusters with k-means and searches only the nearest nprobe clusters. Quantisation stores each dimension in 8 bits (or compresses with PQ), saving memory at the cost of a small rounding error.

Read the lesson

Algorithms and concepts in this lab

Algorithm / conceptLabNatureComplexityNote
Flat indexVector Databases LabReal local executionO(n·d)Exhaustive comparison with every vector; always exact.
IVFVector Databases LabReal local executionO((nlist+n·nprobe/nlist)·d)k-means clusters; searches the nearest nprobe clusters.
HNSWVector Databases LabReal local execution~O(log n)Multi-layer graph for approximate search; a simplified teaching implementation.
Scalar quantisation SQ8Vector Databases LabReal local executionO(n·d)8 bits per dimension: about four times less memory.
Product quantisation (concept)Vector Databases LabEducational simulation—Explained conceptually in the lessons; not implemented in the browser.
MySQL vector storeVector Databases LabReal local executionO(n·d)Stores vectors in site tables and searches by an owner-filtered full scan.
Chroma adapterVector Databases LabExternal integration—Connects to a Chroma server configured by the admin; tested against a real local server.
FAISS adapter (separate service)Vector Databases LabExternal integration—Connects to a companion Python service; FAISS does not run inside PHP.
Qdrant adapterVector Databases LabExternal integration—Implemented to the REST protocol; not tested against a real Qdrant server, so test it before relying on it.
Milvus and Weaviate (planned)Vector Databases LabEducational simulation—Not supported in this version and no connection is claimed.