DEV Community

Gamaliel Dashua
Gamaliel Dashua

Posted on

Slow & Steady Math Tutor

Hacktoberfest Open-Source AI Challenge Week 3: Slow and Steady Submission ๐Ÿฆฅ

This is a submission for the Hacktoberfest Open-Source AI Challenge Week 3: Slow and Steady

What I Built

๐Ÿข Slow & Steady is a calm, patient math tutor that runs entirely on your own computer.

You take a photo of a math problem (from a textbook, a worksheet, or a whiteboard) or type it in. The tutor reads it, works out the answer, and then explains it slowly, like a kind teacher sitting next to you, using everyday pictures: sharing pizza between friends, balancing a seesaw, filling a water tank.

It's built for people who freeze up when they see math:

  • Students who are stuck on homework late at night with nobody to ask.
  • Parents who want to help their kids but haven't seen algebra in 20 years.
  • Adults going back to learning who feel embarrassed to ask "basic" questions.

What makes it different from "just ask a chatbot"

Most AI chatbots are confident even when they're wrong. That's dangerous for a learner, because a beginner can't tell a wrong answer from a right one. So I made the tutor follow one rule:

The AI explains. A calculator checks.

The AI model never does the arithmetic on its own. Every answer is worked out by a real math engine (SymPy), the same kind of tool a scientist would trust. The AI's job is the human part: reading your messy handwriting, understanding the question, and explaining the steps in plain words.

It's honest when it can't see clearly

Photos are often blurry, crooked or half in shadow. Instead of guessing, the tutor handles three situations:

What you send What the tutor does
A clear photo or a typed problem Solves it, shows every step, and explains each one with a simple analogy.
A blurry photo, but the topic is visible (say, you can tell it's about fractions) Tells you kindly that it couldn't read the numbers, then teaches the idea using a practice problem on the same topic, one it has already checked.
A photo with nothing readable Asks you what you're working on, with buttons for each topic, or lets you type the problem yourself.

When it isn't sure what it read, it shows you its reading and asks "Is this right?" before solving anything. A good teacher checks they understood the question before answering it.

What it can help with

It covers school math through first-year university:

  • Arithmetic, fractions, percentages
  • Equations, inequalities, quadratics, simultaneous equations
  • Word problems (ages, mixtures, money, shapes)
  • Complex numbers
  • Matrices (determinants, inverses, eigenvaluesโ€ฆ)
  • Calculus: derivatives, integrals, limits, series, differential equations

There's also a built-in math keyboard (โˆซ, โˆš, fractions, matrices, ฮฃโ€ฆ), so you never have to figure out how to type "the integral from 0 to 1" on a normal keyboard.

Who gets to be a little lazier? The parent who doesn't have to relearn algebra before helping with homework tonight. The student who doesn't have to wait until tomorrow's class. And the teacher, who doesn't have to answer the same "how do I do question 4?" message ten times.

Demo

What the video shows:

  1. A clear photo of an equation โ†’ solved step by step, with an analogy.
  2. A deliberately blurry photo โ†’ the tutor admits it can't read the numbers and teaches the topic with a practice problem.
  3. A blank photo โ†’ the tutor asks what you're working on.
  4. A calculus question typed with the on-screen math keyboard.

Because everything runs on your own machine, there's no public website to visit. That's on purpose, and the next sections explain why. You can run it yourself in about three commands (see Code).

Code

๐Ÿข Slow & Steady: Universal Math Tutor Agent

A calm, patient, local-first math tutor for students, parents, and lifelong learners who feel anxious about math Snap a photo of a problem (or type it). The tutor reads it, checks the math with a deterministic calculator (SymPy), and explains it slowly with an everyday analogy: sharing food, slicing pizza, balancing a scale.

Everything runs on your machine through Ollama. Nothing leaves your computer.

Quick start

# 1. Models (any vision model + any chat model work; these are the defaults)
ollama pull qwen2.5vl:7b        # reads photos
ollama pull qwen3:30b-a3b       # sets up word/diagram problems and writes explanations (~19 GB)
ollama pull qwen2.5vl:3b        # optional second opinion for hard photos

# 2. Python 3.10โ€“3.13
python3.12 -m venv .venv
.venv/bin/pip install -r requirements.txt

# 3. Run
.venv/bin/streamlit run app.py
Enter fullscreen mode Exit fullscreen mode

Override models with environment variables: TUTOR_VISION_MODEL, TUTOR_BACKUP_VISION_MODEL, TUTOR_CHAT_MODEL TUTOR_REASONING_MODEL, โ€ฆ


Run it yourself:
# 1. Download the open models (one-time)
ollama pull qwen2.5vl:7b       # reads photos
ollama pull qwen3:30b-a3b      # understands questions and writes explanations
ollama pull qwen2.5vl:3b       # optional second opinion on hard photos

# 2. Install
python3.12 -m venv .venv
.venv/bin/pip install -r requirements.txt

# 3. Start the tutor
.venv/bin/streamlit run app.py
Enter fullscreen mode Exit fullscreen mode

Then open http://localhost:8501 in your browser.

How I Built It

The open-source pieces

Piece What it does, in plain words
Ollama Runs the AI models on my own laptop (a MacBook with 32 GB of memory). No internet, no cloud account.
Qwen2.5-VL 7B (open-weight) The "eyes". It looks at the photo and writes down the math it sees.
Qwen2.5-VL 3B (open-weight) A second pair of eyes, used when the first reading is unclear.
Qwen3 30B-A3B (open-weight) The "brain" for language. It turns word problems into equations and writes the friendly explanations.
SymPy The calculator. It does every bit of actual math, so answers are exact and never made up.
LangGraph The "flowchart". It decides what happens next: solve, teach a practice problem, or ask the learner.
Streamlit The web page you interact with.
MathLive The on-screen math keyboard, bundled with the app so it works offline.

How the pieces fit together

Think of it as a small team, where each member has one job:

 ๐Ÿ“ท Photo โ”€โ”€โ–บ ๐Ÿ‘€ Reader โ”€โ”€โ–บ "Do two readings agree?"
                               โ”‚
               yes โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ no / blurry / blank
                โ”‚              โ”‚                     โ”‚
                โ–ผ              โ–ผ                     โ–ผ
          ๐Ÿงฎ Calculator   ๐Ÿ“š Practice-problem   ๐Ÿ™‹ Ask the learner
          (SymPy) solves   lesson on the topic    for the topic
                โ”‚              โ”‚
                โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                       โ–ผ
             ๐Ÿง‘โ€๐Ÿซ Tutor explains every
               checked step, slowly
Enter fullscreen mode Exit fullscreen mode

Three ideas that made it trustworthy

1. Read it twice. The photo is read in two different ways: once as structured data, once as a plain transcription. The tutor only goes ahead if both readings describe the same math, compared by meaning rather than by spelling (so 2x and 2*x count as a match). If they disagree, it asks the learner instead of guessing.

2. Solve word problems twice. For a word problem like "Ama is three times as old as Kofiโ€ฆ", the language model writes the equations, together with a reason for each one. It does this twice, independently. The calculator solves both versions, and the answer is only shown if they agree. One wrong translation can't sneak through.

3. The model isn't allowed to change the numbers. After the AI writes its friendly explanation, a final check makes sure every number in it matches the calculator's results. If the AI "improves" an answer, that explanation is rejected.

Testing it like a real product

I built an evaluation set of 60 real problems: clean photos, blurry photos, handwriting, word problems, calculus and more. I scored them by meaning: was the answer right, was it wrong, or did the tutor honestly decline? The current version gets 46 of 60 fully correct (77%), with a median time of about 9 seconds per question. I also wrote 283 automated tests for the math engine, the keyboard-to-math conversion and the decision logic.

The 23% it doesn't get right is mostly harder word problems, and a lot of that is the tutor declining rather than giving a wrong answer. For a learner, "I'm not sure, can you check this for me?" is far better than a confident mistake.

Why Does Open Innovation Matter?

1. Privacy for children. A lot of the people photographing homework are kids. With open-weight models running locally, no photo of a child's handwriting, worksheet or bedroom desk ever leaves the computer. There's no account to make, no data being collected, and nothing to leak.

2. It's free to use, forever. A closed API charges for every question. A student asking 50 questions a night would be a real cost for a family, or a school with 500 students. Once the open models are downloaded, every question costs nothing.

3. It works without internet. My own connection dropped constantly while I built this. A tutor that stops working when the Wi-Fi does is no good to a student in a rural area, on a bus, or in a school with a weak connection. This one keeps working offline.

4. I could look under the hood. With open models I could test exactly how each one behaves, swap them freely and pick the best fit. For example, I found that one model "thinks out loud" for about 45 seconds before every reply, which is far too slow for a nervous learner, so I swapped it for a faster version of the same family. A closed API wouldn't have let me compare and replace models that freely. And because every model is set in one config file, anyone with a smaller laptop can swap in a smaller open model.

5. Anyone can improve it. A teacher can add a new topic, a translator can make the explanations work in another language, and a school can run it on its own computers. Open models plus open code means the tutor can belong to the community that uses it.

The Lazy Payoff

  • For a parent: instead of 20โ€“30 minutes of searching "how to solve simultaneous equations" and watching videos before helping a child, the explanation arrives in about 10 seconds, worded for someone who has forgotten the method.
  • For a student: no waiting until the next class to get unstuck. It's like having a tutor available at 11 p.m. that never gets impatient, never charges by the hour, and never makes you feel silly for asking.
  • For me: the tutor double-checks itself (two readings, two setups, a calculator on every step), so I don't have to double-check it. That's the laziest and safest kind of AI helper: one you can trust.

Top comments (0)