This demo mirrors SGA's actual pipeline: axis-aligned bounding-box intersection over the symbolic scene graph (Extract → Analyze), then targeted .move_to() repairs (Fix), all before any frame is rendered. Coordinates in the log are in Manim scene units.
Recent work leverages Large Language Models (LLMs) to generate executable code for pedagogical animations using libraries such as Manim. However, ensuring spatial correctness and visual legibility remains challenging, as existing frameworks emphasize pedagogical content while overlooking geometric occlusions. We propose the Symbolic Geometric Agent (SGA), a plug-and-play module for code-centric animation pipelines that intercepts LLM-generated code, performs partial execution to extract symbolic scene graphs, and applies targeted refinement when spatial conflicts are detected. We further introduce the Manim Visual Quality Score (MVQS), a deterministic rendering-free proxy for spatial integrity. Experiments on the MMMC-Code benchmark across four LLM backbones and two agentic pipelines show that SGA achieves a peak MVQS of 73.11 (Code2Video + GPT-5.1), a 16.1% relative improvement over the raw baseline, and improves MVQS in 7 of 8 backbone × pipeline configurations. In a human evaluation, raters preferred SGA over the raw baseline in 84.4% of comparisons and over a VLM-based critic in 65.0%.
SGA sits between code generation and rendering. It never touches pixels — every check runs on a symbolic scene graph extracted by partial execution.
Partially executes the generated construct() to recover a symbolic scene graph — objects, positions, dimensions, and updater state.
Computes canvas bounds and pairwise bounding-box overlaps, exempting object types where geometric overlap is expected (axes, arrows, braces).
Converts detected conflicts into a compact, LLM-readable diagnostic — precise coordinates, not natural-language description.
Prompts a targeted repair using absolute .move_to() coordinates, verified against a stub / shrinkage-ratio check before acceptance.
Evaluated across four LLM backbones (GPT-5.1, GPT-5 mini, Claude 4.6 Sonnet, Gemini 3.0 Flash) and two agentic pipelines (TheoremExplainAgent, Code2Video).
| Backbone | TheoremExplainAgent · MVQS ↑ | Code2Video · MVQS ↑ | ||||
|---|---|---|---|---|---|---|
| Raw | +VLM Critic | +SGA | Raw | +VLM Critic | +SGA | |
| GPT-5.1 | 58.74 | 61.58 | 59.81 | 62.97 | 64.54 | 73.11 |
| GPT-5 mini | 59.53 | 63.73 | 63.47 | 63.68 | 63.51 | 66.42 |
| Claude 4.6 Sonnet | 63.84 | 62.41 | 62.83 | 63.27 | 65.15 | 65.87 |
| Gemini 3.0 Flash | 63.67 | 62.34 | 67.14 | 67.82 | 69.09 | 71.86 |
t4 and t5 are trials designed so the "overlap" is not actually a spatial conflict. SGA correctly recognizes this and leaves the scene untouched; VLM Critic over-corrects anyway.
| Trial | Measure | Raw | SGA | VLM Critic |
|---|---|---|---|---|
| t4 | Readability | 5.91 | 5.82 | 3.82 |
| t4 | Clarity | 5.09 | 5.18 | 3.73 |
| t5 | Readability | 6.09 | 6.27 | 3.64 |
| t5 | Clarity | 5.82 | 6.09 | 3.27 |
Frames from both pipelines. Raw output has label–equation collisions. The VLM critic often regresses, pushing objects off-canvas or dropping elements. SGA resolves the conflicts and keeps the math and geometry intact.
Two example trials from the full 6-trial human evaluation study, rendered under three conditions: the raw LLM output, SGA's symbolic correction, and a VLM-critic baseline.
Two representative frames from the paired human evaluation, contrasting a raw-vs-SGA correction and an SGA-vs-VLM-Critic comparison.
@inproceedings{lopez2026sga, title = {SGA: Plug{\&}Play Geometric Verification for Educational Video Synthesis}, author = {Lopez, Jhon and Hinojosa, Carlos and Ghanem, Bernard}, booktitle = {Proceedings of the 2026 Conference on Empirical Methods in Natural Language Processing (EMNLP)}, year = {2026}, eprint = {2607.18116}, archivePrefix = {arXiv} }