Document search with verifiable sources
A Python document-search prototype combining OCR, semantic retrieval and a Gradio interface with source-page references.


My contribution
I developed the document-processing and retrieval pipeline, connected it to a local language model, and built the Gradio interface during the Pfizer externship via Extern.
The context
A useful document assistant must do more than produce a fluent answer. It needs to extract readable text, retrieve relevant passages and give the reader a practical way to check the source. The prototype explores that workflow for people reviewing complex PDFs.
How I worked
- Prepare the documents. Combined PDF text extraction and OCR to handle text-based and scanned content. Explored document classification and routing before splitting text into chunks for retrieval.
- Find supporting passages. Used FAISS for semantic search and connected retrieved context to Qwen 2.5. Kept extraction, retrieval and answer generation as distinct stages so failures could be investigated separately.
- Make answers reviewable. Built a Gradio interface for document questions, with supporting passages and page references rather than presenting generated answers without context.
- Evaluate the trade-offs. Compared retrieval quality with answer quality and explored how model size and response time affect the experience.
Deliverables & takeaways
The deliverable is a working document-questioning prototype, documented in the linked Python notebook. It brings OCR, classification, retrieval and a user interface into one workflow.
A key lesson was that retrieving a relevant passage does not guarantee a correct answer: the response and its citation still need to support the particular claim. This shaped how I assessed the system and presented its sources.
Scope & limitations
The prototype was developed in an externship; it is not a deployed Pfizer system or a tool for clinical or compliance decisions. Human source verification remains necessary. Structured tables, citation checks and evaluation on independent documents are areas for further work.
Company-specific document examples and sensitive evaluation details are withheld. The technical notebook remains available to show the implementation.
Source & supporting evidence
- Explore the technical notebook
Python implementation and technical documentation (English).