π LLM Config (Advanced)
Every knob on the local Qwen3-VL loader, finally behind one node
- config
- diff_config
If you've ever hand-edited a JSON config to get an LLM node to work, this is the node that retires that hobby. π LLM Config (Advanced) is the configurator for KLL535's SimpleQwenVL pack - the one that loads GGUF vision-language models (Qwen3-VL, Qwen3.5/3.6, Gemma4, MiniCPMβ¦) locally through llama.cpp, no API and no key. The pack's core node takes its entire setup as a JSON string; this node is a friendly GUI for writing that string, with all 73+ llama.cpp parameters laid out instead of buried in a config file.
How it works
The node doesn't run the model. It builds the config and hands it to the main Simple Qwen-VL Vision Language Model node as a single config STRING output. You wire config into the core node's config_override input and the loader takes it from there.
Parameters are grouped into nine collapsible sections - Model & Paths, Memory & Context, Sampling & Generation, Hardware & Acceleration, Chat & Prompts, Prompt Template, Multimodal & Media, Embeddings, and Debug - so by default you only see the sensible defaults and expand what you actually need. When the node runs, it merges in a strict priority order: base config β whatever your widget values say β your config_override text input applied last. That override is the sneaky good part: it's stackable and can be plain-ish text, because json_repair will fix missing commas and quotes for you.
There's also built-in preset management. Save, rename, and delete presets right from the node - they land in ComfyUI/user/SimpleQwenVL_configs/system_prompts_user.json, and whatever you save appears in the model_preset dropdown on both this node and the core node. Set up a model once, then pick it from a list forever.
The inputs that actually matter
The full list is huge, but a beginner sets a handful:
- model_path and mmproj_path - the GGUF weights and the multimodal projector.
mmproj_pathis required for vision models; on Windows the Browse buttons find them for you (the file dialogs are Windows-only via ctypes, so on Linux/macOS you type paths). - chat_handler - picks the chat template (
qwen3,qwen35,gemma4,llava15β¦). Required for vision models; get this wrong and the model talks gibberish. - n_ctx - context size. The tooltip gives you the rule:
image_tokens + input_tokens + max_tokens β€ n_ctx. Bigger context eats more VRAM. - n_gpu_layers -
-1puts everything on GPU,0is CPU-only. If you OOM, step it down. - n_cpu_moe - for MoE models, keeps that many experts on CPU instead of letting the GPU spill into shared memory. The pack author's whole "make a 35B fit in 16GB" trick.
- max_tokens + enable_thinking - thinking models (Qwen3, Gemma4) burn through output tokens and emit
<think>β¦</think>blocks you'll want stripped (the pack's Simple Remove Think node does that).
Installing it
Install the pack via ComfyUI Manager (search "ComfyUI_Simple_Qwen3-VL-gguf") or clone it:
cd ComfyUI/custom_nodes
git clone https://github.com/KLL535/ComfyUI_Simple_Qwen3-VL-gguf
Restart ComfyUI and refresh the frontend. Then the real work: the stock pip install llama-cpp-python is stale and doesn't support Qwen3 at all. You need JamePeng's fork - 0.3.17+ for qwen3-VL, 0.3.30+ for qwen3.5, 0.3.35+ for gemma4. Either grab a prebuilt WHL from his releases or, as the README recommends, build from source:
set CMAKE_ARGS=-DGGML_CUDA=on -DCMAKE_CUDA_ARCHITECTURES=89 -DCMAKE_BUILD_TYPE=Release
python -m pip install .
(89 is a 40-series card - see the README table for yours.) Prebuilt WHLs may lack AVX/VMM acceleration, which matters for n_cpu_moe. The pack itself also pulls json_repair, colorama, pillow, opencv-python, and av.
Troubleshooting
ggml_new_object: not enough space- bumppool_size(the tooltip suggests 8MB/16MB) or lowern_ctx.Failed to load shared library ... ggml.dll- missing CUDA runtime. ComfyUI's PyTorch usually provides it; otherwise install the CUDA Toolkit and match driver versions. The README's issue #15 covers this in detail.- Sudden 5-7x slowdown - your VRAM overflowed into shared memory. Watch the CUDA graph in Task Manager; fix with
n_cpu_moe, KV-cache quantization (type_k/type_v), or a stronger quant.
Note the author tests on Windows (RTX 5080/2060, Python 3.13). This node is brand new and only surfaced in the pack's nightly updates, so if something's janky, that's probably why - turn on debug in the Debug group and run in subprocess mode to get clean logs.
Inputs (83)
| Name | Type | Default | Description |
|---|---|---|---|
| model_preset | COMBO | None | Select model preset |
| π Model & Paths | BOOLEAN | true | Show/hide group: model and projector paths. |
| model_path | STRING | Path to GGUF model file. Relative paths are supported (relative to custom_nodes dir). | |
| mmproj_path | STRING | Path to multimodal projector file. Required for vision models. | |
| ποΈ Memory & Context | BOOLEAN | true | Show/hide group: context, batches, memory pool, KV cache. |
| n_ctx | INT | 8192512β1048576 | Context size. Rule: image_tokens + input_tokens + max_tokens <= n_ctx. |
| n_batch | INT | 204832β65536 | Batch size for prompt processing. Lower = less VRAM, higher = faster. |
| n_ubatch | INT | 51232β65536 | Micro-batch size for advanced memory management. |
| n_keep | INT | 2560β131072 | Number of tokens to keep in KV-cache from the initial prompt. Useful for few-shot / long-context scenarios. |
| offload_kqv | BOOLEAN | true | Offload KV Cache to GPU. Turn OFF to save VRAM (will be slower). |
| type_k | COMBO | 1=F16 | KV-cache quantization type for K. Some variants may not work. |
| type_v | COMBO | 1=F16 | KV-cache quantization type for V. Some variants may not work. |
| use_mmap | BOOLEAN | false | Enable mmap. On Windows it is often better to turn it off. |
| use_mlock | BOOLEAN | false | Enable mlock. Lock model in RAM to prevent OS swapping. |
| pool_size | INT | 41943040β104857600 | Memory pool size for llama.cpp. Increase if you get 'ggml_new_object: not enough space'. 0 = default. |
| logits_all | BOOLEAN | false | If True, llama.cpp evaluates logits for ALL tokens (not only the last one). Required for perplexity evaluation and some scoring tasks, but significantly increases VRAM and time. |
| ctx_checkpoints | INT | 00β4096 | Max number of context checkpoints to create per slot. 0 = disabled. |
| swa_full | BOOLEAN | false | Enable full Sliding Window Attention context. Required for some models to prevent truncation. |
| π² Sampling & Generation | BOOLEAN | true | Show/hide group: generation limits and sampling parameters. |
| max_tokens | INT | 204816β131072 | Maximum number of tokens to generate. Thinking models usually need more. |
| temperature | FLOAT | 0.700β2 | Sampling temperature. Lower = deterministic, higher = creative. |
| top_p | FLOAT | 0.920β1 | Nucleus sampling cumulative probability cutoff. |
| min_p | FLOAT | 0.050β1 | Minimum probability for a token to be considered (filters out unlikely tokens). |
| top_k | INT | 00β500 | Limit to top-K most likely tokens. 0 disables top-k filtering. |
| repeat_penalty | FLOAT | 1.100β3 | Penalty for repeating tokens. Values >1 discourage repetition. |
| presence_penalty | FLOAT | 0.00-2β2 | Penalty based on token presence. Positive values encourage new topics. |
| frequency_penalty | FLOAT | 0.00-2β2 | Penalty based on token frequency. Positive values reduce repetition. |
| enable_thinking | BOOLEAN | false | Enable thinking/reasoning process (for Gemma, Qwen, MiniCPM, GLM, etc.). |
| force_reasoning | BOOLEAN | false | For Qwen3: force reasoning mode even on simple queries. |
| words_to_ban | STRING | Comma-separated list of banned words. Applies logit_bias of -100 to their tokens. | |
| βοΈ Hardware & Acceleration | BOOLEAN | true | Show/hide group: GPU layers, MoE offload, threads, multi-GPU. |
| n_gpu_layers | INT | -1-1β999 | Number of layers to offload to GPU. -1 = all, 0 = CPU only. |
| n_cpu_moe | INT | 00β128 | For MoE models: number of experts to keep on CPU. Saves VRAM. Slower than full GPU offload, but faster and more stable than letting the OS swap when VRAM is overcommitted. |
| cpu_moe | BOOLEAN | false | For MoE models: unload ALL experts into RAM. Minimal VRAM usage. |
| n_threads | INT | 81β256 | Number of CPU threads to use for inference (and prompt processing). |
| flash_attn_type | COMBO | -1=AUTO | Flash Attention backend for llama.cpp. Requires a compatible build. |
| split_mode | COMBO | 0-NONE | GPU splitting mode: 0=NONE, 1=LAYER, 2=ROW. |
| main_gpu | INT | 00β16 | Index of the primary GPU when split_mode=NONE. |
| cuda_device | STRING | Sets CUDA_VISIBLE_DEVICES before init. Single index or comma-separated list. | |
| tensor_split | STRING | Fractions of the model to offload to each GPU (split_mode=LAYER). | |
| π¬ Chat, Prompts & Variables | BOOLEAN | false | Show/hide group: chat handlers, formats, system prompts, and variables. |
| chat_handler | COMBO | none | Chat handler for multimodal models. |
| chat_format | COMBO | none | Chat format for text-only models. |
| chat_format_from_gguf | BOOLEAN | false | Force loading chat template from the GGUF metadata. Note: Does not work with images/audio/video. |
| system_prompt_default | STRING | Default system prompt for the model. | |
| system_preset_to_user_prompt | BOOLEAN | false | Move the system preset from the system prompt role to the user prompt role. |
| user_prompt_after_content | BOOLEAN | true | Insert user_prompt after the image/audio/video content. False = before. |
| enable_variables | BOOLEAN | false | Enable substitution of {placeholders} in system and user prompts. |
| add_vision_id | COMBO | auto | Add vision ID token. 'auto' = script decides (True if images != 1 or video > 0). |
| add_image_id | STRING | Template to label images before insertion. {num} = image index. | |
| add_frame_id | STRING | Template to label video frames before insertion. {num} = frame index. | |
| add_audio_id | STRING | Template to label audio clips before insertion. {num} = audio index. | |
| π Prompt Template | BOOLEAN | false | Show/hide group: custom raw prompt templates and stop sequences. |
| raw_mode | BOOLEAN | false | Enable custom raw prompt template mode (bypasses chat handlers). |
| prompt_template | STRING | Custom prompt template. Must include {system}, {images}, {user}. | |
| stop | STRING | Stop sequences. JSON list: ["</s>", "[INST]"] or comma-separated. Empty = use handler defaults. | |
| πΌοΈ Multimodal & Media | BOOLEAN | false | Show/hide group: image/audio/video limits and quality. |
| force_mmproj | BOOLEAN | true | Load mmproj even without media inputs (preserves template for enable_thinking). |
| image_min_tokens | INT | 00β65536 | Minimum tokens for image embeddings. 0 = not set. |
| image_max_tokens | INT | 00β65536 | Maximum tokens for image embeddings. 0 = not set. |
| max_images | INT | 101β100 | Limit on the total number of incoming images. |
| max_frames | INT | 241β512 | Limit on video frames. More frames require larger context. |
| max_audios | INT | 31β100 | Limit on the number of incoming audio clips. |
| audio_sample_rate | INT | 00β192000 | Target sampling frequency for audio resampling. 0 = not set. |
| image_quality | INT | 951β100 | JPEG quality (1-100) when encoding images to data URIs. |
| frame_quality | INT | 751β100 | JPEG quality (1-100) when encoding video frames to data URIs. |
| π’ Embeddings | BOOLEAN | false | Show/hide group: embedding extraction mode (replaces text generation). |
| extract_embedding | BOOLEAN | false | Switch node to embedding mode. Uses LlamaEmbedding. Text output is replaced by a CONDITIONING tensor. |
| pooling_type | COMBO | 0-NONE | Pooling strategy for LlamaEmbedding. NONE = no pooling (per-token embeddings), MEAN = average pool, CLS = use [CLS] token, LAST = use last token. |
| tokenizer_path | STRING | Path to external HuggingFace tokenizer. Overrides built-in llama.cpp tokenizer. | |
| embedding_scale | FLOAT | 1.00.1β1000 | Scalar multiplier applied to the output embedding vector. 1.0 = no scaling. Useful to match the magnitude expected by downstream models. |
| convert_emb_to_cond | BOOLEAN | false | Wrap the raw embedding into a ComfyUI CONDITIONING structure (hidden_states + attention_mask). Required for passing embeddings into SD/Flux conditioning slots. |
| π οΈ Debug, System & Advanced | BOOLEAN | false | Show/hide group: logging, garbage collection, cache, and advanced settings. |
| verbose | BOOLEAN | false | Enables verbose logging from llama.cpp. |
| debug | BOOLEAN | true | Enables timing output for each stage to the console. |
| debug_output | BOOLEAN | false | Print the final LLM text output to console. |
| raw_output | BOOLEAN | false | If True, disables output.strip() (keeps leading/trailing whitespaces). |
| clearing_cache | BOOLEAN | true | Clear cache to prevent execution freezing during heavy memory activity. |
| force_gc_start | BOOLEAN | false | Force garbage collection after memory clearing when unload_all_models is active. |
| force_gc_unload | BOOLEAN | false | Force garbage collection after deleting the LLM model. |
| script | STRING | qwen3vl_run.py | Name of the Python script to execute. |
| extra | STRING | JSON dict of extra keys passed to the backend script. | |
| config_overrideopt | STRING | Stackable config override (JSON or plain text). Applied last, highest priority. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| config | STRING | β |
| diff_config | STRING | β |