The short answer: those sliders in LM Studio and Ollama control how the model picks each word from its list of options. Temperature sets how adventurous it is, top-p and top-k trim the pool of candidate words, and min-p is the newer setting that keeps things coherent even when temperature is high. For most work, a low temperature with min-p is the safe default. Here is what each one actually does, and the settings to use.
This is a plain-English synthesis of the sampling literature and project documentation, cited below.
What is happening when a model picks a word
At every step, the model does not output one word. It produces a probability for every possible next token, thousands of them. A sampling strategy decides how to turn that giant probability list into a single choice. Pick the single most-likely token every time (called greedy decoding) and you get repetitive, lifeless text. The foundational paper here, Holtzman et al.'s "The Curious Case of Neural Text Degeneration" (2019), showed that always-most-likely decoding "leads to text that is bland and strangely repetitive." So we add controlled randomness. The settings below are the controls.
Temperature, explained
Temperature scales how much the model favors its top choices. Low temperature (0.1 to 0.4) makes it stick close to the most-likely tokens: precise, deterministic, good for code, extraction, and factual answers. High temperature (0.8 to 1.2) flattens the distribution so less-likely words get a real chance: more creative and varied, but also more prone to going off the rails. Temperature 0 is effectively greedy decoding. The rule of thumb: low for correctness, high for creativity.
Top-p (nucleus) and top-k, explained
These two trim the candidate pool before sampling. Top-k keeps only the k most-likely tokens (say, the top 40) and ignores the rest. Simple, but a fixed k is clumsy: sometimes 40 candidates is too many, sometimes too few.
Top-p (nucleus sampling, from the same Holtzman paper) is smarter. Instead of a fixed count, it keeps the smallest set of tokens whose probabilities add up to p (say, 0.9, or 90 percent) and samples from that "nucleus." When the model is confident, the nucleus is tiny; when it is unsure, the nucleus widens. This adapts to context, which is why top-p became the default in most runtimes. A typical pairing is temperature 0.7 with top-p 0.9.
Min-p: the newer setting worth knowing
Min-p is a 2024 refinement that fixes top-p's main weakness: at higher temperatures, top-p can still let in low-probability junk and produce incoherent text. Min-p instead sets a floor relative to the top token's probability, so it dynamically tightens when the model is confident and loosens when it is not. The paper, Nguyen et al.'s "Turning Up the Heat: Min-p Sampling" (2024), reports that it "improves both the quality and diversity of generated text... particularly at higher temperatures where traditional methods falter," and it is now built into Hugging Face Transformers and vLLM. A common recipe: a modest min-p (0.05) with temperature turned up, giving you creativity without the incoherence.
The settings to actually use
| Your task | Suggested settings |
|---|---|
| Code, extraction, structured output | Temperature 0.1 to 0.3 (near-deterministic) |
| Factual Q&A, RAG, summarizing | Temperature 0.3 to 0.5, top-p 0.9 |
| General chat / assistant | Temperature 0.6 to 0.8, top-p 0.9 or min-p 0.05 |
| Creative writing, brainstorming | Temperature 0.9 to 1.1 with min-p 0.05 to 0.1 |
| Repetitive or looping output | Raise temperature slightly, add a small repetition penalty |
Two practical notes. First, many 2026 reasoning models ship with a recommended set of sampling values on their model card, use those as your starting point, because a model tuned for one temperature can misbehave at another. Second, change one setting at a time: temperature and top-p interact, and moving both at once makes it impossible to tell what helped.
The bottom line
You do not need to master all of these. The 80/20 version: use low temperature for anything that needs to be correct, and temperature around 0.7 to 0.9 with min-p for anything that should feel natural or creative. Top-k is largely superseded by top-p and min-p. If your model repeats itself or drifts into nonsense, those two symptoms usually mean temperature too low (repetition) or too high (nonsense), and now you know which dial to turn.
Sources and how we researched this
- Nucleus (top-p) sampling and the degeneration problem: Holtzman, Buys, Du, Forbes & Choi, "The Curious Case of Neural Text Degeneration" (arXiv:1904.09751, ICLR 2020).
- Min-p sampling: Nguyen et al., "Turning Up the Heat: Min-p Sampling for Creative and Coherent LLM Outputs" (arXiv:2407.01082, ICLR 2025).
- Parameter behavior and defaults: the sampling documentation in llama.cpp and vLLM, plus per-model recommended settings from model cards. This is a synthesis, not first-hand benchmarking.
Related: Ollama vs LM Studio vs llama.cpp · Speculative decoding, explained · The plain-English quantization guide