Math2Visual-X: A Modular Framework for Pedagogically Aligned Lower-Primary Math Visuals Generation
Organizations: Dept. of Computer Science & Engineering, University of Moratuwa, Sri Lanka · School of Mathematical and Computational Sciences, Massey University, Auckland, New Zealand
Abstract
Visual representations can help lower-primary learners understand Math Word Problems, but generating classroom-usable visuals remains difficult. Existing symbolic systems are controllable but limited in coverage, while end-to-end text-to-image systems often fail to satisfy exact mathematical constraints. This paper presents a symbolic visual generation framework for lower-primary MWP generation with broader problem coverage and more scalable asset generation. The framework includes an LLM-based routing layer, three worksheet-oriented generation modules, and two fallback mechanisms for open-world SVG asset acquisition. A human evaluation comparing Math2Visual-X with Stable Diffusion XL, Nano Banana, and GPT Image showed that the proposed method achieved the strongest overall performance. The results indicate that the framework offers a scalable and pedagogically grounded approach for automatic MWP visual generation.
Figures & tables
| Row | Arithmetic Visual Generation | Pattern Visual Generation | Object Counting Visual Generation | Object Attribute Comparison Generation |
| Description | Captures entities and operations as an operation tree. The renderer translates this into a layout with operator symbols and grouping cues, compacting crowded scenes while preserving explicit arithmetic structure. | Converts prompts into sequence payloads defining repetition behaviors. To aid repetition rule inference, the renderer enforces strict consistency in motif size, alignment, and spacing within a single-row layout. | Transforms prompts into categorical counts, rendered as bounded, mixed-object scenes. Grid layouts prevent overlap for large quantities while intentionally avoiding accidental grouping cues that disrupt direct enumeration. | Extracts target attributes and relative scales to create highly contrastive layouts. It emphasizes relevant spatial dimensions (e.g., shared baselines for height) while minimizing distractions to ensure unambiguous perceptual judgments. |
| Prompt | Janet has nine oranges, and Sharon has seven oranges. How many oranges do Janet and Sharon have together? | Generate a pattern of ball and apple. Repeat 2 times. Use 2 answer line. Title: “Look at the pattern below and fill in the blanks.” | Generate an image of ten apples and take “Count the items.” as the title. | Circle the smallest dolphin among the following 4 dolphins with measurements 47, 85, 63, 25. |
| Image |
| Criterion | 1 – Very Poor | 2 – Poor | 3 – Fair | 4 – Good | 5 – Excellent |
|---|---|---|---|---|---|
| Accuracy | The visual has no recognizable correspondence to the mathematical facts of the problem. Quantities and relationships are absent or completely wrong. | Multiple key quantities or relationships are incorrect. The visual fundamentally misrepresents the mathematical structure of the problem. | An inaccuracy is present (e.g., a core quantity is wrong). The mathematical relationship is present but represented incorrectly. | A minor inaccuracy is present that does not hinder problem-solving, or a non-critical quantity is wrong. | All quantities, entities, and mathematical relationships are represented perfectly, with no errors. |
| Completeness | The visual is effectively empty or misses almost all essential elements, making it useless for solving the problem. | Multiple essential elements are missing. The visual only shows a fraction of the problem. | A key element is missing or an attribute is wrong, making the problem difficult to solve using the visual alone. | One minor, non-essential element is missing or implied rather than shown. Solvable. | Contains all essential elements. Every entity, quantity, and relationship from the text is explicitly visualized. |
| Clarity | The visual is incomprehensible, abstract, or fails to render a coherent scene. Impossible to interpret. | The visual is highly ambiguous. It is difficult to tell what the entities are or how they relate. | The visual is confusing. Entities are muddled, overlap, or are hard to count. Layout is disorganized. | The visual is mostly clear, but may require a moment of study to interpret. | The visual is immediately and unambiguously understandable. Entities are distinct and well organized. |
| Cognitive Load | The visual is overwhelmingly cluttered. Focus is entirely on irrelevant or nonsensical details, obscuring the problem. | Visual is cluttered with irrelevant details, making it difficult to find essential information. | Contains distracting elements that draw attention away from the problem core components. | Includes minor decorative elements that do not contribute to the solution but are not distracting. | The visual is clean and focused. Includes only elements necessary to solve the problem. |
| Model | Acc. | Comp. | Clar. | Cog. | Overall |
|---|---|---|---|---|---|
| SDXL | 1.08 | 1.12 | 1.31 | 1.26 | 1.19 |
| Gemini | 3.74 | 3.85 | 3.97 | 3.87 | 3.86 |
| GPT | 3.50 | 3.63 | 3.96 | 3.87 | 3.74 |
| Framework | 4.82 | 4.79 | 4.82 | 4.87 | 4.82 |
| Category | llama3.1:8b | gpt-oss:20b | ||
|---|---|---|---|---|
| % Prompt 1 | % Prompt 2 | % Prompt 1 | % Prompt 2 | |
| OBJECT_ATTRIBUTES | 93.69 | 100.00 | 100.00 | 99.03 |
| PATTERN_RECOGNITION | 100.00 | 99.61 | 100.00 | 100.00 |
| OBJECT_COUNTING | 96.52 | 99.52 | 100.00 | 100.00 |
| ADDITION | 87.93 | 100.00 | 99.03 | 98.08 |
| SUBTRACTION | 81.97 | 100.00 | 100.00 | 100.00 |
| Model | Pattern Rec. | Object Co. | Attr. Comp. |
|---|---|---|---|
| gemma:7b | 64.10% | 67.90% | 92.60% |
| gpt-oss:20b | 96.30% | 94.50% | 94.30% |
| llama3.1:8b | 84.30% | 91.80% | 31.40% |
| llava:13b | 67.70% | 88.90% | 63.10% |
| Metric | Approach A | Approach B |
|---|---|---|
| CLIP (mean) | 0.3171 | 0.3112 |
| ImageReward (mean) | 0.6974 | 0.9665 |
| TIFA (macro average) | 0.6440 | 0.7170 |