Introduction
The integration of Multimodal Large Language Models (MLLMs) into educational technology promises to revolutionize content creation. However, generating high-quality mathematical questions remains a significant challenge. While models like GPT-4o excel at textual reasoning, they frequently struggle with "drawing"—producing diagrams that are spatially inconsistent or mathematically inaccurate. MAGMA-Edu addresses this by introducing a multi-agent framework that ensures precise alignment between text and diagrams through a programmatic, self-reflective pipeline.
The Challenge of Multimodal Educational Content
Standard MLLMs often suffer from "hallucinations" when generating geometric figures. For instance, a model might describe a right triangle in text but generate an image with mislabeled vertices or incorrect proportions. In a pedagogical context, these discrepancies are more than just errors; they undermine the student's ability to solve the problem. The core issue lies in the lack of semantic alignment and the inherent unreliability of single-pass image generation.
The MAGMA-Edu Framework
MAGMA-Edu moves away from "black-box" image generation, instead treating question creation as a verifiable, multi-stage process. The framework employs a "Generate–Validate–Reflect" cycle across two primary stages:
Stage 1: Text Generation and Refinement
In this stage, three specialized agents—Generator, Validator, and Reflector—work iteratively. The Generator produces the initial question text and a detailed description of the required visual. The Validator checks for mathematical accuracy, and the Reflector provides feedback for revisions. This loop continues until the text is pedagogically sound.
Stage 2: Programmatic Diagram Synthesis
Rather than generating pixels directly, MAGMA-Edu generates executable code (e.g., Python Matplotlib or TikZ). This ensures that geometric constraints are mathematically guaranteed by a rendering engine. An Image Validator then uses OCR and multimodal reasoning to confirm that the rendered image perfectly matches the verified text.
Evaluation and Results
The framework was evaluated using a new Multimodal K-12 Mathematics Dataset covering 78 knowledge points across geometry, trigonometry, and functions. The results demonstrate a dramatic improvement in Image-Text Consistency (ITC). While the GPT-4o baseline achieved an ITC score of only 13.20%, MAGMA-Edu boosted this to 85.24%. When powered by Gemini 2.5 Pro, the framework reached a state-of-the-art ITC of 99.12%.
Conclusion
MAGMA-Edu demonstrates that using code as an intermediate representation effectively bridges the gap between symbolic reasoning and visual perception. By structuring the generation process as a multi-agent conversation, the framework provides a robust solution for creating reliable, high-quality educational materials. Future work will focus on expanding this approach to other STEM fields such as physics and chemistry.
Summary updated