Nodes/SP-Nodes/SP_KoboldCpp_OverrideCfg
ComfyUI Node

SP_KoboldCpp_OverrideCfg

Fine-tune your local LLM's sampling without leaving ComfyUI

By bananasss00·Created 2 years ago·Updated 6 days ago· 20
SP_KoboldCpp_OverrideCfg
    • OVERRIDE_CFG
    temperature0.00
    dynatemp_range0.0
    min_p0.00
    xtc_probability0.00
    xtc_threshold0.50
    smoothing_factor0.00
    smoothing_curve1.00

    The Kobold nodes in this pack let you pick a preset (simple_logical, godlike, and a handful of others) for how the LLM samples its output. This node is the escape hatch when a preset almost fits but not quite - it exposes the individual sampling parameters underneath so you can override just the one or two that matter, without giving up the rest of the preset. The node's own description is direct about the convention: "Override settings like temperature, min_p, xtc, smoothing, and dynatemp. Set to 0 to use default value" - every parameter here defaults to 0, meaning "leave KoboldCpp's own default alone," and only becomes active once you move it off zero.

    How it works

    These are standard local-LLM text-generation samplers, not anything specific to image generation, and the node's own tooltips (quoted below, trimmed) explain each one plainly:

    • temperature - "Controls the randomness of predictions. Higher values make the output more creative and unpredictable, lower values make it more focused and deterministic."
    • dynatemp_range - "Dynamically adjusts temperature based on model uncertainty. If the model is unsure, temperature increases for more creativity; if confident, temperature decreases for accuracy. 0 disables this feature."
    • min_p - "Filters out tokens until their cumulative probability reaches the min_p threshold. Helps prevent repetition and improves generation quality. 0 disables this sampler."
    • xtc_probability - "Probability of activating the XTC (Exclude Top Choices) sampler for each token. XTC removes the most likely words, forcing the model to be more creative."
    • xtc_threshold - "Minimum probability a token must have to be removed by XTC. All candidates above this threshold are excluded except the least likely one."
    • smoothing_factor - "Strength of logit smoothing. Smooths the probability distribution, reducing the gap between likely and unlikely tokens. 0 disables smoothing."
    • smoothing_curve - "Shape of the smoothing curve used in logit smoothing. Adjust for different smoothing behaviors."

    XTC is worth calling out specifically if you haven't run into it: it's a deliberately anti-obvious sampler - it strips away the most predictable next words to force the model off autopilot, which is a different mechanism from just raising temperature, and the two stack.

    Inputs and outputs that matter

    • temperature (0-10) - the one you'll reach for first; 0 leaves KoboldCpp's default in place.
    • min_p (0-1) - a solid general-purpose repetition fighter; try before reaching for temperature if output feels stale.
    • xtc_probability / xtc_threshold - for pushing a model out of its most predictable phrasing.
    • dynatemp_range, smoothing_factor, smoothing_curve - finer-grained tuning, worth leaving at 0 until the simpler knobs aren't enough.
    • Output: OVERRIDE_CFG - feeds SP_KoboldCppWithContext's (or SP_KoboldCpp's) optional override_cfg input.

    How to install it

    Bundled with the rest of SP-Nodes. Through ComfyUI Manager: search "SP-Nodes," install, restart. Manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/bananasss00/ComfyUI-SP-Nodes
    

    Restart ComfyUI. This node has no dependency of its own, but it's dead weight without a running KoboldCpp server for the Kobold nodes to actually call.

    Common issues & troubleshooting

    Changing a value here has no visible effect. Confirm OVERRIDE_CFG is actually wired into the Kobold node's override_cfg input - it's optional, and forgetting to connect it after building the config is the easiest way to be tuning parameters that never reach KoboldCpp.

    Output turns incoherent after raising temperature or min_p toward their max. That's the tradeoff these samplers exist for - creativity and coherence pull against each other, and this pack's ranges (temperature up to 10, well past the 0.7-1.2 most presets use) let you push far past where most models stay sensible. Back off in small steps rather than guessing at the ceiling.

    Not sure whether a change is doing anything since a lot of these interact. Change one parameter at a time and keep preset fixed while you do - combining a preset swap with several manual overrides at once makes it hard to tell which change caused which shift in output.

    CategorySP-Nodes

    Inputs (7)

    NameTypeDefaultDescription
    temperatureFLOAT0.000–10Controls the randomness of predictions. Higher values make the output more creative and unpredictable, lower values make it more focused and deterministic. Управляет случайностью генерации. Более высокие значения делают текст креативнее и менее предсказуемым, низкие — более логичным и последовательным.
    dynatemp_rangeFLOAT0.00–10Dynamically adjusts temperature based on model uncertainty. If the model is unsure, temperature increases for more creativity; if confident, temperature decreases for accuracy. 0 disables this feature. Динамически изменяет температуру в зависимости от уверенности модели. При неуверенности температура повышается для креативности, при уверенности — понижается для точности. 0 отключает функцию.
    min_pFLOAT0.000–1Filters out tokens until their cumulative probability reaches the min_p threshold. Helps prevent repetition and improves generation quality. 0 disables this sampler. Отсекает токены, пока их суммарная вероятность не достигнет порога min_p. Помогает избежать повторов и повысить качество генерации. 0 отключает семплер.
    xtc_probabilityFLOAT0.000–1Probability of activating the XTC (Exclude Top Choices) sampler for each token. XTC removes the most likely words, forcing the model to be more creative. Вероятность активации семплера XTC (исключение самых вероятных токенов) для каждого токена. XTC заставляет модель выбирать менее очевидные слова.
    xtc_thresholdFLOAT0.500–1Minimum probability a token must have to be removed by XTC. All candidates above this threshold are excluded except the least likely one. Минимальная вероятность токена для удаления через XTC. Все кандидаты выше этого порога исключаются, кроме самого маловероятного.
    smoothing_factorFLOAT0.000–10Strength of logit smoothing. Smooths the probability distribution, reducing the gap between likely and unlikely tokens. 0 disables smoothing. Сила сглаживания логитов. Сглаживает распределение вероятностей, уменьшая разницу между вероятными и маловероятными токенами. 0 отключает сглаживание.
    smoothing_curveFLOAT1.000–10Shape of the smoothing curve used in logit smoothing. Adjust for different smoothing behaviors. Форма кривой для сглаживания логитов. Меняйте для разных вариантов сглаживания.

    Outputs (1)

    NameTypeDescription
    OVERRIDE_CFGOVERRIDE_CFG