Roleplay sampler settings: temperature, top P, min P and more
Updated
For roleplay on Gemma 4, start with temperature 0.9 and top P 0.95, and leave everything else neutral: min P 0, top K off, repetition penalty 1, presence and frequency penalty 0. Change one setting at a time, only to fix a problem you can name. On UnsavedAI these values are passed straight to the model.
Try it now, free, no account neededStart a story with The NarratorAny story you want, you chooseThe starting point
- Temperature: 0.9
- Top P: 0.95
- Min P: 0 (off)
- Top K: 0 or -1 (off)
- Repetition penalty: 1 (off)
- Presence and frequency penalty: 0
This is what the SillyTavern preset on our Setup page uses. It keeps the model's own judgment mostly intact, which suits a model that already writes characters well. Most bad roleplay comes from stacking several aggressive samplers, not from too few.
What each one does, briefly
Temperature reshapes how likely each next word is; higher makes unusual words more likely. Top P keeps only the most likely words that together add up to that share of probability, cutting off the long tail of strange choices. Min P drops any word less likely than that fraction of the top choice, which scales nicely with how sure the model is. Top K keeps only the K most likely words.
Repetition, presence and frequency penalties push the model away from words it has already used. They help with loops and hurt with names: a character who cannot repeat your name starts calling you "the traveler".
Fix one symptom at a time
- Replies feel flat and samey: raise temperature to 1.0.
- Replies get weird or incoherent: lower temperature to 0.8, or add min P 0.05.
- The character loops the same phrases: try repetition penalty 1.05, or frequency penalty 0.2. Rewriting or swiping the looped reply matters even more.
- The character forgets their personality: that is a card or context problem, not a sampler one.
After each change, play ten messages before judging. One good or bad reply proves nothing; samplers are about averages.
Accepted ranges
Temperature 0 or more; top P above 0 and up to 1; min P 0 to 1; top K -1 or 0 for off, or a whole number; repetition penalty above 0, where 1 is off; presence and frequency penalty -2 to 2. Seed and stop strings are passed through too.
A value outside these ranges returns an error naming it, such as "top_p must be a number above 0 and at most 1." Other fields, like logit bias, are ignored, so presets from SillyTavern or JanitorAI work without editing. The Chat Completions guide lists them for developers.
Borrowed presets
Presets shared online are tuned for a particular model. One built for a model that needs temperature 0.6 will make Gemma timid; one built for a model that wanders will clamp Gemma down. When a borrowed preset feels off, reset to the starting point above and add changes back one by one.
Questions people ask
Should I use min P or top P?
Either works; using both at gentle values is fine. If you set min P around 0.05, you can leave top P at 0.95 or 1.
Do samplers affect reply length?
Not directly. Length comes from your max tokens setting, the card and how long your own messages are.
Why does the same setting feel different on another site?
Each model responds to samplers differently, and some services change or ignore values. On UnsavedAI what you set is what the model gets, within the ranges above.
