Study tools → ❓ Quiz → Generate quiz
Lewis John Villamor

Self-hosted, citation-grounded PDF study assistant with hybrid retrieval and a real retrieval evaluation harness.
Made by
@lewis-john-villamor
Full Stack Developer / Solutions Architect

PulseShift
Open-source crypto lab that draws AI buy/sell signals on live charts. Paper only.
Live
Kemdara
Cryptography Workbench
Building
Project Hibernate
Local desktop app that reclaims disk space from dormant dev projects by removing rebuildable artifacts, never source cod
Live
Confidential File Merger
Merges PDFs and images into one PDF on your own machine. Self-hosted, fully offline, nothing ever leaves your computer.
LiveLewis John Villamor
Study tools → ❓ Quiz → Generate quiz
Lewis John Villamor
Quick use cases
Exam revision — upload lecture notes + slides, ask "explain X", get answers with page-numbered citations you can verify against the source.
Clause lookup — find 7(c) in a contract or policy without scrolling; the tokenizer keeps sub-clause identifiers intact so the right section surfaces first.
Onboarding Q&A — drop your handbook and runbooks in; new hires ask instead of interrupting, and every answer links back to the doc.
Research triage — load 20 papers, ask which ones cover your method, get per-paper grounded summaries with traceable sources.
Compliance evidence — answers are marked grounded / partially grounded / ungrounded, so you know when to trust one and when to open the PDF.
Study-tool generation — flashcards, quiz questions and summaries built from your own material, not from the model's memory.
Private/air-gapped deployment — self-hosted Postgres + pgvector, no document ever leaves your machine.
Lewis John Villamor
Updates:
Search speed — 35x faster
Keyword search checked every passage in the library for every question. It now jumps straight to passages containing the search terms.
Over 32,000 passages: 44ms → 1.25ms per query. The gain grows as the library grows — this scales, rather than being tuned.
Upload processing — 160x faster
Duplicate-text removal compared every paragraph against every other. On a long book, 12.5 seconds. Now grouped so only plausible matches are compared: 0.08 seconds.
Both exact, not approximations
Speed here usually costs accuracy. Neither does. The duplicate check is provably complete by a mathematical guarantee, enforced by an assertion in the code.
Verified by running old and new side by side: scores identical, results identical, at every size tested.
Lewis John Villamor
Upload speed
Large uploads ~4x faster. The step converting text for search ran one batch at a time, waiting on each before starting the next. A 10,000-passage document dropped from ~20 seconds of waiting to ~5.
Hosted processing only. On-device setups were deliberately left alone — parallel work would slow them, not speed them.
Query efficiency
Removed a redundant database call on every search. Ten searches now cost one lookup, not ten. Lower load and latency, better headroom as the corpus grows.
Risk controlled
The parallel change had one dangerous failure mode: passages silently matched to the wrong search data — the system would look fine while every answer was wrong. We built a test that forces that condition and verifies all 500 pairings.
Assurance
260 automated checks green, up from 255
Answer quality re-measured: unchanged
Validated end-to-end
Lewis John Villamor
Updates:
Accuracy
Found a defect in how the product indexes legal and technical references. "Article 7(c)" was stored as just "Article" — the clause letter discarded — so 7(a), 7(b) and 7(c) were indistinguishable. Any query naming a clause was effectively guessing.
Now fixed. Every accuracy measure improved; the toughest — first result correct — rose from 91% to 96%.
Matters most for regulatory, contract and compliance work, where the clause number is the question.
Infrastructure
Switched the search index to a better-suited type: removes a fragile step that rebuilt it after every upload, and improves result quality.
Lewis John Villamor
Faster
Uploading documents is ~3x quicker — a 200-page file now processes in a third of the time
Study tools (summary, flashcards, quiz) start sooner: 5 trips to the AI service became 1
Answers finish faster — fact-checking and follow-up suggestions now run at the same time instead of one after the other
Cheaper
Our cost-saving feature was silently doing nothing (applied to the wrong part of each request). Now live — document excerpts are paid for once per session, not 3–4x per question
Confidence
245 automated tests passing
Answer quality re-measured: identical — no quality traded for speed
Verified end-to-end in a real browser
Lewis John Villamor
Fixed bugs
MMR discarded fusion scores → recall@5 0.864 → 1.000, misses 3 → 0
SESSION_TTL_MINUTES parsed but never enforced → sessions now expire
"Clear conversation" left transcripts in Postgres → now clears
Embeddings had worse error messages than chat for the same failure
Added
Hybrid BM25 + vector retrieval, RRF fusion, MMR, optional reranker
Citations to file+page, fake [S7] markers stripped, self-check verdicts
Eval harness (recall@k/MRR/nDCG) — it caught the MMR bug
Postgres/pgvector, auth, rate limiting, Docker, study tools
Lewis John Villamor
PDF Chatbot — Now Supports BYOK
Bring Your Own Key: connect your own OpenAI or Anthropic API key and use the PDF study assistant without relying on a shared platform key.
Lewis John Villamor
PDF Study Assistant
Answers only from your PDFs — refuses when they don't cover it
Every claim cited to file + page; self-check pass verifies claims against sources (✅/⚠️/🚩); fake citations stripped
Hybrid BM25 + vector search, RRF fusion, MMR diversification, optional cross-encoder reranker
Smart PDF prep: de-hyphenation, header stripping, structure-aware chunking, dedup
Study tools: summaries, glossaries, Anki flashcards, scored quizzes; Markdown export
Streamlit UI; Docker + Postgres/pgvector; Anthropic or OpenAI; fully offline mode
Caching so re-uploads are free; password auth, rate limits, live cost tracking
Eval harness (recall@k/MRR) with guards against fooling yourself; 205 tests, no network calls
Building a dev tool or hiring developers? Get seen here. Become our Sponsor
Building a dev tool or hiring developers? Get seen here. Become our Sponsor