ThinkingLLM Advanced (GGUF)
Every llama.cpp dial, exposed and explained
- image
- video
- mask
- audio
- RESPONSE
- RAW_TRACE
- MASK_PREVIEW
The plain GGUF node hides llama.cpp's plumbing behind a friendly catalog. The Advanced GGUF node is that plumbing, with a widget for nearly everything the backend accepts - context size, batch sizes, GPU offload depth, image token budget, flash attention, thread counts. It's the node for the person who has read an llama.cpp error message and recognized it. If you're happy with defaults, the non-Advanced version is the better friend; this one exists because sometimes the default ctx isn't big enough or the GPU offload is leaving performance on the table.
Same model catalog as the base GGUF node (70 Qwen3-VL / Qwen3.5 / Qwen2.5-VL / Gemma 4 quants, auto-downloaded on first use), same RESPONSE / RAW_TRACE outputs, same optional image, video, audio, and audio_file_path inputs. The preset_prompt list includes the LTX and Wan scene/timeline templates if you're generating video prompts.
The dials that matter
ctx- the context window, 32768 by default, up to 262144. Bigger is not free: too large and KV-cache memory eats the VRAM you freed by quantizing. Raise it only when the model truncates.gpu_layers- -1 offloads everything it can; 0 is CPU-only. Start at -1, and checkRAW_TRACEfor the actual offload count.image_max_tokens- the token budget per image/video frame. Lower it if multimodal decode fails or VRAM spikes; 4096 is the default.n_batch/n_ubatch- prompt-processing batch and physical batch. Higher batch ingests prompts faster but can fail with image/video input;n_ubatchshould stay at or belown_batch.flash_attn/offload_kqv- on by default, and the node is honest about them:RAW_TRACEreports when the installed backend silently drops the kwarg, so you're not chasing a speedup that was never applied.top_k/temperature/top_p/repetition_penalty- the sampler stack.top_k0 disables it; 20 is the conservative default.device- auto/cpu/mps.autoprefers CUDA when PyTorch sees an NVIDIA GPU.stream_tokens_to_terminal- your "is it thinking or is it dead" debugger, same as everywhere in this pack.
Two widgets exist purely for legacy workflow compatibility and are ignored by current logic: legacy_seed_mode and legacy_unload_after_run. Unloading is controlled by keep_model_loaded now. Leave them alone.
Installing
Manager install (search ThinkingLLM), or:
cd ComfyUI/custom_nodes
git clone https://github.com/goodguy1963/ComfyUI-ThinkingLLM.git
cd ComfyUI-ThinkingLLM
pip install -r requirements.txt
The GGUF caveats from the base node all apply: this needs a vision-capable llama-cpp-python build (JamePeng's fork), Linux auto-installs a matching wheel on first use, Windows usually needs a manually-matched win_amd64 wheel. Verify with python tools/check_llama_backend.py.
Troubleshooting
The recurring theme with this node is that llama.cpp kwargs get dropped silently by mismatched backends. The node's answer is RAW_TRACE - it logs whether flash attention and offload_kqv actually took, whether GPU offload happened, and the pool/context state. When generation is slow or vision decode fails, read that trace before tweaking pool_size or ctx_checkpoints; most of the time the fix is a correct backend wheel, not a knob. And on high-core/NUMA servers, auto thread counts can be slower - the tooltip's advice to try 8–16 generation threads is the real-world fix when GPU utilization looks low.
Inputs (36)
| Name | Type | Default | Description |
|---|---|---|---|
| model_name | COMBO | Qwen3.5-4B-Uncensored-HauhauCS-Aggressive-Q4_K_M.gguf [~2.4GB] | GGUF vision model from gguf_models.json or auto-detected local files. [installed] means the catalog model was found in a configured GGUF/LLM location; [local] means an uncatalogued local model. Missing GGUF or mmproj files are downloaded on first use. |
| device | COMBO | auto | auto prefers CUDA when PyTorch sees an NVIDIA GPU. If RAW_TRACE says GPU offload is no or unknown, verify your llama-cpp-python CUDA wheel before blaming the model. |
| preset_prompt | COMBO | 🖼️ Detailed Description | Select 'No preset' to use only the custom prompt or image input. |
| custom_prompt | STRING | Additional user input that gets combined with the preset template. Leave empty to use only the template. | |
| max_tokens | INT | 819264–32768 | Maximum new tokens to generate. Larger values give more room for reasoning but increase runtime and memory use. |
| temperature | FLOAT | 0.600–2 | Sampling randomness. Lower values are more deterministic; higher values are more varied. |
| top_p | FLOAT | 0.900–1 | Nucleus sampling cutoff. Lower values restrict token choice; 0.9 is a balanced default. |
| repetition_penalty | FLOAT | 1.000.5–2 | Values above 1.0 reduce repeated phrases; 1.0 leaves repetition unmodified. |
| frame_count | INT | 161–64 | Number of video frames to sample. More frames improve video context but raise image-token, batch, and context pressure. |
| ctx | INT | 327681024–262144 | llama.cpp context window. Too large can reduce speed and increase KV-cache memory even on strong GPUs. |
| n_batch | INT | 51264–32768 | Prompt processing batch size. Higher can improve prompt ingestion but may raise memory use or fail with image/video inputs. |
| gpu_layers | INT | -1-1–200 | Number of model layers to offload to GPU. -1 asks llama.cpp to offload all possible layers; 0 is CPU-only. |
| image_max_tokens | INT | 4096256–1024000 | Upper token budget for each image/video frame. Lower it if multimodal decode fails or VRAM use is too high. |
| top_k | INT | 200–32768 | llama.cpp sampler top-k. 0 disables top-k filtering; 20 is a conservative default. |
| pool_size | INT | 41943041048576–10485760 | llama.cpp memory pool size for multimodal work. Increase only when backend errors point at pool/context capacity. |
| keep_model_loaded | BOOLEAN | false | Keep the GGUF model in RAM/VRAM after the run so repeated prompts skip model loading. Disable if you need memory back for other nodes. |
| seed | INT | 11–4294967295 | Sampling seed. The node also uses fixed-seed prompt persistence, so identical inputs can reuse the saved result. |
| legacy_seed_mode | COMBO | fixed | Legacy workflow compatibility only. This widget is ignored by current ThinkingLLM logic. |
| legacy_unload_after_run | BOOLEAN | false | Legacy workflow compatibility only. Model unloading is controlled by keep_model_loaded. |
| n_ubatch | INT | 5120–32768 | Physical batch size. Keep at or below n_batch. Lower values can improve stability; 0 uses min(n_batch, 512). |
| n_threads | INT | 00–256 | CPU generation threads. On high-core/NUMA servers, auto can be slower; try 8-16 if GPU utilization is low. |
| n_threads_batch | INT | 00–256 | CPU prompt/batch threads. Tune separately from generation threads on server CPUs. |
| flash_attn | BOOLEAN | true | Enable llama.cpp flash attention when the installed backend accepts and supports it. RAW_TRACE reports if the kwarg was dropped. |
| offload_kqv | BOOLEAN | true | Keep K/Q/V and KV-cache related work on GPU when supported. RAW_TRACE warns when the backend drops this kwarg. |
| ctx_checkpoints | INT | 00–32 | Checkpoint count for multimodal context handling. JamePeng builds usually recommend 0 for single-turn ComfyUI runs. |
| stream_tokens_to_terminal | BOOLEAN | false | Print generated tokens live in the ComfyUI terminal. Useful for long runs and backend troubleshooting. |
| enable_thinking | BOOLEAN | true | Enable model reasoning/thinking when the backend supports it: True=allow thinking, False=force direct answer. Even when enabled, easy prompts may still get a direct answer, and this node automatically disables thinking when there is not enough output budget left for useful reasoning. For non-Qwen GGUF models this is advisory. |
| auto_finalization_retry | BOOLEAN | false | If enabled, runs an extra LLM completion when the first output is empty or reasoning-only. Disabled by default so one node execution performs one generation pass. |
| hf_token | STRING | Optional Hugging Face access token for private or gated GGUF/mmproj downloads. It is passed only to the download call, never logged or cached, and the in-memory copy is dropped after the download attempt. Clear this field before saving or sharing workflows. | |
| imageopt | IMAGE | — | |
| videoopt | IMAGE | — | |
| maskopt | MASK | — | |
| mask_modeopt | COMBO | focus | Focus describes the selected area; reconstruct conceals it and infers the surrounding scene continuation. |
| audioopt | AUDIO | — | |
| audio_file_pathopt | STRING | Optional local audio file path. M4A, MP3, WAV, FLAC, and other FFmpeg-readable files are decoded to 16 kHz mono WAV before inference. | |
| duration_secondsopt | FLOAT | 5.00.2–150 | Target video duration in seconds. It is used only by registered LTX 2.3 and MiniMax H3 video presets. Connect the same requested duration to the video generator; MiniMax values are normalized to its 17k+5 frame grid at 24 fps. For longer MiniMax scripts, ThinkingLLM selects a coherent moment that fits while keeping any selected dialogue verbatim. |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| RESPONSE | STRING | — |
| RAW_TRACE | STRING | — |
| MASK_PREVIEW | IMAGE | — |