TextEncodeGemmaSystemEditPlusAdvanced
The advanced edit encoder with a system prompt, for Gemma-family models
- clip
- image_inputs
- vae
- CONDITIONING
If TextEncodeEditPlusAdvanced is the pack's reference-blending powerhouse, this is the version for models whose encoder speaks Gemma. Same up-to-16 autogrow image inputs, same two-path reference handling (VLM semantic + VAE structural), same vision-token control - plus a system_prompt input and the Gemma <start_of_turn> chat template, which is what LTX 2 and the Gemma-based edit models actually expect. If you're feeding one of those, the plain EditPlus node is wrapping your prompt in the wrong template, and this is the fix.
How it works
system_prompt (optional, default empty) is the new input. When filled, the node builds the Gemma template - <start_of_turn>system\n{system_prompt}<end_of_turn>\n<start_of_turn>user\n… - with your prompt and image tokens inside the user turn. Reference images from the autogrow image_inputs sockets are placed as soft image tokens (<img><image_soft_token><end_of_image>), either at the image_input_N keyword positions in your prompt or prepended in socket order if you reference none.
Everything else carries over from the EditPlus design:
- vlm_resolution - semantic-path image size (Fast 384 → XX-Large 1536 → Original).
- vae + vae_resolution + vae_dimension_multiple - the structural path, VAE-encoding references as latents.
- ref_latent_mode -
off(default),single/multi(append), orparallel-single/parallel-multi(separate stream so structure doesn't override your prompt). - Batched images flatten into sequential inputs per the tooltip: every image in a connected batch becomes the next input socket.
Output is CONDITIONING.
When this one wins
Two cases. First, LTXV 2 and Gemma-family video/edit models: the template is the whole game - Gemma encoders are trained on <start_of_turn>, and the system turn is where you put the model's editing persona (the pack's SystemMessagePresets strings drop in neatly). Second, reference-heavy edits where you want the system message and the blending: this node gives you both. The system prompt is the difference-maker for edit quality on these models - it's what tells the model to preserve composition and identity rather than just respond to the raw request.
Where people get burned
- Template-model matching. This node assumes a Gemma-family encoder. Using it with a chatml encoder (Klein, Z-Image) is a template mismatch - same mistake as the reverse.
ref_latent_modeneeds a realvaeconnection to do anything;offis the safe default.- Resolution dials are a genuine memory/quality tradeoff; don't sit at 1536 unless you're chasing the last few percent.
- This one has no scaled-bias
<tag=strength>parser - for that, the pack's scaled-bias encoders are the family to look at.
Installing it
Ships in silveroxides/ComfyUI-UtilsCollection. ComfyUI Manager: search ComfyUI-UtilsCollection, install, restart. Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/silveroxides/ComfyUI-UtilsCollection
cd ComfyUI-UtilsCollection
pip install -r requirements.txt # opencv-python, typing-extensions
Restart. No node-specific model downloads. This is a canonical node, not a legacy alias.
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| clip | CLIP | — | |
| prompt | STRING | — | |
| system_prompt | STRING | — | |
| vlm_resolution | COMBO | Fast (384) | Resolution of the image passed to the VLM (semantic path). 'Fast' = 384x384, 'Balanced' = 512x512, 'Detailed' = 768x768, 'Large' = 1024x1024, 'X-Large' = 1280x1280, 'XX-Large' = 1536x1536, 'Original' uses native resolution. |
| vae_resolution | COMBO | Fast (1024) | Resolution of the reference latent encoded by the VAE (structural path). |
| ref_latent_mode | COMBO | off | Reference latent encoding mode. 'single'/'multi' append latents; 'parallel-single'/'parallel-multi' run them in a separate conditioning stream to prevent semantic override. |
| vae_dimension_multiple | INT | 84–256 | Pixel multiple used to align reference images before VAE encoding. |
| image_inputs | COMFY_AUTOGROW_V3 | Images are flattened in ascending socket order; every image in a connected batch becomes the next sequential image input. | |
| vaeopt | VAE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| CONDITIONING | CONDITIONING | — |