KoboldCpp sampler settings: good starting points and what each one does
For the best settings in KoboldCpp, start from the model card's recommended values, or from the starting points below, and change one value at a time. Most problems come from three things: temperature too high or too low, repetition settings that are too strong or too weak, and a maximum output length that is too small. Launcher settings such as GPU layers and context are a different topic, linked below.
Checked against KoboldCpp 1.124.2 · updated 13 Nov 2026
- lab-lnx: Linux test VM · 4 vCPU · 15 GB · no GPU
On this page
- Two kinds of settings
- KoboldCpp best settings: starting points by use case
- What we measured
- What each sampler does
- Temperature
- Top-K and Top-P
- Min-P (1.48)
- Repetition penalty
- DRY (1.70)
- XTC (1.74), dynamic temperature (1.55), smoothing (1.57), Adaptive-P (1.105)
- Sampler order
- Where to change them
- Replies too short or cut off
- Repetition and loops
- Model-specific settings
Two kinds of settings
| Launcher and server settings | Backend, GPU layers, context size, flash attention, KV cache | At start-up: GPU layers, context, speed |
| Sampler settings | Temperature, Min-P, DRY, repetition penalty, output length | Per request: Lite, SillyTavern or the API |
If replies are slow or the program fails, look at the first kind. If replies repeat, ramble or feel flat, look at the second.
KoboldCpp best settings: starting points by use case
| Assistant or coding (precise) | 0.2 to 0.6 | 0.05 | 1.0 | off |
| General chat | 0.7 | 0.05 | 1.0 to 1.05 | off |
| Roleplay and story | 0.8 to 1.0 | 0.05 to 0.1 | 1.0 to 1.1 | 0.8 |
| Creative writing | 1.0 | 0.1 | 1.0 | 0.8 |
What we measured
On a prompt built to make a model loop, we measured how much text repeated for each setting F83. Lower means less repetition, which is not the same as better text:
| Request defaults | 45% | The same sentence again and again |
rep_pen 1.0 | 45% | Identical to the default: the default adds no penalty |
rep_pen 1.1, range 256 | 6% | Moves on to new text |
rep_pen 1.3, range 256 | 0% | Drifts away from the prompt |
| DRY 0.8 (base 1.75, length 2) | 6% | Moves on; one run turned the text into a quiz |
| Temperature 1.0, Min-P 0.05 | 30% | Still loops: Min-P alone does not stop repetition |
| DRY 0.8, temperature 1.0, Min-P 0.05 | 13% | Readable, with some repeats |
| Temperature 2.0, no truncation | 0% | Unreadable: low repetition by being random |
The lesson: fix a loop with repetition penalty or DRY, not with temperature alone, and a score of zero is not the goal.
What each sampler does
Versions are from the release notes. Field names are the ones /api/v1/generate takes (API fields).
Temperature
Higher makes unlikely words more likely. At 0 the same prompt gives the same text for any seed F83. Our test showed the other end too: 2.0 with nothing cutting the tail gave unreadable text. A seed is not portable between machines: the same model, prompt and seed gave different text on Linux and on Windows and macOS (F33).
Top-K and Top-P
Top-K keeps the K likeliest words; Top-P keeps the smallest group whose chances add to P. Many guides turn both off when using Min-P.
Min-P (1.48)
Drops every word whose chance is below a share of the likeliest word’s chance, so it adapts to how sure the model is. Field min_p.
Repetition penalty
Makes words used in the last rep_pen_range tokens less likely. We measured 1.1 cutting repeats from 45% to 6% F83, and 1.3 drifting off topic. The server default behaves as 1.0.
DRY (1.70)
Penalises a word that would extend a sequence already in the text. Fields dry_multiplier, dry_base, dry_allowed_length. At 0.8 it matched the repetition penalty’s effect in our test F83.
XTC (1.74), dynamic temperature (1.55), smoothing (1.57), Adaptive-P (1.105)
XTC sometimes removes the likeliest word to add variety. Dynamic temperature (dynatemp_range) varies temperature with the model’s certainty. Smoothing (smoothing_factor) reshapes the chances around the top word. Adaptive-P steers towards a target probability. We did not test these four. The old --usemirostat flag was removed after 1.59; the API still lists a mirostat field.
Sampler order
Keep the default order. Users report that custom orders cause odd output; the field is sampler_order. Change it only if a guide for your model says so.
Where to change them
- KoboldAI Lite: Settings, then the Samplers tab. On 1.124.2 its preset
[Default](“same as Simple Balanced”) shows temperature 0.75, repeat penalty 1.05, top-P 0.92, top-K 100, Min-P 0, a repetition range of 360 and the sampler order6,0,1,3,4,2,5; DRY, XTC, Mirostat and the other advanced samplers have their own boxes, and a preset list offers Simple Logical, Balanced and Creative, Basic Min-P, Creative Min-P, Basic DynaTemp and others F104. Lite’s repeat penalty of 1.05 is not the server’s 1.0.
- SillyTavern: the sampler panel (SillyTavern).
- API: per request (API fields).
- Server defaults: JSON object of default generation fields added to API requests that don't set them, e.g. {"temperature":0.7}.Default Launcher Context tab: Default Params (JSON) + OverrideSince v1.105All details fills fields a request leaves out. We set
{"temperature":0}and two seeds gave identical text when the request omitted temperature; with Makes --gendefaults values override what clients send instead of only filling gaps.Default falseLauncher Context tab: Default Params (JSON) + OverrideSince v1.105All details a request asking for 1.5 was still forced to 0 F83.
Replies too short or cut off
The server default is 2048 tokens (/api/v1/config/max_length, F05; Tokens to generate when a request does not specify a length (default 2048). Most frontends send their own value.Default 2048Launcher Context tab: Default Gen AmtSince v1.86.1All details). A request’s max_length wins: we asked for 20 and got about 10 words F83. In Lite the box is “Amount to generate”. Hard cap on generated tokens for every request (0 = no cap). Formerly --promptlimit.Default 0Launcher Context tab: Prompt LimitSince v1.73All details caps what any request can ask for. If a reply ends after a few words with EOS token triggered!, suspect the chat template first (template symptoms).
Repetition and loops
Fix in this order: check the template (chat templates); then DRY or a repetition penalty of 1.05 to 1.1; then temperature. A long chat at the context limit can also look like a loop (context).
Model-specific settings
Use the values on your model’s card for Gemma, Qwen, Mistral or GLM; we do not copy numbers we did not test. Per-family template and thinking facts are in the template finder.
Frequently asked questions
What are the best settings for KoboldCpp?
There is no single best setting. Start from your model's card, or from a community starting point (temperature 0.7 to 1.0, Min-P 0.05 to 0.1, repetition penalty at most 1.1), and change one value at a time with the same prompt.
What does DRY do?
DRY penalises a token that would repeat a sequence already in the text, however long. In our test on a looping prompt it cut repeated 4-grams from 45% to 6% on a 0.5B model.
What temperature should I use for roleplay?
Community guides suggest roughly 0.7 to 1.0 with Min-P 0.05 to 0.1. We did not test roleplay quality; we only measured that temperature 2.0 without truncation produced unreadable text.
How do I make replies longer?
Raise the amount to generate in Lite, or max_length in an API request. The server default is 2048 tokens. Short replies after a few words are often a chat template problem instead.
Should I use Top-K and Top-P with Min-P?
Many guides switch Top-K and Top-P off when using Min-P, because Min-P already cuts the unlikely tail. We did not test the combinations.
What are good settings for Gemma 4?
Use the values on the model card; we do not copy numbers we did not test.