StepCheck
Photograph your algebra working. StepCheck finds the first wrong step, boxes it on your photo and gives a hint, not the answer. Free, runs on your own computer.
Code and full evaluation: https://github.com/Rithwik-P-26/stepcheck
1. Who it is for, and why they would use it
Rubric: V1, V2, V3
Who. Students who do algebra homework by hand: linear and quadratic equations, simplifying, expanding and factoring, fractions, exponents and radicals, simple inequalities.
The situation. It is evening, the worksheet is done, and the answer at the back of the book does not match. The student knows that something is wrong, but not where.
What StepCheck does. The student photographs (or types) their own working. StepCheck reads each line, checks every step against the step before it, draws a red box around the first wrong step on the photo, names the kind of mistake ("the 2 wasn't multiplied into every term") and gives a hint, not the answer. Two more hint levels are there if needed, and only the last one shows the corrected step. If it may have misread a line, it says "I may have misread this line" instead of calling the step wrong.
Compared with what students do now.
- Answer key: tells you only whether the final answer matches, not which step went wrong.
- Asking an AI model "where is my mistake?": we tested this. The same local model (Gemma 4 12B) was given the typed steps of 240 fresh synthetic solutions and asked for the first wrong step. It found it in 57 of 135 mistakes when answering directly and 80 of 135 when asked to reason first. StepCheck's checker found 135 of 135, and flagged 0 of 105 correct solutions as wrong. (Caveat: a small local model, not a large commercial chatbot, on synthetic cases.)
So the benefit is specific: the student finds out where they went wrong, on their own page, and still fixes it themselves. It costs nothing, and the photo never leaves their computer.
What it needs.
- A computer that can run a 7.6 GB local model through Ollama (free). I developed and tested on one machine only: an Apple Silicon laptop with 24 GB of memory.
- One-time downloads (Ollama, the model, the Python packages). After that it works offline. No account, no API key, no payment.
- Typed steps work even without the model: sympy does the checking and the hint falls back to a written template.
- Patience for photos: about 40 seconds each on my laptop (median 37.5 s). The main blocker is hardware, so a family or school computer set up once is a workable route.
2. What was built during the hackathon
Rubric: event contribution, A4
New project. StepCheck was started during the event; there was no earlier version.
Built during the event (all in the public repo):
- Line reader: cleans the photo, checks blur, darkness and size, splits the page into one crop per line, and asks the local model to transcribe each line.
- Step checker: parses each line into math and decides with sympy whether each step is equivalent to the one before it. Unsure means "unknown", never "wrong".
- Mistake namer: names the kind of mistake with hand-written rules (sign error, distribution error, ...), not with the model.
- Hint writer and leak guard: the model words a hint, and a sympy guard rejects any level-1 or level-2 hint that contains the corrected step or the final answer.
- Web app: photo or typed input, an editable transcript, the highlight on the photo, a step list, the diagnosis, three hint levels, light and dark themes.
- Evaluation kit: generated algebra solutions with known first mistakes, a handwriting renderer, a test harness, and a second fresh test set generated after the code was frozen.
- Failure tests: injected faults, fuzzing and abuse inputs.
- Photo fixes after the first evaluation: a "possible misread" gate, a page-scope check, and a whole-page second read before any photo accusation.
Third-party parts we did not build: the Gemma 4 12B model and Ollama, SymPy, OpenCV, FastAPI, KaTeX, a third-party design kit copied into web/assets/, Lucide icons and open-licence fonts. Licences are listed in README.md ("Credits and licences") and docs/LICENSES.md.
Who did what. Solo entry. Most of the code, tests and docs were written by Claude Code agents, each working on one module against a written contract (SPEC.md), under my direction. I set the rules they worked under: free and local models only, no paid services, and an evaluation that must be fair, meaning it is run by separate agents in fresh sessions, on frozen code, on data nobody tuned on. When the fresh test found a bug that hid a mistake behind "correct", I decided to patch it and label the patch as made after the held-out run. Every agent logged what it produced and how it was checked in docs/devlog/.
Where to see it in the video: the photo flow and hints 0:17-1:01, typed steps 1:01-1:14, the "I may have misread" case 1:14-1:36, the evidence 1:47-2:26, failure handling 2:26-2:45, the limits 2:45-3:03.
3. How AI is used
Rubric: A1, A2, A3, A4
AI in the finished project
One local model, Gemma 4 12B (gemma4:12b, Apache-2.0, 4-bit, 7.6 GB), run by Ollama on the student's own computer. It has exactly two jobs:
- Read: transcribe each handwritten line into math text (and, on a photo where a step looks wrong, read the whole page once more as a second opinion).
- Word the hint: turn an already-verified diagnosis into a short question for the student.
It never decides whether a step is right or wrong, and it does not choose the mistake type. sympy and hand-written rules do that.
Why this model (A1). It is free, needs no account, runs offline, never uploads the student's homework, and one model handles both images and text, so there is one download. It costs $0 per check. A typed check with a mistake takes about 3.5 s, and a correct typed solution needs no model call. A photo takes 37.5 s median (76.1 s at the 95th percentile). On fresh synthetic pages it read 337 of 387 lines exactly (87.1%), but messy handwriting is the weak spot (74 of 99 lines). The only other free candidate, gemma4:31b-cloud, answered our test request with HTTP 402 (payment required), so there is no head-to-head between free models. As a benchmark only, fresh Claude subagents read 40 held-out synthetic pages blind (166 of 166 lines exactly), and their readings gave 40/40 right verdicts through our own checker. That shows the checker is not the weak part: reading is. Claude is a paid cloud service and would mean uploading the photo, so it does not fit the brief.
Three design choices, each measured (A2):
- "The model reads, sympy decides." On the same 240 fresh typed cases, the checker was right on 240/240, found the first wrong step on 135/135, and flagged 0/105 correct solutions. The model alone judging directly was right on 156/240 (57/135 first wrong steps, 6/105 false alarms), and with reasoning first on 183/240 (80/135, 2/105). The typed cases are clean and in scope, so 100% is a ceiling, not a real-world rate.
- Per-line crops instead of the whole page in one call. Reading each line separately gives every step its own box, so the error can be drawn on the photo. It costs accuracy: on fresh pages, reading the whole page in one call is more accurate (79/90 vs 67/90, McNemar p = 0.017). We report this rather than hide it. The product keeps per-line crops as the reading and uses one whole-page read only as a second opinion before it accuses a step on a photo.
- Hints with a leak guard. On 20 fresh error cases covering all 15 problem categories, the guard accepted 18/20 model hints at level 1 and 18/20 at level 2. The other 2 became templates. 0 of the accepted hints contained the corrected step or the final answer, and reading all 20 by hand found 0 leaks at each level. The automatic check matches text verbatim, so it is a lower bound.
How quality was checked, and when to trust it (A3)
Method. Ground truth comes from a generator that injects exactly one labelled mistake (or none) into each solution. The headline numbers come from a fresh held-out split (240 typed cases and 90 synthetic handwriting pages) generated with a new seed after the code was frozen and hashed (47/47 files unchanged after the last run), so nothing was tuned on it. Each configuration ran once, run by an evaluating agent that built neither the product nor the photo fix. Rates come with 95% bootstrap intervals, and paired comparisons use exact McNemar tests.
Results.
- Typed steps: 240/240 right, 0/105 correct solutions flagged as wrong.
- Photos, synthetic handwriting, fresh split: correct pages flagged as wrong 3 of 44 (6.8%; v1 on an older split: 7 of 45, 15.6%). Whole case right 67 of 90 (74.4%; v1: 66 of 90, 73.3%). No verdict on 17 of 90 pages (v1: 6 of 90). The first wrong step was found exactly on 35 of 46 pages with a mistake, and it was right 67 of 73 times when it gave a verdict. By handwriting style: clean 20/22, notebook 21/23, photo-style 16/22, messy 10/23.
- Real photos: on 18 crops of 8 licensed public photos (mostly teachers' chalkboards), the model read 13 of 85 lines exactly. StepCheck got 2 of 18 right, flagged 0 of 15 correct photos as wrong, and gave no verdict on 16 of 18. These photos were used to tune v2 and their labels were written by an AI and are not yet checked by a person, so these are development numbers.
Reading the v1 to v2 change honestly. The v2 changes do what they were designed to do: fewer false accusations and more "I may have misread this line". They did not make the photo path more accurate on fresh pages. On the older split we tuned on, the same code looked better (77/90 right), and on fresh pages it scored 67/90, so part of that gain was fitted to pages we had seen. We report the fresh numbers.
What the numbers do not show. Accuracy on students' own handwriting at scale (test pages are generated, one tidy mistake each), pages with several mistakes or skipped steps, whether the hints help students learn (we counted leaks only), speed on other computers, and a comparison between free models.
AI used during development (A4)
Tools. Claude Code (Anthropic) with parallel subagents, one per module: Claude Sonnet 5.5 coordinated, Claude Opus 5.5 subagents wrote and evaluated the code, and Claude Haiku 5.5 only fetched the hackathon's web pages. Claude is a development and benchmarking tool only. It is not inside StepCheck.
AI checking AI. Every agent logged its tests and what they changed in docs/devlog/. Examples where a check changed the work:
- A review agent's fuzz test found the checker calling 9 correct steps wrong (rounded decimals,
1/2x). They were fixed with regression tests, and 0 of 4,087 equivalent fuzz pairs fail afterwards. - A live hint run showed
\timesarriving as a TAB character inside JSON, so a good hint was wrongly rejected. It was fixed with a regression test. - The second evaluating agent showed that the photo fix's gain on tuned-on pages did not carry over to fresh pages, and found three remaining bugs. We report those numbers and list the bugs.
4. How to access and use it, and what it achieves
Rubric: R1, R2, D1-D4, V3
Access. Public repo: https://github.com/Rithwik-P-26/stepcheck. No hosted version, because it runs on the student's own computer by design.
- Needs macOS or Linux, about 8 GB free disk, Ollama and
uv. - Steps:
ollama pull gemma4:12b,uv sync,uv run python -m stepcheck, then openhttp://127.0.0.1:8000. Setup details are inREADME.mdanddocs/SETUP.md. - Mock mode (
STEPCHECK_MOCK=1) shows fixed example reports for looking at the interface only and is labelled "Demo mode". The demo video does not use it.
Main task and success. Photo or typed steps in, then either "correct", or the first wrong step is marked (on the photo too), named, and given a level-1 hint that does not contain the corrected step or the answer. Anything it cannot check must come back as a clear "can't check this" or "I may have misread this line" with a next step, never a guess.
Cases (R2). Cases were picked by a fixed rule (lowest test ids at difficulty 1 and 3), not by outcome. All photo cases are synthetic handwriting.
- Ordinary, typed and photo:
ari-0012(correct) came back "correct" in both. - Ordinary, typed:
ari-0016(mistake at step 2) was flagged at step 2. - Live, on the final code: the README example as a synthetic photo came back
error_foundat the second line,distribution_error, with a model-written hint that passed the guard, in 27 s. This run is in the video. - Repeat: 10 cases run 3 times each. Typed: 10/10 identical every time. Photos on 10 fresh pages: 10/10 gave the same verdict and step on all 3 runs, but only 18 of the 30 runs were right. Consistent is not the same as right.
- Demanding, typed:
ari-0008(negative powers, division, double negatives) was correctly "correct". The model-alone baseline flagged a false error at step 4. - Demanding, photo:
clt-0014__messy(messy handwriting, two variables) was read correctly and passed as correct. Messy is the style where the product most often gives no verdict (10 of 23).
Design choices that save the student effort (D1-D4).
- The verdict comes first: one sentence ("Step 2 is where it goes wrong") and one main button.
- The mistake is shown where it was made: boxed in red on the student's own photo, linked to the same row in the step list.
- Fix a misread line without retaking the photo: "What I read" is editable, and Re-check checks the steps again without re-reading the photo.
- Hints in steps, answer last: only level 3 shows the corrected step.
- One consistent system: same tokens, type and status colours in light and dark, status never shown by colour alone, full keyboard use, checked from 375 to 1440 px.
5. Limits, and what happens when something goes wrong
Rubric: R3, A3, honesty about unfinished work
Failures of different causes, handled safely (R3).
- Bad photo (blurry, too dark, too small, blank, corrupt): "I couldn't read this photo", the reason and how to retake it, with no verdict. 11/11 synthetic bad inputs got exactly the expected code.
- Model not running: the photo path says "The local AI model isn't running" with how to start it and a "Type the steps instead" button. Typed steps still get a full check with a template hint.
- Model gives garbage or leaks the answer in a hint: the verified result is kept, a template hint replaces the model's, and the leak is never shown. 8/8 injected-fault scenarios were handled.
- A line it may have misread: "I may have misread this line", and no step is called wrong until the student checks the line. The flagged line was in fact misread in 10 of 10 gated pages on the fresh split.
- Out of scope (word problems, systems of equations, notes): "Can't check this kind of problem", with the lines kept on screen and editable.
- One line unreadable: the other lines are still checked, and the failed line becomes an empty editable step.
- Math sympy cannot finish: it stops at a 2-second cap and says "couldn't check this step", never "wrong".
Where it still fails.
- Photo accuracy did not improve on fresh pages (74.4% vs 73.3%). The v2 changes mainly turned wrong verdicts into "no verdict".
- Messy handwriting: 10 of 23 messy pages got no verdict.
- Real photos: 2 of 18 right, no verdict on 16 of 18. The model read 13 of 85 lines exactly.
- Three bugs found by the fresh test: (1) an unchecked step that is not the last line could hide a mistake behind "correct". This was patched afterwards (v2.1) and labelled as made after the held-out run. We did not re-run the model for it, so all measured numbers here are for v2. (2) Split fractions and phantom lines caused 3 of the 6 wrong verdicts. (3) Confident digit misreads get past the gate (2 of the 6). Bugs 2 and 3 are not fixed.
- Only the first mistake is diagnosed. It checks that each step follows, not that the problem is finished.
- One machine: all timings and tests are from one Apple Silicon laptop.
- Scope: one- or two-variable algebra only.
Simulated or special conditions. All test pages and the demo photo are synthetic (generated problems, handwriting rendered from fonts). Mock mode is for interface work only, and every result in the video and in the numbers above comes from the real pipeline. All failure-injection tests use a scripted fake model, so the live model's own mistakes are measured in the evaluation instead.
What I would test next. Fixing the three bugs and re-testing on another fresh split, trying whole-page reading as the main reading while keeping per-line boxes, testing on many more real student photos with human-checked labels, and trying a smaller model for 8-16 GB laptops.
Every number above, with its source file, is in docs/EVALUATION.md and evals/results/v2/summary.json in the repo.