AI Technical Articles
ComfyUI for Non-Developers: A Real txt2img Workflow with KSampler, VAE, and VRAM Checks
ComfyUI is a visual programming environment for diffusion models. The interface looks complex because every operation is visible, but that visibility is the feature: you can see where the checkpoint enters, how text becomes conditioning, where denoising happens, and where the latent becomes an image. A non-developer does not need to master every node; they need one graph they can save, rerun, and explain.
Key Takeaways
- Start with six node types: checkpoint, text conditioning, latent canvas, KSampler, VAE decode, and image output. The example uses seven node instances because positive and negative prompts have separate text encoders.
- Keep the seed, steps, CFG, sampler, resolution, and checkpoint beside every output.
- Use ComfyUI Manager only for a named custom node; record its version before sharing a workflow.
- When VRAM fails, change one variable and log the result instead of rebuilding the graph.
Five practical ComfyUI habits
- Start with six node types. Load Checkpoint, CLIP Text Encode, Empty Latent Image, KSampler, VAE Decode, and Save Image are enough for a first txt2img workflow.
- Keep the sampler parameters visible. Seed, steps, CFG, sampler, scheduler, resolution, and batch size are the variables that explain most output changes.
- Save the workflow JSON. A PNG without its graph is difficult to reproduce; the JSON records node classes, connections, and inputs.
- Install custom nodes deliberately. Use ComfyUI Manager for a named dependency, then record the node and version in the project note.
- Treat VRAM errors as a decision tree. Reduce resolution or batch size first, then remove a custom node or use tiled upscale. Change one thing per run.
A concrete txt2img workflow
The graph above is intentionally small. The checkpoint provides the model, CLIP, and VAE. Two text encoders create positive and negative conditioning. KSampler denoises an empty latent, VAE Decode converts that latent to pixels, and Save Image writes the result. If an output changes, there is a short list of inputs to inspect.
| Node | Role | First setting to inspect |
|---|---|---|
| Load Checkpoint | Loads model, CLIP, and VAE | Checkpoint filename and model family |
| CLIP Text Encode | Turns positive/negative prompts into conditioning | Prompt text and clip connection |
| Empty Latent Image | Creates the canvas | Width, height, batch size |
| KSampler | Performs denoising | Seed, steps, CFG, sampler, scheduler |
| VAE Decode | Converts latent to pixels | VAE connection and tile settings |
| Save Image | Writes output and metadata | Filename prefix and output folder |
Run the same graph through the local API
ComfyUI can queue a workflow through its local HTTP endpoint. The example below uses standard node class names and a fixed seed so a beginner can compare one change at a time. Replace the checkpoint filename with a model installed on your own machine.
import requests
workflow = {
"4": {"class_type": "CheckpointLoaderSimple",
"inputs": {"ckpt_name": "sdxl_base_1.0.safetensors"}},
"6": {"class_type": "CLIPTextEncode",
"inputs": {"text": "a red lighthouse at dusk", "clip": ["4", 1]}},
"7": {"class_type": "CLIPTextEncode",
"inputs": {"text": "blurry, distorted, extra fingers", "clip": ["4", 1]}},
"5": {"class_type": "EmptyLatentImage",
"inputs": {"width": 768, "height": 768, "batch_size": 1}},
"3": {"class_type": "KSampler",
"inputs": {"seed": 1234, "steps": 20, "cfg": 7,
"sampler_name": "euler", "scheduler": "normal",
"denoise": 1.0, "model": ["4", 0],
"positive": ["6", 0], "negative": ["7", 0],
"latent_image": ["5", 0]}},
"8": {"class_type": "VAEDecode",
"inputs": {"samples": ["3", 0], "vae": ["4", 2]}},
"9": {"class_type": "SaveImage",
"inputs": {"filename_prefix": "tti_test", "images": ["8", 0]}}
}
r = requests.post("http://127.0.0.1:8188/prompt",
json={"prompt": workflow}, timeout=30)
r.raise_for_status()
print(r.json())
The request returns a prompt identifier. Keep that identifier with the output, then inspect the history endpoint or the UI queue when debugging. This is a local example; do not expose the server to the public internet without authentication and network controls.
Illustrative worksheet: record setup effort and reruns
The numbers below are illustrative example entries, not observed test results or a hardware benchmark. Replace them with your own recorded runs before comparing workflows. For a repeatable protocol, define “setup time” as the time until an image passes three checks: the subject is present, the composition is readable, and there is no obvious generation error. Record the GPU, checkpoint, resolution, settings, and failure reason alongside the time. “Reruns passing” records how many of four attempts queue successfully without a missing node or configuration failure; it does not measure image quality. A shorter example time and fewer passing reruns show why these columns must be read separately.
| Workflow | Example setup time | Example reruns passing | What changed |
|---|---|---|---|
| Starter graph | 18 min | 4/4 | No custom nodes |
| Reusable template | 12 min | 3/4 | Saved JSON and fixed seed |
| Checkpointed workflow | 9 min | 3/4 | Metadata and version note |
| High-resolution retry | 23 min | 2/4 | Reduced size after OOM |
VRAM troubleshooting without guesswork
A CUDA out-of-memory message does not mean the workflow is unusable. Change one variable, rerun, and write down the result. Resolution and batch size are the first levers; custom nodes and upscalers can be isolated after the base graph works.
Editorial Verdict
The beginner-friendly ComfyUI workflow is a saved graph with visible parameters, not a giant template downloaded without context. Start with the seven-node txt2img example, run it through the UI or local API, and promote a template only after it survives a rerun.
FAQ
What does KSampler control?
It controls the denoising pass: seed, steps, CFG, sampler, scheduler, denoise strength, and the connections to model, conditioning, and latent image.
Why do I need both CLIP and VAE?
CLIP turns text into conditioning; VAE converts between pixel images and the latent representation used by the sampler. They solve different parts of the pipeline.
When should I install a custom node?
Only when the base graph cannot perform the task. Record the node name and version, and keep a working baseline so a dependency failure is reversible.