DEV Community

Khushighosh
Khushighosh

Posted on

Study Buddy: an offline GATE study partner for my friend, built with Ollama

Hacktoberfest Weekend Challenge: Build for a Friend Submission 🤝

This is a submission for the Hacktoberfest Weekend Challenge: Build for a Friend

What I Built

Study Buddy is an offline exam study partner I built for my friend Anushka, who is preparing for GATE.

GATE has a huge syllabus, and she wanted quick answers and practice questions from her own notes. I also wanted her study material to stay on her laptop and not go to someone else's server.

You add your notes (PDF, text or markdown) to a folder, and Study Buddy does three things:

  • Answers from your notes only. Every answer cites its source, like [notes.pdf p.3]. If the notes don't cover a question, it says so instead of guessing.
  • Quizzes you on your own material. It writes multiple-choice questions from the notes and explains each answer with a pointer to the source.
  • Tracks your weak spots. It remembers which topics you get wrong and lets you practice them, so it works like a study partner and not just a chatbot.

Everything runs on a laptop. After the one-time download of the models, nothing is uploaded anywhere and it works with Wi-Fi off.

Demo

Screenshot of Study Buddy in a browser: the Ask tab with a question about the notes and an answer that cites its source file

What Anushka said after using it:

I usually spend a lot of time searching through my GATE notes whenever I get stuck on a topic. With Study Buddy, I can just ask a question and get an answer directly from my own notes, along with the page where it came from.

The quiz feature is my favorite because it helps me figure out which topics I actually don't understand instead of just rereading everything. And knowing that my notes stay on my laptop makes me much more comfortable putting all my study material into it.

Code

GitHub logo Khushighosh / study-buddy

Offline exam study buddy: ask questions and get quizzes from your own notes, using Ollama, local embeddings and ChromaDB. Nothing leaves your laptop.

Study Buddy

An offline exam study partner built for a friend. It answers questions and generates quizzes from their own notes, running entirely on a laptop with open models. Nothing is uploaded anywhere.

Features

  • Ask questions and get answers with citations to the notes
  • Says "This isn't covered in your notes" instead of guessing
  • Multiple-choice quizzes generated from the notes
  • Tracks weak topics and offers to practice them

How it works

  1. ingest.py splits your notes into chunks and embeds them with nomic-embed-text into a local ChromaDB store.
  2. For each question, the closest chunks are retrieved and passed to qwen2.5:7b with strict instructions to answer only from them and cite the source.
  3. Quiz mode asks the model for one multiple-choice question per chunk as JSON, validates it, and logs each result in SQLite so weak topics can be practiced again.

Stack

Ollama (qwen2.5:7b and nomic-embed-text), ChromaDB, SQLite, FastAPI, plain HTML.

Tested

…

How I Built It

The whole thing is open-source and local:

  • Ollama runs the models on the laptop.
  • qwen2.5:7b (open-weight) writes the answers and quiz questions.
  • nomic-embed-text (open-weight) turns notes into embeddings.
  • ChromaDB stores the vectors locally; SQLite stores quiz results.
  • FastAPI serves a small plain-HTML page, so it's used in a browser and not in a terminal.

How it works:

  1. ingest.py extracts text from the notes, splits it into overlapping chunks, and stores each chunk with its file name and page number so answers can cite sources.
  2. For each question, the closest chunks are retrieved and passed to the model with strict instructions: answer only from these notes, cite them, and say so if the answer isn't there.
  3. For quizzes, the model is asked for one question as JSON (topic, question, four options, answer_index, explanation). The code validates the JSON and retries once if it's malformed.
  4. Each answer is logged in SQLite by topic, so "Practice my weak topic" picks the topic with the lowest accuracy.

Tested on: a Windows laptop with 16 GB RAM, an Intel Core i7-13620H and no dedicated GPU, so everything runs on the CPU. Timings were about 55 s for the first answer after starting the server (the model has to load), about 42 s for a normal answer, and about 35 s per quiz question. That's slower than a cloud chatbot, but it works on an ordinary laptop.

Limitations: a 7B model can still misread a passage, so every answer shows its source for checking. Answers are slow on a CPU-only laptop, and notes are added through a folder and an indexing command, not an upload button.

Why Does Open Innovation Matter?

  • Privacy: notes never leave the laptop. With a closed API, every question would have sent her study material to a server I don't control. Here I could demo it with Wi-Fi off.
  • Cost: it costs nothing per question, so people can ask as much as they like during revision.
  • Control: the models are open weights, so swapping one is a one-line change (CHAT_MODEL in rag.py), which lets someone with a weaker laptop trade answer quality for speed. I also wrote the prompts so the model refuses when the notes don't cover something, which matters for exam prep.
  • Reproducible: anyone with a similar laptop can run it from the README. There are no API keys or accounts.

Top comments (0)