ALGOGEN: Tool-Generated Verifiable Traces for Reliable Algorithm Visualization

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Liao, Kunpeng, Ma, Yuexiao, Lin, Yisheng, Zeng, Hualin, Zheng, Xiawu, Ji, Rongrong
Format: Preprint
Published: 2026
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866917486488715264
author Liao, Kunpeng
Ma, Yuexiao
Lin, Yisheng
Zeng, Hualin
Zheng, Xiawu
Ji, Rongrong
author_facet Liao, Kunpeng
Ma, Yuexiao
Lin, Yisheng
Zeng, Hualin
Zheng, Xiawu
Ji, Rongrong
contents Algorithm Visualization (AV) helps students build mental models by animating algorithm execution states. Recent LLM-based systems such as CODE2VIDEO generate AV videos in an end-to-end manner. However, this paradigm requires the system to simultaneously simulate algorithm flow and satisfy video rendering constraints, such as element layout and color schemes. This complex task induces LLM hallucinations, resulting in reduced execution success rates, element overlap, and inter-frame inconsistencies. To address these challenges, we propose ALGOGEN, a novel paradigm that decouples algorithm execution from rendering. We first introduce Visualization Trace Algebra (VTA), a monoid over algorithm visual states and operations. The LLM then generates a Python tracker that simulates algorithm flow and outputs VTA-JSON traces, a JSON encoding of VTA. For rendering, we define a Rendering Style Language (RSL) to templatize algorithm layouts. A deterministic renderer then compiles algorithm traces with RSL into Manim, LaTeX/TikZ, or Three.js outputs. Evaluated on a LeetCode AV benchmark of 200 tasks, ALGOGEN achieves an average success rate improvement of 17.3% compared to end-to-end methods, with 99.8% versus 82.5%. These results demonstrate that our decoupling paradigm effectively mitigates LLM hallucinations in complex AV tasks, providing a more reliable solution for automated generation of high-quality algorithm visualizations. Demo videos and code are available in the project repository.
format Preprint
id arxiv_https___arxiv_org_abs_2605_12159
institution arXiv
publishDate 2026
record_format arxiv
spellingShingle ALGOGEN: Tool-Generated Verifiable Traces for Reliable Algorithm Visualization
Liao, Kunpeng
Ma, Yuexiao
Lin, Yisheng
Zeng, Hualin
Zheng, Xiawu
Ji, Rongrong
Artificial Intelligence
Graphics
Algorithm Visualization (AV) helps students build mental models by animating algorithm execution states. Recent LLM-based systems such as CODE2VIDEO generate AV videos in an end-to-end manner. However, this paradigm requires the system to simultaneously simulate algorithm flow and satisfy video rendering constraints, such as element layout and color schemes. This complex task induces LLM hallucinations, resulting in reduced execution success rates, element overlap, and inter-frame inconsistencies. To address these challenges, we propose ALGOGEN, a novel paradigm that decouples algorithm execution from rendering. We first introduce Visualization Trace Algebra (VTA), a monoid over algorithm visual states and operations. The LLM then generates a Python tracker that simulates algorithm flow and outputs VTA-JSON traces, a JSON encoding of VTA. For rendering, we define a Rendering Style Language (RSL) to templatize algorithm layouts. A deterministic renderer then compiles algorithm traces with RSL into Manim, LaTeX/TikZ, or Three.js outputs. Evaluated on a LeetCode AV benchmark of 200 tasks, ALGOGEN achieves an average success rate improvement of 17.3% compared to end-to-end methods, with 99.8% versus 82.5%. These results demonstrate that our decoupling paradigm effectively mitigates LLM hallucinations in complex AV tasks, providing a more reliable solution for automated generation of high-quality algorithm visualizations. Demo videos and code are available in the project repository.
title ALGOGEN: Tool-Generated Verifiable Traces for Reliable Algorithm Visualization
topic Artificial Intelligence
Graphics
url https://arxiv.org/abs/2605.12159