Inspiration
A student scores 5 out of 5 and the teacher moves on. But many maths errors are not random slips: they are wrong rules, applied consistently, and some of them give the right answer on easy questions. In our own rule bank, 16 of 24 common wrong rules score a perfect 5/5 on an ordinary worksheet. A grade cannot see them, so the student carries the wrong rule into harder work. We wanted a tool that finds the rule itself, not just the wrong answers.
What it does
Misconception MRI diagnoses the wrong rule behind a student's answers in negative numbers and fractions:
- It chooses questions where the possible wrong rules disagree, so every answer narrows the field.
- Before naming a rule, it writes down its prediction of the student's next answers before they are given. A rule is named only after its predictions come true.
- When no known rule fits, Claude Sonnet 5.5 writes the student's rule as Python code. The code runs in a sandbox and must predict answers it was never shown before it can be used.
- When the evidence is not strong enough, it says "no diagnosis" instead of guessing.
A diagnosis comes with the evidence side by side and practice questions where the wrong rule fails.
How we built it
- Python engine: 24 wrong rules across 5 topics, each an executable function, matched to published misconceptions (MaE dataset).
- AI rule-writer with safeguards: hidden answers, a restricted sandbox, checks on every kind of question, a "rival check" that tests small edits of the AI's code, and decision coverage, so every branch of the AI's logic is tried on a real answer before it is trusted.
- Web interface (Flask): watch a scan step by step, or be the student yourself.
- Evaluation: 90 automated tests, simulated students, rules held back from development, stand-in AIs that cheat or fail, and ten live Claude runs, all saved and replayable without an API key.
Challenges we ran into
Our live Claude runs went 20/24, then 22/24, then 23/24 with one wrong diagnosis. A wrong diagnosis is worse than "no diagnosis", so we traced every failure in the raw logs. Claude's rules often fitted every answer shown while differing on cases never asked: a missing condition, or a hidden branch inside a max(). Each fix was general, not a special case: test small edits of the AI's code, make sure every branch of its logic is tried, give AI rules no allowance for careless slips, and repair near-miss rules but only trust them after new predictions come true. The final design scored 24/24 with 0 wrong in two separate live runs, one with a student it had never seen.
What we learned
An AI that writes plausible code is not the same as an AI that is right. The most useful thing the AI can do here is propose; the most important thing the tool does is test. Trust comes from predictions made before the answer, and from being willing to say "I cannot tell".
What's next
Testing with real students and teachers, more topics such as simplifying fractions and decimals, and a classroom view that groups students by misconception.
Code, tests and every live run: https://github.com/marvelprince-bit/misconception-mri
Built With
- anthropic-api
- claude
- css
- flask
- html
- javascript
- python