Temperature, Top-P, and Other LLM Settings Explained

Temperature is a setting, usually from 0 to 2, that controls how random a model’s word choices are. Low values give focused, repeatable answers, and high values give more varied ones. You can still set it through the API on many models, including OpenAI’s GPT-6 models with reasoning turned off and older Claude and Gemini models. The newest Claude and Gemini models no longer use it.

Every time you send a prompt to an LLM, a set of hidden controls shapes the response. These settings determine whether the output sounds creative or predictable, long or short, repetitive or varied.

The gap between a mediocre result and a great one often comes down to how you use LLMs. That includes the settings behind the scenes.

Five settings come up again and again: temperature, top-p, max tokens, frequency penalty, and presence penalty. Not every model accepts all five today, and the table below shows which ones still do.

Most users never need to change them. Default values handle everyday tasks well.

Key Takeaways

  • Temperature controls randomness: lower values produce focused outputs, higher values produce varied ones.
  • Many models still accept it through the API, including OpenAI’s GPT-6 models with reasoning turned off. The newest Claude and Gemini models reject or ignore temperature and top-p.
  • On those models, steer the output with your prompt, reasoning effort, and structured outputs instead.
  • Max tokens sets the length ceiling for responses, not a target. On reasoning models, it also covers hidden thinking.
  • On older models that still accept both, adjust temperature or top-p, not both at once.
  • What LLM Settings Actually Control

    When a large language model generates text, it predicts one word (or token) at a time. At each step, the model calculates a probability for every possible next word. Settings like temperature and top-p shape how the model picks from those probabilities.


    LLM settings (inference parameters): Controls that adjust how a model selects its next word during text generation. They do not change the model itself, only how it samples from its predictions.

    Think of it like a music playlist on shuffle. Temperature controls how adventurous the shuffle is. A low temperature plays your top hits on repeat.

    A high temperature pulls from deep cuts and obscure tracks. Top-p sets how big the playlist is in the first place.

    Bar chart comparing low temperature 0.2 with steep probability drop-off favoring top word versus high temperature 1.0 with more even distribution across words
    At low temperature, the model strongly favors the top-ranked word. At high temperature, probabilities spread more evenly, giving less common words a real chance of being selected.

    You meet these settings in the developer APIs from the makers of ChatGPT, Claude, Gemini, and most other LLMs. The newest models from all three labs now limit them, and the exact rules vary by provider. The concepts still explain why the same prompt can give different answers.

    Which Models Still Accept Temperature (October 2026)

    All three big labs changed how they handle sampling settings during 2026. The newest models no longer take them the way older ones did.

    ProviderModelsTemperature, top-p, top-kTemperature rangeSource
    AnthropicClaude 4.7 and later, including Opus 5.5Fixed at the defaults. On API version 2026-10-21, sending any of the three returns an error, even at the default value.1.0 onlyAnthropic migration guide
    AnthropicOlder models, such as Claude Sonnet 4.6Still accepted on API version 2023-06-01Other values acceptedAnthropic migration guide
    GoogleGemini 3.6 Flash, 3.5 Flash-Lite, and later models, including 3.8 Flash and 4 ArgonDeprecated and ignored. Google says future model generations will return an error.IgnoredGemini 3.6 guide, Google’s Argon guide
    OpenAIGPT-6 modelsAccepted when reasoning effort is “none” (GPT-6.1 Terra, GPT-6 Sol, GPT-6 Luna). With reasoning on, remove temperature and top-p. GPT-6 Astra and GPT-6.1 Sol have no “none” setting.0 to 2, with reasoning effort “none”OpenAI GPT-6 guide

    Checked October 31, 2026. Older models still accept these settings.

    How Each Setting Works in Practice

    Temperature

    Temperature controls the randomness of the model’s word choices, and it has long been the most commonly adjusted setting. Most LLM APIs offered it, though the newest models now limit it. OpenAI’s API reference documents it as a value between 0 and 2.

    At temperature 0, the model always picks the most probable next word. The same prompt will produce nearly identical outputs every time.

    At temperature 1, the model samples more freely across all probable words. This produces varied and sometimes surprising results. Values above 1 (up to 2 on most platforms) push outputs toward increasingly unpredictable territory.

    Here is what different ranges feel like in practice:

    • 0 to 0.3: Highly focused and deterministic. The model sticks to the most likely phrasing. Good for factual answers, data extraction, and classification tasks.
    • 0.4 to 0.7: Balanced. Enough variety to feel natural without going off-topic. Works well for general writing and summarization.
    • 0.8 to 1.2: Creative and exploratory. The model takes more risks with word choice. Suited for brainstorming, fiction, and creative copywriting.
    • 1.3 to 2.0: Highly random. Outputs can become incoherent at the upper end. Rarely useful outside of experimental contexts.

    On models that accept it, temperature is the single most impactful setting to learn. If you only adjust one thing, this is it.

    Top-P (Nucleus Sampling)

    Top-p works differently from temperature but targets a similar outcome. Instead of scaling all probabilities up or down, top-p cuts off the tail end of unlikely words.

    A top-p of 0.9 means the model only considers words that collectively make up 90% of the probability mass. The remaining 10% of least-likely words are excluded entirely. A top-p of 0.1 restricts the model to only the very top candidates.

    The effect is subtle but meaningful. Where temperature stretches the entire distribution, top-p trims it. A low top-p eliminates surprising word choices completely, while a low temperature just makes them less likely.

    Most providers set top-p to 1.0 by default, which means no words are excluded at all. Adjusting top-p below 1.0 is useful when you want focused outputs without making the temperature so low that text sounds robotic. For structured data extraction, use structured outputs instead, because a schema controls the format and no sampling setting can.

    On older models that still accept it, a top-p of 0.1 to 0.3 keeps code and other tight outputs predictable.


    On models that accept both, adjust either temperature or top-p, not both at the same time. Changing both creates unpredictable interactions. Start with temperature for broad control, and switch to top-p only if you need finer pruning of unlikely outputs.

    Max Tokens (Maximum Length)

    Max tokens sets the upper limit on how long the model’s response can be. It does not force the model to write that many individual tokens, it just prevents it from exceeding the number.

    This matters for cost control and practical formatting. Each token you generate through an API costs money, and LLM costs are typically calculated per token. Setting a max token limit prevents runaway responses that burn through your budget.

    A few things to keep in mind. Max tokens limits only the output, not the input. The total of input plus output cannot exceed the model’s context window.

    Today’s large models accept very long inputs, so most everyday prompts fit with plenty of room to spare.

    On reasoning models, the limit also covers hidden thinking. OpenAI’s reasoning guide warns that a tight limit can use up the tokens before any visible answer appears. You still pay for the thinking, and the reply comes back cut off or empty.

    If you set max tokens too low, responses get cut off mid-sentence. If you leave it at the maximum, you may pay for more output than you need.

    For models without reasoning, setting max tokens to roughly 1.5 times your expected response length is a practical starting point. Reasoning models need far more room. For Gemini 4 Argon, Google’s Argon guide suggests keeping the default of 65,536 tokens, and raising any lower limit to at least 32,768.

    Frequency Penalty

    Frequency penalty reduces how often the model repeats the same words or phrases. It applies a penalty each time a word appears, and the penalty grows with each additional use.

    A value of 0 means no penalty. Values up to 2.0 apply increasingly strong discouragement against repetition.

    This setting is most useful for longer outputs where models tend to fall into loops. If you notice the model restating the same point in different words, a moderate frequency penalty (0.3 to 0.8) can break the pattern. This is especially common with outputs longer than 1,000 tokens.

    Be cautious, because frequency penalty values above 1.0 often make text sound unnatural. The model starts avoiding common words that naturally repeat in normal writing, like “the” or “is.”

    Presence Penalty

    Presence penalty is similar to frequency penalty but works as a flat, one-time nudge. Once a word appears in the output, it receives a fixed penalty regardless of how many times it has been used. This encourages the model to introduce new topics and vocabulary rather than circling back.

    The practical difference is straightforward. Frequency penalty fights word-level repetition. Presence penalty fights topic-level repetition.

    A moderate presence penalty (0.3 to 0.6) encourages the model to explore new ground. This is helpful for brainstorming and open-ended generation.

    In practice, presence penalty matters most when you ask a model to generate lists or ideas. Without it, models tend to cluster around similar concepts. A small presence penalty pushes the model toward more diverse suggestions.

    Most users can leave both penalties at 0 for everyday tasks. They become valuable primarily in long-form generation or when building prompt engineering techniques into pipelines that handle extended outputs.

    What to Use Instead on the Newest Models

    When a model rejects or ignores sampling settings, you steer the output in other ways. Anthropic’s Opus 5.5 guide puts it simply: leave the settings out and guide the model with your prompt.

    • A clear prompt with an example: Show the model one sample of the output you want. An example fixes tone and format better than any number.
    • Length in the prompt: Ask for a word count, a number of items, or a number of sentences. Models usually follow these requests well.
    • Reasoning effort: OpenAI calls it reasoning effort, Anthropic calls it effort, and Google calls it thinking level. Lower levels give faster, cheaper answers, and higher levels think longer.
    • Structured outputs: For data extraction, give the model a JSON schema. It then returns data in that shape, which no sampling setting can promise.

    One more point for anyone who relied on temperature 0. Temperature 0 never guaranteed identical answers, as Anthropic’s guide notes, even on models that accepted it.

    Settings at a Glance

    The table below gives starting values, only for models that still accept these settings.

    SettingRangeDefault (Typical)Factual/Data TasksGeneral WritingCreative Work
    Temperature0 – 2.01.00 – 0.20.5 – 0.70.8 – 1.2
    Top-P0 – 1.01.00.1 – 0.30.7 – 0.90.9 – 1.0
    Max Tokens1 – model limitVaries256 – 512 (much more on reasoning models)1,024 – 2,0482,048 – 4,096
    Frequency PenaltyUp to 2.0 (negative values allowed)000.2 – 0.50.5 – 0.8
    Presence PenaltyUp to 2.0 (negative values allowed)000.1 – 0.30.3 – 0.6

    Ranges and defaults from OpenAI’s chat completions reference and OpenAI’s advanced usage guide, checked October 31, 2026.

    These are starting points, not rules. The right settings depend on your specific task, the model you are using, and the quality of your prompt. A well-crafted prompt with clear instructions often matters more than any setting adjustment.

    When Settings Work for You and When They Do Not

    Strengths

    On models that accept them, temperature and top-p give you meaningful control over output style without changing your prompt. This is useful when you want the same prompt to produce different types of results.

    A customer service template at temperature 0.2 stays on-script. The same template at 0.8 sounds warmer and more conversational.

    Max tokens provides cost predictability. For API users running thousands of requests, capping output length keeps bills from spiraling. Combined with smart prompt design, it lets you build reliable automated workflows.

    Frequency and presence penalties solve a real problem with long-form generation. Models naturally drift toward repetition over long outputs, and these settings counteract that tendency without requiring prompt changes. For writers generating articles or reports, even a small frequency penalty of 0.3 can noticeably reduce circular phrasing.

    Limitations

    Settings cannot fix a bad prompt. If your instructions are vague, lowering the temperature just makes the model confidently produce the wrong thing. The foundation is always what you write in the prompt itself.

    In practice, temperature above 1.2 rarely produces usable results for any real task. The outputs become incoherent quickly. The added randomness does not translate into genuine creativity, which comes from better prompts, not higher temperature.

    These settings also do not reduce LLM hallucinations. A model at temperature 0 will still state incorrect facts confidently.

    This happens when the answer is not well-represented in the training data. Low temperature makes outputs consistent, not more accurate.

    Our LLM hallucination test shows how wrong details slip into confident answers. ChatGPT, Claude and Gemini all spotted every trap, yet Gemini’s accuracy averaged 3.7 out of 5 because of wrong details.

    Settings also differ across providers. Anthropic’s documentation says Claude samples at a temperature of 1.0, and on Claude 4.7 and later that is the only value. On API version 2026-10-21, sending temperature, top-p, or top-k returns an error.

    OpenAI’s reference still recommends changing temperature or top-p, not both, on models that accept them. These differences matter when you switch between models.


    Low temperature does not mean higher accuracy. A model at temperature 0 still generates text based on statistical patterns, not verified facts. Always validate important claims regardless of the temperature setting used.

    Common Misunderstandings About LLM Settings

    “Temperature 0 gives the correct answer.”

    Temperature 0 gives the most probable answer, which is not the same thing. The model’s training data may contain errors or biases that surface in the most likely prediction. Temperature controls consistency, not truthfulness.

    “Higher temperature means more creative.”

    Only up to a point. Beyond about 1.0, outputs become random rather than creative. Genuine creativity comes from providing the model with rich context and interesting constraints, not from cranking up randomness.

    “You should always adjust top-p and temperature together.”

    On models that accept both, adjusting them together often creates unpredictable results. Providers recommend choosing one or the other, depending on how much control you need. The newest models take neither, so the question only applies to older ones.

    “Max tokens controls quality.”

    Max tokens only controls length. A 500-token response is not inherently better or worse than a 2,000-token response.

    The length you want is best set in the prompt. In our LLM instruction following test, ChatGPT, Claude and Gemini all wrote exactly 75 words when the prompt asked for exactly 75.

    Quality depends on the prompt, the model, and how well the task fits the model’s strengths. Comparing different models for specific tasks often matters more than adjusting output length.

    “These settings work the same across all models.”

    While the concepts are consistent, each provider implements them differently. A temperature of 0.7 on one model may feel different from 0.7 on another, and the newest models reject or ignore it. Testing with your specific model is the only way to calibrate.

    Conclusion

    LLM settings give you a second layer of control beyond your prompt. Temperature is the one most worth understanding first, even though the newest models no longer let you change it. It explains whether outputs feel predictable or exploratory.

    Top-p, frequency penalty, and presence penalty offer finer adjustments for specific use cases, but they are not essential for everyday use.

    The most important takeaway is that settings are secondary to prompt quality. A well-written prompt at default settings will almost always outperform a vague prompt with carefully tuned parameters. Start with strong prompting fundamentals, then use these controls on models that accept them, or reasoning effort and structured outputs on models that don’t.

    To see how these settings play out across different models, comparing which LLM fits your specific use case is a natural next step.

    Frequently Asked Questions

    Stojan Trajkovikj

    Written by Stojan Trajkovikj

    Stojan is an SEO specialist and marketing strategist focused on scalable growth, content systems, and search visibility. He blends data, automation, and creative execution to drive measurable results. An AI enthusiast, he actively experiments with LLMs and automation to build smarter workflows and future-ready strategies.

    View all articles