Concept
Inference parameters
Settings you change at request time, such as temperature, that make answers steadier or more creative.
Temperature
- What it does
- Sets how random the word choice is.
- Effect
- Low: steady. High: creative.
Top-p
- What it does
- Keeps the likeliest words up to a share of the odds.
- Effect
- Lower: safer words.
Top-k
- What it does
- Keeps only the k likeliest words.
- Effect
- Lower: fewer choices.
Maximum output length
- What it does
- Caps the tokens in the reply.
- Effect
- Limits size and cost.
Stop sequences
- What it does
- Strings that end the reply.
- Effect
- Stops the model at a set point.
| Setting | What it does | Effect |
|---|---|---|
| Temperature | Sets how random the word choice is. | Low: steady. High: creative. |
| Top-p | Keeps the likeliest words up to a share of the odds. | Lower: safer words. |
| Top-k | Keeps only the k likeliest words. | Lower: fewer choices. |
| Maximum output length | Caps the tokens in the reply. | Limits size and cost. |
| Stop sequences | Strings that end the reply. | Stops the model at a set point. |
1 / 2
Temperature
- What it does
- Sets how random the word choice is.
- Effect
- Low: steady. High: creative.
Top-p
- What it does
- Keeps the likeliest words up to a share of the odds.
- Effect
- Lower: safer words.
Top-k
- What it does
- Keeps only the k likeliest words.
- Effect
- Lower: fewer choices.
| Setting | What it does | Effect |
|---|---|---|
| Temperature | Sets how random the word choice is. | Low: steady. High: creative. |
| Top-p | Keeps the likeliest words up to a share of the odds. | Lower: safer words. |
| Top-k | Keeps only the k likeliest words. | Lower: fewer choices. |
2 / 2
Maximum output length
- What it does
- Caps the tokens in the reply.
- Effect
- Limits size and cost.
Stop sequences
- What it does
- Strings that end the reply.
- Effect
- Stops the model at a set point.
| Setting | What it does | Effect |
|---|---|---|
| Maximum output length | Caps the tokens in the reply. | Limits size and cost. |
| Stop sequences | Strings that end the reply. | Stops the model at a set point. |
Consistent answers
Low temperature, low top-p. For facts, extraction, support.
Creative answers
High temperature, high top-p. For ideas, stories, slogans.
What it is
Inference parameters are settings you send with each request to a foundation model. They do not change the model. They change how it picks the next word, and how long the reply may be.
Temperature controls randomness. A low temperature gives steady, predictable answers, good for facts and extraction. A high temperature gives more varied, creative answers, good for brainstorming. Top-p and top-k also limit which words the model may pick: top-p keeps the most likely words whose chances add up to a set share, and top-k keeps only a fixed number of the most likely words. Lower values make answers safer and more repeatable.
What it is
Length settings control cost and size. Maximum output length caps how many tokens the reply can have. Stop sequences are strings that make the model stop when it writes them. The length of the input is limited by the model's context window.
Remember
- Temperature: low is consistent and focused, high is creative and varied.
- Top-p and top-k: lower values narrow the word choices, so answers become safer.
- Maximum output length caps the tokens in a reply, which caps cost and shortens the wait.
- Stop sequences end the reply when a chosen string appears.
Remember
- Latency follows model size and the length of the input and the output. Temperature, top-p and top-k change variety, not speed.
- Input length is limited by the context window. These settings act at request time and do not train the model.
On the exam
- “Make answers more consistent and less random” points to a lower temperature.
- “Make answers more creative” points to a higher temperature.
- “Limit how long and how costly each reply is” points to maximum output length.
- “Replies are too slow” points to a smaller model or a shorter output, not a lower temperature.
Do not mix it up with
- Tokens and the context windowThe small pieces of text a model reads and writes, and the limit on how many fit in one request.
- Prompt engineeringSteer a foundation model with better instructions, without training it.
- Choosing a foundation modelThe checklist for picking a foundation model: cost, modality, latency, language, size, customization, length and caching.