New Tool Radar

Local AI

How to Set Sampling Parameters in Text Generation WebUI

Change temperature, top-p, top-k, and repetition penalty in Text Generation WebUI's Parameters tab and compare the replies to the same prompt.

Schematic diagram with three steps: set temperature to control randomness, narrow top-p and top-k to limit word choices, then raise the repetition penalty to cut loops.

A language model generates one token at a time: given your prompt it calculates the probabilities for every possible next token, and then a sampling technique chooses one. The Parameters tab’s Generation section is where you control that choice. Four controls matter most for everyday use, and changing one at a time is the only way to tell which change did what.

Find the four controls

Open the Parameters tab and look at the Generation section. The project’s own docs define the four controls like this:

Control What the docs say
temperature Primary factor to control the randomness of outputs. 0 = deterministic (only the most likely token is used). Higher value = more randomness.
top_p If not set to 1, select tokens with probabilities adding up to less than this number. Higher value = higher range of possible random results.
top_k Similar to top_p, but select instead only the top_k most likely tokens. Higher value = higher range of possible random results.
repetition_penalty Penalty factor for repeating prior tokens. 1 means no penalty, higher value = less repetition, lower value = more repetition.

Try one change at a time

Load a model, go to the Chat tab, and send the same prompt after each change so the replies are comparable: “Explain why a lighthouse lamp matters in one sentence.” First set temperature to 0 and send the prompt twice — the docs say 0 is deterministic, so the two replies should match. Then raise temperature to 1.0 and send the same prompt again — the reply should differ in wording. If a reply gets stuck repeating a phrase, raise repetition_penalty above 1, for example to 1.2, and send the prompt again. If replies are still wilder than you want, narrow top_p to 0.9 so fewer tokens are in play. Change one control, send the prompt, and note the difference before touching the next one.

Check What you should see If you do not see it
Temperature 0 Two replies to the same prompt read the same The temperature change was not applied before you sent the prompt — set it, then send
Temperature 1.0 The reply differs in wording from the temperature 0 reply Temperature is still 0 — check the value in the Parameters tab
Repetition With the penalty raised above 1, a looping reply stops repeating itself Raise the penalty a little more, or shorten the prompt
Top-p / top-k Narrowing them makes replies more focused and more similar to each other The values were not applied — change one control at a time and re-send

Expected result. We checked Text Generation WebUI’s own Parameters Tab docs for the token-at-a-time rundown and the definitions of temperature, top_p, top_k, and repetition_penalty. We did not run Text Generation WebUI.

Limits

These controls only affect how the next token is chosen, not what the model knows — no setting turns a wrong answer into a right one. Extreme values can produce nonsense or loops, so move in small steps. The docs also warn about max_new_tokens: it is used in the truncation calculation, so setting it higher than necessary can truncate your prompt. A combination you like is worth saving as a preset rather than re-entering by hand each time — that is a separate step, covered in the presets guide. We did not run Text Generation WebUI, so no reply here is a recorded result.

Sources

See all