AI Geometry Problem Generator
Completed: 2025

Today's LLMs are pretty good at generating math problems, but generating diagram-based geometry problems is hard. Generating a solution and programmatically validating that the AI set up everything correctly is even harder, and that's what I set out to do. To achieve this, I built a custom javascript framework that, using relatively few directives, can model constraints-based diagrams and render them with all the required labeling and graphical elements. Then I "taught" an LLM to use this framework and generates complete problems — solutions and hints included. Since LLMs aren't good at arithmetics, it was crucial that problem declaration is entirely parametric — in terms of variables and formulas — allowing the framework to run the actual numbers, validate the solution and even plug in different numbers to generate variations of the problem type.
Examples
These were generated by LLM models, sometimes at first try, others after a followup. The underlying code that the LLM generated is shown next to each example, and can even be edited.