Nodes/Comfy DV Nodes/Ollama Option — Repeat Penalty
ComfyUI Node

Ollama Option — Repeat Penalty

Ollama Option — Repeat Penalty

By darth-veitcher·Created 2 years ago·Updated about a month ago· 2
Ollama Option — Repeat Penalty
  • options
  • options
repeat_penalty1.10

Every local model eventually hits its loop: it starts repeating a phrase, re-answering the same thing, or spiraling into the same sentence forever. Ollama Option - Repeat Penalty is the knob that pushes back on that, and it's one of the more genuinely useful options in this pack because it maps to a parameter Ollama models actually respond well to.

It's one of the pack's composable option nodes: it takes one value, merges it into an OLLAMA_OPTIONS dict, and passes that dict down the chain to an Ollama Chat Completion. This one sets Ollama's repeat_penalty, which penalizes tokens the model has already used - the higher the penalty, the harder it is for the model to fall into a repetition groove.

The inputs and outputs

  • repeat_penalty (required) - a FLOAT from 0 to 2, default 1.1, stepping by 0.01. The useful range is 1.0 to 1.5. 1.0 = no penalty, 1.1 = a slight nudge (the sensible default), 1.5 = strong - the model will visibly avoid repeating itself, at some cost to fluency. Crank it too high and output starts sounding deliberately awkward, like the model is dodging obvious words.
  • options (optional input) - the merged dict from the previous option node in the chain, so this stacks with temperature, top_k, and the rest.
  • options (output) - the merged dict, on its way to Chat Completion.

Installing it

Ships with the ComfyUI Ollama Model Manager pack. ComfyUI Manager → search "Ollama Manager" → Install → restart, or git clone https://github.com/darth-veitcher/comfyui-ollama-model-manager into ComfyUI/custom_nodes and run python install.py. Python 3.12+ with httpx, loguru, rich handled automatically.

Where people get burned

The trap is treating 1.1 as a universal fix. It's a fine default, but if your model is looping, the first thing to check is usually the prompt or the context, not the penalty - short, ambiguous prompts invite repetition. When you do raise it, go in small steps (1.2, then 1.3) because the penalty interacts with temperature; a high repeat penalty plus high temperature is how you get output that's random and stilted. And it's worth knowing this is one of the knobs that differs from the OpenAI-compatible APIs - Ollama exposes repeat_penalty directly, which is a nice reason to prefer this option node over assuming an OpenAI-style frequency penalty works the same.

Categorydv/ollama/options

Inputs (2)

NameTypeDefaultDescription
repeat_penaltyFLOAT1.100–2
optionsoptOLLAMA_OPTIONS

Outputs (1)

NameTypeDescription
optionsOLLAMA_OPTIONS