AI · Setup & Infrastructure
Building a Workflow
The SDXL minimal workflow from scratch — node by node, following the data flow.
Open ComfyUI and delete everything on the canvas — if default nodes are present, select all and remove them. What remains: an empty canvas.
That's where we start.
You're now building the SDXL minimal workflow from 2.2.2 — ComfyUI: Philosophy and Interface from scratch — node by node, in the order of the data flow. At the end you'll have a working workflow that does exactly what the JSON you loaded there does. Only this time you'll know why every node sits where it sits.
Adding nodes: right-click on the empty canvas → search field appears → type the node name → Enter. The node appears on the canvas. Drawing connections: drag from the output point of one node to the input point of the next. ComfyUI only allows compatible connections — if a connection isn't possible, it's a type mismatch, not a positioning issue.
The loader
Right-click → search for CheckpointLoaderSimple → add.
This node sits all the way to the left — it's the source of all data in the workflow. In the dropdown, select your SDXL checkpoint: Juggernaut XL, or whatever you installed in Stability Matrix.
The node has three outputs: MODEL, CLIP, VAE. All three are needed — none stays unconnected.
Don't draw any connections yet. Place all nodes first, then connect.
The text fields
Right-click → CLIPTextEncode → add. Then the same again.
Two identical nodes, two different roles. Think of the first as "positive" — what should be in the image. The second as "negative" — what shouldn't.
Both have a CLIP input and a CONDITIONING output. Connect the CLIP input of both nodes to the CLIP output of the CheckpointLoaderSimple. One connection, two receivers — ComfyUI allows this.
You can enter text now or later. For a first test, a simple prompt in the positive field and blurry, low quality in the negative is enough.
The empty latent
Right-click → EmptyLatentImage → add.
This node creates the workspace for diffusion — an empty field at the specified resolution. Standard for SDXL: 1024×1024. For quick testing: 512×512 is significantly faster, with some quality trade-off.
Don't connect yet — this node's output goes into the KSampler, which we don't have yet.
The sampler
Right-click → KSampler → add.
The central node. It has four inputs: MODEL, positive CONDITIONING, negative CONDITIONING, LATENT. And one output: the processed LATENT.
Now connect:
- MODEL output of
CheckpointLoaderSimple→ MODEL input ofKSampler - CONDITIONING output of positive
CLIPTextEncode→ positive input ofKSampler - CONDITIONING output of negative
CLIPTextEncode→ negative input ofKSampler - LATENT output of
EmptyLatentImage→ latent_image input ofKSampler
Parameters in the KSampler:
- seed — random number, determines the starting point of diffusion. Same seed + same prompt + same parameters = reproducible result. Set to "randomize" to get a new seed each run — useful for exploring. Set to "fixed" to keep the seed constant — useful when you've found a good starting point and want to vary only the prompt or individual parameters.
- steps — 30 to 35 for SDXL
- cfg — 4 to 5 for photorealistic results with Juggernaut XL
- sampler_name —
dpmpp_2m - scheduler —
karras - denoise — controls how much of the incoming latent is replaced by noise before diffusion begins. At 1.0 the model starts from pure noise, giving the prompt maximum influence. For generation from an empty latent like here: always 1.0. Lower values are relevant for image-to-image — when an existing image serves as starting point and should only be partially changed.
What is CFG?
CFG stands for Classifier-Free Guidance — a value that determines how strictly the model follows the prompt. Low: the model interprets freely, the prompt is more of a direction. High: the model follows the prompt very closely, at the cost of naturalness and image quality.
For SDXL with Juggernaut XL, the sensible range is 4–7. Below that, results become too generic; above that, colors and contrast start to clip — oversaturation, hard edges, unnatural textures.
With Flux.1 dev, a different rule applies: CFG must be set to 1 — without exception. Flux is a guidance-distilled model: prompt steering is already trained into the architecture, an external CFG value works against it. Setting CFG to 7 with Flux as you would with SDXL produces poor results — not because the prompt is wrong, but because the value is wrong. This is one of the most common mistakes when switching from SDXL to Flux.
Sampler and scheduler — what's behind them?
Samplers are the mathematical algorithms that determine how the model iterates from noise to image. euler is the simplest and most stable — it iterates conservatively per step and works reliably even with fewer steps. dpmpp_2m uses information from the previous step to take larger jumps: more efficient, but needs enough steps to deliver. Below 25 steps it can start producing artifacts. euler_ancestral adds additional noise per step — more variation between runs, even with the same seed.
Schedulers determine how quickly noise decreases over steps. exponential drops steeply early — the model does the rough work quickly and has steps left for detail. This works well with fewer steps. karras holds noise at a mid level longer, only dropping late — more iterations for fine detail, but only useful if those iterations are available. From 30 steps up this becomes visible. simple is the linear variant and the standard for Flux.
A practical guide: at 20–25 steps use euler + exponential — stable, no artifacts. At 30–35 steps dpmpp_2m + karras is worthwhile — more efficient, more room for detail. Prompt and CFG influence the result more than sampler choice in most cases.
VAE and output
Right-click → VAEDecode → add.
Right-click → SaveImage → add.
VAEDecode needs two inputs: the LATENT from the KSampler, and a VAE. Connect:
- VAE output of
CheckpointLoaderSimple→ VAE input ofVAEDecode - LATENT output of
KSampler→ samples input ofVAEDecode - IMAGE output of
VAEDecode→ images input ofSaveImage
The workflow is now fully connected.
Queue
Top right: Queue. ComfyUI processes nodes in the correct order — following the data flow, not left to right as placed. Progress is visible in the status bar.
If everything is connected and model paths are correct, an image appears on the canvas after the configured steps.
What you have in front of you
Seven nodes, all connected, a working SDXL workflow.
This is exactly the same structure as the JSON from 2.2.2 — only this time you built it yourself. If you now save the workflow as JSON via Save, you get a file you can share with anyone running ComfyUI. It loads the same workflow, with the same connections, the same parameters.
A workflow isn't a secret and isn't a program — it's a described process. Readable, shareable, modifiable.
What comes next
This workflow is the starting point — not the goal. From here, everything can be extended: an external VAE instead of the embedded one, a LoRA influencing the style, a ControlNet node taking composition from an input image.
But that comes later. First come the model-specific setups — SDXL and Flux.1 dev with their respective parameters, quirks, and recommended starting configurations.