SGA: A Plug-and-Play Geometric Verification Module for Educational Video Synthesis

This paper addresses spatial occlusion and visual clarity issues arising when large language models generate Manim teaching animations, proposing a plug-and-play Symbolic Geometry Agent (SGA) module. While existing frameworks tend to prioritize educational content over geometric conflicts, SGA intercepts LLM-generated code, performs partial parsing to extract symbolic scene graphs, and applies targeted corrections when spatial conflicts are detected. The study also introduces Manim Visual Quality Score (MVQS), a rendering-free deterministic proxy metric for spatial integrity. Experiments on the MMMC-Code benchmark show that SGA achieves a peak score of 73.11 with the Code2Video + GPT-5.1 configuration, representing a 16.1% relative improvement over the original baseline, and delivers performance gains in 7 out of 8 configurations, significantly enhancing spatial correctness in generated animations.

Background and Context

The synthesis of educational video content has increasingly relied on large language models (LLMs) to automatically generate executable code for libraries such as Manim. This paradigm shift offers a scalable solution for creating dynamic, mathematically precise animations that are essential for STEM education. However, a persistent and critical flaw in current automated frameworks is the neglect of spatial correctness. While existing systems prioritize the logical coherence of the educational narrative, they frequently fail to account for the geometric relationships between visual elements in a two-dimensional plane. This oversight leads to significant visual defects, including object occlusion, layering confusion, and overlapping graphics, which severely degrade the viewer's ability to comprehend the instructional material.

To address this gap, researchers have introduced the Symbolic Geometry Agent (SGA), a plug-and-play module designed specifically to intercept and rectify spatial conflicts without altering the core code generation pipeline. Unlike traditional approaches that might require retraining large models or complex end-to-end learning architectures, SGA operates as an intermediate layer. It functions by capturing the raw code output from the LLM, performing partial parsing to extract symbolic scene graphs, and identifying potential geometric collisions before the code is executed. This proactive intervention strategy allows the system to enhance the spatial logic of the final video output, filling a critical void in geometric verification tools for educational video synthesis.

Deep Analysis

From a technical perspective, the SGA module employs a lightweight and efficient intervention strategy that balances computational cost with accuracy. The process begins with the interception of LLM-generated code, followed by a partial execution phase. This step is crucial as it extracts key geometric objects and their relative positional relationships, constructing a symbolic scene graph that represents the intended visual layout. The system does not rely on heavy rendering engines for this initial assessment; instead, it analyzes the structural definitions of shapes, lines, and text elements to build a mathematical representation of the scene.

When the symbolic scene graph reveals spatial conflicts—such as two distinct graphical elements intersecting on the projection plane where they should not—the SGA triggers a targeted refinement algorithm. This correction mechanism is not based on random adjustments or heuristic guesses. Instead, it applies precise modifications grounded in geometric constraints. The goal is to eliminate occlusions and resolve layering issues while strictly preserving the original pedagogical intent encoded in the script. This ensures that the educational message remains intact while the visual presentation becomes clear and unambiguous.

Furthermore, the study introduces the Manim Visual Quality Score (MVQS), a deterministic proxy metric designed to evaluate spatial integrity without the need for actual video rendering. By parsing the code structure, MVQS infers the likelihood and severity of visual conflicts, offering a rapid and low-cost evaluation method. This metric significantly reduces the computational overhead associated with traditional visual quality assessments, which often require rendering the entire animation sequence. The ability to monitor geometric quality in real-time during the generation process provides a reliable data foundation for automated optimization, allowing the system to self-correct before the final video is produced.

Industry Impact

The implications of the SGA module extend beyond academic research, offering tangible benefits to the educational technology sector and the broader open-source community. For educators and content creators, the ability to automatically generate high-quality, spatially correct animations drastically reduces the production costs and time associated with manual video creation. By lowering the technical barrier to entry, SGA enables teachers and students to access intuitive, visually accurate teaching resources more easily, thereby enhancing the overall learning experience. The plug-and-play nature of the module ensures that it can be easily integrated into existing Manim workflows, promoting wider adoption and standardization in educational content production.

In industrial applications, the lightweight geometric verification method employed by SGA has potential use cases beyond education. It can be adapted for other code-based graphics generation scenarios, such as automated data visualization, interactive dashboard creation, and even game asset generation. The MVQS metric, in particular, offers a novel approach to automated evaluation systems. By shifting the industry standard from subjective visual reviews to objective, quantifiable metrics, SGA and MVQS pave the way for more rigorous quality control in AI-generated visual content. This transition is critical for scaling AI-driven content creation in professional environments where visual clarity and accuracy are paramount.

Outlook

Experimental validation on the MMMC-Code benchmark dataset underscores the robustness and generalizability of the SGA module. The research team conducted extensive tests across four different LLM backends and two distinct agent pipeline configurations. The results demonstrated that SGA consistently improves performance, achieving a peak MVQS score of 73.11 when combined with the Code2Video pipeline and the GPT-5.1 model. This represents a relative improvement of 16.1% over the original baseline. Notably, SGA delivered performance gains in seven out of the eight tested configurations, highlighting its strong adaptability to different model architectures and generation strategies.

Ablation studies further confirmed that the extraction of symbolic scene graphs and the subsequent conflict detection mechanism are the primary drivers of this performance enhancement. The high correlation between the MVQS metric and final visual quality validates the effectiveness of the rendering-free evaluation approach. Looking forward, as LLM capabilities continue to advance, SGA is poised to integrate with more complex geometric reasoning modules. This evolution will enable the creation of more intelligent and adaptive educational content generation systems, capable of handling increasingly complex spatial reasoning tasks. Ultimately, these advancements will provide strong technical support for the development of personalized learning environments, ensuring that AI-generated educational materials are not only abundant but also visually precise and pedagogically effective.

Sources