Lune

ACL Findings2026

ComfyUI-R1: Exploring Reasoning Models for Workflow Generation

Zhenran Xu, Yiyu Wang, Xue Yang, Longyue Wang, Weihua Luo, Kaifu Zhang, Baotian Hu, Min Zhang

Abstract

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 knowledge bases, 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 twostage 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 rulemetric 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, surpassing prior state-of-the-art methods that employ leading closed-source models such as GPT-4o and Claude series. Qualitative analysis further highlights our model's strength in synthesizing intricate workflows with diverse nodes, aligning with human instructions, and generalizing to newly introduced nodes, underscoring the potential of long CoT reasoning in AI art creation 1 . Node Selection: I will choose the nodes ['CLIPTextEncode', 'ControlNetLoader', ...]. Workflow Planning: 1. The workflow begins by loading an InstantID model (InstantIDModelLoader) and preparing a face analysis model (InstantIDFaceAnalysis); 2. The reference image is loaded via the LoadImage node, and its facial keypoints are extracted with FaceKeypointsPreprocessor; 3. The conditioned model undergoes sampling Design a workflow that creates a high-resolution image of a woman while preserving the facial features of the reference image. The workflow should analyze the facial structure of t h e r e f e r e n c e i m a g e a n d integrate it into the generation process, ensuring the output aligns with the identity and facial features of the reference.

Ask Lune

Ask anything. The answer quotes the paper.

Lune reads all of it and the papers around it, then shows you the passages behind every answer.

Questions to start from

Lune answers from

the full paper · related work

Get the answer

Free to start. No credit card required.

Builds on23

  1. Denoising Diffusion Probabilistic ModelsJonathan Ho, Ajay Jain, Pieter AbbeelNeurIPS 2020 · 35,902 citations
  2. LoRA: Low-Rank Adaptation of Large Language ModelsEdward J. Hu, Yelong Shen, Phillip Wallis, Zeyuan Allen-Zhu et al.ICLR 2022 · 18,833 citations
  3. Diffusion Models Beat GANs on Image SynthesisPrafulla Dhariwal, Alexander Quinn NicholNeurIPS 2021 · 13,211 citations
  4. Adding Conditional Control to Text-to-Image Diffusion ModelsLvmin Zhang, Anyi Rao, Maneesh AgrawalaICCV 2023 · 6,759 citations
  5. Reflexion: language agents with verbal reinforcement learningNoah Shinn, Federico Cassano, Ashwin Gopinath, Karthik Narasimhan et al.NeurIPS 2023 · 5,828 citations

Related papers

  1. ComfyMind: Toward General-Purpose Generation via Tree-Based Planning and Reactive FeedbackLitao Guo, Xinli Xu, Luozhou Wang, Jiantao Lin et al.NeurIPS 2025 · 18 citations
  2. ComfyFlow: Benchmarking LLMs for AIGC Workflow GenerationZhenran Xu, Yiyu Wang, Yunxin Li, Muyang Ye et al.ACL Findings 2026
  3. ComfyBench: Benchmarking LLM-based Agents in ComfyUI for Autonomously Designing Collaborative AI SystemsXiangyuan Xue, Zeyu Lu, Di Huang, Zidong Wang et al.CVPR 2025
  4. WorkflowLLM: Enhancing Workflow Orchestration Capability of Large Language ModelsShengda Fan, Xin Cong, Yuepeng Fu, Zhong Zhang et al.ICLR 2025 · 1 citation
  5. Leveraging Verifier-Based Reinforcement Learning in Image EditingHanzhong Guo, Jie Wu, Jie Liu, Yu Gao et al.CVPR 2026 · 9 citations
Dusk over the sea between two cliffs drawn in fine vertical lines