ComfyUI Node

YALS Samplers

Llama.cpp's DRY, XTC and Mirostat — plus JSON-schema output — in ComfyUI

By DBMePls·Created 4 months ago·Updated 4 months ago· 0
YALS Samplers
    • yals_parameters
    top_k0
    min_p0.00
    repetition_penalty1.00
    xtc_probability0.00
    xtc_threshold0.10
    dry_multiplier0.0
    dry_base1.75
    dry_allowed_length2
    mirostat_mode0
    json_schema

    YALS Samplers is the "Spoke" node in the comfyui-llm-api-client pack for anyone running YALS - Yet Another Llama Server, the lightweight OpenAI-compatible wrapper around llama.cpp. If your local LLM stack is GGUF quantized models served by a llama.cpp backend, this is how you get llama.cpp's modern samplers into a ComfyUI workflow instead of settling for whatever plain chat requests happen to support.

    GGUF is the format the entire local-LLM layer runs on, and llama.cpp is its reference runtime, so this isn't an exotic corner - it's the natural fit if you already have a llama.cpp server running on port 5000. The catch is just that the fancy samplers it supports have no home in a standard OpenAI request. That's what this node fixes.

    How it works

    Like its TabbyAPI sibling, YALS Samplers doesn't make a call itself. It builds a dictionary of sampler parameters and hands it to the pack's Universal OpenAI Hub through the extra_parameters socket. The Hub then sends those as extra_body on the chat-completions request - the OpenAI SDK's escape hatch for backend-specific parameters.

    The wiring: YALS Samplers → yals_parameters output → Hub's extra_parameters input. No connection, no effect.

    The sampler inputs are the same modern toolkit as the TabbyAPI node - top_k, min_p, repetition_penalty, plus xtc_probability/xtc_threshold (XTC, which chops low-probability tokens so the model can't play it safe), dry_multiplier/dry_base/dry_allowed_length (DRY, the anti-repetition penalty) and mirostat_mode (adaptive temperature). And same design rule: a default value means "don't send it." dry_multiplier starts at 0 and stays off until you raise it; xtc_probability starts at 0 for the same reason. The node only emits params you've actually changed.

    The differentiator is the json_schema optional input. Paste a JSON Schema into that multiline box and the node hands it to the backend for structured output - the model is constrained to produce JSON that conforms to your schema. It gets parsed with json.loads and sent as a real JSON object, not a string. Which brings us to the one real footgun.

    The inputs that matter

    • json_schema - the reason to pick this node over the TabbyAPI one. Empty by default (no constraint). Invalid JSON is not a crash: the node prints a warning to the console and silently ignores your schema, then proceeds with unconstrained generation. Validate your schema in a JSON linter first, or you'll get chatty prose where you asked for JSON and no error telling you why.
    • dry_multiplier - DRY is the headline sampler; 0.5–0.8 on top of the default base is a reasonable first try.
    • xtc_probability - set above 0 to activate XTC with the default 0.1 threshold.
    • mirostat_mode - 0 off, 1 or 2 for adaptive temperature.

    Output: yals_parameters (LLM_PARAMS), which only connects to the Hub's extra_parameters.

    Installing it

    Same as the whole pack - there's no separate install for this node.

    cd ComfyUI/custom_nodes/
    git clone https://github.com/DBMePls/comfyui-llm-api-client
    pip install openai
    

    Restart ComfyUI. openai is the only real dependency (torch, numpy and PIL ship with ComfyUI), and nothing is downloaded - the model is the one YALS is already serving. Windows portable users: .\python_embeded\python.exe -m pip install openai. ComfyUI Manager: search comfyui-llm-api-client. Minor warning: the README's clone command uses a placeholder URL, so use the real one above.

    Common issues

    • Nothing arrives at the server. The yals_parameters socket isn't connected to extra_parameters, or the sampler you set is still at its off default. Check both before debugging the server.
    • You asked for JSON and got prose. Your schema didn't parse (check the console for [YALS Sampler] Warning: Invalid JSON schema provided. Ignored.) or your YALS/llama.cpp build doesn't support JSON-schema constraint.
    • Model list looks empty. The Hub scans ports at ComfyUI startup; if YALS wasn't up yet, restart ComfyUI with it running or type the model name manually.

    If your backend is ExLlamaV2 instead of llama.cpp, grab the pack's TabbyAPI Samplers node - same sampler family, different server.

    CategoryUniversal LLM/Samplers

    Inputs (10)

    NameTypeDefaultDescription
    top_kINT0-1–1000
    min_pFLOAT0.000–1
    repetition_penaltyFLOAT1.000–3
    xtc_probabilityFLOAT0.000–1
    xtc_thresholdFLOAT0.100–1
    dry_multiplierFLOAT0.00–5
    dry_baseFLOAT1.750–5
    dry_allowed_lengthINT20–100
    mirostat_modeINT00–2
    json_schemaoptSTRING

    Outputs (1)

    NameTypeDescription
    yals_parametersLLM_PARAMS