Nodes/SeargeSDXL/SDXL Prompt Encoder (Searge)
ComfyUI Node Runs on cloud

SDXL Prompt Encoder (Searge)

The dual-CLIP prompt encoder for base and refiner

By SeargeDP·Created 3 years ago·Updated 2 years ago· 870
SDXL Prompt Encoder (Searge)
  • base_clip
  • refiner_clip
  • base_positive
  • base_negative
  • refiner_positive
  • refiner_negative
◄pos_gPOS_G►
◄pos_lPOS_L►
◄pos_rPOS_R►
◄neg_gNEG_G►
◄neg_lNEG_L►
◄neg_rNEG_R►
◄base_width4096►
◄base_height4096►
◄crop_w0►
◄crop_h0►
◄target_width4096►
◄target_height4096►
◄pos_ascore6.00►
◄neg_ascore2.50►
◄refiner_width2048►
◄refiner_height2048►

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.
CategorySearge/_deprecated_/ClipEncoding

Inputs (18)

NameTypeDefaultDescription
base_clipCLIP—
refiner_clipCLIP—
pos_gSTRINGPOS_G—
pos_lSTRINGPOS_L—
pos_rSTRINGPOS_R—
neg_gSTRINGNEG_G—
neg_lSTRINGNEG_L—
neg_rSTRINGNEG_R—
base_widthINT40960–16384—
base_heightINT40960–16384—
crop_wINT00–16384—
crop_hINT00–16384—
target_widthINT40960–16384—
target_heightINT40960–16384—
pos_ascoreFLOAT6.000–1000—
neg_ascoreFLOAT2.500–1000—
refiner_widthINT20480–16384—
refiner_heightINT20480–16384—

Outputs (4)

NameTypeDescription
base_positiveCONDITIONING—
base_negativeCONDITIONING—
refiner_positiveCONDITIONING—
refiner_negativeCONDITIONING—