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

From Diagrams to Code: Multilingual Programming with Visual Design

Linzheng Chai, Jian Yang, Shukai Liu, Wei Zhang, Liran Wang, Ke Jin, Tao Sun, Congnan Liu, Chenchen Zhang, Hualei Zhu, Jiaheng Liu, Xianjie Wu, Ge Zhang, Tianyu Liu, Zhoujun LiICML 2026

Introduction: The Shift to "Vibe Coding"

In modern software development, the starting point for a project is rarely a blank text file. Instead, developers increasingly rely on "vibe coding"—iterating quickly through visual interactions, whiteboard sketches, UML class diagrams, and logic flowcharts.

While current Large Multimodal Models (LMMs) like GPT-4o showcase impressive capabilities, they are primarily trained on text-heavy data. Consequently, they often treat architectural diagrams as auxiliary hints rather than the primary specification. Compounding this issue, existing code generation benchmarks are almost entirely text-based. This creates a significant gap in the AI ecosystem: we have models that can write code from a paragraph, but they struggle to implement system architectures defined purely by visual diagrams, especially across multiple programming languages.

To bridge this gap, researchers have introduced a comprehensive new ecosystem for visual-first programming: M²C-INSTRUCT (a massive multimodal dataset), M²-CODER (a highly capable 7B parameter model), and M²EVAL (a rigorous benchmark).

Methodology: Building the M² Ecosystem

To train models capable of treating diagrams as the "sole source of truth," the researchers developed a sophisticated two-stage instruction-tuning process, resulting in the M²-CODER model (built on a Qwen2-VL-7B base):

  1. Stage 1: Foundational Alignment. The model is trained on 12.9 million samples to align visual features with code. This includes cross-modal tasks—such as reading code rendered as images to improve OCR capabilities—and basic diagram-to-code translations.
  2. Stage 2: Visual Workflow Fine-tuning. The model is refined on 168,000 high-quality "Visual Workflow" problems. Crucially, the text prompts in these problems are intentionally insufficient. The model must understand the visual logic of the diagram (e.g., a flowchart's routing or a UML's inheritance structure) to generate the correct code.

To ensure the highest data quality, the team utilized a "synthesis-by-verification" approach. They used LLMs to generate Mermaid/PlantUML code from existing problems, rendered them into images, and then had the LLM rewrite the problem text to guarantee the diagram remained the sole source of key logic.

Datasets and Benchmarks

The paper introduces two major open-science contributions to support this methodology:

  • M²C-INSTRUCT: A massive dataset of 13.1 million instruction-answer pairs covering over 50 programming languages and featuring 42.3 million images. It is strategically divided to support both large-scale alignment and complex visual reasoning.
  • M²EVAL: A "gold standard" evaluation benchmark containing 300 human-curated problems across 10 languages (including Python, Java, C++, and JavaScript). Unlike previous benchmarks focused on narrow domains like UI/HTML generation, M²EVAL tests core software engineering concepts such as Design Patterns, Algorithms, and Class Design.

Key Findings and Performance

The evaluation of M²-CODER yielded several striking insights into the current state of multimodal code generation:

  • Diagrams as the "Sole Source of Truth": Text-only models, such as DeepSeek-V3, score 0% on M²EVAL. This validates the benchmark's design, proving that it successfully isolates visual reasoning and prevents models from simply guessing the solution from the text prompt.
  • Small Models, Big Data: The 7B M²-CODER achieved an average Pass@1 score of 25.3% across 10 languages. Remarkably, it matched or outperformed models ten times its size, such as Qwen2-VL-72B (24.7%), and remained competitive in several categories against models like Llama-4-Scout (31.0%). This suggests that for specialized visual programming tasks, high-quality data and task-specific alignment trump raw parameter count.
  • The Importance of Two-Stage Training: Ablation studies showed that skipping Stage 1 (foundational alignment) caused the model's performance to plummet from 25.3% to 18.0%.
  • The "Scripting" Bias and Strict Typing: Models perform significantly better in popular scripting languages (Python, JavaScript, PHP) than in languages like C# or Scala. Furthermore, models struggle with strict typing and visibility rules. Accurately generating Java or C# requires the model to precisely interpret tiny visual symbols (like - for private or + for public) and map them to strict syntax.
  • The Proprietary Gap: Closed-source models still maintain a significant lead. GPT-4o leads the benchmark at 49.7%, closely followed by Gemini-2.5-Flash at 48.7%.

Limitations and Future Work

While M²-CODER represents a massive leap forward for open-source visual programming, the authors identify several hurdles for the next generation of AI software developers:

  1. The 50% Ceiling: Even the most advanced proprietary models (GPT-4o) only solve about half of the M²EVAL problems, indicating that complex, multi-step visual reasoning remains a profound challenge.
  2. Language Imbalance: Performance in languages like Scala and C# lags behind, highlighting the need for more balanced multilingual code corpora in base model training.
  3. Higher-Order Skills: While models excel at basic "Class Design," they struggle with complex "Design Patterns" (e.g., Singleton or Factory patterns) that require a holistic understanding of system architecture.
  4. Resolution and Context Limits: Very large, intricate system diagrams can easily exceed the input resolution or context window of current 7B models, leading to critical lost details.

Reference: Chai, L., et al. (2026). From Diagrams to Code: Multilingual Programming with Visual Design. Proceedings of the 43rd International Conference on Machine Learning (ICML).

Summary updated

BibTeX
@inproceedings{chai2026from,
  author = {Linzheng Chai and Jian Yang and Shukai Liu and Wei Zhang and Liran WANG and Ke Jin and Tao Sun and Congnan Liu and Chenchen Zhang and Hualei Zhu and Jiaheng Liu and Xianjie Wu and Ge Zhang and Tianyu Liu and Zhoujun Li},
  title = {{From Diagrams to Code: Multilingual Programming with Visual Design}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=tkrWQSJEtA},
}
Figure