Z-Engineer Prompt Enhancer (Local)
Enhance prompts with the model that encodes them
- clip
- prompt
Here's the thing that makes ComfyUI-Z-Engineer more than "a GGUF loader with a longer name." Z-Image is a prose model - feed it a sentence and it renders a scene, not a tag soup. But prose quality is exactly where most people's "cute girl, neon, rain, 8k" seeds fall apart, because the encoder is a 4B LLM and like any LLM it does a lot better when the prompt is well-written. The Z-Engineer Prompt Enhancer (Local) is a prompt-writing model that runs on the same Qwen3-4B weights you already loaded as your text encoder. No external server, no API key, no second copy of the model in VRAM.
Drop a raw seed into input_prompt, queue, and it returns a polished 180–250 word natural-language prompt, previewed right on the node. That's the whole loop: it writes the prompt, and the same model encodes it.
How it works
You feed it the clip output from one of the Z-Engineer CLIP loaders (GGUF or Safetensors/Shards). The node wraps your seed in the Qwen chat template, calls the model's generate() with the sampling knobs, decodes the result, then runs a post-processing pass that's honestly the most thoughtful part: it strips <think> reasoning blocks, chatml tags, negative-prompt sections and camera-brand names, re-appends seed constraints (counts, colors, quoted text) the model dropped, and re-appends anything in keep_terms. Because the model is already resident as your text encoder, ComfyUI's model management treats it as one model - no VRAM double-billing, and it unloads normally.
The inputs that matter
Most of the required fields are sampling knobs with sensible defaults. You'll actually touch:
clip- must come from a Z-Engineer loader (or any Z-Image Qwen3-4B CLIP). Feed it a stock CLIP and it dies with "this CLIP does not support text generation."input_prompt- your raw seed. Multiline, and each box is vertically resizable via the grip in its corner (double-click the grip to reset).keep_terms- comma-separated LoRA trigger words or phrases that must survive verbatim (m4rty style, neon glow). The model is told to weave them in unchanged, and anything it still drops gets deterministically re-appended. This is the one input I'd genuinely call essential if you run LoRAs.enforce_seed_terms/strip_reasoning/sanitize_output- the safety nets. Leave them on.
The defaults are the README's recommended V6 settings: temperature 0.20, top_p 0.9, top_k 40, min_p 0.03, repetition_penalty 1.05, max_tokens 320. They're well-chosen; don't fight them until you've seen output.
Output is a single prompt STRING, and there's a batch_mode + batch_separator (default \n---\n) if you want to process several seeds in one call.
The workflow
[Z-Engineer CLIP Loader (GGUF)] ──clip──┬──> [Z-Engineer Prompt Enhancer (Local)] ──prompt──> [CLIP Text Encode] ──> ...
└──────────────────────clip──────────────────────────────^
The same clip feeds both the enhancer and CLIP Text Encode. One model, two jobs.
Install
Pack install is the usual: Manager search "ComfyUI Z-Engineer," or git clone https://github.com/BennyDaBall930/ComfyUI-Z-Engineer into custom_nodes, pip install -r requirements.txt, restart. Then load the model with either Z-Engineer loader - Q4_K_M GGUF for low VRAM (~3–4 GB), sharded FP16 for full fidelity (~9 GB). Requires ComfyUI v0.3.75+ with native Z-Image support.
Where people get burned
- The "does not support text generation" error means the CLIP didn't come from a Z-Engineer loader. Re-wire it.
- Samey output. Z-Image Turbo is already notorious for near-identical results across seeds, and a prompt enhancer can compound it. Change the seed, nudge temperature toward 0.3–0.4, and check
keep_termsif a trigger isn't showing up. - Nothing happens on an empty seed. An empty
input_promptreturns empty by design. Type something first. - The model has favorite phrases - earlier Z-Image-Engineer versions were heavy on "weathered wood" and "ethereal" people. If every result starts smelling the same, that's the seed/temperature dial, not a broken node.
Inputs (16)
| Name | Type | Default | Description |
|---|---|---|---|
| clip | CLIP | The Z-Image-Engineer model loaded with one of the Z-Engineer CLIP loaders (or any Z-Image Qwen3-4B CLIP). | |
| input_prompt | STRING | — | |
| system_prompt | STRING | You are Z-Image-Engineer V6, a prompt-only cinematography and visual-language specialist for the Tongyi-MAI Z-Image-Turbo Qwen text encoder. Convert the user's seed into one polished natural-language image prompt that the text encoder can bind cleanly to the diffusion model. Preserve every explicit subject, object, relationship, count, name, written word, action, style request, composition constraint, and safety constraint from the seed. Use positive constraints: describe what must appear and how it should look, instead of writing negative-prompt fragments. Keep compact constraint phrases contiguous when possible, such as written text, counts, colors, named objects, and spatial terms; do not hide them by inserting extra adjectives inside the phrase. Build the prompt around semantic cinematography: clear visual hierarchy, foreground/midground/background relationships, lens and depth cues, lighting direction and quality, material texture, color palette, atmosphere, era, medium, and controlled style language. Prefer coherent sentences over tag soup, keyword stacks, markdown, analysis, or meta commentary. Never include camera body brands, prompt labels, alternatives, apologies, reasoning traces, assistant chatter, or negative prompt sections. Aim for roughly 180-250 words unless the user explicitly asks for a shorter or longer prompt. Return only the final image prompt as one self-contained paragraph. | — |
| seed | INT | 66060–18446744073709550000 | — |
| temperature | FLOAT | 0.200–2 | — |
| top_p | FLOAT | 0.900–1 | — |
| top_k | INT | 400–1000 | — |
| min_p | FLOAT | 0.030–1 | — |
| repetition_penalty | FLOAT | 1.050–5 | — |
| max_tokens | INT | 32032–4096 | — |
| enforce_seed_terms | BOOLEAN | true | Deterministically re-append seed phrases (counts, colors, quoted text) the model dropped. |
| strip_reasoning | BOOLEAN | true | — |
| sanitize_output | BOOLEAN | true | — |
| batch_mode | BOOLEAN | false | — |
| batch_separator | STRING | \n---\n | — |
| keep_termsopt | STRING | Comma-separated trigger words/phrases (e.g. LoRA triggers) kept verbatim in the output. Any the model drops are re-appended. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| prompt | STRING | — |