Lists Cartesian Product
Run every combination of your settings in one pass
- *
- *
- *
- *
- *
- *
- *
- *
- *
So you want to test three CFG values against two LoRA strengths against four seeds. You could build an XY plot, or you could run the whole grid by hand. Or you could let Lists Cartesian Product do the thing it's named for: take your lists, compute every combination, and feed them all through one workflow.
This is the "batched prompt variations" trick from ComfyUI's playbook - the graph lets you express a sweep that a form-based UI can't - without learning the XY plot node's wiring. It's a utility node, plain as that.
How it works
The whole node is one call to itertools.product, plus a transpose. Give it lists [A, B, C], [a, b], and [5, 7], and it produces three output lists, each 12 long: the first repeats [A, A, A, A, B, B, B, B, C, C, C, C], the second cycles [a, a, b, b, ...], the third runs the CFG values [5, 7, 5, 7, ...]. Every output position is one distinct combination, so whatever you wire the outputs into executes once per combination. Because each output is marked as a list, ComfyUI loops downstream nodes over them for you.
The input that matters
There's exactly one widget: inputs_len (an INT, default 2, min 2, max 9). It sets how many input/output pairs the node has. And here's the fiddly bit that trips everyone up: changing the widget doesn't change the sockets. You have to right-click the node and pick "update I/Os" at the top of the menu - a small JavaScript extension ships with the pack to add and remove those i1…i9 / o1…o9 ports. If you change the number and see no new sockets, that's the step you forgot.
All ports are typed * ("any"), so you can feed in lists of numbers, text, conditioning, whatever - no type-matching fights. The nine outputs are all lists; wire them to the inputs of a KSampler, a LoRA loader, a prompt node, and so on.
Install
Easiest path: ComfyUI Manager → Install Custom Nodes → search "Lists Cartesian Product". Or, old school:
cd ComfyUI/custom_nodes
git clone https://github.com/bmad4ever/comfyui_lists_cartesian_product
Then restart ComfyUI. That's it - there's no requirements.txt and nothing to download. The whole pack is one ~35-line Python file and the I/O-update script. No models, no GPU tax.
Where people get burned
The math is the trap. The output length is the product of all input lengths, and it grows fast: 3 × 4 × 5 = 60 images. A sweep that feels small on paper can become a long queue fast, so count before you queue. The other classic: leaving inputs_len at its default of 2 when you meant three lists - the third combination silently never happens. Update I/Os, check the socket count, run.
One more note: this pack is versioned and the dynamic I/O logic had a real bug in earlier builds (the fix is commented right in the shipped source). If "update I/Os" ever leaves stray sockets or drops your wiring, pull the latest version rather than fighting it.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| inputs_len | INT | 22–9 | — |
Outputs (9)
| Name | Type | Description |
|---|---|---|
| * | * | — |
| * | * | — |
| * | * | — |
| * | * | — |
| * | * | — |
| * | * | — |
| * | * | — |
| * | * | — |
| * | * | — |