Encode Prompt Batch
The [SEP] Trick That Made ADetailer Great, Now in ComfyUI
- clip
- positive
- negative
If you ever used ADetailer in the WebUI world, you remember the [SEP] trick: write one prompt, throw [SEP] between segments, and each detected face gets its own prompt while the first segment stays global. It was one of those features people learned about and went "wait, I can do that?" SimpleSyrup's author missed that workflow enough that they ported it into ComfyUI, and Encode Prompt Batch is the port. Type portrait of a smiling woman [SEP] close-up of her green eyes, and you get an ordered CONDITIONING_BATCH: entry 0 is global, each later entry belongs to a mask or SEG in order.
How it works
The inputs are a clip, a positive_prompt, a negative_prompt, and a separator (default [SEP]). The node splits both prompt fields on the separator and CLIP-encodes each segment into its own conditioning entry, producing matched positive and negative batches. Two behaviors make it forgiving:
[SEP|name]labels:[SEP|eyes]adds an organizational label so you can tell batch entries apart when the graph gets busy. Matching still follows order - the label is just for readability.- Missing regional entries fall back to the global prompt: if your positive has three regions but your negative only has one global line, the negative's global entry fills the missing regions. You don't have to write matching negatives for every region, and unbalanced prompt/negative counts won't silently produce empty conditioning.
The outputs - positive and negative CONDITIONING_BATCH - feed straight into SimpleSyrup's batch-aware samplers (KSampler (Prompt by Region), Compose Regional Conditioning) or the detailers' per-region inputs.
The ordering trap
Position is the whole contract, and it's the same trap ADetailer users hit: the prompts bind to regions in order, not to the subjects you meant. The Red Sonja-and-Conan demo of this failure is legendary - the two characters swapped prompts because the ordering was wrong. So the discipline is: first segment is global, then face, then hands, in exactly the order your masks/SEGS arrive. When the right prompt lands on the wrong region, it's never the node's fault and always your ordering.
Why you'd reach for it
Two reasons. First, it's the fastest way to build a regional batch - one text box instead of a chain of Start/Append nodes. Second, it's the natural partner to detected regions: run Detect SEGS w/ Ultralytics or SAM-based detection, pair each region with a [SEP] segment, and you've rebuilt the ADetailer loop with far more control over the region geometry.
Install
Ships in the SimpleSyrup pack. ComfyUI Manager → search SimpleSyrup → Install → restart. Or:
Set-Location ComfyUI\custom_nodes
git clone https://github.com/Artificial-Sweetener/SimpleSyrup.git
Set-Location SimpleSyrup
..\..\venv\Scripts\python.exe -m pip install -r requirements.txt
Restart after. Current ComfyUI required (v3 extension API). The pack's own requirements add TorchLanc, Ultralytics, ONNX Runtime and Segment Anything, among others.
Common issues
- Region gets the wrong prompt - ordering. Count segments and regions; they must match.
- Negative seems to do nothing per-region - you only wrote one global negative. That's by design (global fills the gaps), but if you want per-region negatives, add them with
[SEP]. - Node missing after install - stale ComfyUI. Update it first.
It's the single most pleasant way into regional prompting in this pack, and it makes the mental model click: text in, ordered batch out.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| clip | CLIP | Text encoder used to turn each prompt entry into conditioning. | |
| positive_prompt | STRING | Ordered positive prompt entries separated by [SEP] or [SEP|name]; the global entry fills missing positive regions. | |
| negative_prompt | STRING | Ordered negative prompt entries separated by [SEP] or [SEP|name]; the global entry fills missing negative regions. | |
| separator | STRING | [SEP] | Text marker that separates prompt entries. With the default [SEP], use [SEP|name] to add an organizational label. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| positive | CONDITIONING_BATCH | Ordered positive conditioning entries for batch-aware consumers. |
| negative | CONDITIONING_BATCH | Ordered negative conditioning entries for batch-aware consumers. |