EMNLP 2026 · arXiv 2607.18116

Symbolic Geometric Agent Plug-and-play geometric verification for detecting and correcting spatial overlaps in LLM-generated Manim animation code.

1 Universidad Industrial de Santander, Bucaramanga, Colombia 2 KAUST, Thuwal, Saudi Arabia
scene_graph.py — live AABB check
no overlap detected
Each scene is random, with a few collisions built in. Drag objects around, or let SGA fix them.

    

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.

01 — Abstract

Rendering-free spatial verification

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%.

Overview: existing agents ignore spatial constraints or rely on costly VLM feedback; SGA adds a deterministic spatial reasoning layer
Fig. 1Current agents produce code that runs but renders occluded frames. TheoremExplainAgent ignores spatial constraints, and Code2Video depends on slow, stochastic VLM feedback. SGA extracts a symbolic scene graph and fixes conflicts before rendering.
02 — Method

Four-stage symbolic pipeline

SGA sits between code generation and rendering. It never touches pixels — every check runs on a symbolic scene graph extracted by partial execution.

SGA architecture: partial execution, conflict detection, targeted LLM refinement and MVQS evaluation
Fig. 2SGA intercepts LLM-generated code, extracts a symbolic scene graph by partial execution, detects conflicts with deterministic AABB analysis, and triggers template-based refinement only when needed. It plugs into TheoremExplainAgent as a spatial guardrail and replaces the VLM critic in Code2Video.
STAGE 01

Extract

Partially executes the generated construct() to recover a symbolic scene graph — objects, positions, dimensions, and updater state.

STAGE 02

Analyze

Computes canvas bounds and pairwise bounding-box overlaps, exempting object types where geometric overlap is expected (axes, arrows, braces).

STAGE 03

Format

Converts detected conflicts into a compact, LLM-readable diagnostic — precise coordinates, not natural-language description.

STAGE 04

Fix

Prompts a targeted repair using absolute .move_to() coordinates, verified against a stub / shrinkage-ratio check before acceptance.

MVQS = 0.5·Ssp + 0.2·Sly + 0.3·Sed
S_sp — spatial overlap: penalizes geometric occlusion between objects
S_ly — layout: penalizes objects falling outside the visible canvas
S_ed — edit distance: penalizes unnecessary deviation from the original code
03 — Results

MMMC-Code benchmark

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).

73.11
Peak MVQS — Code2Video + GPT-5.1
+16.1%
Relative improvement over raw baseline
7 / 8
Backbone × pipeline configurations improved
BackboneTheoremExplainAgent · MVQS ↑Code2Video · MVQS ↑
Raw+VLM Critic+SGARaw+VLM Critic+SGA
GPT-5.158.7461.5859.8162.9764.5473.11
GPT-5 mini59.5363.7363.4763.6863.5166.42
Claude 4.6 Sonnet63.8462.4162.8363.2765.1565.87
Gemini 3.0 Flash63.6762.3467.1467.8269.0971.86

MVQS on the 117 topics of MMMC-Code. Best per backbone and pipeline highlighted. Full per-component scores (Ssp, Sly, Sed) and VLM-Judge aesthetics are in the paper.

Scatter plots of MVQS versus VLM-Judge scores across 24 configurations
Fig. 3Perceptual vs. symbolic evaluation across 24 configurations. MVQS spreads over 14.4 points while VLM-Judge scores span only 10.5, so VLM judges barely notice geometric errors (left). Educational sub-scores agree more closely (right).

Frame head-to-head win rate (25 raters, overlap + canvas pooled)

SGA vs Raw
SGA 84.4%
SGA vs VLM Critic
SGA 65.0%
Raw vs VLM Critic
30.0%
VLM 44.4%

n = 90, 60, 90 pairwise ratings respectively. Remaining share is ties. Krippendorff's α = 0.407 (fair-to-moderate agreement, 95% CI [0.287, 0.606]).

Video head-to-head win rate (readability + clarity pooled, n = 192 per pair)

SGA vs Raw
SGA 37.0%
11.5%
SGA vs VLM Critic
SGA 55.2%
17.7%
Raw vs VLM Critic
45.8%
31.2%

Video-level agreement is weaker (α = 0.208) — expected, since full-clip judgments pool many more confounds than a single frame. Ties dominate the SGA-vs-Raw pair (51.6%), consistent with SGA editing only the subset of frames that actually need it.

3-way overall video preference (pooled across 6 held-out trials, 96 votes)

SGA
38.5%
VLM Critic
26.0%
Raw
24.0%
No preference
11.5%

Case study — declining a false-positive overlap (t4 / t5)

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.

TrialMeasureRawSGAVLM Critic
t4Readability5.915.823.82
t4Clarity5.095.183.73
t5Readability6.096.273.64
t5Clarity5.826.093.27

Raw ≈ SGA on both trials (SGA declines to modify); VLM Critic drops sharply on every measure by intervening where it shouldn't.

05 — Videos

Video comparisons

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.

06 — Human Study Frames

Frame comparisons

Two representative frames from the paired human evaluation, contrasting a raw-vs-SGA correction and an SGA-vs-VLM-Critic comparison.

Raw output vs. SGA correction f1

Raw LLM output
Raw LLM-generated frame with a geometric overlap
SGA (ours)
Same frame after SGA's symbolic correction

SGA vs. VLM Critic f7

SGA (ours)
Frame corrected by SGA
VLM Critic
Same frame corrected by the VLM-critic baseline
07 — Cite

BibTeX

@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}
}