Nodes/comfyui_ab_sampler/AB SamplerCustom (experimental)
ComfyUI Node

AB SamplerCustom (experimental)

The sampler that runs two whole recipes and stitches them together — on purpose

By bmad4ever·Created 3 years ago·Updated 2 years ago· 11
AB SamplerCustom (experimental)
  • sampler
  • latent_image
  • sigmasA
  • sigmasB
  • modelA
  • positive_A
  • negative_A
  • positive_B
  • negative_B
  • modelB
  • roi_mask
  • output
  • denoised_output
add_noisetrue
noise_seed0
cfgA8.0
cfgB8.0

AB SamplerCustom is the node you reach for when one sampler isn't enough and you want to interleave two of them. Every step alternates between a complete "A" sampling setup (model, prompt, CFG, noise schedule) and a complete "B" setup, so the denoising trajectory is a ping-pong match between two different recipes instead of one run with one prompt. It's from bmad4ever, the author behind a bunch of ComfyUI custom nodes, and it ships with an honest disclaimer in the README: applications are niche and "there are likely better alternative approaches." Read that as this is a toy for the curious, not a tool you'll wire into a production workflow. Only 2 people even found it on comfy.icu. You're in early.

How it actually works

This is a re-skinned version of ComfyUI's built-in SamplerCustom node with two full input sets. On each loop it runs an A step on your latent, then a B step, and keeps going until the shorter of the two sigma schedules runs out. A goes first.

Here's the weird part, and it's worth understanding before you judge it. The B steps don't run on your normal latent - they run on a 2x2 grid. Your current A-result goes in the top-left quadrant, and the other three quadrants are copies of the original input latent. Why? So B can see your evolving result and the original image at the same time, in one tensor. After B finishes, its top-left quadrant gets copied back into the real latent and the next A step continues. The author describes exactly this in the README: 3/4 of the grid is copies of the original.

The optional roi_mask turns it into a region-locked sampler. With a mask connected, everything outside the region is copied back from the original latent at the end of every step. That's sampler-level masked editing - only the ROI evolves, the rest stays bit-identical, which is the same guarantee the KB's inpainting panel leans on. No inpainting checkpoint required.

The inputs that matter

The full info_schema is big, but a beginner really sets these:

  • sigmasA / sigmasB - two SIGMAS schedules (from BasicScheduler or similar). There is no steps field. Your step count is just the length of these tensors, and if they differ, the longer one keeps running alone after the shorter dies. Same for both sides, so "5 A steps, 20 B steps" is a real configuration.
  • cfgA / cfgB - default 8, range 0–100. Different values mean one side steers hard toward its prompt and the other doesn't. Given every 2026 model family has its own CFG sweet spot, don't assume the defaults suit your checkpoint.
  • positive_A / negative_A / positive_B / negative_B - two full conditioning sets, i.e. two prompts (or two CLIP-text-encode chains).
  • modelB - optional; if you leave it disconnected it silently defaults to modelA. So you can alternate prompts alone, or actually swap checkpoints mid-sampling.
  • sampler - one shared sampler for both sides. You can't give A and B different samplers.
  • roi_mask - the region lock described above.

Both outputs are LATENT: output (wire it into VAEDecode) and denoised_output. One honest gotcha: in the shipped code the internal callback that computes the denoised prediction is commented out, so denoised_output is effectively a mirror of output. Don't build around it.

Install

No dependencies, no model files - the pack imports only nodes that ship inside ComfyUI itself, and it has no requirements.txt. The easy way:

ComfyUI Manager → Install Custom Nodes → search "comfyui_ab_sampler" (or comfyui_ab_samplercustom).

Or manually:

cd ComfyUI/custom_nodes
git clone https://github.com/bmad4ever/comfyui_ab_samplercustom

Restart ComfyUI. It appears under Bmad/experimental in the node menu.

Where people get burned

  • Looking for a steps box and not finding one. Steps come entirely from the sigmas tensors; forget to connect a scheduler and you get an error, not a default.
  • Expecting predictability. B is conditioning against a grid with three copies of the original baked in, and B's steps run on a zero-noise tensor - this isn't a standard trajectory, so results are more "lets see what happens" than fine-tunable.
  • Treating it as a normal sampler. The author's own README says to expect niche behavior. If what you actually want is two-pass sampling or masked inpainting, the built-in nodes do it better and with less surprise.

Which is the honest bottom line: this is an experiment someone shipped as a learning tool and a curiosity. If you like poking at the machinery, it's a great one to reverse-engineer. If you need a reliable output, look elsewhere.

CategoryBmad/experimental

Inputs (15)

NameTypeDefaultDescription
add_noiseBOOLEANtrue
noise_seedINT00–18446744073709550000
samplerSAMPLER
latent_imageLATENT
cfgAFLOAT8.00–100
cfgBFLOAT8.00–100
sigmasASIGMAS
sigmasBSIGMAS
modelAMODEL
positive_ACONDITIONING
negative_ACONDITIONING
positive_BCONDITIONING
negative_BCONDITIONING
modelBoptMODEL
roi_maskoptMASK

Outputs (2)

NameTypeDescription
outputLATENT
denoised_outputLATENT