Shipped

Paper Pal

Chat with any arXiv paper. Every answer cites the page it came from, so you can check it instead of trusting it.

Stack
Python · FastAPI · pgvector · PyMuPDF
Built
Jun – Aug 2026
License
MIT

> cat story.md

The story in three panels

  1. The problem

    Chatbots summarize papers confidently and sometimes wrongly. You can't tell which sentences are real without reading the paper yourself, which defeats the point.

  2. The build

    Split the PDF into chunks tagged with page numbers, retrieve the best ones for each question, and force the model to cite a page for every claim it makes.

  3. The result

    Answers you can check in one click. On our test set, correct answers went from 61% to 84%, and every claim now points to a page.

> tree ./architecture

How it works

Two pipelines. One runs once per paper, the other runs for every question.

Indexing: PDF goes to parse and chunk, then embed, then stored in pgvector. Asking: a question is embedded, the top 20 chunks are retrieved from pgvector, reranked to the top 5, sent to the LLM, which returns an answer with page citations. INDEX · once per paper arXiv PDF9 pages Parse & chunk~400 tokens + page no. Embed1 vector / chunk pgvectorchunks + pages ASK · every question Question"what is SWA?" Retrieve top 20vector search Rerank → 5cross-encoder LLMcite or refuse Answer+ [p.2] [p.4]
The dashed line is the only link between the two pipelines: questions search what indexing stored.

> python eval.py

Results

120 hand-written questions across 10 papers, each graded against the paper by a human.

What each change did
VersionCorrect answersAnswers with a valid citation
Plain RAG, fixed 1,000-char chunks61%48%
+ cross-encoder reranker78%71%
+ page-aware chunks, "cite or refuse" prompt84%97%

Lessons learned

Search