Idea · Aug 29, 2026
Build-Your-Own Vector Search Engine
Students implement a complete vector similarity search engine from flat brute-force cosine search to HNSW approximate nearest-neighbor search, wrapped in a Flask API, learning the algorithms and tradeoffs underlying every modern RAG and semantic search system.
What it would do
As retrieval-augmented generation becomes central to AI applications, CS students need to understand how vector search actually works rather than just calling an SDK. This four-milestone assignment builds understanding from the ground up: implement cosine similarity and a flat in-memory embedding store; add a simple inverted-file index for metadata filtering; implement the Hierarchical Navigable Small World (HNSW) graph for approximate nearest-neighbor search with tunable recall-speed tradeoffs; and wrap the engine in a Flask HTTP API with file-based persistence, then benchmark it against ChromaDB or Qdrant on a 100K-snippet Wikipedia embedding dataset. Students submit benchmark plots (Recall@K vs. query latency) as part of their deliverable, forcing them to reason about the tradeoffs their design choices create. A C++ variant using the CSS 342/343 toolchain adds an optional systems-programming dimension.
Key features
- Four scaffolded milestones: flat cosine search, inverted-file index, HNSW graph, and REST API with persistence
- Pre-embedded benchmark dataset (Wikipedia 100K snippets, 384-dimensional sentence-transformer embeddings) ready to download
- Benchmarking harness computing Recall@1/5/10 and median query latency against a reference database
- Optional C++ variant using Eigen for vector math and Google Test for unit testing, compatible with the CSS 342/343 toolchain