ComfyUI Node

SDXL Batch Prompts

The Node That Fills One Batch With Many Prompts at Once

By tusharbhuttΒ·Created 3 years agoΒ·Updated about a year agoΒ· 68
SDXL Batch Prompts
  • clip
  • CONDITIONING
  • PROMPT_LIST
  • PROMPT_COUNT
β—„promptsbeautiful landscape mountain sunset ocean wavesβ–Ί
β—„print_outputtrueβ–Ί
β—„max_batch_size0β–Ί

Stock ComfyUI has a real gap here: set a batch size of 4 and you get 4 copies of the same prompt. Want 4 different prompts? You queue 4 runs and generate one at a time. There was a long-running community complaint about exactly this - people asking for a way to batch different prompts in one pass - and this node is a direct answer to it. SDXL Batch Prompts encodes a list of prompts into a single conditioning batch that flows through one KSampler, so a powerful GPU actually earns its keep.

How it works

The mechanics are the interesting part, because "batch encode" has to survive contact with SDXL's dual text encoders (the CLIP-L and CLIP-G pair that SDXL uses). Here's what happens when you hit queue:

  1. Your prompts field is split on newlines into a list.
  2. Each prompt is tokenized and encoded through the clip input with pooled output captured - SDXL's conditioning needs that pooled_output for the timestep conditioning, so this is where most naive "just concat the tensors" nodes break.
  3. The node tries to concatenate everything into one batched conditioning tensor. If the shapes don't line up (different prompt lengths producing ragged tensors, a known SDXL annoyance), it falls back to a list of separate conditionings instead.
  4. Either way, one KSampler consumes the whole thing and produces one image per prompt, simultaneously.

That's the "true batch" claim in the README, and it's the real deal - not queue management pretending to be batching.

Inputs and outputs

The fields that actually matter:

  • prompts (multiline STRING) - one prompt per line, up to 64. This is the whole show.
  • clip (CLIP) - your SDXL checkpoint's CLIP, straight from the loader.
  • max_batch_size (INT, 0–64) - leave at 0 to process every line you typed. Set it higher and the node cycles your prompts to fill the batch; set it lower and it truncates to the first N.
  • print_output (BOOLEAN) - dumps each encoded prompt to the console. Leave it on while you're learning.

Outputs:

  • CONDITIONING - wire this into a KSampler's positive input. It carries the whole batch.
  • PROMPT_LIST (STRING) - your prompts joined with |, useful downstream (e.g. for saving into filenames).
  • PROMPT_COUNT (INT) - how many prompts got encoded. Feed it to anything that needs to know.

Pair it with the pack's Prompt Counter node and you can chain this into an image saver that names each file after its prompt - that's the workflow the author designed it around.

Where people get burned

  • VRAM is the ceiling, not the node. All the prompts process simultaneously, which means a 12-prompt batch needs 12Γ— the latent/conditioning memory of a single run. The author is upfront that he built this because his own card can't do much - check your batch size against your VRAM before you blame the node.
  • Use the SDXL loader, not a random one. This node expects an SDXL-family CLIP. Feeding it an SD 1.5 clip won't do what you want.
  • Empty lines vanish, which is usually helpful but can surprise you if you're counting on a blank prompt as one of your variants.

Installing

ComfyUI Manager (search Endless Nodes) or:

cd ComfyUI/custom_nodes
git clone https://github.com/tusharbhutt/Endless-Nodes

Restart, then look under Endless 🌊✨ β†’ BatchProcessing. The repo ships ready-made SDXL batch workflow JSONs in its workflows folder if you want a starting point. The pack is a single hobbyist's project (GPL v3, no maintenance promises), so treat it as a convenience, not infrastructure.

CategoryEndless 🌊✨/BatchProcessing

Inputs (4)

NameTypeDefaultDescription
promptsSTRINGbeautiful landscape mountain sunset ocean wavesβ€”
clipCLIPβ€”
print_outputBOOLEANtrueβ€”
max_batch_sizeINT00–64β€”

Outputs (3)

NameTypeDescription
CONDITIONINGCONDITIONINGβ€”
PROMPT_LISTSTRINGβ€”
PROMPT_COUNTINTβ€”