Vektordatenbanken
Definition
Vektordatenbanken speichern hochdimensionale Vektoren (Einbettungen) und unterstützen schnelle Ähnlichkeitssuche (z. B. k-NN, approximate nearest neighbor). Sie sind the backbone of Abruf in RAG.
Sie befinden sich between embeddings (die die Vektoren erzeugen) and the RAG retriever (das die Top-k-Chunks benötigt). Im Gegensatz zu keyword search, they support semantic similarity: “customer support” can nachzuahmen “help desk” if the embedding model maps them close together. See RAG architecture for how the index fits into die vollständige pipeline.
Funktionsweise
Documents are embedded und ihre Vektoren werden in einen geschrieben index (z. B. HNSW, IVF, or flat for small datasets). At query time, the query vector is compared against the index via k-NN (or approximate k-NN for scale); the index returns top-k ids (und optional the vectors or stored metadata). You then fetch the corresponding chunks and pass them to the LLM. Options include Pinecone, Weaviate, Chroma, pgvector, and others; choice depends on scale, latency, and whether you need metadata filtering.
Anwendungsfälle
Vector stores werden immer verwendet, wenn you need fast similarity search over many embeddings (RAG, recommendations, dedup).
- Storing and querying document embeddings for RAG
- Real-time similarity search at scale (z. B. recommendations, dedup)
- Combining vector search with metadata filters (z. B. by date, category)
Externe Dokumentation
- Chroma – Get started
- Pinecone – Vector database docs
- pgvector — Vector similarity search in PostgreSQL