ComfyUI-R1: ワークフロー生成のための推論モデルの探求
ComfyUI-R1: Exploring Reasoning Models for Workflow Generation
June 11, 2025
著者: Zhenran Xu, Yiyu Wang, Xue Yang, Longyue Wang, Weihua Luo, Kaifu Zhang, Baotian Hu, Min Zhang
cs.AI
要旨
AI生成コンテンツは、単一のモデルからモジュール型のワークフローへと進化し、特にComfyUIのようなプラットフォームでは、クリエイティブパイプラインにおけるカスタマイズが可能となっている。しかし、効果的なワークフローを構築するためには、多数の専門的なコンポーネントを調整するための高度な専門知識が必要であり、ユーザーにとっては急峻な学習曲線が存在する。この課題に対処するため、我々は自動ワークフロー生成のための初の大規模推論モデルであるComfyUI-R1を提案する。我々がキュレートした4Kのワークフローデータセットを基に、ノード選択、ワークフロー計画、コードレベルのワークフロー表現を含む長い連鎖的思考(CoT)推論データを構築する。ComfyUI-R1は、二段階のフレームワークを通じて訓練される:(1) コールドスタートのためのCoTファインチューニングにより、モデルをComfyUIドメインに適応させる;(2) 推論能力を促進するための強化学習を、細かいルールとメトリックを組み合わせた報酬に基づいて行い、フォーマットの妥当性、構造の整合性、ノードレベルの忠実性を確保する。実験結果では、7Bパラメータのモデルが97%のフォーマット妥当率を達成し、高い合格率、ノードレベルおよびグラフレベルのF1スコアを記録し、GPT-4oやClaudeシリーズなどの主要なクローズドソースモデルを採用した従来の最先端手法を大幅に上回った。さらなる分析により、推論プロセスの重要性と、ワークフローをコードに変換することの利点が明らかとなった。質的比較により、多様なノードを含む複雑なワークフローを合成する我々の強みが示され、AIアート創作における長いCoT推論の可能性が強調された。
English
AI-generated content has evolved from monolithic models to modular workflows,
particularly on platforms like ComfyUI, enabling customization in creative
pipelines. However, crafting effective workflows requires great expertise to
orchestrate numerous specialized components, presenting a steep learning curve
for users. To address this challenge, we introduce ComfyUI-R1, the first large
reasoning model for automated workflow generation. Starting with our curated
dataset of 4K workflows, we construct long chain-of-thought (CoT) reasoning
data, including node selection, workflow planning, and code-level workflow
representation. ComfyUI-R1 is trained through a two-stage framework: (1) CoT
fine-tuning for cold start, adapting models to the ComfyUI domain; (2)
reinforcement learning for incentivizing reasoning capability, guided by a
fine-grained rule-metric hybrid reward, ensuring format validity, structural
integrity, and node-level fidelity. Experiments show that our 7B-parameter
model achieves a 97\% format validity rate, along with high pass rate,
node-level and graph-level F1 scores, significantly surpassing prior
state-of-the-art methods that employ leading closed-source models such as
GPT-4o and Claude series. Further analysis highlights the critical role of the
reasoning process and the advantage of transforming workflows into code.
Qualitative comparison reveals our strength in synthesizing intricate workflows
with diverse nodes, underscoring the potential of long CoT reasoning in AI art
creation.