All projects

Personal project · NLP prototype

RAG for Research Paper Q&A

This retrieval-augmented generation (RAG) pipeline retrieves three passages from a research paper and uses them as context for GPT-4o-mini to answer the reader’s question.

Prototype
Scope
Question answering over an uploaded PDF
When
2026

PDF retrieval & command-line Q&A

Try demo
Read the context behind an answer — public demonstration

A fictional document supports local keyword retrieval and extractive responses. The visual inspection interface is new for this portfolio; no LLM API or upload runs here. This interface was created for the portfolio.

The question

How can a question-answering tool use an uploaded paper rather than relying only on a model’s prior knowledge?

Supporting figure

What reaches the language model?

RETRIEVAL ARCHITECTURE
Chunk 1 · 1,000 characters200-character overlap
Shared textChunk 2 · 1,000 characters
Load & splitPDF → overlapping chunks
Embed & indexOpenAI → Chroma
RetrieveTop 3 chunks per question
GenerateContext → GPT-4o-mini

Context sent with the question

Retrieved passage 1Retrieved passage 2Retrieved passage 3

“Answer the question based only on the following context.”

Architecture diagram based on the public implementation. Three retrieved passages supply context; this is not a guarantee that an answer is supported or that retrieval found every relevant passage.

Approach

PyPDF loads a document and a recursive splitter creates 1,000-character chunks with 200-character overlap. OpenAI embeddings index chunks in Chroma. For each question, the pipeline retrieves the three closest chunks and supplies them as context to GPT-4o-mini through LangChain.

Project work

The command-line tool lets a reader ask questions about a PDF. For each question it retrieves three passages and passes them to the answer model. The retrieved text and chunking settings can be inspected when an answer misses relevant context.

Results & evidence

The public repository contains the pipeline and an example question. It demonstrates loading, chunking, embedding, retrieval, and generation; it does not include a comparative evaluation of retrieval quality or answer faithfulness.

Scope & interpretation

A prompt asking the model to stay within context does not guarantee factual or complete answers. The next useful extension is an annotated question set, source-page attribution, and separate evaluation of retrieval coverage and answer support.

Project materials

Public code and a method diagram; this portfolio does not upload documents to an API.