This is Part 4 of the ComfyUI Masterclass series, where we explore the powerful features of ComfyUI for AI image generation. Here's what we've covered so far:
- Part 1: Install and Run ComfyUI deals with installing ComfyUI on lightning.ai, a cloud platform that’s beneficial if you don’t have much GPU power. Since the installation steps are the same as for local installation, you can follow along regardless of your preferred setup
- Part 2: Nodes and Workflows covers the ComfyUI interface, essential node types, and how to build a complete text-to-image workflow from scratch, including workflow organization techniques
Did you know that using the wrong batch settings in ComfyUI could slow down your workflow by up to 400%? - Part 3: The KSampler explores the settings that control your image generation.
Did you know that using the wrong batch settings in ComfyUI could slow down your workflow by up to 400%?
In this guide, we'll explore everything you need to know about batch processing in ComfyUI, from basic concepts to advanced workflow optimization techniques.
If you're more of a visual learner or simply want to see how it's done, I recommend checking out my YouTube tutorial. It covers everything step-by-step.
Understanding Batch Size vs Batch Count
The key to efficient image generation lies in understanding two fundamental concepts: batch size and batch count. While they might sound similar, they serve very different purposes.
Batch Size controls how many images your computer processes at the same time - like baking multiple trays of cookies in the oven at once. You'll find this setting in the "Empty Latent Image" node. It uses more VRAM because all images are generated in parallel, just like how you'd need a bigger oven to bake multiple cookie trays at once.
Batch Count, on the other hand, is like putting multiple trays in the oven one after another. You complete one tray, set it aside to cool, and start on the next one. You'll find this setting in the top menu bar.
You might think that generating images one after another with batch count would be slower than processing them all at once with batch size. But during my tests, I discovered the opposite is true. Here are the actual results using a T4 GPU:
- Batch Count (4 images): Total generation time of 62.63 seconds
- Batch Size (4 images): Total generation time of 16.20 seconds
While batch size appears faster at first glance, here's what's actually happening: When we try to process multiple images at once using batch size, it's like trying to stuff too many cookie trays in a small oven. Our GPU simply doesn't have enough VRAM to handle it all. When this happens, it's forced to use your computer's regular memory instead, which is much slower - like trying to bake cookies on your stovetop when the oven is full.
That's why for most users, especially if you're working with limited VRAM, batch count is recommended. It's like baking your cookie trays one at a time - sure, you're waiting for each batch to finish, but at least they're baking properly in the oven rather than trying to cook them somewhere else.
Visualization Options
ComfyUI provides two convenient ways to view images which were generated in bulk (via batch size):
- Queue Panel View
- Comprehensive overview of all generated images
- Accessible through the queue number
- Perfect for reviewing multiple generations at once
- Save Image Node View
- Direct access to latest generations within your workflow
- Browse images using the bottom right counter
- Grid layout available for viewing all images simultaneously
File Organization
All generated images are automatically stored in the ComfyUI/output directory. The filename prefix system enables intuitive organization - instead of generic "ComfyUI_0001, ComfyUI_0002" naming, use descriptive prefixes like "sunset_beach_0001" or "portrait_study_0001".
Running Multiple Workflows in Parallel
One of ComfyUI's most powerful features is the ability to run multiple workflows simultaneously, allowing you to experiment and compare results efficiently. This becomes especially valuable when testing different settings or trying to find the perfect combination for your specific needs.
Step 1: Group Nodes
Group nodes consolidate multiple nodes into one unified component, perfect for organizing complex workflows. They allow customizable layouts and visible inputs/outputs, making them ideal for combining related components like positive and negative prompts.
Step 2: Creating Parallel Workflows
The process starts with grouping and cloning your workflow. First, select all nodes by clicking the control button, right-click, and choose "Convert to Group Node." After naming your group, you can clone it with a simple right-click and selecting "clone." This creates an exact duplicate of your entire workflow, ready for modifications.
Step 3: Testing Different Settings
With parallel workflows, you can experiment with various aspects simultaneously:
- Test different samplers on the same prompt
- Compare varying CFG values
- Try multiple model combinations
- Experiment with different prompt variations
For example, in my testing with a T4 GPU, I set up two identical workflows with different samplers. The first used DPM++ 2M, while the second used UniPC. By using different filename prefixes (like "dpm_test" and "unipc_test"), I could easily identify and compare the results.
The Bypass Feature
Sometimes you'll want to temporarily disable a workflow without deleting it - perhaps to focus on fine-tuning one particular version. The bypass feature (accessed via right-click on any node) makes this possible. When bypassed, a workflow remains in your workspace but is completely ignored during execution. This is particularly useful during the experimentation phase, allowing you to keep alternative versions of your workflow while focusing on specific variations.
Best Practices for Parallel Processing
- Keep your filename prefixes descriptive and organized
- Use the bypass feature instead of deleting workflows you might need later
- Start with small changes between parallel workflows to better understand their impact
- Monitor your VRAM usage when running multiple complex workflows
This parallel workflow capability transforms ComfyUI from a simple image generation tool into a powerful experimentation platform, allowing you to systematically improve your results through controlled testing and comparison.
ComfyUI Masterclass Part 5
In part 5 of the ComfyUI Masterclass series, we explore everything you need to know about image-to-image workflows in ComfyUI.