Retrieval · pgvector
Document question-answering pipeline
A retrieval-augmented generation pipeline that answers questions from a document collection using vector search in PostgreSQL. POC: the work was not pursued to deployment.
POCProof of concept. Not pursued to deployment.
The problem
Language models don't know your documents. Answers need to be grounded in the right passages, retrieved quickly and reliably.
Context
A document question-answering prototype: split a corpus, store vectors, retrieve the nearest passages, then draft an answer from those passages only.
My role
I designed and built the retrieval pipeline: chunking, embeddings, pgvector storage, similarity search and the grounded LLM answer. The work was not pursued to deployment.
What I built
Built features
- 01Document chunking
- 02Embedding and vector storage
- 03Similarity search for a question
- 04Answer generated from retrieved passages
Design decisions
- Split documents into chunks small enough to retrieve a precise passage.
- Store embeddings in PostgreSQL with pgvector so similarity search stays next to the data.
- Ground the language-model answer in the retrieved chunks rather than in the model’s prior knowledge.
- 01Documents are split into chunks suited to retrieval.
- 02Each chunk is embedded and stored with pgvector in PostgreSQL.
- 03A query retrieves the most similar chunks.
- 04An LLM writes the answer from the retrieved context.
Outcome
This work stayed at proof-of-concept and was not pursued to deployment.
Architecture
How Document question-answering pipeline fits together.
Each step, in order. Select a node to see what it is responsible for.
The source collection the system answers from.
Splits documents into passages small enough to retrieve precisely.
Encodes each chunk as a vector that captures its meaning.
- Embedding model
Stores vectors in PostgreSQL and supports similarity search.
- PostgreSQL
- pgvector
Finds the chunks most similar to the user's question.
Generates an answer grounded in the retrieved chunks.
- LLM
Stack
- PostgreSQL
- pgvector
- Embeddings
- LLMs
Next project
Clinical training simulator
A clinical training MVP in development: students work through cases, guided by a state machine and evaluated with AI feedback and scoring. Several modules are functional; the platform is not fully delivered.