QwenVL (Advanced)
The node that reads your images, watches your video, and writes the prompt back — QwenVL (Advanced)
- image
- video
- source_path
- RESPONSE
You've got a folder of renders that need captions, a frame you want the model to actually look at before you describe it, or a video you need summarized. That's the whole genre of "vision-language model inside ComfyUI," and QwenVL (Advanced) is the full-featured end of this pack's two-node lineup. It runs Alibaba's Qwen vision models locally - no API key, no cloud, everything on your GPU - and hands you back a plain text RESPONSE.
The catch is right there in the name: "Advanced." If this is your first VLM node, the Basic version in the same pack is the saner entry point. This one is for when you know you want control.
What it actually does
Pick a model_name and the node does the rest. First run downloads the weights from HuggingFace automatically into ComfyUI/models/LLM/Qwen-VL/ - the tooltip says it plainly: "First run downloads weights automatically." You choose between 83 models, in two flavors:
- HuggingFace (HF) models run full Transformers at FP16, or quantized to 8-bit / 4-bit via
quantization(bitsandbytes). Best quality, and the only path withattention_modeanduse_torch_compile. - [GGUF] models run through llama.cpp using unsloth's quantized files. This is the low-VRAM escape hatch, and the KB's GGUF panel is the context you want: Q8 is essentially fp16 at half the size, Q4_K_M is the accepted compromise for tight cards.
One genuinely new thing worth knowing: Qwen3.5 merged thinking and instruct into a single model, so instead of picking a separate "-Thinking" file you flip enable_thinking. ON gets you step-by-step <think>…</think> reasoning; OFF (default) answers directly. It's ignored for Qwen3-VL and Qwen2.5-VL models.
The inputs that matter
Most of the 25+ knobs are set-and-forget. The ones a beginner actually touches:
preset_prompt/custom_prompt- the built-in templates run from Tags to Ultra Detailed Description to Video Summary. Fillcustom_promptand it completely replaces the preset. This is 90% of what makes the output useful.max_tokens- default 512, ceiling 256000. Bump to 2048–4096 for video summaries.temperature(0–2, default 0.6) andtop_p(default 0.9) - the usual sampling dials. Below 0.01 temperature flips to greedy decoding.frame_count- how many frames get uniformly sampled from avideoinput (1–64, default 16).quantizationandattention_mode- HF only.attention_mode: autopicks flash-attention-2 → SDPA flash → sage → math → eager in order of what's installed. Leave it on auto.num_beams- HF only, default 1. Bump past 1 and it switches to beam search, which disables temperature/top_p.keep_model_loaded- cache the model in VRAM between runs. Nice for iterating, a trap if you're juggling memory.
The GGUF-only fields (ctx, n_batch, gpu_layers, min_p, top_k_sampling, pool_size, …) default to sane values. Change them when you know why.
How it works
Feed the optional image (an IMAGE tensor) or video (a batch of frames), pick a preset, and the node builds a chat template, applies enable_thinking through apply_chat_template(), generates, and returns RESPONSE - a single STRING you can wire into Save Text, a display node, or anything else that eats text. The source_path input is accepted but in the current release the backends consume the image/video tensors, so treat it as scaffolding for now.
Install
Via ComfyUI Manager: search "QwenVL Utils", install, restart. Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/AkihaTatsu/ComfyUI-QwenVL-Utils.git
cd ComfyUI-QwenVL-Utils
pip install -r requirements.txt
requirements.txt pulls transformers, accelerate, opencv-python, and friends. 4/8-bit needs bitsandbytes, GGUF needs llama-cpp-python (see below), and flash-attn is optional - auto mode falls back to PyTorch SDPA without it.
Where people get burned
- Out of memory. The README's ladder: drop 8-bit → 4-bit, switch to a [GGUF] Q4_K_M model, disable
keep_model_loaded, or shrink the model. Also close the browser tab running three other workflows. - Qwen3.5 GGUF won't load. It needs
llama-cpp-python>= 0.3.30 with theQwen35ChatHandler, which lives in JamePeng's fork, not stock llama.cpp:pip install git+https://github.com/JamePeng/llama-cpp-python.git ImportError: transformersor weird failures - make sure you're ontransformers>=4.45.0; older versions miss Qwen3.5 support.- Windows portable + attention errors. The QwenVL node family has a reported failure mode on the portable Windows build where triton tries to compile a CUDA helper at runtime and dies; a common workaround is sorting out the triton include libs or switching the attention backend.
One honest caveat: this pack is brand new - zero community footprint yet - so the above is README plus what the parent implementations (1038lab's ComfyUI-QwenVL) have taught people. Start small (Qwen3-VL-2B), get one RESPONSE flowing, then climb.
Inputs (31)
| Name | Type | Default | Description |
|---|---|---|---|
| model_name | COMBO | Qwen3.5-0.8B | Select the vision-language model. HuggingFace models offer full-precision inference; [GGUF] models use quantized llama.cpp backend for lower VRAM. First run downloads weights automatically. |
| enable_thinking | BOOLEAN | false | [Unified Qwen models only] Enable Thinking mode for Qwen3.5, Qwen3.6, and Qwen3.8 models. When ON, the model reasons inside <think>…</think> blocks before the final answer. When OFF, it responds directly in Instruct mode. Ignored for model families without unified thinking support. |
| quantization | COMBO | None (FP16) | [HF models only] Precision vs VRAM trade-off. FP16 gives the best quality; 8-bit suits 8-16 GB GPUs; 4-bit fits 6 GB or lower but is slower. |
| attention_mode | COMBO | auto | [HF models only] Attention backend selection. • auto: Auto-select best available (recommended) • flash_attention_2: External flash-attn package (best performance, needs separate installation) • sdpa_flash: PyTorch SDPA Flash backend (excellent performance, best compatibility) • sage_attention: SageAttention wrapper (experimental, memory efficient) • sdpa_math: PyTorch SDPA math backend (stable fallback) • eager: Standard PyTorch attention (slowest, always works) • sdpa: Legacy option, auto-selects Flash or math |
| use_torch_compile | BOOLEAN | false | [HF models only] Enable torch.compile() optimization. Provides ~20-30% speedup after first compilation pass. Requires CUDA and PyTorch 2.1+. |
| device | COMBO | auto | Target device for inference. 'auto' selects the best available device. Use 'cpu' for CPU-only, 'cuda:0'/'cuda:1' for specific GPUs. |
| preset_prompt | COMBO | 🖼️ Detailed Description | Built-in instruction template describing how the model should analyze the media. Selecting '❌ None' sends no system instruction (use custom_prompt instead). |
| custom_prompt | STRING | When filled, completely replaces the preset prompt template. Leave empty to use the selected preset_prompt. | |
| max_tokens | INT | 51264–256000 | Requested maximum number of new tokens. For GGUF, prompt and media tokens also share ctx; an explicit context window can reduce the effective output budget. |
| temperature | FLOAT | 0.60–2 | Controls sampling randomness. Lower values (0.1-0.3) produce focused, deterministic outputs; higher values (0.7+) produce more creative, varied outputs. Values below 0.01 trigger greedy decoding (no randomness). Used by both HF (when num_beams=1) and GGUF backends. |
| top_p | FLOAT | 0.900–1 | Nucleus sampling: only tokens whose cumulative probability exceeds this threshold are considered. Lower values (0.5) restrict to high-confidence tokens; higher values (0.9-0.95) allow more variety. Used by both HF (when num_beams=1) and GGUF backends. |
| num_beams | INT | 11–8 | [HF models only] Beam search width. Values >1 disable temperature/top_p sampling and use beam search instead, which produces more stable but less creative outputs. |
| repetition_penalty | FLOAT | 1.20.5–2 | Penalizes repeated tokens. Values >1.0 (e.g. 1.1-1.3) reduce repetition; 1.0 applies no penalty. Used by both HF and GGUF backends. |
| frame_count | INT | 161–64 | Number of frames uniformly sampled from video inputs. More frames provide richer temporal context but increase processing time and memory usage. |
| keep_model_loaded | BOOLEAN | false | Keep the model loaded in VRAM/RAM after inference so subsequent runs skip the loading step. Disable to free memory after each run. |
| seed | INT | 11–4294967295 | Random seed for sampling reproducibility and video frame selection. Reuse the same seed to reproduce identical results. |
| imageopt | IMAGE | — | |
| videoopt | IMAGE | — | |
| source_pathopt | PATH | — | |
| min_pixelsopt | INT | 2007043136–12845056 | [HF models only] Minimum pixel count for image preprocessing. Controls the lower bound of image resolution. Default: 256×28×28 = 200,704. |
| max_pixelsopt | INT | 10035203136–12845056 | [HF models only] Maximum pixel count for image preprocessing. Controls the upper bound of image resolution. Higher values give better detail but use more memory. Default: 1280×28×28 = 1,003,520. |
| ctxopt | INT | 00–262144 | [GGUF models only] Total prompt + media + response capacity. 0 = Auto for unified Qwen3.5+ models; positive values are used exactly as an explicit context limit. |
| n_batchopt | INT | 51264–32768 | [GGUF models only] Prompt processing batch size. Higher values can improve prompt ingestion throughput at the cost of memory. Default: 512. |
| gpu_layersopt | INT | -1-1–200 | [GGUF models only] Number of model layers offloaded to GPU. -1 offloads all layers (recommended for VRAM-sufficient GPUs). 0 runs entirely on CPU. |
| image_max_tokensopt | INT | 4096256–1024000 | [GGUF models only] Maximum tokens allocated for image encoding. Higher values preserve more image detail but consume more context window. Default: 4096. |
| top_kopt | INT | 00–32768 | [GGUF models only] Top-K parameter for llama.cpp model constructor. Controls constructor-level top-K setting passed to Llama(). 0 = disabled. See also top_k_sampling for generation-time top-K. |
| min_popt | FLOAT | 0.000–1 | [GGUF models only] Minimum probability sampling threshold. Filters out tokens with probability below min_p × max_token_probability. Default 0.0 (disabled) matches HF behavior. Higher values (e.g. 0.05) aggressively narrow candidates, which may reduce output length. |
| top_k_samplingopt | INT | 00–1000 | [GGUF models only] Top-K sampling during generation. Restricts each token choice to the K most probable candidates. Default 0 (disabled) matches HF behavior. Non-zero values (e.g. 40) reduce variety and may shorten output. |
| pool_sizeopt | INT | 41943041048576–10485760 | [GGUF models only] Memory pool size for GGUF vision processing. Controls internal buffer allocation. Default: 4,194,304 (4 MB). |
| sampling_profileopt | COMBO | Manual | Manual preserves the values configured on this node. Qwen Recommended applies the official general-task sampling preset for the selected Qwen3.5/3.6/3.8 model and Thinking/Instruct mode. |
| reasoning_effortopt | COMBO | medium | [Qwen3.8 Thinking mode only] Reasoning depth passed to the chat template. medium is the safe default; low favors shorter reasoning; xhigh asks for the most thorough reasoning and may use substantially more tokens. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| RESPONSE | STRING | — |