1–2 Minute Brief Pitch: RAG Technical Documentation Assistant

Target Duration: ~60–90 seconds (~190–240 spoken words)
Tone: Confident, structured, systems-focused, and natural.
Goal: Deliver a crisp, memorable overview connecting recursive token-aware chunking, dual-indexed PostgreSQL storage, hybrid RRF search, cross-encoder neural reranking, and citation-grounded LLM synthesis.


🎙️ Spoken Script (Memorize & Deliver Naturally)

“I built a Retrieval-Augmented Generation (RAG) assistant for querying PostgreSQL 16 documentation. Rather than using high-level wrapper frameworks, I implemented the pipeline myself to maintain complete control over database indexing, retrieval algorithms, and latency.

The project centers on three core engineering components.

First, document ingestion. I built an automated pipeline that extracts structured sections from documentation, recursively splits them into 512-token chunks, and generates 384-dimensional embeddings using BAAI/bge-small-en-v1.5. Everything is stored in a single PostgreSQL instance using pgvector with an HNSW index for semantic similarity, and PostgreSQL full-text search with a GIN index for keyword matching.

Second, hybrid retrieval and reranking. Vector search is great for conceptual questions, but fails on exact syntax flags, error strings, and configuration keys like shared_buffers. I run vector and full-text search together, merge their candidate lists using Reciprocal Rank Fusion (RRF) to bridge score scale differences, and then pass the top candidates to a cross-encoder for neural reranking to isolate the most relevant excerpts.

Finally, citation-grounded generation. I feed the top passages to Gemini with strict instructions to answer strictly from context, cite every claim using [Source N], and fall back explicitly if information is missing. A regex-based extraction layer parses these citations and maps them directly back to documentation sections and URLs.

Through this project, I gained deep hands-on experience in database vector indexing, hybrid ranking math, and evaluating end-to-end RAG quality.”


🎯 Strategic Follow-Up Breadcrumbs (Hooks Dropped)

  1. Why a Single PostgreSQL Store over Dedicated Vector DBs? Drops a hook to discuss why combining relational metadata, pgvector (HNSW), and full-text search (GIN) in a single ACID engine avoids distributed synchronization lag and simplifies production deployments.
  2. Why Reciprocal Rank Fusion (RRF) instead of Linear Score Weighting? Invites the interviewer to ask why cosine distance ($[0, 1]$) and ts_rank_cd ($[0, \infty)$) cannot be added directly, leading into rank-based scoring math ($\sum \frac{1}{60 + \text{rank}}$).
  3. Bi-Encoder vs. Cross-Encoder Architecture: Sets up a deep dive into why bi-encoders encode query and documents independently for fast index lookup ($\mathcal{O}(1)$), whereas cross-encoders perform full joint attention ($\mathcal{O}(N)$) over candidates for superior precision.
  4. Asymmetric Retrieval Prefixes: Leads to explaining why BGE embedding models require a special task prompt for queries ("Represent this sentence...") while documents are indexed bare.
  5. Anti-Hallucination & Citation Parsing: Sets up questions about how regex extraction maps [Source N] markers back to chunk metadata and verifies groundedness.

⚡ Rapid-Fire Interview Follow-Up Q&A

Q: Why did you choose pgvector with HNSW over IVFFlat?
“IVFFlat partitions the vector space into inverted lists using k-means clustering. While IVFFlat has lower memory overhead and faster index build times, it requires periodic retraining as data grows and suffers from severe recall drops unless you probe many centroids. HNSW creates a multi-layer graph with $\mathcal{O}(\log N)$ traversal complexity. It provides much higher recall out-of-the-box, doesn't require index retraining, and allows query-time tuning of accuracy via SET hnsw.ef_search.”
Q: Why is Full-Text Search necessary if dense embeddings already capture semantic meaning?
“Dense embeddings capture semantic concepts, but they struggle with out-of-vocabulary technical tokens, specific CLI flags (like -rf or -i), and exact configuration parameters (such as PostgreSQL's shared_buffers or wal_level). An embedding might treat kill -9 and kill -15 as almost identical vectors, but their operational semantics are completely different. Full-Text Search with GIN indexes guarantees exact lexical matching for technical symbols.”
Q: What is the computational cost of cross-encoder reranking?
“A cross-encoder concatenates the query and passage into a single sequence and runs it through all transformer layers with full self-attention across both texts. Because inference is $\mathcal{O}(N)$ in the number of candidates, running it over an entire database of 50,000 chunks would take dozens of seconds. By using a two-stage retrieve-and-rerank design, we retrieve the top-20 candidates in ~25 ms via pgvector + FTS, and then rerank only those 20 candidates in ~80 ms on CPU, maintaining an interactive response time.”
Q: Why did you choose BAAI/bge-small-en-v1.5 (384 dimensions, float32) and what alternatives did you consider?
“I chose BAAI/bge-small-en-v1.5 for three critical systems and algorithmic reasons: Alternatives Considered: ”

← Project Index Next: 4–5 Minute Speech →