SDXL Prompt Encoder (Searge)
The dual-CLIP prompt encoder for base and refiner
- base_clip
- refiner_clip
- base_positive
- base_negative
- refiner_positive
- refiner_negative
This is the node that turns your prompts into conditioning for a full SDXL base-plus-refiner run - and it does it for both models at once. Feed it your positive and negative text plus both CLIP models, and it hands back four conditioning outputs: positive and negative for the base, positive and negative for the refiner. It's doing in one node what would otherwise be a small forest of CLIP Text Encode nodes.
The reason it's more involved than a stock encoder is that SDXL's conditioning is more involved than SD 1.5's. SDXL has two text encoders on the base - OpenCLIP bigG and CLIP-L - and it also conditions on size and crop information. This node exposes all of that. Its category is Searge/_deprecated_/ClipEncoding, so it's from the older toolkit, but it's a great window into how SDXL conditioning actually works under the hood.
How it works
SDXL's base model reads two text streams. Searge splits your prompt into pos_g (the "global" prompt, fed to bigG) and pos_l (the "local" prompt, fed to CLIP-L), with matching neg_g/neg_l on the negative side. In practice you often put the same text in both, but the split lets you emphasize composition versus detail differently. The pos_r/neg_r pair is the prompt for the refiner, which uses its own single CLIP.
On top of the text, SDXL takes micro-conditioning: an "original size," a crop offset, and a "target size." The node's base_width/base_height/target_width/target_height default to 4096 and crops to 0 - Searge deliberately sets these high, which is a known trick to nudge SDXL toward cleaner, higher-perceived-resolution output. The pos_ascore/neg_ascore values are the refiner's aesthetic-score conditioning (6 and 2.5 by default), a knob unique to how the refiner was trained.
The inputs and outputs that matter
Required plumbing: base_clip and refiner_clip (from your loaded checkpoints). The fields you'll actually write into:
- pos_g / pos_l - your positive prompt for the base's two encoders. Same text in both is a fine starting point.
- neg_g / neg_l - your negative prompt. Keep SDXL negatives short; the SD 1.5 wall-of-negatives habit hurts here.
- pos_r / neg_r - the refiner's positive/negative prompt.
The size, crop, and ascore fields have sensible defaults - leave them unless you know what you're steering. Outputs are the four conditioning wires: base_positive, base_negative, refiner_positive, refiner_negative, which go straight into the base+refiner sampler.
How to install it
ComfyUI Manager: search SeargeSDXL, install, restart. Manual: python -m pip install opencv-python in ComfyUI's Python env (required), then cd ComfyUI/custom_nodes && git clone https://github.com/SeargeDP/SeargeSDXL.git, restart. Windows portable has an installer script.
No models to download for the node itself, but you'll need the base and refiner CLIPs - i.e. the SDXL base and refiner checkpoints loaded elsewhere in the graph.
Where people get burned
- No refiner loaded, but wiring the refiner outputs. If you're not running a refiner, use the base-only encoder (SeargeSDXLBasePromptEncoder) instead of leaving refiner sockets dangling.
- Over-stuffing negatives. SDXL does better with concise negatives. Dumping a hundred tokens of "bad hands, extra fingers…" in here is an SD 1.5 reflex that backfires.
- Fiddling the size/crop fields blind. The 4096 defaults are intentional. Random values there can subtly wreck composition - change them only with a reason.
Inputs (18)
| Name | Type | Default | Description |
|---|---|---|---|
| base_clip | CLIP | — | |
| refiner_clip | CLIP | — | |
| pos_g | STRING | POS_G | — |
| pos_l | STRING | POS_L | — |
| pos_r | STRING | POS_R | — |
| neg_g | STRING | NEG_G | — |
| neg_l | STRING | NEG_L | — |
| neg_r | STRING | NEG_R | — |
| base_width | INT | 40960–16384 | — |
| base_height | INT | 40960–16384 | — |
| crop_w | INT | 00–16384 | — |
| crop_h | INT | 00–16384 | — |
| target_width | INT | 40960–16384 | — |
| target_height | INT | 40960–16384 | — |
| pos_ascore | FLOAT | 6.000–1000 | — |
| neg_ascore | FLOAT | 2.500–1000 | — |
| refiner_width | INT | 20480–16384 | — |
| refiner_height | INT | 20480–16384 | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| base_positive | CONDITIONING | — |
| base_negative | CONDITIONING | — |
| refiner_positive | CONDITIONING | — |
| refiner_negative | CONDITIONING | — |