NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Flow2Code: Evaluating Large Language Models for Flowchart-based Code Generation Capability

Mengliang He, Jiayi Zeng, Yankai Jiang, Wei Zhang, Zeming Liu, Xiaoming Shi, Aimin Zhou

Abstract

While Large Language Models (LLMs) have demonstrated exceptional proficiency in generating code from textual descriptions, their ability to interpret visual logic remains a critical frontier. This paper introduces Flow2Code, a comprehensive benchmark designed to evaluate multimodal Large Language Models (MLLMs) on their capacity to translate visual flowcharts into executable code. Spanning 15 programming languages and three distinct flowchart styles, the benchmark reveals a significant "visual gap" in current models. While top-tier models like Gemini-2.0 lead the field, the study demonstrates that specialized supervised fine-tuning (SFT) can provide a massive performance boost, suggesting that current models possess the latent reasoning capabilities but lack specific alignment for visual-to-logic tasks.

Introduction

In the realm of software engineering, flowcharts serve as a fundamental bridge between abstract architectural design and concrete implementation. They provide a standardized visual language for representing program logic, decision paths, and iterative loops. Despite the rapid advancement of LLMs in coding benchmarks like HumanEval and MBPP, these evaluations are primarily text-centric. To truly participate in the full lifecycle of software development—from design to deployment—AI models must be able to "read" and interpret these visual representations.

Existing multimodal benchmarks have explored interpreting mathematical problems or statistical plots, but the specific pipeline of flowchart-to-code has remained largely unaddressed. Flow2Code fills this gap by providing a rigorous framework to measure how well MLLMs can bridge the divide between visual spatial reasoning and algorithmic syntax.

The Flow2Code Benchmark

Dataset Construction

The researchers developed an automated, high-fidelity pipeline to generate the Flow2Code dataset, ensuring both diversity and technical accuracy:

  1. Source Selection: 5,622 code segments were curated from established benchmarks, including HumanEval-X and MBXP.
  2. Flowchart Generation: Using the Visustin tool, code was converted into DOT code (a graph description language) to generate three distinct flowchart styles: Basic Code, UML, and Pseudocode.
  3. Semantic Transformation: To test higher-level reasoning, GPT-4o was utilized to transform raw code labels within the DOT files into natural language pseudocode.
  4. Validation: To maintain data integrity, the researchers implemented a "Gemini-2.0 check" to validate GPT-4o’s transformations, followed by a double-blind human review conducted by five computer science graduate students.

Scope and Diversity

The resulting benchmark is one of the most diverse in the field, featuring:

  • 16,866 flowcharts paired with 5,622 code segments.
  • 15 Programming Languages: A broad spectrum including Python, Java, C++, C#, JavaScript, PHP, Ruby, and legacy/specialized languages like Fortran and HTML.
  • Three Representation Styles: Code Flowcharts (direct execution steps), UML Flowcharts (formal graphical structure), and Pseudocode Flowcharts (high-level abstractions).

Experimental Results and Insights

The "Visual Gap"

A primary finding of the study is that even state-of-the-art models perform significantly worse when presented with a flowchart compared to an equivalent textual description. This suggests that visual-to-logic reasoning is a distinct cognitive skill that is not automatically acquired through standard text-based code training.

Model Performance Rankings

  • Gemini-2.0 Dominance: Gemini-2.0 emerged as the top performer, maintaining a consistent lead across all tasks and languages. It outperformed the next best model, GPT-4o, by an average of 4.78% in pass rates, indicating superior spatial-logical reasoning.
  • Scaling Effects: Larger models showed systematic improvements. For instance, the 78B version of Intern-VL2.5 outperformed its 8B counterpart by 75.1% in UML-based tasks, suggesting that model capacity is a strong predictor of visual reasoning success.
  • Language Sensitivity: Models showed the highest proficiency in PHP, Python, and Ruby. Conversely, performance dropped by as much as 65% for markup or legacy languages like HTML and Fortran, likely due to the scarcity of visual-logic training data for these formats.

The Difficulty of Pseudocode

Among the three flowchart styles, Pseudocode Flowcharts proved to be the most challenging, resulting in a ~10.6% performance drop compared to basic code flowcharts. This difficulty stems from the requirement that the model must map high-level natural language concepts back to specific, syntactically correct code, adding a layer of semantic translation to the visual reasoning task.

The Impact of Supervised Fine-Tuning (SFT)

One of the most striking results was the impact of targeted training. By performing Supervised Fine-Tuning on a small subset of flowchart data, the Qwen2-VL-7B model saw a staggering 103.8% performance boost. This suggests that current MLLMs already possess the underlying "intelligence" required for these tasks but require specific alignment to understand the syntax and conventions of flowchart imagery.

Conclusion and Future Work

Flow2Code establishes a new standard for evaluating the intersection of computer vision and software engineering. While current top-tier models like Gemini-2.0 show promise, the benchmark highlights a significant need for better visual-logic integration in AI training.

Future research directions include:

  • Complexity Scaling: Moving beyond short code snippets to enterprise-level architecture flowcharts.
  • Maintenance Tasks: Evaluating the ability of MLLMs to perform debugging or refactoring based on visual logic updates.
  • Interactive Design: Exploring how these models can assist human developers in real-time during the design phase by generating boilerplate or logic checks directly from whiteboard sketches.

By bridging the gap between visual design and code implementation, Flow2Code paves the way for AI agents that can participate more fully in the creative and architectural phases of software development.

Summary updated

BibTeX
@inproceedings{he2025flow,
  author = {Mengliang He and Jiayi Zeng and Yankai Jiang and Wei Zhang and Zeming Liu and Xiaoming Shi and Aimin Zhou},
  title = {{Flow2Code: Evaluating Large Language Models for Flowchart-based Code Generation Capability}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2025},
}
Figure