Nodes/ComfyUI-Prompt-Rewriter/Prompt Rewriter Options
ComfyUI Node

Prompt Rewriter Options

The Config Node That Decides What Your Prompt Rewriter Actually Does

By BigStationW·Created 9 months ago·Updated 5 months ago· 20
Prompt Rewriter Options
  • image_1
  • image_2
  • image_3
  • image_4
  • image_5
  • options
modelNo models available
gpu_layers
enable_thinkingtrue
context_size4096
max_tokens4096
flash_attentiontrue
system_prompt
use_model_default_samplingfalse
temperature0.80
top_p0.95
top_k40
min_p0.05
repeat_penalty1.00

The pack's main node, Prompt Rewriter, is deliberately dumb: it takes your prompt and a bag of options and does what it's told. All the actual decisions happen here, in its companion Options node. Connect this node's options output into the main node's options input and suddenly you control which LLM does the writing, how much of it lands on GPU versus CPU, whether it "thinks" before answering, and how creative it's allowed to get. Without it, the main node has no model to load at all - it's not optional, it's the brain.

The model list - the field that matters most

model is a dropdown that lists every .gguf file found in ComfyUI/models/LLM/gguf. The node creates that folder for you on first run, so it always has somewhere to look. No files, and you'll see a lonely "No models available." The tooltip mentions models marked with ⬇ downloading automatically - in the current code that list is disabled, so you download the GGUF yourself and drop it in. Projector files are filtered out of this list, so you never accidentally pick a vision projector as your text model.

GPU layers - the whole multi-GPU story in one string

Leave gpu_layers empty and everything goes to GPU 0. Otherwise it's a comma-separated recipe: gpu0:0.7 puts 70% of layers on GPU 0 and 30% on CPU; gpu0:0.5, gpu1:0.4 splits across two cards with the rest in system RAM. If you're running a 4B or 8B model on a single card, empty is exactly right and you can forget this field exists.

How the model behaves

  • enable_thinking - on by default, meant for "thinking" models like Qwen3-Thinking. The model deliberates before answering, which usually gives richer rewrites at the cost of time and tokens.
  • system_prompt - an override for the pack's carefully-worded default (the one that locks in your core elements and forbids "8K"/"masterpiece"-style filler). That default is genuinely good and prompt-specific; leave this empty unless you know you want different behavior.
  • use_model_default_sampling - skip the sampling knobs below and trust the model's own defaults. If you have no strong opinion about temperature, this is a perfectly reasonable setting.

The sampling knobs

temperature (higher = more creative, lower = more literal), top_p, top_k, min_p, and repeat_penalty. Defaults are 0.8 / 0.95 / 40 / 0.05 / 1.0, and they're sensible for prompt rewriting - don't touch them until you've seen a few outputs and know which direction the model is off in.

The VRAM budget

context_size is the dial to watch. It's the total token budget for input + output, and higher values eat more VRAM - which matters when the LLM is sharing your card with a diffusion model. 4096 is the default and plenty for prompt rewriting. max_tokens caps the length of the rewrite; 4096 is generous. flash_attention should stay on unless your GPU misbehaves.

Vision inputs

image_1 through image_5 accept IMAGE tensors for vision-language models. Feed the model a reference image alongside your prompt and it can extend or describe what it sees. This needs a VLM GGUF plus its matching mmproj file in the same models folder (the README's naming convention: Qwen3-VL-4B-Thinking-mmproj-BF16.gguf), and the node auto-detects the matching projector from the model name.

The single output, options, goes into the Prompt Rewriter node's options input. That's the entire job - the node is a control panel, not a renderer.

Gotchas

Change the model and the node restarts the llama-server, which means a full model reload - the first run after a swap is slow, so don't read it as a hang. Connect images but have no mmproj file and the main node errors out with a message telling you exactly that. And if the dropdown shows "No models available," you've put the GGUF in the wrong place - it must be ComfyUI/models/LLM/gguf, not one of the other model folders. Install is the same as the main node: clone the repo, pip install its three requirements, and get a llama.cpp backend in place (Vulkan via winget install llama.cpp, or the bundled CUDA installer) before anything actually runs.

CategoryPrompt Manager

Inputs (18)

NameTypeDefaultDescription
modelCOMBONo models availableSelect model to use. Models with ⬇ will be downloaded automatically.
gpu_layersSTRINGGPU layer distribution. Examples: • empty -> All layers go to the first GPU (default) • gpu0:0.7 -> 70% to GPU:0, 30% to CPU • gpu0:0.5, gpu1:0.4 -> 50% GPU:0, 40% GPU:1, 10% CPU
enable_thinkingBOOLEANtrueEnable thinking/reasoning mode (model thinks before answering)
context_sizeINT4096256–1000000Context window size (total tokens for input + output). Higher values use more VRAM.
max_tokensINT40961–1000000Maximum tokens to generate
flash_attentionBOOLEANtrueEnable Flash Attention for faster inference (recommended: enabled)
system_promptSTRINGOverride the default system prompt
use_model_default_samplingBOOLEANfalseUse the model's default sampling parameters (overrides temperature, top_p, etc)
temperatureFLOAT0.800–2Temperature for generation (higher = more creative, lower = more focused)
top_pFLOAT0.950–1Top-p (nucleus) sampling
top_kINT400–200Top-k sampling (0 = disabled)
min_pFLOAT0.050–1Min-p sampling threshold
repeat_penaltyFLOAT1.000–2Repetition penalty (1.0 = no penalty, higher = less repetition)
image_1optIMAGEOptional image input for VLM models (image 1 of 5). Requires mmproj file.
image_2optIMAGEOptional image input for VLM models (image 2 of 5). Requires mmproj file.
image_3optIMAGEOptional image input for VLM models (image 3 of 5). Requires mmproj file.
image_4optIMAGEOptional image input for VLM models (image 4 of 5). Requires mmproj file.
image_5optIMAGEOptional image input for VLM models (image 5 of 5). Requires mmproj file.

Outputs (1)

NameTypeDescription
optionsOPTIONS