Proceedings

SketchAgent: Generating Structured Diagrams from Hand-Drawn Sketches

Download BibTeX Cite

Proceedings of the Thirty-Fourth International Joint Conference on Artificial Intelligence. Main Track. Pages 1918-1926.

https://doi.org/10.24963/ijcai.2025/214

Abstract

Hand-drawn sketches are a natural and efficient medium for capturing and conveying ideas. Despite significant advancements in controllable natural image generation, translating freehand sketches into structured, machine-readable diagrams remains a labor-intensive and predominantly manual task. The primary challenge stems from the inherent ambiguity of sketches, which lack the structural constraints and semantic precision required for automated diagram generation. To address this challenge, we introduce SketchAgent, a multi-agent system designed to automate the transformation of hand-drawn sketches into structured diagrams. SketchAgent integrates sketch recognition, symbolic reasoning, and iterative validation to produce semantically coherent and structurally accurate diagrams, significantly reducing the need for manual effort. To evaluate the effectiveness of our approach, we propose the Sketch2Diagram Benchmark, a comprehensive dataset and evaluation framework encompassing eight diverse diagram categories, such as flowcharts, directed graphs, and model architectures. The dataset comprises over 6,000 high-quality examples with token-level annotations, standardized preprocessing, and rigorous quality control. By streamlining the diagram generation process, SketchAgent holds great promise for applications in design, education, and engineering, while offering a significant step toward bridging the gap between intuitive sketching and machine-readable diagram generation.

  1. [Abdin et al., 2024] Marah Abdin, Jyoti Aneja, Hany Awadalla, Ahmed Awadallah, Ammar Ahmad Awan, Nguyen Bach, Amit Bahree, Arash Bakhtiari, Jianmin Bao, Harkirat Behl, et al. Phi-3 technical report: A highly capable language model locally on your phone. arXiv preprint arXiv:2404.14219, 2024.
  2. [Achiam et al., 2023] Josh Achiam, Steven Adler, Sandhini Agarwal, Lama Ahmad, Ilge Akkaya, Florencia Leoni Aleman, Diogo Almeida, Janko Altenschmidt, Sam Alt- man, Shyamal Anadkat, et al. Gpt-4 technical report. arXiv preprint arXiv:2303.08774, 2023.
  3. [AI, 2025a] Meta AI. Llama 3.1: A state-of-the-art large lan- guage model, 2025.
  4. [AI, 2025b] Meta AI. Llama-3.2-11b-vision-instruct: A multimodal instruction-tuned model, 2025.
  5. [Almazroi et al., 2021] Abdulwahab Ali Almazroi, Laith Abualigah, Mohammed A Alqarni, Essam H Houssein, Ahmad Qasim Mohammad AlHamad, and Mohamed Abd Elaziz. Class diagram generation from text requirements: An application of natural language processing. Deep Learning Approaches for Spoken and Natural Language Processing, pages 55-79, 2021.
  6. [Arar et al., 2024] Moab Arar, Andrey Voynov, Amir Hertz, Omri Avrahami, Shlomi Fruchter, Yael Pritch, Daniel Cohen-Or, and Ariel Shamir. Palp: prompt aligned person- alization of text-to-image models. In SIGGRAPH, pages 1-11, 2024.
  7. [Bar-Tal et al., 2023] Omer Bar-Tal, Lior Yariv, Yaron Lip- man, and Tali Dekel. Multidiffusion: Fusing diffusion paths for controlled image generation. ICLR, 2023.
  8. [Cai et al., 2024] Zheng Cai, Maosong Cao, Haojiong Chen, Kai Chen, Keyu Chen, Xin Chen, Xun Chen, Zehui Chen, Zhi Chen, Pei Chu, et al. Internlm2 technical report. arXiv preprint arXiv:2403.17297, 2024.
  9. [Cao et al., 2024] Pu Cao, Feng Zhou, Qing Song, and Lu Yang. Controllable generation with text-to- image diffusion models: A survey. arXiv preprint arXiv:2403.04279, 2024.
  10. [Chen et al., 2022] Bei Chen, Fengji Zhang, Anh Nguyen, Daoguang Zan, Zeqi Lin, Jian-Guang Lou, and Weizhu Chen. Codet: Code generation with generated tests. arXiv preprint arXiv:2207.10397, 2022.
  11. [Epstein et al., 2023] Dave Epstein, Allan Jabri, Ben Poole, Alexei Efros, and Aleksander Holynski. Diffusion self- guidance for controllable image generation. NeurIPS, 36:16222-16239, 2023.
  12. [Ghosh et al., 2018] Sutirtha Ghosh, Prasenjit Mukherjee, Baisakhi Chakraborty, and Rezaul Bashar. Automated generation of er diagram from a given text in natural lan- guage. In iCMLDE, pages 91-96. IEEE, 2018.
  13. [Guo et al., 2024] Daya Guo, Qihao Zhu, Dejian Yang, Zhenda Xie, Kai Dong, Wentao Zhang, Guanting Chen, Xiao Bi, Yu Wu, YK Li, et al. Deepseek-coder: When the large language model meets programming-the rise of code intelligence. arXiv preprint arXiv:2401.14196, 2024.
  14. [Hong et al., 2024] Wenyi Hong, Weihan Wang, Ming Ding, Wenmeng Yu, Qingsong Lv, Yan Wang, Yean Cheng, Shiyu Huang, Junhui Ji, Zhao Xue, et al. Cogvlm2: Vi- sual language models for image and video understanding. arXiv preprint arXiv:2408.16500, 2024.
  15. [Huang et al., 2024] Shanshan Huang, Qingsong Li, Jun Liao, Shu Wang, Li Liu, and Lian Li. Controllable image synthesis methods, applications and challenges: a compre- hensive survey. Artificial Intelligence Review, 57(12):336, 2024.
  16. [Hui et al., 2024] Binyuan Hui, Jian Yang, Zeyu Cui, Jiaxi Yang, Dayiheng Liu, Lei Zhang, Tianyu Liu, Jiajun Zhang, Bowen Yu, Keming Lu, et al. Qwen2. 5-coder technical report. arXiv preprint arXiv:2409.12186, 2024.
  17. [Jiang et al., 2024] Xue Jiang, Yihong Dong, Lecheng Wang, Zheng Fang, Qiwei Shang, Ge Li, Zhi Jin, and Wen- pin Jiao. Self-planning code generation with large lan- guage models. TOSEM, 33(7):1-30, 2024.
  18. [Le et al., 2022] Hung Le, Yue Wang, Akhilesh Deepak Got- mare, Silvio Savarese, and Steven Chu Hong Hoi. Coderl: Mastering code generation through pretrained models and deep reinforcement learning. NeurIPS, 35:21314-21328, 2022.
  19. [Li et al., 2019] Bowen Li, Xiaojuan Qi, Thomas Lukasiewicz, and Philip Torr. Controllable text-to- image generation. NeurIPS, 32, 2019.
  20. [Liu and Others, 2025] Haotian Liu and Others. Llava-v1.6- 34b: Large multimodal language vision model, 2025.
  21. [Lozhkov et al., 2024] Anton Lozhkov, Raymond Li, Loubna Ben Allal, Federico Cassano, Joel Lamy-Poirier, Nouamane Tazi, Ao Tang, Dmytro Pykhtar, Jiawei Liu, Yuxiang Wei, et al. Starcoder 2 and the stack v2: The next generation. arXiv preprint arXiv:2402.19173, 2024.
  22. [Luo et al., 2023] Ziyang Luo, Can Xu, Pu Zhao, Qingfeng Sun, Xiubo Geng, Wenxiang Hu, Chongyang Tao, Jing Ma, Qingwei Lin, and Daxin Jiang. Wizardcoder: Em- powering code large language models with evol-instruct. arXiv preprint arXiv:2306.08568, 2023.
  23. [Phan et al., 2021] Long Phan, Hieu Tran, Daniel Le, Hieu Nguyen, James Anibal, Alec Peltekian, and Yanfang Ye. Cotext: Multi-task learning with code-text transformer. arXiv preprint arXiv:2105.08645, 2021.
  24. [Roziere et al., 2023] Baptiste Roziere, Jonas Gehring, Fabian Gloeckle, Sten Sootla, Itai Gat, Xiaoqing Ellen Tan, Yossi Adi, Jingyu Liu, Romain Sauvestre, Tal Remez, et al. Code llama: Open foundation models for code. arXiv preprint arXiv:2308.12950, 2023.
  25. [Shi et al., 2022] Freda Shi, Daniel Fried, Marjan Ghazvininejad, Luke Zettlemoyer, and Sida I Wang. Natural language to code translation with execution. arXiv preprint arXiv:2204.11454, 2022.
  26. [Shin and Nam, 2021] Jiho Shin and Jaechang Nam. A sur- vey of automatic code generation from natural language. Journal of Information Processing Systems, 17(3):537- 555, 2021.
  27. [Song et al., 2025] Kunpeng Song, Yizhe Zhu, Bingchen Liu, Qing Yan, Ahmed Elgammal, and Xiao Yang. Moma: Multimodal llm adapter for fast personalized image gener- ation. In ECCV, pages 117-132. Springer, 2025.
  28. [Tan et al., 2024] Cheng Tan, Dongxin Lyu, Siyuan Li, Zhangyang Gao, Jingxuan Wei, Siqi Ma, Zicheng Liu, and Stan Z Li. Peer review as a multi-turn and long-context dialogue with role-based interactions. arXiv preprint arXiv:2406.05688, 2024.
  29. [Team et al., 2024] Gemini Team, Petko Georgiev, Ving Ian Lei, Ryan Burnell, Libin Bai, Anmol Gulati, Garrett Tanzer, Damien Vincent, Zhufeng Pan, Shibo Wang, et al. Gemini 1.5: Unlocking multimodal understand- ing across millions of tokens of context. arXiv preprint arXiv:2403.05530, 2024.
  30. [Team, 2024] Qwen Team. Qwen2: A scalable and versatile language model, 2024. [Team, 2025a] 01.AI Team. Yi-1.5: Open foundation models by 01.ai, 2025. [Team, 2025b]
  31. AI Team. Yi-coder: Open foundation models by 01.ai, 2025. [Team, 2025c]
  32. AI Team. Yi-vl-34b: A multimodal foun- dation model by 01.ai, 2025.
  33. [Team, 2025d] CodeGeeX Team. Codegeex4: Open multi- lingual code generation model, 2025.
  34. [Team, 2025e] DeepSeek Team. Deepseek v2.5: A scalable and efficient mixture-of-experts language model, 2025. [Team, 2025f] DeepSeek AI Team. Deepseek-vl-7b-chat: A vision-language model for advanced multimodal under- standing, 2025.
  35. [Team, 2025g] Zhipu AI Team. Glm-4-plus: A multilingual foundation model for general purpose ai, 2025.
  36. [Thakur et al., 2024] Shailja Thakur, Baleegh Ahmad, Ham- mond Pearce, Benjamin Tan, Brendan Dolan-Gavitt, Ramesh Karri, and Siddharth Garg. Verigen: A large lan- guage model for verilog code generation. ACM Trans. on Design Automation of Electronic Systems, 29(3):1-31, 2024.
  37. [Tipirneni et al., 2024] Sindhu Tipirneni, Ming Zhu, and Chandan K Reddy. Structcoder: Structure-aware trans- former for code generation. TKDD, 18(3):1-20, 2024.
  38. [Wang et al., 2024] Peng Wang, Shuai Bai, Sinan Tan, Shi- jie Wang, Zhihao Fan, Jinze Bai, Keqin Chen, Xuejing Liu, Jialin Wang, Wenbin Ge, et al. Qwen2-vl: Enhanc- ing vision-language model's perception of the world at any resolution. arXiv preprint arXiv:2409.12191, 2024.
  39. [Wei et al., 2024a] Yuxiang Wei, Zhe Wang, Jiawei Liu, Yifeng Ding, and Lingming Zhang. Magicoder: Empow- ering code generation with oss-instruct. In ICML, 2024.
  40. [Wei et al., 2024b] Zhichao Wei, Qingkun Su, Long Qin, and Weizhi Wang. Mm-diff: High-fidelity image per- sonalization via multi-modal condition integration. arXiv preprint arXiv:2403.15059, 2024.
  41. [Wei et al., 2025] Jingxuan Wei, Cheng Tan, Qi Chen, Gaowei Wu, Siyuan Li, Zhangyang Gao, Linzhuang Sun, Bihui Yu, and Ruifeng Guo. From words to structured visuals: A benchmark and framework for text-to-diagram generation and editing. CVPR, 2025.
  42. [Xu et al., 2022] Frank F Xu, Bogdan Vasilescu, and Gra- ham Neubig. In-ide code generation from natural lan- guage: Promise and challenges. TOSEM, 31(2):1-47, 2022.
  43. [Yang et al., 2023] Aiyuan Yang, Bin Xiao, Bingning Wang, Borong Zhang, Ce Bian, Chao Yin, Chenxu Lv, Da Pan, Dian Wang, Dong Yan, et al. Baichuan 2: Open large- scale language models. arXiv preprint arXiv:2309.10305, 2023.
  44. [Zhang et al., 2023a] Pan Zhang, Xiaoyi Dong, Bin Wang, Yuhang Cao, Chao Xu, Linke Ouyang, Zhiyuan Zhao, Haodong Duan, Songyang Zhang, Shuangrui Ding, et al. Internlm-xcomposer: A vision-language large model for advanced text-image comprehension and composition. arXiv preprint arXiv:2309.15112, 2023.
  45. [Zhang et al., 2023b] Tianjun Zhang, Yi Zhang, Vibhav Vineet, Neel Joshi, and Xin Wang. Controllable text-to-image generation with gpt-4. arXiv preprint arXiv:2305.18583, 2023.
  46. [Zhao and Lai, 2022] Puning Zhao and Lifeng Lai. Analysis of knn density estimation. TIT, 68(12):7971-7995, 2022.
  47. [Zhao et al., 2024] Puning Zhao, Fei Yu, and Zhiguo Wan. A huber loss minimization approach to byzantine robust federated learning. In AAAI, 2024.

References were extracted automatically from the PDF and may contain errors.

Welcome Future Conferences AI Journal Division IJCAI Proceedings About IJCAI IJCAI Awards