Nodes/ComfyUI llama.cpp Suite/llama.cpp ADV Prompt
ComfyUI Node

llama.cpp ADV Prompt

Llama.cpp ADV Prompt for vision models

By Setmaster·Created 8 months ago·Updated 2 months ago· 6
llama.cpp ADV Prompt
  • trigger
  • image_1
  • image_2
  • image_3
  • image_4
  • image_5
  • image_6
  • image_7
  • image_8
  • image_9
  • image_10
  • connection
  • response
  • thinking
  • success
prompt
image_amount2
model(use running model)
server_url
system_prompt
enable_thinkingtrue
max_tokens2048
temperature0.70
top_p0.90
top_k40
min_p0.05
repeat_penalty1.10
presence_penalty0.0
frequency_penalty0.0
seed0
keep_contextfalse
enable_chainingfalse
stop_sequences
api_key_envLLAMACPP_API_KEY
verify_tlstrue
request_timeout300
include_image_batchfalse

Basic Prompt is for text. ADV Prompt is for when you want the LLM to actually look at something. It's the same generation engine, plus up to ten IMAGE sockets and a full Comfy image-batch option, which makes it the node for VLM jobs: caption an image for a LoRA dataset, describe a reference frame for img2img or image-to-video, or review the image you just generated and rewrite the prompt for another pass.

Vision models are the classic "bolt an LLM onto the graph" move - read the image, feed the description into an enhancer, feed that into the sampler. This node is the reading half of that chain.

How it works

The node takes Comfy IMAGE tensors, encodes them for the server, and sends them along with the prompt to llama-server's chat-completions endpoint. It requires a multimodal model - a plain text GGUF won't do anything useful with your image. On the direct-server side you select the matching mmproj projector on the start node; the vision model plus its projector is what actually lets the server see.

image_amount controls how many image sockets appear (0 to 10). All ten sockets exist in Python regardless, so saved workflows survive a frontend reload even when you shrink the count. include_image_batch is the sleeper feature: turn it on and it sends every image in a connected Comfy image batch, so you can caption a whole folder's worth in one pass. Off preserves the legacy first-image behavior.

Inputs and outputs that matter

Beyond the same sampling stack as Basic Prompt (temperature, top_p, top_k, min_p, repeat_penalty, seed), the ones you'll actually touch:

  • image_amount - how many image slots show. Default 2; crank it if you're doing multi-image reasoning.
  • image_1 … image_10 - the actual IMAGE inputs. Wire a Load Image or any image-generating node in.
  • include_image_batch - send the whole batch instead of the first image. The caption-a-dataset switch.
  • prompt - for captioning, an instruction like "describe this image in detail, focusing on the subject's appearance, clothing, and pose" rather than an empty string.
  • enable_thinking - on by default. For captioning you usually want it off, because reasoning models leak their deliberation into the output and eat tokens. Captioning wants small-and-obedient, not clever-and-chatty.

Outputs: response, thinking, and success, same as Basic Prompt. response goes straight into a Prompt Output node, a caption save, or a downstream enhancer.

Wiring it

A captioning workflow: Load Image → ADV Prompt (model + mmproj from the start node) → Prompt Output. For the img2img assistant pattern the KB describes, chain it: ADV Prompt captions the image, Basic/ADV Prompt rewrites that into a generation prompt, the string feeds your text encoder. Two tightly-scoped steps drift less than one open-ended prompt.

Issues to expect

  • Model won't describe the image - you're almost certainly on a text-only model, or the projector doesn't match the base model. Pair projectors from the same model size and architecture, never across.
  • Image socket seems dead - image_amount controls visibility; if a socket isn't showing, the count is set below it.
  • Batch gives you only the first image - include_image_batch is off. That's the default, and it trips everyone.
CategoryLlamaCpp

Inputs (34)

NameTypeDefaultDescription
promptSTRINGThe user prompt to send to the LLM
image_amountINT20–10Number of image input slots to show
modeloptCOMBO(use running model)Model for router mode, or the running direct model.
server_urloptSTRINGLeave empty to use the server owned by this node pack. Attached endpoints are never implicitly stopped.
system_promptoptSTRINGSystem prompt that defines model behavior.
enable_thinkingoptBOOLEANtrueRequest thinking/reasoning from compatible models.
max_tokensoptINT20481–131072Maximum number of tokens to generate.
temperatureoptFLOAT0.700–2Sampling randomness. Lower values are more deterministic.
top_poptFLOAT0.900–1Keep tokens within this cumulative probability mass.
top_koptINT400–200Sample from the top K tokens. 0 disables top-k filtering.
min_poptFLOAT0.050–1Discard tokens below this probability relative to the best token.
repeat_penaltyoptFLOAT1.101–2Penalize recently repeated tokens. 1.0 disables the penalty.
presence_penaltyoptFLOAT0.0-2–2Penalize tokens that have appeared at least once.
frequency_penaltyoptFLOAT0.0-2–2Penalize tokens in proportion to how often they appeared.
seedoptINT00–2147483647Random seed
keep_contextoptBOOLEANfalseReuse a matching prompt-prefix KV cache. This is not chat history.
enable_chainingoptBOOLEANfalseCompatibility toggle. A connected trigger already controls ordering.
triggeropt*Optional dependency input used to sequence execution.
stop_sequencesoptSTRINGStop sequences. JSON arrays preserve commas and whitespace.
api_key_envoptSTRINGLLAMACPP_API_KEYEnvironment variable containing the API key. The secret is not serialized.
verify_tlsoptBOOLEANtrueVerify HTTPS certificates.
request_timeoutoptINT3001–86400Overall generation deadline in seconds.
include_image_batchoptBOOLEANfalseSend every image in each Comfy IMAGE batch. Off preserves legacy first-image behavior.
image_1optIMAGEOptional image 1. Visibility follows image_amount.
image_2optIMAGEOptional image 2. Visibility follows image_amount.
image_3optIMAGEOptional image 3. Visibility follows image_amount.
image_4optIMAGEOptional image 4. Visibility follows image_amount.
image_5optIMAGEOptional image 5. Visibility follows image_amount.
image_6optIMAGEOptional image 6. Visibility follows image_amount.
image_7optIMAGEOptional image 7. Visibility follows image_amount.
image_8optIMAGEOptional image 8. Visibility follows image_amount.
image_9optIMAGEOptional image 9. Visibility follows image_amount.
image_10optIMAGEOptional image 10. Visibility follows image_amount.
connectionoptLLAMACPP_CONNECTIONOptional reusable local or remote connection profile.

Outputs (3)

NameTypeDescription
responseSTRINGGenerated multimodal response text.
thinkingSTRINGReasoning content reported separately by compatible models.
successBOOLEANWhether generation completed successfully.