Nodes/ComfyUI-QwenVL-Utils/QwenVL (Advanced)
ComfyUI Node

QwenVL (Advanced)

The node that reads your images, watches your video, and writes the prompt back — QwenVL (Advanced)

By AkihaTatsu·Created 7 months ago·Updated 6 months ago· 0
QwenVL (Advanced)
  • image
  • video
  • source_path
  • RESPONSE
model_nameQwen3.5-0.8B
enable_thinkingfalse
quantizationNone (FP16)
attention_modeauto
use_torch_compilefalse
deviceauto
preset_prompt🖼️ Detailed Description
custom_prompt
max_tokens512
temperature0.6
top_p0.90
num_beams1
repetition_penalty1.2
frame_count16
keep_model_loadedfalse
seed1
min_pixels200704
max_pixels1003520
ctx8192
n_batch512
gpu_layers-1
image_max_tokens4096
top_k0
min_p0.00
top_k_sampling0
pool_size4194304

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 with attention_mode and use_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. Fill custom_prompt and 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) and top_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 a video input (1–64, default 16).
  • quantization and attention_mode - HF only. attention_mode: auto picks 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 the Qwen35ChatHandler, which lives in JamePeng's fork, not stock llama.cpp: pip install git+https://github.com/JamePeng/llama-cpp-python.git
  • ImportError: transformers or weird failures - make sure you're on transformers>=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.

CategoryQwenVL-Utils

Inputs (29)

NameTypeDefaultDescription
model_nameCOMBOQwen3.5-0.8BSelect 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_thinkingBOOLEANfalse[Qwen3.5+ models only] Enable Thinking mode for Qwen3.5 unified models. When ON (Thinking mode), the model reasons step-by-step inside <think>…</think> blocks before producing the final answer — best for complex reasoning, math, and coding tasks. When OFF (Instruct mode), the model responds directly without internal reasoning — faster and more concise for straightforward queries. Only affects Qwen3.5 models; ignored for other model families.
quantizationCOMBONone (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_modeCOMBOauto[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_compileBOOLEANfalse[HF models only] Enable torch.compile() optimization. Provides ~20-30% speedup after first compilation pass. Requires CUDA and PyTorch 2.1+.
deviceCOMBOautoTarget device for inference. 'auto' selects the best available device. Use 'cpu' for CPU-only, 'cuda:0'/'cuda:1' for specific GPUs.
preset_promptCOMBO🖼️ Detailed DescriptionBuilt-in instruction template describing how the model should analyze the media. Selecting '❌ None' sends no system instruction (use custom_prompt instead).
custom_promptSTRINGWhen filled, completely replaces the preset prompt template. Leave empty to use the selected preset_prompt.
max_tokensINT51264–256000Maximum number of new tokens the model may generate. Larger values produce longer answers but take more time and memory. Both HF and GGUF backends respect this limit.
temperatureFLOAT0.60–2Controls 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_pFLOAT0.900–1Nucleus 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_beamsINT11–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_penaltyFLOAT1.20.5–2Penalizes 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_countINT161–64Number of frames uniformly sampled from video inputs. More frames provide richer temporal context but increase processing time and memory usage.
keep_model_loadedBOOLEANfalseKeep the model loaded in VRAM/RAM after inference so subsequent runs skip the loading step. Disable to free memory after each run.
seedINT11–4294967295Random seed for sampling reproducibility and video frame selection. Reuse the same seed to reproduce identical results.
imageoptIMAGE
videooptIMAGE
source_pathoptPATH
min_pixelsoptINT2007043136–12845056[HF models only] Minimum pixel count for image preprocessing. Controls the lower bound of image resolution. Default: 256×28×28 = 200,704.
max_pixelsoptINT10035203136–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.
ctxoptINT81921024–262144[GGUF models only] Context window size in tokens. Determines total prompt + response capacity. Higher values allow longer conversations but use more memory. Default: 8192.
n_batchoptINT51264–32768[GGUF models only] Prompt processing batch size. Higher values can improve prompt ingestion throughput at the cost of memory. Default: 512.
gpu_layersoptINT-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_tokensoptINT4096256–1024000[GGUF models only] Maximum tokens allocated for image encoding. Higher values preserve more image detail but consume more context window. Default: 4096.
top_koptINT00–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_poptFLOAT0.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_samplingoptINT00–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_sizeoptINT41943041048576–10485760[GGUF models only] Memory pool size for GGUF vision processing. Controls internal buffer allocation. Default: 4,194,304 (4 MB).

Outputs (1)

NameTypeDescription
RESPONSESTRING