DEV Community

Quan Zhan
Quan Zhan

Posted on

PaperLens: Read Research Papers with an Open-Weight Model Running on Your Own Machine

The problem

I'm an undergraduate student, and I read a lot of papers — optimization algorithms, optics, whatever my coursework drags me into. The bottleneck isn't finding papers, it's digesting them: a 12-page PDF takes me an evening, and half of that evening goes to re-reading the method section.

Proprietary AI APIs would solve this, but they charge per token and — worse for a student — they'd see every unpublished manuscript or thesis draft I upload. I wanted a paper-reading assistant where the intelligence is free and the data never leaves my laptop.

What I built

PaperLens: a ~130-line Python CLI. Point it at a PDF, get back a structured Markdown report:

  • TL;DR — problem + headline result in two sentences
  • Key contributions — bullet list
  • Method — explained in plain language
  • Key results — the numbers that matter
  • Reproduction notes — what you'd need to reproduce it, with honest "unclear" flags instead of invented details
pip install -r requirements.txt

# Fully local: data never leaves your machine
ollama pull qwen3:8b
python paperlens.py paper.pdf -o report.md

# Or Groq Cloud free tier (open-weight Llama, no credit card needed)
export GROQ_API_KEY=your_key_here
python paperlens.py paper.pdf --backend groq -o report.md
Enter fullscreen mode Exit fullscreen mode

How it works

The pipeline is deliberately boring:

PDF → text (pypdf) → structured prompt → open-weight model → Markdown report
Enter fullscreen mode Exit fullscreen mode
  1. Extract — pypdf pulls raw text from the PDF (.txt also works, handy for testing).
  2. Constrain — long papers are truncated to 12,000 characters so they fit the context window; the user is told when this happens.
  3. Prompt — one fixed template demands exactly the five sections above and instructs the model to say "unclear" rather than hallucinate when text is missing. This is the whole "prompt engineering": narrow the job, forbid invention.
  4. Run — three backends, all stdlib HTTP, no SDK needed:
    • ollama (default): local server, zero cost, zero data egress
    • groq: free-tier cloud inference of open-weight models, OpenAI-compatible
    • echo: dry-run that prints the prompt — lets anyone verify the pipeline without a GPU or API key

Tech stack

Python stdlib + pypdf. That's it — one dependency. I wanted something a first-year student could read end to end in one sitting.

Why open matters here

Three reasons, all practical:

  • Cost. Reading 100 papers through a proprietary API is a student-budget problem. A local 8B model or a free-tier endpoint makes it $0.
  • Privacy. Students and researchers routinely work with unpublished manuscripts. With the Ollama backend, the paper never leaves the device — there is no trust decision to make.
  • Auditability. The entire pipeline fits in one short file. If the summary looks wrong, you can read the prompt and see exactly what the model was asked. Try that with a black-box reading app.

My agent session

I built PaperLens with an AI coding agent: I described the pipeline I wanted, it drafted the code, and I directed the testing — including a real PDF-extraction test with a generated PDF and an end-to-end dry run. The agent wrote fast; I kept the design boring on purpose.

Try it

Repo: https://github.com/yniantongtian-oss/paperlens — MIT licensed, PRs welcome.

Prize categories: submitted for the Hacktoberfest Open-Source AI Challenge: Week 3.

Top comments (0)