Nodes/WAS LMStudio Easy-Query/LM Studio Options
ComfyUI Node

LM Studio Options

Per-request sampling control without touching your Model node

By WASasquatch·Created 11 months ago·Updated 6 months ago· 19
LM Studio Options
    • options
    temperature0.20
    max_tokens512
    seed0
    top_p1.00
    top_k0
    frequency_penalty0.00
    presence_penalty0.00
    repeat_penalty1.00
    strip_thinking_tagsfalse
    stop

    LM Studio Options is the fine-control node in the WAS LMStudio Easy-Query pack, and it does exactly one job: hand a set of sampling overrides to whichever request node it's plugged into. The pitch is simple - your Model node sets your baseline temperature, max_tokens, and seed, and this node lets you override them for a single request without reconfiguring the whole graph.

    Why does that exist? Because in a real workflow you don't want the same generation settings for every call. A captioning pass wants low, boring, deterministic temperature so your .txt files come out clean; a "rewrite this prompt" step wants more randomness so you get variety; a chat about your workflow might want a long output cap. The Model node is one shared configuration object - Options is how you branch. Anything it provides takes precedence over the Model node's values, per the tooltips.

    Inputs worth knowing:

    • temperature (default 0.2) - the usual knob. Lower = more deterministic, and for captioning you almost always want it low.
    • max_tokens (default 512) - cap on new tokens per response; -1 means unlimited, recommended for thinking models.
    • seed - 0 disables; set a nonzero value if you want reproducible sampling where LM Studio supports it.
    • top_p (default 1.0, meaning off) and top_k (default 0, meaning off) - the classic nucleus/top-k filters, only if you're chasing a specific feel.
    • frequency_penalty, presence_penalty, repeat_penalty - repetition control. Frequency penalizes tokens proportionally to how often they appear; presence penalizes them just for appearing at all; repeat_penalty is the generic engine-specific one (1.0 = off). If your captions come back looping on the same words, this is the section to touch.
    • strip_thinking_tags (default off) - the one that actually saves you time. It strips <thinking>...</thinking> / <think>...</think> blocks out of the output. A thinking model without this will happily dump its entire chain-of-thought into your caption file.
    • stop (optional) - comma-separated strings that halt generation when any of them appears. Leave blank for none.

    The output is a single options wire of type LMSTUDIO_OPTIONS. It plugs into the optional options socket on the Query, Caption, Caption Dataset, and Chat nodes. That's it - the node does no model work on its own, which is why you'll always see it sitting upstream of a request node rather than standalone.

    Installation is the same as the rest of the pack - it ships inside WASasquatch/ComfyUI_LMStudio_EasyQuery, so if you have that installed you already have this node. Via Manager, search "WAS LMStudio Easy-Query":

    cd ComfyUI/custom_nodes
    git clone https://github.com/WASasquatch/ComfyUI_LMStudio_EasyQuery
    

    Restart ComfyUI, and it needs the lmstudio SDK installed (pip install lmstudio numpy Pillow) plus LM Studio running locally - though strictly, Options itself only builds a dict; it's the request node downstream that needs the server alive.

    One gotcha worth naming: the seed here overrides the Model node's seed, so if you want reproducibility across an Options-fed request, set it here, not on the Model node. And if you're captioning a dataset with a thinking model, flip strip_thinking_tags on early - scrubbing reasoning text out of hundreds of caption files after the fact is a chore nobody wants.

    CategoryLM Studio

    Inputs (10)

    NameTypeDefaultDescription
    temperatureFLOAT0.200–2Sampling temperature. Higher = more random; lower = more deterministic.
    max_tokensINT512-1–32768Maximum number of new tokens to generate for the response. Use -1 for unlimited (recommended for thinking models).
    seedINT00–2147483647Optional random seed for reproducible sampling. Use 0 to disable and let the model choose.
    top_pFLOAT1.000–1Nucleus sampling: consider tokens with cumulative probability up to top_p. Set to 1.0 to disable.
    top_kINT00–2048Top-K sampling: only consider the top_k most likely tokens. Set to 0 to disable.
    frequency_penaltyFLOAT0.000–2Penalize tokens proportionally to how often they have appeared. Helps reduce repetition.
    presence_penaltyFLOAT0.000–2Penalize tokens if they have appeared at all. Encourages introducing new topics.
    repeat_penaltyFLOAT1.000–2Generic repetition penalty (model/engine specific). 1.0 means no penalty.
    strip_thinking_tagsBOOLEANfalseRemove <thinking>...</thinking> tags and their content from the output. Useful for getting clean captions without reasoning text.
    stopoptSTRINGComma-separated stop strings. Generation will stop when any is encountered. Leave blank for none.

    Outputs (1)

    NameTypeDescription
    optionsLMSTUDIO_OPTIONS