Stepwise KSampler (Save Latents)
A KSampler that saves every step's latent — the tool that made the paper's grids possible
- model
- positive
- negative
- latent_image
- latent
- save_dir
You've probably seen one of those grids where every cell is the same prompt at a different denoising step - step 1 a gray smear, step 5 a ghost of a composition, step 20 the finished image. That grid is this node's whole reason for existing. StepwiseKSampler is a stock KSampler with one difference: it dumps the latent to disk at every step it's asked to, as .pt files, so you can inspect (or decode, or re-load) exactly what the model was thinking mid-generation. It's the analysis backbone of the AsymmetricQuantSampler pack - the paper's "what does each step actually do" figures came out of this thing.
Mechanically it's as close to the stock node as you can get while still being a different node. It calls ComfyUI's comfy.sample.sample() with the exact same path a regular KSampler uses, and wraps the preview callback so that at each step it writes step_0001.pt, step_0002.pt, and so on into a timestamped folder. Each file stores the noisy sample and the model's x0_prediction (the denoised guess for that step), plus a metadata.json with your seed, sampler, scheduler, steps, and cfg - handy for reproducibility. It also handles the FLUX 16-channel latent quirk automatically via fix_empty_latent_channels, which is a real convenience for a FLUX-focused pack. The final latent is saved as step_final.pt.
The inputs that matter: save_steps is a comma-separated string, default "all" - set it to something like "1,3,5,10,20" to skip the boring steps and save disk. save_prefix (default stepwise) names the output folder. Everything else - model, positive, negative, latent_image, seed, steps, cfg, sampler_name, scheduler, denoise - is a plain KSampler. Two outputs: latent (the final result, so it works as a drop-in KSampler replacement in a normal workflow) and save_dir, a STRING pointing at the folder that got written. That second output is the one you care about, because it's what feeds the pack's two companion nodes: StepwiseLatentLoader to pull a specific step back into the graph, and StepwiseLatentPreview to decode a selection into a comparison grid. Since this node is marked as an output node in the graph, use it as a terminal or wire save_dir onward as needed.
Where people get caught: the .pt files aren't PNGs - they're raw latent tensors, and the only things that know how to read them are this pack's other nodes (or a little PyTorch of your own). And the folder goes to your ComfyUI output/ directory, not to wherever you wish it went; follow the save_dir output if you lose track of it. Disk usage is the other thing to budget for - save_steps="all" on a 20-step run writes 21 tensors of the full latent resolution, which adds up across experiments, so trim the list once you've seen the pattern. Also note the parse is simple: anything in save_steps that isn't an integer or "all" is silently ignored, so keep it clean.
Install is the pack install, no surprises: ComfyUI Manager → search "Asymmetric Quantization Sampler", or clone the repo into custom_nodes:
cd ComfyUI/custom_nodes/
git clone https://github.com/lee09lee26/ComfyUI-AsymQuantSampler.git
Restart, done. There are no pip dependencies - the pack runs on ComfyUI built-ins alone - so this is one of the easier custom nodes you'll add this month. If you're coming from the dual-model side of the pack, this is the node that lets you see why the first three steps tolerate a Q2_K: run the same prompt through it with a full model and watch how little happens to the image after step 3. That's the whole thesis, made visible.
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| positive | CONDITIONING | — | |
| negative | CONDITIONING | — | |
| latent_image | LATENT | — | |
| seed | INT | 420–18446744073709550000 | — |
| steps | INT | 201–10000 | — |
| cfg | FLOAT | 1.00–100 | — |
| sampler_name | COMBO | 44 options: euler, euler_cfg_pp, euler_ancestral, euler_ancestral_cfg_pp, heun, heunpp2, +38 | |
| scheduler | COMBO | 9 options: simple, sgm_uniform, karras, exponential, ddim_uniform, beta, +3 | |
| denoise | FLOAT | 1.000–1 | — |
| save_steps | STRING | all | — |
| save_prefix | STRING | stepwise | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| latent | LATENT | — |
| save_dir | STRING | — |