Nodes/comfyui-llm-bikeshed/LLM Options: LM Studio
ComfyUI Node

LLM Options: LM Studio

LM Studio sampling, toggle by toggle

By VirusShell·Created 4 months ago·Updated 3 days ago· 1
LLM Options: LM Studio
    • options
    ◄enable_temperaturefalse►
    ◄temperature0.70►
    ◄enable_top_pfalse►
    ◄top_p1.00►
    ◄enable_max_tokensfalse►
    ◄max_tokens2048►
    ◄enable_seedfalse►
    ◄seed0►
    ◄enable_stop_stringfalse►
    ◄stop_string►
    ◄enable_top_kfalse►
    ◄top_k40►
    ◄enable_repeat_penaltyfalse►
    ◄repeat_penalty1.10►
    ◄enable_presence_penaltyfalse►
    ◄presence_penalty0.00►
    ◄enable_frequency_penaltyfalse►
    ◄frequency_penalty0.00►

    LLM Options: LM Studio is where you fine-tune how your LM Studio model samples. It's an optional companion to the Advanced generation node: produce an LLM_OPTIONS object here, wire it into LLM Generate (Advanced)'s options input, and those parameters get passed through to the backend on the chat completion call. Don't connect one and the model just uses its own defaults - this is purely additive.

    The design is a toggle-per-parameter pattern, and it's the one thing to understand about this node: every sampling parameter has a Boolean enable_* switch in front of it. Flip enable_temperature ON and the temperature value gets sent; leave it OFF and temperature is silently skipped, so the backend falls back to its own default. Everything starts OFF. That's deliberate - the node only sends what you explicitly ask for, which means "unset" is a real state and not accidentally shipped as a value.

    The parameters

    The LM Studio node exposes the classic llama.cpp-family sampling set:

    • temperature (default 0.7) - randomness. Low for repeatable, high for creative.
    • top_p (default 1.0) - nucleus sampling: cut the probability mass off below this cumulative threshold.
    • top_k (default 40) - only sample from the top-K most likely tokens.
    • repeat_penalty (default 1.1) - dampens repetition; above 1.0 punishes tokens already used.
    • presence_penalty / frequency_penalty (both default 0) - the OpenAI-style penalty pair.
    • seed (default -1) - set a fixed value for reproducible output; -1 means "don't send," i.e. random.
    • max_tokens (default 2048) - reply length ceiling.
    • stop_string - a string that stops generation when the model emits it (mapped to the API's stop parameter; the widget name is friendlier than the wire name).

    All of them are optional, all of them start disabled, and unsupported parameters are silently dropped (the pack logs that at info level) - so a parameter that some other backend ignores won't hard-fail your run.

    Where it fits

    Use this with LLM Generate (Advanced) - Basic has its own inline temperature/max_tokens/seed and doesn't take an options input, so this node is specifically for the modular path. The payoff versus Basic's inline knobs is that you can build and save distinct sampling personalities as separate nodes: a "creative" options node and a "strict" one, swapped by a single wire. Given the local-model context from llm-in-comfyui.md - an 8B abliterated model on a consumer card is the typical workhorse, and its sampling quirks are the thing you'll actually tune - having the knobs out where you can flip them without touching the generation node is the point.

    It can also chain: if you want to layer options (say, start from one set and override a single parameter), upstream options merge in rather than being replaced.

    Install

    Pack standard: ComfyUI Manager search "comfyui-llm-bikeshed", or clone into custom_nodes/ and pip install -r requirements.txt. Only pyyaml and requests (already in ComfyUI core), no model downloads. No config needed - the node just builds a dict; the URL and keys live on the provider side.

    CategoryLLM Bikeshed/options

    Inputs (18)

    NameTypeDefaultDescription
    enable_temperatureoptBOOLEANfalse—
    temperatureoptFLOAT0.700–2—
    enable_top_poptBOOLEANfalse—
    top_poptFLOAT1.000–1—
    enable_max_tokensoptBOOLEANfalse—
    max_tokensoptINT20480–128000Output cap. 0 omits the field (host default).
    enable_seedoptBOOLEANfalse—
    seedoptINT00–18446744073709550000—
    enable_stop_stringoptBOOLEANfalse—
    stop_stringoptSTRING—
    enable_top_koptBOOLEANfalse—
    top_koptINT400–500—
    enable_repeat_penaltyoptBOOLEANfalse—
    repeat_penaltyoptFLOAT1.100–5—
    enable_presence_penaltyoptBOOLEANfalse—
    presence_penaltyoptFLOAT0.00-2–2—
    enable_frequency_penaltyoptBOOLEANfalse—
    frequency_penaltyoptFLOAT0.00-2–2—

    Outputs (1)

    NameTypeDescription
    optionsLLM_OPTIONS—