llama.cpp ADV Prompt
Llama.cpp ADV Prompt for vision models
- 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
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
IMAGEinputs. 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_amountcontrols visibility; if a socket isn't showing, the count is set below it. - Batch gives you only the first image -
include_image_batchis off. That's the default, and it trips everyone.
Inputs (34)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | The user prompt to send to the LLM | |
| image_amount | INT | 20–10 | Number of image input slots to show |
| modelopt | COMBO | (use running model) | Model for router mode, or the running direct model. |
| server_urlopt | STRING | Leave empty to use the server owned by this node pack. Attached endpoints are never implicitly stopped. | |
| system_promptopt | STRING | System prompt that defines model behavior. | |
| enable_thinkingopt | BOOLEAN | true | Request thinking/reasoning from compatible models. |
| max_tokensopt | INT | 20481–131072 | Maximum number of tokens to generate. |
| temperatureopt | FLOAT | 0.700–2 | Sampling randomness. Lower values are more deterministic. |
| top_popt | FLOAT | 0.900–1 | Keep tokens within this cumulative probability mass. |
| top_kopt | INT | 400–200 | Sample from the top K tokens. 0 disables top-k filtering. |
| min_popt | FLOAT | 0.050–1 | Discard tokens below this probability relative to the best token. |
| repeat_penaltyopt | FLOAT | 1.101–2 | Penalize recently repeated tokens. 1.0 disables the penalty. |
| presence_penaltyopt | FLOAT | 0.0-2–2 | Penalize tokens that have appeared at least once. |
| frequency_penaltyopt | FLOAT | 0.0-2–2 | Penalize tokens in proportion to how often they appeared. |
| seedopt | INT | 00–2147483647 | Random seed |
| keep_contextopt | BOOLEAN | false | Reuse a matching prompt-prefix KV cache. This is not chat history. |
| enable_chainingopt | BOOLEAN | false | Compatibility toggle. A connected trigger already controls ordering. |
| triggeropt | * | Optional dependency input used to sequence execution. | |
| stop_sequencesopt | STRING | Stop sequences. JSON arrays preserve commas and whitespace. | |
| api_key_envopt | STRING | LLAMACPP_API_KEY | Environment variable containing the API key. The secret is not serialized. |
| verify_tlsopt | BOOLEAN | true | Verify HTTPS certificates. |
| request_timeoutopt | INT | 3001–86400 | Overall generation deadline in seconds. |
| include_image_batchopt | BOOLEAN | false | Send every image in each Comfy IMAGE batch. Off preserves legacy first-image behavior. |
| image_1opt | IMAGE | Optional image 1. Visibility follows image_amount. | |
| image_2opt | IMAGE | Optional image 2. Visibility follows image_amount. | |
| image_3opt | IMAGE | Optional image 3. Visibility follows image_amount. | |
| image_4opt | IMAGE | Optional image 4. Visibility follows image_amount. | |
| image_5opt | IMAGE | Optional image 5. Visibility follows image_amount. | |
| image_6opt | IMAGE | Optional image 6. Visibility follows image_amount. | |
| image_7opt | IMAGE | Optional image 7. Visibility follows image_amount. | |
| image_8opt | IMAGE | Optional image 8. Visibility follows image_amount. | |
| image_9opt | IMAGE | Optional image 9. Visibility follows image_amount. | |
| image_10opt | IMAGE | Optional image 10. Visibility follows image_amount. | |
| connectionopt | LLAMACPP_CONNECTION | Optional reusable local or remote connection profile. |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| response | STRING | Generated multimodal response text. |
| thinking | STRING | Reasoning content reported separately by compatible models. |
| success | BOOLEAN | Whether generation completed successfully. |