Nodes/ComfyUI-ThinkingLLM/ThinkingLLM Advanced (GGUF)
ComfyUI Node

ThinkingLLM Advanced (GGUF)

Every llama.cpp dial, exposed and explained

By goodguy1963·Created 4 months ago·Updated 6 days ago· 21
ThinkingLLM Advanced (GGUF)
  • image
  • video
  • mask
  • audio
  • RESPONSE
  • RAW_TRACE
  • MASK_PREVIEW
model_nameQwen3.5-4B-Uncensored-HauhauCS-Aggressive-Q4_K_M.gguf [~2.4GB]
deviceauto
preset_prompt🖼️ Detailed Description
custom_prompt
max_tokens8192
temperature0.60
top_p0.90
repetition_penalty1.00
frame_count16
ctx32768
n_batch512
gpu_layers-1
image_max_tokens4096
top_k20
pool_size4194304
keep_model_loadedfalse
seed1
legacy_seed_modefixed
legacy_unload_after_runfalse
n_ubatch512
n_threads0
n_threads_batch0
flash_attntrue
offload_kqvtrue
ctx_checkpoints0
stream_tokens_to_terminalfalse
enable_thinkingtrue
auto_finalization_retryfalse
hf_token
mask_modefocus
audio_file_path
duration_seconds5.0

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 check RAW_TRACE for 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_ubatch should stay at or below n_batch.
  • flash_attn / offload_kqv - on by default, and the node is honest about them: RAW_TRACE reports 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_k 0 disables it; 20 is the conservative default.
  • device - auto/cpu/mps. auto prefers 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.

CategoryThinkingLLM

Inputs (36)

NameTypeDefaultDescription
model_nameCOMBOQwen3.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.
deviceCOMBOautoauto 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_promptCOMBO🖼️ Detailed DescriptionSelect 'No preset' to use only the custom prompt or image input.
custom_promptSTRINGAdditional user input that gets combined with the preset template. Leave empty to use only the template.
max_tokensINT819264–32768Maximum new tokens to generate. Larger values give more room for reasoning but increase runtime and memory use.
temperatureFLOAT0.600–2Sampling randomness. Lower values are more deterministic; higher values are more varied.
top_pFLOAT0.900–1Nucleus sampling cutoff. Lower values restrict token choice; 0.9 is a balanced default.
repetition_penaltyFLOAT1.000.5–2Values above 1.0 reduce repeated phrases; 1.0 leaves repetition unmodified.
frame_countINT161–64Number of video frames to sample. More frames improve video context but raise image-token, batch, and context pressure.
ctxINT327681024–262144llama.cpp context window. Too large can reduce speed and increase KV-cache memory even on strong GPUs.
n_batchINT51264–32768Prompt processing batch size. Higher can improve prompt ingestion but may raise memory use or fail with image/video inputs.
gpu_layersINT-1-1–200Number of model layers to offload to GPU. -1 asks llama.cpp to offload all possible layers; 0 is CPU-only.
image_max_tokensINT4096256–1024000Upper token budget for each image/video frame. Lower it if multimodal decode fails or VRAM use is too high.
top_kINT200–32768llama.cpp sampler top-k. 0 disables top-k filtering; 20 is a conservative default.
pool_sizeINT41943041048576–10485760llama.cpp memory pool size for multimodal work. Increase only when backend errors point at pool/context capacity.
keep_model_loadedBOOLEANfalseKeep the GGUF model in RAM/VRAM after the run so repeated prompts skip model loading. Disable if you need memory back for other nodes.
seedINT11–4294967295Sampling seed. The node also uses fixed-seed prompt persistence, so identical inputs can reuse the saved result.
legacy_seed_modeCOMBOfixedLegacy workflow compatibility only. This widget is ignored by current ThinkingLLM logic.
legacy_unload_after_runBOOLEANfalseLegacy workflow compatibility only. Model unloading is controlled by keep_model_loaded.
n_ubatchINT5120–32768Physical batch size. Keep at or below n_batch. Lower values can improve stability; 0 uses min(n_batch, 512).
n_threadsINT00–256CPU generation threads. On high-core/NUMA servers, auto can be slower; try 8-16 if GPU utilization is low.
n_threads_batchINT00–256CPU prompt/batch threads. Tune separately from generation threads on server CPUs.
flash_attnBOOLEANtrueEnable llama.cpp flash attention when the installed backend accepts and supports it. RAW_TRACE reports if the kwarg was dropped.
offload_kqvBOOLEANtrueKeep K/Q/V and KV-cache related work on GPU when supported. RAW_TRACE warns when the backend drops this kwarg.
ctx_checkpointsINT00–32Checkpoint count for multimodal context handling. JamePeng builds usually recommend 0 for single-turn ComfyUI runs.
stream_tokens_to_terminalBOOLEANfalsePrint generated tokens live in the ComfyUI terminal. Useful for long runs and backend troubleshooting.
enable_thinkingBOOLEANtrueEnable 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_retryBOOLEANfalseIf 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_tokenSTRINGOptional 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.
imageoptIMAGE
videooptIMAGE
maskoptMASK
mask_modeoptCOMBOfocusFocus describes the selected area; reconstruct conceals it and infers the surrounding scene continuation.
audiooptAUDIO
audio_file_pathoptSTRINGOptional local audio file path. M4A, MP3, WAV, FLAC, and other FFmpeg-readable files are decoded to 16 kHz mono WAV before inference.
duration_secondsoptFLOAT5.00.2–150Target 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)

NameTypeDescription
RESPONSESTRING
RAW_TRACESTRING
MASK_PREVIEWIMAGE