Nodes/LLM Node for ComfyUI/Advanced Options Node
ComfyUI Node

Advanced Options Node

The LLM Node's sampling dials, kept off the main node

By Big-Idea-Technology·Created 2 years ago·Updated about a year ago· 71
Advanced Options Node
    • AdvOptionsConfig
    temperature1.0
    top_p0.9
    top_k50
    repetition_penalty1.2
    trust_remote_codefalse
    torch_dtypeauto

    The main LLM_Node in this pack keeps its required inputs minimal - text, seed, model, max tokens. Everything that actually controls how the model thinks lives in the Advanced Options Node instead, which bundles the sampling parameters into a single config you plug into the main node. It's a tidy pattern: the main node stays clean, and you can swap presets by rewiring one connection.

    What it does

    This node takes six inputs and packs them into one AdvOptionsConfig output:

    • temperature - randomness. Lower = more confident, repetitive output; higher = more variety. Default 1.0.
    • top_p - nucleus sampling cutoff. Only the highest-probability tokens totaling that cumulative probability get considered. Default 0.9.
    • top_k - limits sampling to the top N tokens. 0 means no limit. Default 50.
    • repetition_penalty - discourages the model from reusing tokens it already emitted; values above 1 penalize repeats. Default 1.2.
    • trust_remote_code - whether to allow a model repo to execute its own custom code at load. Default false.
    • torch_dtype - auto, float32, bfloat16, float16, or float64. Default auto, which picks bfloat16 on compatible CUDA cards.

    Wire the AdvOptionsConfig output into the AdvOptionsConfig input on the main LLM_Node and you're done. For everyday prompt-enhancement work, a temperature around 0.7–0.9 with the default repetition penalty of 1.2 is a sane starting point; crank temperature only if output feels sterile.

    The mechanism, and one trap

    Reading the pack's source, the node just builds a dict and the main node reads it. But which fields actually apply depends on which model path you're on. For transformers models (T5, GPT-2, Llama, Mistral, Qwen2, ...) all six options are honored: torch_dtype becomes the load dtype and trust_remote_code is passed to from_pretrained. For GGUF models - folders with "GGUF" in the name, loaded through llama.cpp - only temperature, top_p, top_k, and repetition_penalty do anything, and repetition_penalty gets renamed to llama.cpp's repeat_penalty internally. torch_dtype and trust_remote_code are silently ignored on that path, because a GGUF file is already quantized and llama.cpp doesn't need either. So if you're on a GGUF model and your dtype setting "doesn't work," it isn't a bug - it's the design.

    Installing and using it

    Same pack install as everything else here: ComfyUI Manager, searching "LLM Node", or

    cd ComfyUI/custom_nodes
    git clone https://github.com/Big-Idea-Technology/ComfyUI_LLM_Node
    

    then restart. The node is inert on its own - it only matters wired into LLM_Node, and the model you point that at has to be sitting in ComfyUI/models/LLM_checkpoints/. One thing worth calling out: leave trust_remote_code off unless the model card explicitly requires it. Enabling it runs arbitrary code from the repo at load time, and the custom-node ecosystem has already learned that lesson the hard way.

    CategoryLLM

    Inputs (6)

    NameTypeDefaultDescription
    temperatureFLOAT1.0
    top_pFLOAT0.9
    top_kINT50
    repetition_penaltyFLOAT1.2
    trust_remote_codeBOOLEANfalse
    torch_dtypeCOMBOauto5 options: auto, float32, bfloat16, float16, float64

    Outputs (1)

    NameTypeDescription
    AdvOptionsConfigADVOPTIONSCONFIG