HyperAI超神経

ComfyUI-R1: Exploring Reasoning Models for Workflow Generation

Zhenran Xu, Yiyu Wang, Xue Yang, Longyue Wang, Weihua Luo, Kaifu Zhang, Baotian Hu, Min Zhang
公開日: 6/12/2025
ComfyUI-R1: Exploring Reasoning Models for Workflow Generation
要約

AI-generated content has evolved from monolithic models to modular workflows,particularly on platforms like ComfyUI, enabling customization in creativepipelines. However, crafting effective workflows requires great expertise toorchestrate numerous specialized components, presenting a steep learning curvefor users. To address this challenge, we introduce ComfyUI-R1, the first largereasoning model for automated workflow generation. Starting with our curateddataset of 4K workflows, we construct long chain-of-thought (CoT) reasoningdata, including node selection, workflow planning, and code-level workflowrepresentation. ComfyUI-R1 is trained through a two-stage framework: (1) CoTfine-tuning for cold start, adapting models to the ComfyUI domain; (2)reinforcement learning for incentivizing reasoning capability, guided by afine-grained rule-metric hybrid reward, ensuring format validity, structuralintegrity, and node-level fidelity. Experiments show that our 7B-parametermodel achieves a 97\% format validity rate, along with high pass rate,node-level and graph-level F1 scores, significantly surpassing priorstate-of-the-art methods that employ leading closed-source models such asGPT-4o and Claude series. Further analysis highlights the critical role of thereasoning process and the advantage of transforming workflows into code.Qualitative comparison reveals our strength in synthesizing intricate workflowswith diverse nodes, underscoring the potential of long CoT reasoning in AI artcreation.