Nodes/ComfyUI Gemma4 Reference Prompt/Gemma 4 Reference Prompt Pair Lock
ComfyUI Node

Gemma 4 Reference Prompt Pair Lock

One reference image, one locked positive/negative prompt pair for your Wan shots

By MaikiOS·Created 2 months ago·Updated 2 months ago· 2
Gemma 4 Reference Prompt Pair Lock
  • image
  • positive_prompt
  • negative_prompt
positive_instructionDescribe this reference image as a concise Wan/VACE VFX positive prompt. Preserve the original source subject and composition. Focus on visible materials, lighting, floor contact, reflection, shadow softness, camera, and environment. Keep it one practical English prompt.
negative_instructionWrite a stable Wan/VACE negative prompt for this same reference. List what must not change: source identity, colors, background, body shape, new objects, hard shadows, flicker, color shift, dirty blobs, invented detail, overpainted areas, and AI artifacts.
lock_promptfalse
refresh_lockfalse
model_idgoogle/gemma-4-E2B-it
max_new_tokens512
temperature0.10
dtypeauto
unload_after_generatetrue

The annoying part of multi-shot video work isn't writing one prompt - it's keeping the prompt stable across every clip of the same reference. A slightly different negative prompt between shots is how you get color shift, flicker, and drift you didn't ask for. Gemma4ReferencePromptPairLock takes a single reference image and returns a positive and negative prompt, then lets you "lock" that pair to disk so every repeated render uses literally the same text.

It's the sibling of Gemma4ReferencePrompt from the same pack, aimed squarely at Wan/VACE VFX work. The default negative instruction reads like a list of the failure modes anyone who's done I2V knows by heart: color shift, hard shadows, dirty blobs, overpainted areas, flicker, invented detail. That's not accidental - cross-clip consistency is the classic unsolved problem in local video generation, and a locked, model-written negative prompt takes one variable out of it.

How it works

The node bundles your two instructions into a single request that asks the model to return valid JSON with positive_prompt and negative_prompt keys, then parses the response. If the JSON parse fails it falls back to a positive:/negative: text scan, and if that fails too you still get a usable pair via a built-in default negative. It's robust where it counts.

The lock is where this node earns its name. When lock_prompt is on (and refresh_lock is off), it reads the saved pair from prompt_locks/<node_id>.json inside the node's own folder - no model run at all, and the result survives a ComfyUI restart. Set refresh_lock to true and it always regenerates, overwriting the saved pair. So the pattern is: generate once, lock it, render as many shots as you like against the identical text.

The inputs that matter

  • image - your reference image, same as the single-prompt sibling.
  • positive_instruction / negative_instruction - both multiline with Wan/VACE-tuned defaults. Leave them until you know why you're editing; they encode the "describe materials, lighting, floor contact, reflections, camera" discipline that I2V models actually reward.
  • lock_prompt (false) and refresh_lock (false) - the two toggles that control the whole workflow. Run once with lock_prompt true to save a pair; flip refresh_lock on whenever you change the image and want a new one.
  • temperature - 0.1 default, deliberately low; you want the same pair to come out the same way every run. max_new_tokens (512) and the model/dtype settings behave like the sibling node.

It outputs positive_prompt and negative_prompt, both STRING, which drop straight into the positive and negative CLIP Text Encode nodes of your Wan or VACE graph.

Installing it

Same pack, same path: search ComfyUI Gemma4 Reference Prompt in ComfyUI Manager, install, restart. Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/MaikiOS/ComfyUI-Gemma4-ReferencePrompt
python -m pip install -r ComfyUI-Gemma4-ReferencePrompt/requirements.txt

The first run downloads the model to your HuggingFace cache (not ComfyUI/models), so budget a wait and a few GB. If HuggingFace demands a token, huggingface-cli login.

Where people get burned

Same gotchas as the single-prompt node: an old Transformers throws Unrecognized processing class, fixed with python -m pip install --upgrade "transformers>=5.5.0" accelerate. Two things are specific to the lock, though. First, if you edit the image but leave the node locked, it keeps serving the old pair - that's the feature, but it'll look like a bug until you hit refresh_lock. Second, the negative prompt is written for Wan/VACE; don't silently reuse it for SDXL or Flux without retuning the instruction, or you'll be fighting its assumptions instead of your own.

CategoryGemma4

Inputs (10)

NameTypeDefaultDescription
imageIMAGE
positive_instructionSTRINGDescribe this reference image as a concise Wan/VACE VFX positive prompt. Preserve the original source subject and composition. Focus on visible materials, lighting, floor contact, reflection, shadow softness, camera, and environment. Keep it one practical English prompt.
negative_instructionSTRINGWrite a stable Wan/VACE negative prompt for this same reference. List what must not change: source identity, colors, background, body shape, new objects, hard shadows, flicker, color shift, dirty blobs, invented detail, overpainted areas, and AI artifacts.
lock_promptBOOLEANfalse
refresh_lockBOOLEANfalse
model_idCOMBOgoogle/gemma-4-E2B-it2 options: google/gemma-4-E2B-it, google/gemma-4-E4B-it
max_new_tokensINT51264–2048
temperatureFLOAT0.100–2
dtypeCOMBOauto4 options: auto, bf16, fp16, fp32
unload_after_generateBOOLEANtrue

Outputs (2)

NameTypeDescription
positive_promptSTRING
negative_promptSTRING