Home / use case

Gist: an offline exam-prep partner that mines past papers with Ollama

What they built

Gist is a study partner built for a friend who wasn't willing to upload copyrighted lecture PDFs to someone else's inference endpoint. It runs entirely on the laptop: PDFs are parsed, embedded and searched locally, the LLM runs in Ollama, and the app works with the Wi-Fi switched off. There is no API key in the codebase.

Its core is a past-paper analyser. You drop in three or more years of university exam PDFs and it works out which questions repeat, what each topic is worth in total marks, how often each concept appears across semesters, and how your own quiz results line up against that weighting.

On top of that it offers page-grounded document Q&A with citations, adaptive quizzes, a priority matrix of high-yield weak spots, and timed mock exams in a 'Grill Me' mode. The author reports about 4,700 lines of Python, up from 2,000 when the quiz was the main feature.

Setup

  • Ollama with gemma2:9b and the lighter gemma2:2b (Llama 3.2 also mentioned) for chat, classification and grading
  • nomic-embed-text or bge-m3 for embeddings
  • FastAPI backend with PyMuPDF for PDF ingestion
  • ChromaDB for vectors and SQLite (tracker.db) for papers, question bank and attempt history
  • React 18 + Vite frontend

How it works

  1. A deterministic regex pass splits questions on structural boundaries like Q1(a), 2. or (i) and pulls marks written as [10], (5 marks), 15M or 4 + 6 + 2 = 12.
  2. A keyword ontology maps question vocabulary to canonical syllabus topics (for example bcnf, 3nf and attribute closure all map to Normalization), so small models can't invent topic names.
  3. Only questions that fall through to the generic bucket go to Ollama, batched at 12 snippets or fewer with num_predict=200; full LLM extraction is kept as a fallback for unstructured scanned layouts.
  4. Exam importance = marks_pct * (0.6 + 0.4 * frequency_pct / 100), and study priority = exam_importance * ((100 - accuracy) / 100) * 1.5; untested topics are treated as 75% weak.

Results & numbers

  • The rules-first parser runs in milliseconds and keeps mark extraction exact, which the whole priority model depends on
  • The app works fully offline, so the privacy claim can be checked by confirming nothing leaves localhost

Gotchas

  • The first prototype sent whole exam papers to the LLM for structured JSON; it was slow on local hardware and hallucinated marks
  • Getting mark parsing wrong skews every downstream percentage, so it has to be deterministic rather than approximate
“There is no API key in the codebase because there is no API involvement.”— Gist author on DEV Community

Do it yourself

  1. Install Ollama and pull a small chat model (the author uses gemma2:2b and gemma2:9b) plus an embedding model such as nomic-embed-text.
  2. Extract text from your PDFs locally with PyMuPDF and store chunks with embeddings in ChromaDB.
  3. Write regex rules for your university's question numbering and mark formats before reaching for the LLM.
  4. Map keywords to a fixed list of syllabus topics, and send only unmatched questions to the local model in small batches.
  5. Track quiz accuracy per topic in SQLite and rank topics by marks share, frequency and your weakness.
exam_importance = marks_pct * (0.6 + 0.4 * (frequency_pct / 100))
priority = exam_importance * ((100 - accuracy) / 100) * 1.5
Source: DEV Community (Hacktoberfest Build for a Friend) · 2026-10-04 · Added 2026-10-20. This write-up summarizes the original source; see it for full details.

Related

LazyDesk AI: a local file organizer that renames and sorts your Downloads with Qwen3

LazyDesk AI scans a folder you allow, reads PDFs, DOCX, Markdown and CSVs locally, and has a local Ollama model propose clean filenames and categories, then moves files only after you approve, with hash-checked one-click undo.

Ayush Dinda (DEV Community) · 2026-10-20

PromptCI: regression-testing LLM prompts offline against Ollama

Soumyabrata Mukherjee built PromptCI so freelancers can catch prompt changes that silently break client workflows, running YAML-defined pipelines and output checks against open-weight models on a laptop, with no API keys or cloud bills.

Soumyabrata Mukherjee (DEV Community) · 2026-10-17

Offline menu description writer for small restaurants with Gemma 3 4B

A one-button Streamlit app where a tea shop or restaurant owner types a dish name in English and Tamil plus a short note, and Gemma 3 4B in Ollama writes a two-sentence English menu description in about 20 seconds, with no internet.

ajaypraneeth15 (DEV Community) · 2026-10-16

A 4B local model on a 4 GB laptop GPU as a PASS/FAIL test evaluator

Qwen3 4B Instruct in Ollama (Docker, WSL2) grades a Spring Boot app's root-cause answers against expected ones, returning a JSON verdict, with every speed and memory number measured on a 4 GB Quadro T1000.

Vishnu Vardhan · 2026-10-15