π LLM Config
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 (107)
| 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. |
| 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.). |
| remove_thinking | BOOLEAN | false | Remove <think>...</think> or <|channel>...<channel|> section in text |
| answer_delimiter | STRING | Use this for non-standard models to clean up the output. Enter the token where the real answer starts, and the node will automatically cut out all thinking processes and technical tags generated prior to it. | |
| 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 (0,1,2...) | |
| add_frame_id | STRING | Template to label video frames before insertion. {video_num} = video index (0,1,2...). {frame_num} = frame index (0,1,2...) | |
| add_audio_id | STRING | Template to label audio clips before insertion. {num} = audio index (0,1,2...) | |
| π 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 | 100β100 | Limit on the total number of incoming images. |
| max_frames | INT | 240β512 | Limit on video frames. More frames require larger context. |
| max_audios | INT | 30β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 (image video mode only) |
| video_mode | COMBO | images | Video processing mode. "native": Video processing on the llama side (requires llama-cpp-python version 4.0.0 or higher);uses ffmpeg for video encoding; preserves temporal sequence understanding but requires the model to support video."images": extracts frames and processes them as individual images.Use "native" for better temporal coherence, and "images" for compatibility with all models or if ffmpeg is missing from the system (not in PATH or the "python_embeded\Scripts" folder). |
| video_fps_target | FLOAT | 1.00.1β60 | Target frames per second for video encoding (native video mode only). Lower values (0.5-2.0) reduce the number of frames sent to the model, saving VRAM and processing time but potentially missing fast motion. Higher values (15.0-30.0) capture more detail for fast-paced content but increase VRAM usage significantly. Typical range: 1.0-5.0 FPS for most use cases. |
| video_timestamp_interval_ms | INT | 5000100β60000 | Interval in milliseconds between timestamp markers injected into the video stream (native video mode only). Smaller values (1000-2000ms) provide finer temporal granularity for precise event localization but increase token count. Larger values (5000-10000ms) reduce overhead for long videos where exact timing is less critical. Set to 0 to disable timestamps entirely. |
| mmproj_batch_max_tokens | INT | 10240β1048576 | Maximum batch size for the multimodal projector (mmproj). Multimodal tasks require more VRAM per token than standard text, so this value is typically lower than n_batch. Reduce if VRAM is insufficient (to 512 or 256) or increase for faster processing if memory allows. |
| β‘ Speculative Decoding | BOOLEAN | false | Show/hide group: speculative decoding parameters (requires llama-cpp-python >= 0.3.48). |
| speculative_enabled | BOOLEAN | false | Master switch to enable speculative decoding. Disabled automatically for multimodal inputs. |
| speculative_type | COMBO | 3=MTP (Multi-token Prediction) | Speculative algorithm type. 3=MTP (best for Qwen3), 4/5=DFlash/DSpark (requires external draft), 7/8=N-gram (no draft model needed, good for code/JSON). |
| draft_n_max | INT | 21β32 | Maximum number of draft tokens to generate per step. Recommended: 2 for MTP, 7 for DFlash. |
| draft_p_min | FLOAT | 0.000β1 | Minimum probability threshold to accept a draft token. 0.0 = accept all. |
| draft_model_path | STRING | Path to external draft GGUF model. Required for DFlash/DSpark. Leave empty for built-in MTP or N-gram. | |
| draft_n_gpu_layers | INT | -1-1β999 | Number of layers to offload for the external draft model. -1 = all, 0 = CPU. |
| draft_backend_sampling | BOOLEAN | true | Use backend vocabulary sampler for draft tokens. Recommended True for DFlash v1 and DSpark. |
| ngram_size_n | INT | 82β32 | [N-gram only] Size of the n-gram window (N). |
| ngram_size_m | INT | 162β64 | [N-gram only] Maximum length of the draft continuation (M). |
| ngram_min_hits | INT | 11β10 | [N-gram only] Minimum number of matching occurrences required to propose a draft. |
| ngram_max_entries_per_key | INT | 41β16 | [N-gram K4V only] Maximum cached continuations per n-gram key. |
| ctx_checkpoints | INT | 00β4096 | Max number of context checkpoints per slot (0 = disabled). Set to 16 if using N-gram speculative decoding (required for rollbacks). For standard 1-question-1-answer generation or MTP/DFlash methods, keep at 0 to save memory. |
| checkpoint_on_device | BOOLEAN | false | Store context checkpoints in VRAM (True) instead of RAM (False). Saves VRAM if False, but makes rollbacks slower. Only matters if 'ctx_checkpoints' (in Memory group) > 0. |
| π’ Embeddings & TTS | BOOLEAN | false | Show/hide group: embedding/TTS 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. |
| extract_tts | BOOLEAN | false | Switch node to TTS (Text-to-Speech) mode. When enabled, the node generates audio from text instead of user_prompt text. Requires mmproj_path and a TTS-compatible model. |
| mmproj_use_gpu | BOOLEAN | true | Use GPU for mmproj (multimodal projector). Disable for CPU-only inference (slower but works without CUDA). |
| mmproj_flash_attn | BOOLEAN | true | Enable Flash Attention for mmproj (multimodal projector). Improves performance on supported GPUs. Disable if you encounter compatibility issues. |
| language | STRING | Language code for TTS generation (zh, en, de, it, pt, es, ja, ko, fr, ru). Leave empty for auto-detection or model default. Note: model must support the specified language. | |
| π οΈ 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). |
| streaming_mode | BOOLEAN | false | Enables token streaming to allow interrupting generation via the ComfyUI 'Interrupt' button. Adds a negligible overhead (~1%), but guarantees you can manually stop long responses. Recommended if you often need to cancel generations. |
| 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 | β |