ManimCode: Learning Visual Self-Correction for Educational Animation
Zhengyang Liang, Lizi Liao
Abstract
Manim supports precise, programmatic video generation, but a successfully rendered educational animation can still have visual defects, missing explanations, or incorrect content. Rendering does not directly identify the code changes needed to correct these visual failures, so feedback-driven revision is needed. Existing agentic frameworks use iterative rendering and revision but typically rely on large models, often proprietary. Existing Manim datasets primarily contain final programs and often lack quality verification and the trajectories of feedback and revisions needed to learn this refinement process. We introduce ManimData and ManimCode, a data and training framework for feedback-driven educational animation generation. We construct ManimData through a render-guided pipeline that iteratively generates, executes, reviews, and revises Manim programs with retrieved API documentation. Its 24,034 render-verified, quality-filtered records preserve intermediate programs, execution errors, visual critiques, and corrective revisions. We use role-conditioned supervised fine-tuning on these trajectories to train ManimCode, a single 4B model, to write, review, and revise animation programs. To improve correction of errors that differ from those in the collected trajectories, we then train the Reviser with reinforcement learning on self-generated states, using rendering outcomes and reference-free quality feedback. ManimCode achieves 96.6% and 97.0% render success on ManimData-test and ManimBench, compared with 52.6% and 82.0% for the untrained 4B model under the same inference setup, while also improving video quality scores from 2.48 to 2.94 and from 3.00 to 3.44. Integrating ManimCode into two long-form educational video generation systems increases completed videos from 19/117 to 107/117 and from 53/239 to 239/239, alongside improvements in educational effectiveness and visual quality.
Create a lesson
Related papers
4D Point Splatting for mmWave Radar Micro-Doppler Differentiable Rendering
Adnan Armouti, Guanyue Qian, Rajalakshmi Nandakumar
InstantHand: Feed-Forward 3D Gaussian Splatting for Animatable Hand Avatar Reconstruction from a Single Image
Chanho Kim, Muhammad Salman Ali, Kyeonghwan Gwak et al.
Hierarchical Incremental Beta Splatting for Online Reconstruction
Linus Franke
Interactive Visual Gym: Evaluating Visual Interaction Models with Simulated Users in Interactive Worlds
Chenhao Zheng, Zixian Ma, Kai Li et al.
DART: Domain-Agnostic Residual Transfer for Generalist Anomaly Detection
Muhammad Aqeel, Maham Nazir, Marco Cristani et al.
SplatAnything: Gaussian Spacing Normalization for Feed-forward 3DGS across Arbitrary Scenes
Hao Yu, Zhenwei Wang, Yongzhen Hu et al.