Nodes/ComfyUI-Z-Engineer/Z-Engineer Prompt Enhancer (LFM2.5 Local)
ComfyUI Node

Z-Engineer Prompt Enhancer (LFM2.5 Local)

Type two words, get a 250-word Z-Image prompt — the fast local enhancer

By BennyDaBall930·Created 8 months ago·Updated a day ago· 91
Z-Engineer Prompt Enhancer (LFM2.5 Local)
  • llm
  • prompt
input_prompt
system_promptInterpret the user seed as production intent, then build a definitive 200-250 word single-paragraph image prompt that preserves every explicit constraint while intelligently expanding missing details. First infer the core subject, action, setting, and emotional tone; treat these as non-negotiable anchors. Then enhance with precise visual staging (explicit foreground, midground, background), clear visual hierarchy and eye path, physically plausible lighting (source, direction, softness, color temperature), and optical strategy (if lens/aperture are provided, preserve exactly; if absent, choose fitting lens and aperture and imply their depth-of-field effect). Integrate organic, manufactured, and environmental textures with realistic material behavior, add motion/atmospheric cues only when they support the scene, and apply a coherent color grade consistent with mood and environment. Keep the prose vivid but controlled: no contradictions, no overstuffing, no generic filler. Do not mention camera body brands. Output one polished paragraph only, no bullets, no line breaks, no meta commentary.
seed6606
temperature0.20
top_p0.90
top_k40
min_p0.03
repetition_penalty1.05
max_tokens320
enforce_seed_termstrue
strip_reasoningtrue
sanitize_outputtrue
batch_modefalse
batch_separator\n---\n
keep_terms

The node that does the actual writing

If the LFM2.5 Enhancer Loader is the engine, this is the driver. Z-Engineer Prompt Enhancer (LFM2.5 Local) takes a raw seed prompt - "cyberpunk street market, rain, neon" - runs it through the 1.2B LFM2.5-Z-Image-Engineer model, and hands you back a polished, single-paragraph Z-Image Turbo prompt. It previews the result right on the node, so you see what the model wrote before it ever touches a sampler.

Z-Image is a Qwen3-4B-encoder model that wants prose, not comma soup - the KB's Z-Image guide notes Chinese prompts and careful detail help adherence a lot. An enhancer is the shortcut to that detail without writing it all yourself. What makes this node worth reaching for over the pack's Qwen3 version: it's the fast one (~3x quicker), ideal for low-VRAM boxes and for batch-expanding a stack of seed prompts. No LM Studio, no Ollama, no API key, no server. You type, it writes, offline.

How it works

Wire the llm output from Z-Engineer LFM2.5 Enhancer Loader in, and the node builds a chat from your input_prompt and a system_prompt - the default is the V4 system prompt, and it's genuinely good: it tells the model to preserve every explicit constraint while adding staging, lighting, lens choice, material behavior, a coherent grade. Then comes the part that separates a real enhancer from a chat model with a textbox bolted on:

  • strip_reasoning and sanitize_output - cuts the model's scratch-pad thinking and any chat preamble out of the result, so you don't feed "Here is your enhanced prompt:" into your conditioning.
  • enforce_seed_terms - deterministically re-appends counts, colors, and quoted phrases the model dropped. LLMs love quietly deleting "two" or "red".
  • keep_terms (optional) - comma-separated trigger phrases like m4rty style, neon glow kept verbatim, and any the model still drops get re-appended. LoRA users: this is your friend, because a chat model will absolutely eat your trigger word otherwise.
  • batch_mode + batch_separator - process several seeds at once, split by \n---\n (falls back to lines), outputs joined the same way and each shown in the preview.

The few knobs you'll actually touch

Defaults are sane - temperature 0.2, top_p 0.9, top_k 40, min_p 0.03, repetition_penalty 1.05, max_tokens 320. The two worth nudging: crank temperature up toward 0.4 if everything comes back samey, and raise max_tokens if prompts look truncated. seed is there so you can reproduce a good rewrite exactly.

What it outputs

One prompt STRING. Wire it into your CLIP Text Encode node's text input instead of typing there. Critical reminder, because it's the pack's single biggest footgun: the enhancer writes the prompt, but Z-Image still needs a Qwen3-4B CLIP to encode it. The loader refuses to double as an encoder - keep a Qwen3-4B model on your CLIP loader and this feeds its text box.

Install

Comes with the pack - Manager search "ComfyUI Z-Engineer", or:

cd ComfyUI/custom_nodes
git clone https://github.com/BennyDaBall930/ComfyUI-Z-Engineer.git
pip install -r ComfyUI-Z-Engineer/requirements.txt

Restart, then put an LFM2.5 quant (e.g. LFM2.5-1.2B-Z-Image-Engineer-V4-Q4_K_M.gguf) in ComfyUI/models/text_encoders/. Needs transformers>=4.54 - upgrade with your ComfyUI venv's pip if the node complains.

Common issues

  • "No LFM model provided" - you forgot the llm wire from the loader, or loaded nothing. Fix the connection, queue again.
  • Output reads like the model talking to you - strip_reasoning/sanitize_output somehow got flipped off; the defaults exist for a reason.
  • LoRA triggers missing from the result - that's keep_terms's whole job. Put them in, comma-separated.
  • It's fast but the prompt is meh - it's a 1.2B model; it won't out-write a frontier model. It's a convenience that kills the blank-page problem, not a ghostwriter. For more polish per generation, the pack's Qwen3-4B Local enhancer trades speed for a bit more depth.
CategoryZ-Engineer

Inputs (16)

NameTypeDefaultDescription
llmZE_LLMThe LFM2.5 Engineer loaded with 'Z-Engineer LFM2.5 Enhancer Loader'.
input_promptSTRING
system_promptSTRINGInterpret the user seed as production intent, then build a definitive 200-250 word single-paragraph image prompt that preserves every explicit constraint while intelligently expanding missing details. First infer the core subject, action, setting, and emotional tone; treat these as non-negotiable anchors. Then enhance with precise visual staging (explicit foreground, midground, background), clear visual hierarchy and eye path, physically plausible lighting (source, direction, softness, color temperature), and optical strategy (if lens/aperture are provided, preserve exactly; if absent, choose fitting lens and aperture and imply their depth-of-field effect). Integrate organic, manufactured, and environmental textures with realistic material behavior, add motion/atmospheric cues only when they support the scene, and apply a coherent color grade consistent with mood and environment. Keep the prose vivid but controlled: no contradictions, no overstuffing, no generic filler. Do not mention camera body brands. Output one polished paragraph only, no bullets, no line breaks, no meta commentary.
seedINT66060–18446744073709550000
temperatureFLOAT0.200–2
top_pFLOAT0.900–1
top_kINT400–1000
min_pFLOAT0.030–1
repetition_penaltyFLOAT1.050–5
max_tokensINT32032–4096
enforce_seed_termsBOOLEANtrueDeterministically re-append seed phrases (counts, colors, quoted text) the model dropped.
strip_reasoningBOOLEANtrue
sanitize_outputBOOLEANtrue
batch_modeBOOLEANfalse
batch_separatorSTRING\n---\n
keep_termsoptSTRINGComma-separated trigger words/phrases (e.g. LoRA triggers) kept verbatim in the output. Any the model drops are re-appended.

Outputs (1)

NameTypeDescription
promptSTRING