Contents

15 / 153

The Foundations

The single most important piece of infrastructure: ComfyUI

Chapter 14

17 min read

Reviewed v78 · August 2026

We need to spend some time on a piece of software that is not a model and not a company, but without which the entire ecosystem of generative imagery would look completely different. That piece of software is ComfyUI, and the story of how it came to exist is one of the more remarkable side stories in the history of this field.

01

The origin

In January 2023, five months after the public release of Stable Diffusion, an anonymous developer who goes only by the handle 'comfyanonymous' published the first version of ComfyUI on GitHub. The person behind the handle has never publicly identified themselves. What is known is that they were working alone, that they built ComfyUI in part to learn how Stable Diffusion worked under the hood, and that they made an unusual design choice: instead of building a traditional web interface with text fields and buttons, they built a node-based graph editor.

If you have ever used Blender's compositing nodes, or Houdini, or Unreal Engine's Blueprints, or Touch Designer, you know what node-based interfaces look like. The screen is a canvas. On the canvas sit boxes (the nodes), each of which represents a single operation. Boxes have inputs on the left and outputs on the right. You connect outputs to inputs by dragging lines between them. The whole graph forms a directed flow of data from the source nodes (loaders) through processing nodes to output nodes (savers and previewers). When you press 'queue prompt,' the graph executes from left to right.

This kind of interface is unusual for a deep learning tool. Most other Stable Diffusion interfaces, AUTOMATIC1111's web User Interface (UI) was the dominant one in 2023, looked like a normal form: a text box for the prompt, a slider for the steps, a dropdown for the sampler, a button to generate. ComfyUI's node graph was harder to learn, more verbose for simple tasks, and visually intimidating. It seemed like a worse interface.

02

Why nodes turned out to be the right choice

It was not a worse interface. It was a much better one, for reasons that took a year for the community to fully appreciate.

The first reason is transparency. In a form-based UI, the steps of the diffusion process are hidden inside the application code. The user does not see that there is a model loader, a text encoder, a noise generator, a sampler, a VAE decoder, and a save step, they just see a 'generate' button. In ComfyUI, every one of those steps is a visible node on the canvas. You can see what is happening, in what order, and you can intervene at any point. You learn how the model actually works just by looking at the graph.

The second reason is composability. Once every step is a node, you can rearrange them. You can insert custom processing in the middle. You can run the same prompt through multiple samplers and compare. You can chain models together, generate with one model, refine with another, upscale with a third. You can do things that the original interface designers never anticipated, because you are not constrained by the choices they made about which features to expose. ComfyUI is closer to a programming environment than a tool, and that gives it a much higher ceiling.

The third reason is reproducibility. ComfyUI workflows can be saved as JSON files, but more importantly, they can be embedded in the metadata of the PNG files that the workflow produces. If somebody on Twitter posts an image they generated in ComfyUI, you can drag that image into your own ComfyUI canvas, and the entire graph that produced it appears on your screen. You can see exactly which model was used, which prompts, which samplers, which custom nodes, in what order. This reproducibility is unique to ComfyUI in the open-source generative imagery space, and it has had a profound effect on how the community shares techniques. Workflows are the unit of knowledge transfer.

The fourth reason, and this is the one that turned out to matter most for the trajectory of the field, is extensibility. ComfyUI supports custom nodes. Anyone can write a Python script that adds new nodes to the canvas, and other users can install those nodes through a package manager called ComfyUI-Manager. Within a year of launch, there were thousands of community-developed custom nodes for everything from advanced samplers to face restoration to video frame interpolation to Low-Rank Adaptation (LoRA) training to depth map generation. Every time a new technique was published in a research paper, somebody would wrap it in a ComfyUI node within days, often within hours.

03

Why it feels so complicated, and why that is the point

If your first look at a ComfyUI graph felt like being dropped into an airplane cockpit, that reaction is correct, and it is worth sitting with, because the complexity you are seeing is not ComfyUI being needlessly technical. It is the actual machinery of image generation, uncovered. Every other tool you have used hides that machinery behind a single button, the way a microwave hides thermodynamics behind the word Start. ComfyUI takes the cover off. The graph looks complicated because the thing it is showing you genuinely is complicated, and for the first time you are looking straight at it instead of at a friendly facade.

The reason there are so many boxes is that generating an image really does take that many distinct steps, and each box is one of them. A model has to be loaded. Your words have to be turned into numbers the model understands. A canvas of pure noise has to be prepared. That noise has to be denoised step by step under the guidance of your prompt. And the result has to be decoded from the model's compressed inner space back into pixels you can actually see. That is not an arbitrary pipeline someone chose to make painful. It is close to the shortest honest description of what diffusion does. A one-button app runs the exact same steps, it just performs them offstage where you cannot reach them.

So the real distinction between the two kinds of tools is not simple versus complicated, it is sealed versus open. A one-button app is a microwave meal: fast, foolproof, and impossible to change the moment you want something the menu does not offer. ComfyUI is a professional kitchen: every station is exposed, which is overwhelming on the first day and is precisely why a cook there can make something the microwave never could. The intimidating dials are not obstacles standing between you and the image. They are the controls that were always there, finally within your reach.

And here is the part that makes the whole thing learnable. That wall of nodes is not hundreds of separate things to memorize. Almost every workflow, however elaborate it looks, is built from the same short list: load the model, encode the prompt, start from noise, denoise with the sampler, decode with the VAE, save the result. A complicated graph is usually just that same skeleton with a few extra nodes spliced into the middle to do one specific job. Once you can recognize the recurring skeleton, the complexity stops being a wall and starts being a language, and every new workflow you open becomes a sentence you can already mostly read.

04

ComfyUI as the de facto standard

By 2024, ComfyUI had become the dominant power-user interface for Stable Diffusion. AUTOMATIC1111's web UI still had more casual users, but anybody doing serious work, anybody chaining multiple models, doing complex pipelines, using ControlNet, running custom training, was using ComfyUI. Stability AI itself started using it internally to test new model releases. When Stability AI released Stable Diffusion 3 in 2024, the official launch came with a ComfyUI workflow as the reference implementation. When Black Forest Labs released FLUX in August 2024, the same was true. New models now ship with ComfyUI workflows because that is how the community expects to consume them.

The interesting thing is that this dominance has spread beyond just Stable Diffusion. ComfyUI now supports workflows for image models from many vendors, video models including Wan, Hunyuan, LTX, and others, audio models, 3D generation models, and more. Custom nodes exist for accessing the APIs of closed-source models from Runway, Luma, Kling, and OpenAI, so you can mix open-source local models with closed-source cloud models in the same graph. In effect, ComfyUI has become the universal substrate on top of which the entire field operates, the same way Linux became the universal substrate underneath modern computing.

In June 2024, comfyanonymous left Stability AI (where they had been hired during 2023) and, with several core contributors, formed an organization called Comfy Org to put the project on more sustainable footing. Comfy Org has since received support from companies including NVIDIA, which announced ComfyUI integration into its RTX Remix modding software in July 2024, and joined the Open Model Initiative under the Linux Foundation. As of late 2025, the ComfyUI GitHub repository has more than 89,000 stars, putting it among the most-starred AI projects in history. The pseudonymous solo developer who started the project on a whim two and a half years ago is now the technical lead of an organization that effectively stewards the ecosystem layer beneath every major image and video model.

Why this matters for understanding the field. When you use Krea or Flora, you are using a curated, polished interface that hides the underlying complexity. When you use ComfyUI, you see all of it. The reason these two perspectives matter is that almost every clever technique and creative workflow in the generative imagery world is invented in ComfyUI first and then, sometimes, finds its way into the consumer tools. If you want to know what Krea or Flora will support next year, look at what is happening in the ComfyUI custom nodes scene this month. The lag is real but small.

05

How a ComfyUI workflow actually works, briefly

Just so you have a concrete picture, let us build one specific image and follow it through every node. Say you want a cinematic portrait of an astronaut standing in a golden wheat field at sunset, and you are going to make it with an SDXL checkpoint, one of the popular community ones like Juggernaut XL. Here is what that basic Stable Diffusion text-to-image workflow looks like as a graph. At the far left is a 'Load Checkpoint' node, and this is where you point at the Juggernaut file sitting on your disk. When it loads, it hands out three separate outputs, each wired off to whichever node downstream needs it: the diffusion model itself (called the 'unet' or 'transformer' depending on the architecture), the text encoder (the CLIP model) that will read your words, and the VAE that will turn the final result back into pixels.

Fig.diagram
LOAD CHECKPOINTMODEL >CLIP >VAE >CLIP TEXT ENCODEprompt (+)CLIP TEXT ENCODEprompt (-)EMPTY LATENT1024 x 1024KSAMPLERsteps 28cfg 7.0sampler eulerscheduler karrasVAE DECODESAVE IMAGEEVERY STEP OF THE PROCESS IS A VISIBLE NODE. CONNECT OUTPUTS TO INPUTS, PRESS QUEUE, READ LEFT TO RIGHT.
A basic text-to-image workflow in ComfyUI. Every step of the diffusion process is a visible node. Connect outputs to inputs. Press queue. The graph executes left to right.

Next come two 'CLIP Text Encode' nodes, and this is where your astronaut actually gets described. The positive one holds what you want, so you type something like 'an astronaut standing in a golden wheat field at sunset, cinematic, 85mm lens, shallow depth of field.' The negative one holds what you want kept out, the usual suspects like 'blurry, low resolution, extra fingers, text, watermark.' Both take the CLIP text encoder as input and turn your words into conditioning embeddings, the numeric form the model can actually steer toward. Alongside them an 'Empty Latent Image' node creates the blank canvas your astronaut will emerge from, and you set it to 1024 by 1024, SDXL's native resolution.

Then comes the 'KSampler' node, the heart of the workflow and the place your astronaut is actually pulled out of the noise. It takes the model, the positive and negative conditionings, that empty latent, and the handful of parameters that decide how the sampling runs: the number of steps, the guidance scale, the sampling algorithm, and a random seed. For this SDXL portrait you might set 25 steps, a guidance scale of 7, the DPM++ 2M sampler with the Karras scheduler, and, importantly, a fixed seed, because that seed is what lets you reproduce this exact astronaut later instead of rolling a different one. It runs the diffusion loop and produces a denoised latent.

Finally a 'VAE Decode' node takes that denoised latent and converts it back into a real image, your actual astronaut in the wheat field, and a 'Save Image' node writes the PNG to disk. Press queue, the graph executes left to right, and the picture appears. That is text-to-image, start to finish, for one concrete image.

Once you have this, every variation is a small modification to the same graph, and it helps to keep the astronaut in mind as you make them. Want image-to-image, so the composition follows a real photo of a field you shot? Replace the 'Empty Latent' with a 'Load Image' node connected through a 'VAE Encode.' Want the astronaut to consistently be a specific character or painted style across many images? Insert a 'Load LoRA' node between the model loader and the sampler. Want a larger, sharper version for print? Add an upscaling node after the VAE decode. Want the astronaut in an exact pose you sketched? Add a ControlNet loader and route its output into the sampler. Want the astronaut to move instead of stand still? Replace the SDXL loader with a Wan or Hunyuan video loader, swap the KSampler for a video sampler, and replace the save image with a save video. Same skeleton, one piece swapped at a time. The graph composes.

06

The KSampler up close: steps, and why more is not better

The KSampler node is where the denoising actually happens, and it exposes the handful of settings that most determine what your image looks like: the number of steps, the CFG scale, the sampler, and the scheduler. Every other node in the graph exists to feed this one. Understanding these four fields is the difference between operating ComfyUI and merely clicking through a workflow someone else built.

Start with steps. A step is one iteration of denoising. Recall from the diffusion chapter that the model does not paint an image in a single stroke. It starts from pure noise and removes a little of it at a time, re-evaluating after each pass. The step count is simply how many of those passes it runs. At step one the latent is almost entirely noise. By the final step it should be a clean image.

The intuition most people start with is 'more steps, more quality,' and for the first stretch that is true. Going from 10 steps to 20 is usually a visible jump: edges firm up, small objects stop being mush, text gets closer to legible. But the returns flatten fast. The difference between 30 and 50 steps is, for most modern models, almost invisible in a side by side, and past a point extra steps can even slightly degrade an image by over-sharpening or introducing artifacts. You pay linearly in time for a benefit that decays.

The reason few-step models exist at all connects back to distillation. A base model needs many steps because each step can only safely remove a small amount of noise before it starts guessing wrong. Distillation trains a student model to take much larger, more confident steps. This is why you cannot simply run a normal model at 4 steps and expect a distilled result. The normal model was never taught to make jumps that big, and it will hand you a blurry, unresolved mess.

07

CFG scale: the prompt-adherence dial, and what turning it up costs

CFG stands for classifier-free guidance, and the CFG scale is the single most misunderstood setting in the entire stack. It controls how hard the model is pushed to follow your prompt versus how much freedom it has to produce a natural-looking image. It is, in effect, a leash.

The mechanism is worth understanding because it explains the tradeoff. At each denoising step the model actually makes two predictions: one conditioned on your prompt, and one conditioned on nothing at all, an empty prompt. The difference between those two predictions is the direction that points 'toward your prompt.' The CFG scale is how far the sampler travels in that direction. A CFG of 1 ignores the prompt-direction entirely. A CFG of 7 pushes several times harder toward the prompt than the raw conditioned prediction alone would.

So why not set it to 20 and get perfect adherence? Because the prompt-direction is only an approximation, and the further you extrapolate along an approximation, the more it breaks. Crank CFG too high and images become over-saturated, contrast blows out, skin turns plasticky, and fine detail fractures into a fried, crunchy texture. Too low and the image drifts off-prompt, ignoring elements you explicitly asked for, looking washed out and directionless. The craft is finding the point where the model is listening to you but not being tortured.

Fig.interactive

CFG scale

7.0

the working band

15101520
Prompt adherence83%
Artifacts and burn1%
SDXL / SD 1.5 5-8FLUX guidance ~3.5Turbo / Lightning ~1
The CFG dial: prompt adherence rises with guidance until the image starts to burn. The working band for full models sits between 5 and 8, near 3.5 for FLUX guidance, and near 1 for distilled models.

This is the most common mistake when people move a FLUX or Turbo workflow onto SDXL settings, or the reverse. The connection back to distillation is exact. Classifier-free guidance normally requires running the model twice per step, once conditioned and once unconditioned, which doubles the cost. Guidance distillation trains that behavior directly into the weights so the model only has to run once and still behaves as if guided. That is why the fast models both need fewer steps and want a CFG near 1: the guidance is already inside them.

08

Choosing a sampler and scheduler: the part that matters least

The sampler is the algorithm that decides how to move from one step to the next, and the scheduler decides how much noise to remove at each step, the so-called noise schedule. ComfyUI exposes dozens of samplers with intimidating names: Euler, Euler a, Heun, DPM++ 2M, DPM++ 2M SDE, DPM++ 3M SDE, UniPC, DDIM, LMS, and more. The names look like a wall, but they cluster into a few families, and the honest truth is that the sampler matters far less than steps or CFG.

The first useful split is deterministic versus ancestral. A plain sampler like Euler or DPM++ 2M is deterministic: same seed, same settings, same image every time, and the image 'converges,' meaning it settles down and stops changing as you add steps. An ancestral sampler, marked with a trailing 'a' as in Euler a, or 'SDE' as in DPM++ 2M SDE, injects a little fresh noise at every step. That makes it non-converging: it keeps changing as steps increase, and it often adds pleasing texture and variation at the cost of reproducibility. For LoRA work and anything you need to reproduce exactly, prefer a deterministic sampler.

The second split is order, which is really a speed versus accuracy tradeoff. Higher-order samplers such as Heun and the DPM++ 2M and 3M family do more math per step to follow the denoising path more accurately, so they reach a clean result in fewer steps but each step is slower. Euler is first-order: cheapest per step, needs a few more of them. In practice this mostly washes out.

09

When agents drive the graph

The manual node graph is not the end state. In 2026 the same workflows started being driven by agents rather than by hand.

Comfy MCP, launched by Comfy Org on June 30, 2026, is the official bridge. It exposes ComfyUI through the Model Context Protocol so an AI agent, Claude among them, can search for models and nodes, assemble and run workflows, and generate image, video, 3D, or audio, executing on Comfy Cloud GPUs. The agent does the wiring you used to do by dragging.

This matters for the same reason nodes mattered in the first place. Once a workflow is a program an agent can read and write, generation becomes something you can orchestrate in language and fold into a larger automated pipeline. Community tools such as ComfyUI-Copilot push the same idea inside the canvas, suggesting and building graphs for you.

The mental model to carry forward: ComfyUI made every step of generation explicit and composable, and agentic ComfyUI makes those explicit steps something a machine can assemble on your behalf. The power user's graph becomes the agent's API.

Check your understanding

pass: 5 of 7

Answer at least 5 of 7 correctly to unlock the next chapter.

  1. 1. Why did ComfyUI's node graph ultimately beat the simpler form-based interfaces despite being harder to learn?

  2. 2. How can you exactly reproduce an image someone generated in ComfyUI?

  3. 3. Which node is described as the heart of a ComfyUI text-to-image workflow?

  4. 4. Why can you not simply run a normal model at four steps and expect a clean image?

  5. 5. What does the CFG scale actually control?

  6. 6. Why do distilled Turbo and Lightning models typically want a CFG near 1?

  7. 7. What distinguishes an ancestral sampler such as Euler a from a deterministic one?

The weekly briefing

Get the week's moves in your inbox.

A short, sourced digest of what actually moved across generative AI, every week. Free.

Free. One email a week, no spam, unsubscribe anytime. Prefer a reader? RSS.