Elamur Research⌕
☰
home / papers / 2026 / ComfyUI-R1: Exploring Reasoning Models for Workflow Generation

ComfyUI-R1: Exploring Reasoning Models for Workflow Generation

Paper · 2026 · Zhenran Xu, Yiyu Wang, Xue Yang et al.

Summary

ComfyUI is a node-based platform for building image and video generation pipelines. Assembling a working workflow there takes real expertise, because the platform has thousands of community components with complex dependencies. Earlier automation attempts prompted proprietary LLMs or multi-agent setups to emit JSON, and they often produced broken graphs or nonexistent nodes. Most of them also handled only text-to-image tasks.

The authors present ComfyUI-R1, which they describe as the first reasoning-oriented model built specifically for this job. They collected workflows and node documentation from community sites into knowledge bases spanning image, video and 3D tasks. From these they synthesized long chain-of-thought traces covering node retrieval, node selection, step-by-step planning and finally Python-like code that encodes the workflow.

Training on Qwen2.5-Coder proceeds in two stages. A cold-start supervised fine-tuning phase comes first, followed by GRPO reinforcement learning. The RL stage uses a hybrid reward: invalid format, non-DAG structure or hallucinated nodes are penalized, and only well-formed outputs earn credit for correct node choice.

The resulting 7B model beats GPT-4o- and Claude-based systems. This suggests that small open models with targeted post-training can lower the entry barrier to creative AI tools.

Key points

  • Base model: Qwen2.5-Coder 7B. Format validity rose from 41% for the original model to 97% after both training stages, with strong node-level and graph-level F1.
  • On a 42-task subset of ComfyBench (text-to-image, image editing, text-to-video, image-to-video), ComfyUI-R1 reached the best pass and solve rates. It outperformed ComfyAgent, o3-mini and Gemini-2.5-pro.
  • For ComfyBench, candidate nodes come from the top 3 workflows retrieved from the knowledge base using text-embedding-3-small.
  • Ablations indicate three things help: the explicit reasoning step, the fine-grained reward components, and representing workflows as code instead of JSON.
  • The model handled nodes introduced after training, such as API nodes released 6 May 2025. Its main limitation is that it relies on default node parameters. Code is available at GitHub AIDC-AI/ComfyUI-Copilot.

Our summary of the paper, in our own words — not its text. The work belongs to its authors; read it at the links above.

 Institutions

 Fields, topics and concepts

📚 Shelves 3The field of science this work belongs to (OpenAlex fields).Computer Science · 16,667 worksArtificial Intelligence · 16,194 worksComputer Vision and Pattern Recognition · 2,869 works

🧭 Topics 1Research subjects and languages the work is about.Reasoning · 1,426 works

Cite

Cite as Zhenran Xu, Yiyu Wang, Xue Yang, Longyue Wang, Weihua Luo, Kaifu Zhang, Baotian Hu and Min Zhang. 2026. ComfyUI-R1: Exploring Reasoning Models for Workflow Generation. Findings of the Association for Computational Linguistics: ACL 2026.

The paper itself, not this page. BibTeX from the library's record of the work. DOI 10.18653/v1/2026.findings-acl.146

@inproceedings{xu2026comfyui,
  title = {{ComfyUI-R1: Exploring Reasoning Models for Workflow Generation}},
  author = {Zhenran Xu, Yiyu Wang, Xue Yang, Longyue Wang, Weihua Luo, Kaifu Zhang, Baotian Hu and Min Zhang},
  booktitle = {Findings of the Association for Computational Linguistics: ACL 2026},
  year = {2026},
  doi = {10.18653/v1/2026.findings-acl.146},
  url = {https://doi.org/10.18653/v1/2026.findings-acl.146}
}

References

57 references, 15 of them with a card of ours. ↗ leads to the work, «find» searches for one we have no id for yet.

  1. Mert Cemri, Melissa Z. Pan, Shuyi Yang, Lakshya A. Agrawal, Bhavya Chopra, Rishabh Tiwari, Kurt Keutzer, Aditya Parameswaran, Dan Klein, Kannan Ramchandran, Matei Zaharia, Joseph E. Gonzalez, and Ion Stoica. 2025. Why do multi-agent llm systems fail? Preprint, arXiv:2503.13657. find
  2. Yulin Chen, Haoran Li, Yuan Sui, Yufei He, Yue Liu, Yangqiu Song, and Bryan Hooi. 2025. Can indirect prompt injection attacks be detected and removed? In Proceedings of the 63rd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 18189–18206, Vienna, Austri…
  3. Joost C. F. de Winter, Dimitra Dodou, and Yke Bauke Eisma. 2024. System 2 thinking in openai’s o1-preview model: Near-perfect performance on a mathematics exam. CoRR, abs/2410.07114. find
  4. DeepSeek-AI. 2025. Deepseek-r1: Incentivizing reasoning capability in llms via reinforcement learning. Preprint, arXiv:2501.12948.
  5. Prafulla Dhariwal and Alexander Nichol. 2021. Diffusion models beat gans on image synthesis. In Advances in Neural Information Processing Systems, volume 34, pages 8780–8794. Curran Associates, Inc. find
  6. Hugging Face. 2025. open-r1. https://github.com/ huggingface/open-r1. GitHub Repository. ↗
  7. Shengda Fan, Xin Cong, Yuepeng Fu, Zhong Zhang, Shuyan Zhang, Yuanwei Liu, Yesai Wu, Yankai Lin, Zhiyuan Liu, and Maosong Sun. 2025. WorkflowLLM: Enhancing workflow orchestration capability of large language models. In The Thirteenth International Conference on Learning Representations. find
  8. Rinon Gal, Adi Haviv, Yuval Alaluf, Amit H. Bermano, Daniel Cohen-Or, and Gal Chechik. 2024. Comfy-gen: Prompt-adaptive workflows for text-to-image generation. Preprint, arXiv:2410.01731. — [arXiv:2410.01731](https://arxiv.org/abs/2410.01731) find
  9. Litao Guo, Xinli Xu, Luozhou Wang, Jiantao Lin, Jinsong Zhou, Zixin Zhang, Bolan Su, and Ying-Cong Chen. 2025. Comfymind: Toward general-purpose generation via tree-based planning and reactive feedback. Preprint, arXiv:2505.17908. — [arXiv:2505.17908](https://arxiv.org/abs/2505.17908) find
  10. Taicheng Guo, Xiuying Chen, Yaqi Wang, Ruidi Chang, Shichao Pei, Nitesh V. Chawla, Olaf Wiest, and Xiangliang Zhang. 2024. Large language model based multi-agents: A survey of progress and challenges. Preprint, arXiv:2402.01680.
  11. Jonathan Ho, Ajay Jain, and Pieter Abbeel. 2020. Denoising diffusion probabilistic models. In Advances in Neural Information Processing Systems, volume 33, pages 6840–6851. Curran Associates, Inc. find
  12. Sirui Hong, Mingchen Zhuge, Jonathan Chen, Xiawu Zheng, Yuheng Cheng, Jinlin Wang, Ceyao Zhang, Zili Wang, Steven Ka Shing Yau, Zijuan Lin, Liyang Zhou, Chenyu Ran, Lingfeng Xiao, Chenglin Wu, and Jürgen Schmidhuber. 2024. MetaGPT: Meta programming for a multi-agent collaborative framework. In The T…
  13. Edward J Hu, Phillip Wallis, Zeyuan Allen-Zhu, Yuanzhi Li, Shean Wang, Lu Wang, Weizhu Chen, et al. 2021. Lora: Low-rank adaptation of large language models. In International Conference on Learning Representations.
  14. Shengran Hu, Cong Lu, and Jeff Clune. 2025. Automated design of agentic systems. In The Thirteenth International Conference on Learning Representations. find
  15. Oucheng Huang, Yuhang Ma, Zeng Zhao, Mingrui Wu, Jiayi Ji, Rongsheng Zhang, Zhipeng Hu, Xiaoshuai Sun, and Rongrong Ji. 2025. Comfygpt: A self-optimizing multi-agent system for comprehensive comfyui workflow generation. Preprint, arXiv:2503.17671. — [arXiv:2503.17671](https://arxiv.org/abs/2503.17671) find
  16. Binyuan Hui, Jian Yang, Zeyu Cui, Jiaxi Yang, Dayiheng Liu, Lei Zhang, Tianyu Liu, Jiajun Zhang, Bowen Yu, Keming Lu, Kai Dang, Yang Fan, Yichang Zhang, An Yang, Rui Men, Fei Huang, Bo Zheng, Yibo Miao, Shanghaoran Quan, Yunlong Feng, Xingzhang Ren, Xuancheng Ren, Jingren Zhou, and Junyang Lin. 2024… — Qwen2.5-Coder Technical Report
  17. Xiaoxi Li, Guanting Dong, Jiajie Jin, Yuyao Zhang, Yujia Zhou, Yutao Zhu, Peitian Zhang, and Zhicheng Dou. 2025a. Search-o1: Agentic search-enhanced large reasoning models. arXiv preprint arXiv:2501.05366.
  18. Xuefeng Li, Haoyang Zou, and Pengfei Liu. 2025b. Torl: Scaling tool-integrated rl. Preprint, arXiv:2503.23383. find
  19. Yunxin Li, Xinyu Chen, Shenyuan Jiang, Haoyuan Shi, Zhenyu Liu, Xuanyu Zhang, Nanhao Deng, Zhenran Xu, Yicheng Ma, Meishan Zhang, Baotian Hu, and Min Zhang. 2025c. Uni-moe-2.0-omni: Scaling language-centric omnimodal large model with advanced moe, training and data. Preprint, arXiv:2511.12609. — [arXiv:2511.12609](https://arxiv.org/abs/2511.12609) find
  20. Yunxin Li, Shenyuan Jiang, Baotian Hu, Longyue Wang, Wanqi Zhong, Wenhan Luo, Lin Ma, and Min Zhang. 2024a. Uni-moe: Scaling unified multimodal llms with mixture of experts. Preprint, arXiv:2405.11273. — [arXiv:2405.11273](https://arxiv.org/abs/2405.11273) find
  21. Yunxin Li, Zhenyu Liu, Zitao Li, Xuanyu Zhang, Zhenran Xu, Xinyu Chen, Haoyuan Shi, Shenyuan Jiang, Xintong Wang, Jifang Wang, Shouzheng Huang, Xinping Zhao, Borui Jiang, Lanqing Hong, Longyue Wang, Zhuotao Tian, Baoxing Huai, Wenhan Luo, Weihua Luo, Zheng Zhang, Baotian Hu, and Min Zhang. 2025d. Pe… — [arXiv:2505.04921](https://arxiv.org/abs/2505.04921) find
  22. Yunxin Li, Haoyuan Shi, Baotian Hu, Longyue Wang, Jiashun Zhu, Jinyi Xu, Zhen Zhao, and Min Zhang. 2024b. Anim-director: A large multimodal model powered agent for controllable animation video generation. In SIGGRAPH Asia 2024 Conference Papers, SA ’24, New York, NY, USA. Association for Computing M… find
  23. Yexiang Liu, Jie Cao, Zekun Li, Ran He, and Tieniu Tan. 2025. Breaking mental set to improve reasoning through diverse multi-agent debate. In The Thirteenth International Conference on Learning Representations. find
  24. Oscar Mañas, Pietro Astolfi, Melissa Hall, Candace Ross, Jack Urbanek, Adina Williams, Aishwarya Agrawal, Adriana Romero-Soriano, and Michal Drozdzal. 2024. Improving text-to-image consistency via automatic prompt optimization. Preprint, arXiv:2403.17804. — [arXiv:2403.17804](https://arxiv.org/abs/2403.17804) find
  25. Qian Ning, Weisheng Dong, Guangming Shi, Leida Li, and Xin Li. 2021. Accurate and lightweight image super-resolution with model-guided deep unfolding network. IEEE Journal of Selected Topics in Signal Processing, 15(2):240–252. find
  26. Boye Niu, Yiliao Song, Kai Lian, Yifan Shen, Yu Yao, Kun Zhang, and Tongliang Liu. 2025. Flow: Modularized agentic workflow automation. In The Thirteenth International Conference on Learning Representations. find
  27. OpenAI. 2024. Introducing openai o1-preview. https://openai.com/index/ introducing-openai-o1-preview/. ↗
  28. OpenAI. 2025a. Introducing deep research. Accessed: 2025-02-02. find
  29. OpenAI. 2025b. Introducing openai o3 and o4-mini. Accessed: 2025-04-18. find
  30. Dustin Podell, Zion English, Kyle Lacey, Andreas Blattmann, Tim Dockhorn, Jonas Müller, Joe Penna, and Robin Rombach. 2023. Sdxl: Improving latent diffusion models for high-resolution image synthesis. Preprint, arXiv:2307.01952.
  31. Chen Qian, Xin Cong, Wei Liu, Cheng Yang, Weize Chen, Yusheng Su, Yufan Dang, Jiahao Li, Juyuan Xu, Dahai Li, Zhiyuan Liu, and Maosong Sun. 2023. Communicative agents for software development. Preprint, arXiv:2307.07924.
  32. Cheng Qian, Emre Can Acikgoz, Qi He, Hongru Wang, Xiusi Chen, Dilek Hakkani-Tür, Gokhan Tur, and Heng Ji. 2025. Toolrl: Reward is all tool learning needs. Preprint, arXiv:2504.13958. find
  33. Shuofei Qiao, Runnan Fang, Zhisong Qiu, Xiaobin Wang, Ningyu Zhang, Yong Jiang, Pengjun Xie, Fei Huang, and Huajun Chen. 2025. Benchmarking agentic workflow generation. Preprint, arXiv:2410.07869. — [arXiv:2410.07869](https://arxiv.org/abs/2410.07869) find
  34. Simo Ryu. 2023. Low-rank adaptation for fast text-to-image diffusion fine-tuning. https://github.com/ cloneofsimo/lora. ↗
  35. Yu Shang, Yu Li, Keyu Zhao, Likai Ma, Jiahe Liu, Fengli Xu, and Yong Li. 2025. Agentsquare: Automatic LLM agent search in modular design space. In The Thirteenth International Conference on Learning Representations. find
  36. Zhihong Shao, Peiyi Wang, Qihao Zhu, Runxin Xu, Junxiao Song, Xiao Bi, Haowei Zhang, Mingchuan Zhang, Y. K. Li, Y. Wu, and Daya Guo. 2024. Deepseekmath: Pushing the limits of mathematical reasoning in open language models. Preprint, arXiv:2402.03300.
  37. Haoyuan Shi, Yunxin Li, Xinyu Chen, Longyue Wang, Baotian Hu, and Min Zhang. 2025. Animaker: Multi-agent animated storytelling with mcts-driven clip generation. In Proceedings of the SIGGRAPH Asia 2025 Conference Papers, SA Conference Papers ’25, New York, NY, USA. Association for Computing Machiner… find
  38. Noah Shinn, Federico Cassano, Ashwin Gopinath, Karthik R Narasimhan, and Shunyu Yao. 2023. Reflexion: language agents with verbal reinforcement learning. In Thirty-seventh Conference on Neural Information Processing Systems.
  39. Dominik Sobania, Martin Briesch, and Franz Rothlauf. 2024. Comfygi: Automatic improvement of image generation workflows. Preprint, arXiv:2411.14193. — [arXiv:2411.14193](https://arxiv.org/abs/2411.14193) find
  40. Huatong Song, Jinhao Jiang, Yingqian Min, Jie Chen, Zhipeng Chen, Wayne Xin Zhao, Lei Fang, and Ji-Rong Wen. 2025. R1-searcher: Incentivizing the search capability in llms via reinforcement learning. arXiv preprint arXiv:2503.05592.
  41. Jifang Wang, Xue Yang, Longyue Wang, Zhenran Xu, Yiyu Wang, Yaowei Wang, Weihua Luo, Kaifu Zhang, Baotian Hu, and Min Zhang. 2025a. A unified agentic framework for evaluating conditional image generation. In Proceedings of the 63rd Annual Meeting of the Association for Computational Linguistics (Vol… find
  42. Junlin Wang, Jue WANG, Ben Athiwaratkun, Ce Zhang, and James Zou. 2025b. Mixture-of-agents enhances large language model capabilities. In The Thirteenth International Conference on Learning Representations. find
  43. Qineng Wang, Zihao Wang, Ying Su, Hanghang Tong, and Yangqiu Song. 2024. Rethinking the bounds of LLM reasoning: Are multi-agent discussions the key? In Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 6106–6131, Bangkok, Thailand… find
  44. Chen Henry Wu and Fernando De la Torre. 2023. A latent space of stochastic diffusion models for zero-shot image editing and guidance. In ICCV. find
  45. Minghao Wu, Yulin Yuan, Gholamreza Haffari, and Longyue Wang. 2024. (perhaps) beyond human translation: Harnessing multi-agent collaboration for translating ultra-long literary texts. Preprint, arXiv:2405.11804.
  46. Jia Xu, Weilin Du, Xiao Liu, and Xuejun Li. 2024. Llm4workflow: An llm-based automated workflow model generation tool. In Proceedings of the 39th IEEE/ACM International Conference on Automated Software Engineering, ASE ’24, page 2394–2398, New York, NY, USA. Association for Computing Machinery. find
  47. Zhenran Xu, Senbao Shi, Baotian Hu, Jindi Yu, Dongfang Li, Min Zhang, and Yuxiang Wu. 2023. Towards reasoning in large language models via multi-agent peer review collaboration. Preprint, arXiv:2311.08152.
  48. Zhenran Xu, Longyue Wang, Jifang Wang, Zhouyi Li, Senbao Shi, Xue Yang, Yiyu Wang, Baotian Hu, Jun Yu, and Min Zhang. 2025a. Filmagent: A multi-agent framework for end-to-end film automation in virtual 3d spaces. Preprint, arXiv:2501.12909. — [arXiv:2501.12909](https://arxiv.org/abs/2501.12909) find
  49. Zhenran Xu, Yangxue Yangxue, Yiyu Wang, Qingli Hu, Zijiao Wu, Baotian Hu, Longyue Wang, Weihua Luo, and Kaifu Zhang. 2025b. ComfyUI-copilot: An intelligent assistant for automated workflow development. In Proceedings of the 63rd Annual Meeting of the Association for Computational Linguistics (Volume… find
  50. Xiangyuan Xue, Zeyu Lu, Di Huang, Zidong Wang, Wanli Ouyang, and Lei Bai. 2024. Comfybench: Benchmarking llm-based agents in comfyui for autonomously designing collaborative ai systems. Preprint, arXiv:2409.01392. — [arXiv:2409.01392](https://arxiv.org/abs/2409.01392) find
  51. Hu Ye, Jun Zhang, Sibo Liu, Xiao Han, and Wei Yang. 2023. Ip-adapter: Text compatible image prompt adapter for text-to-image diffusion models. arXiv preprint arXiv:2308.06721. — [arXiv:2308.06721](https://arxiv.org/abs/2308.06721) find
  52. Di Zhang, Jianbo Wu, Jingdi Lei, Tong Che, Jiatong Li, Tong Xie, Xiaoshui Huang, Shufei Zhang, Marco Pavone, Yuqiang Li, et al. 2024. Llama-berry: Pairwise optimization for o1-like olympiad-level mathematical reasoning. arXiv preprint arXiv:2410.02884. find
  53. Jiayi Zhang, Jinyu Xiang, Zhaoyang Yu, Fengwei Teng, Xiong-Hui Chen, Jiaqi Chen, Mingchen Zhuge, Xin Cheng, Sirui Hong, Jinlin Wang, Bingnan Zheng, Bang Liu, Yuyu Luo, and Chenglin Wu. 2025. AFlow: Automating agentic workflow generation. In The Thirteenth International Conference on Learning Represe… find
  54. Lvmin Zhang, Anyi Rao, and Maneesh Agrawala. 2023. Adding conditional control to text-to-image diffusion models. In CVPR. find
  55. Jiaxing Zhao, Xihan Wei, and Liefeng Bo. 2025. R1-omni: Explainable omni-multimodal emotion recognition with reinforcement learning. Preprint, arXiv:2503.05379. — [arXiv:2503.05379](https://arxiv.org/abs/2503.05379) find
  56. Yu Zhao, Huifeng Yin, Bo Zeng, Hao Wang, Tianqi Shi, Chenyang Lyu, Longyue Wang, Weihua Luo, and Kaifu Zhang. 2024. Marco-o1: Towards open reasoning models for open-ended solutions. CoRR, abs/2411.14405. find
  57. Yuxiang Zheng, Dayuan Fu, Xiangkun Hu, Xiaojie Cai, Lyumanshan Ye, Pengrui Lu, and Pengfei Liu. 2025. Deepresearcher: Scaling deep research via reinforcement learning in real-world environments. arXiv preprint arXiv:2504.03160. *Figure 4: An illustration of the task categories in our constructed wor…

Updated

↑ back to top

This page in Markdown → https://md.research.elamur.ai/free/en/papers/xu-2026-comfyui-r1-exploring-reasoning-models/