📄️ Hybrid document retrieval
Retrieval is the query-time counterpart of everything you did during indexing. Given a (possibly HyDE-rewritten) user question, RAG Me Up must find the chunk set most likely to ground a good answer. In this framework that always means hybrid retrieval over Postgres: dense similarity via pgvector and sparse keyword search via ParadeDB BM25 (pg_search).
📄️ Reranking
Bi-encoder retrieval (what your embedding model does) encodes the query and each chunk independently. That is why indexing can be offline and why query-time search is fast: you compare vectors that never attended to each other during encoding. The price is that fine-grained interactions between a specific question and a specific passage — negation, constraint words, cross-sentence references — are only approximated in the vector space.
📄️ Query rewriting through self-inflection
Retrieval can fail silently. Hybrid search always returns something in the top-k, and a reranker always produces an ordering. Neither step guarantees that the retained chunks actually contain what is needed to answer the question. If you prompt the LLM anyway, you often get a fluent answer that is under-grounded — or confidently wrong.