AI & Local LLM • 2026-10-01 • 3 min read
Retrieval That Stays on Your Own Hardware: pgvector or Qdrant
Most RAG systems are disappointing because retrieval is bad, not because the model is small. What we changed, and how to decide between pgvector and a dedicated vector database.

When a private assistant gives a vague answer, the instinct is to reach for a bigger model. In our experience it is almost always retrieval: the right paragraph was never in the context to begin with.
Chunking decides everything downstream
A chunk is the unit a user gets back. Split by token count alone and you cut tables in half and separate a heading from the sentence that gives it meaning.
What worked for us:
- Split on document structure first — headings, sections, list boundaries
- Target 400 to 800 tokens, but let a section be shorter rather than merging two unrelated ones
- Keep the heading path in the chunk text, so "Rotation" carries "Certificates > Rotation" with it
- Overlap by a sentence or two, not by a fixed window, so a sentence spanning a boundary survives
Store the source document, the section anchor and the position with every chunk. Without them you cannot cite, and an answer you cannot verify is an answer nobody trusts twice.
Hybrid search, not pure vectors
Embeddings are good at meaning and bad at exact strings. A user searching for an error code, a CVE identifier or a function name wants a literal match, and the nearest-neighbour search will cheerfully return three paragraphs about the general topic instead.
Run both — keyword search and vector search — and fuse the results. Reciprocal rank fusion is a few lines and needs no tuning: score each document by the sum of 1 / (k + rank) across both lists. It consistently beat our hand-weighted blend.
SELECT id, 1.0 / (60 + rank_vec) + 1.0 / (60 + rank_kw) AS score FROM fused ORDER BY score DESC LIMIT 12;
Then re-rank the top 12 with a cross-encoder and keep 4. The re-ranker is the single highest-value addition we made; it is a small model, it runs in milliseconds, and it fixes the ordering problem that fusion alone leaves.
pgvector or Qdrant
pgvector if your documents already live in Postgres. One database to back up, one to monitor, one connection pool. Transactional consistency between a document and its embeddings is free, which matters more than it sounds: with two stores, a failed write leaves a chunk whose text and vector disagree. HNSW indexes handle low millions of vectors comfortably.
Qdrant when you are past that, when payload filtering is complex — per-tenant, per-permission, per-date — or when you need to rebuild an index without competing for the same resources your application is using. Filtered vector search at scale is what it is built for, and it shows.
Our default is pgvector, and we have moved exactly one system off it.
Re-embedding is a migration
Changing the embedding model invalidates every vector you have. Old and new vectors are not comparable, so this is not a rolling change — it is a full rebuild. Store the model name and dimension with every vector, keep the chunk text so you can re-embed without re-parsing the source, and plan the switch as you would any schema migration. Teams that skip this discover it on the day they want to upgrade.
Measure it
Write thirty real questions with the passage that should be retrieved for each. Check recall at 5 whenever anything changes. It takes an afternoon and it converts "the assistant feels worse" into a number you can act on.