CertBrain
CoursesBlog
Sign in
← Back to decks
Sign in to save your progress, vote, and build your own decks.Sign in

Inference Parameters

Inference parameters are settings you send with each request to shape how a foundation model writes its answer, without retraining or changing the model. Some control how predictable or varied the wording is; others control how long the answer can run and where it stops. Exam scenarios describe a…

9 cards
Study this deck

Inference Parameters

Inference parameters are settings you send with each request to shape how a foundation model writes its answer, without retraining or changing the model. Some control how predictable or varied the wording is; others control how long the answer can run and where it stops. Exam scenarios describe a symptom, such as answers that are too repetitive, too random or too long, and ask which setting to change and in which direction.

How a Model Picks Words

A language model writes one token at a time. For each next token, it scores every possible option with a probability, then picks from those options. Inference parameters change that picking step. They either reshape the probabilities or shrink the pool of candidates the model is allowed to choose from. Default values and allowed ranges vary from model to model.

Temperature

Temperature changes how strongly the model favors its most likely options.

  • Lower temperature makes the top choices even more dominant, so answers become more predictable and consistent. Good for factual answers, extraction and anything that must be repeatable.
  • Higher temperature flattens the probabilities, so less likely words get picked more often. Answers become more varied and creative, but also more prone to wander. Good for brainstorming, slogans and stories.

Temperature never makes a model know more facts. A low setting makes it consistent, not correct.

Top K and Top P

Both settings limit which candidate tokens the model may pick from.

  • Top K keeps a fixed number of the most likely candidates. With Top K set to 50, the model chooses among the 50 most probable next tokens, whatever their probabilities.
  • Top P keeps the smallest group of top candidates whose probabilities add up to a set share. With Top P at 0.9, the model chooses from the candidates that together make up 90% of the probability. When the model is confident, that group may be one or two tokens; when it's unsure, the group grows.

Lower values of either make output more focused. Higher values allow more unusual choices.

Length and Stopping

  • Maximum length (often called max tokens) caps how many tokens the answer can contain. It controls cost and response time, because output tokens are billed and take time to generate. Set it too low and answers get cut off mid-sentence.
  • Stop sequences are strings that end generation the moment the model produces them. They're useful when the model keeps writing past the point you need, for example adding extra made-up questions after answering yours.
  • Penalties, offered by some models, discourage repeated words or phrases.
SymptomChange
Answers vary when they should be identicalLower temperature
Creative output feels repetitiveRaise temperature or Top P
Answers run long and cost too muchLower maximum length
Model keeps writing past the useful partAdd a stop sequence

On the Exam

Match the symptom to the parameter. Consistency problems point to temperature. Length and cost problems point to maximum length. Runaway output points to stop sequences. If an option says a parameter makes the model "more accurate" or "know more", it's a trap: parameters change style and length, not knowledge.

Quiz me on this
A bank's assistant answers questions about its account fee schedule. Auditors complain that the same question gets differently worded answers from one day to the next. Which change BEST makes the answers more consistent?
  1. Raise the maximum length setting
  2. ✓ Lower the temperature setting
  3. Raise the Top K setting
  4. Remove all stop sequences
A marketing team uses a foundation model to brainstorm product slogans, but the suggestions keep sounding nearly identical. Which adjustment is MOST likely to produce more varied ideas?
  1. Lower the Top P setting
  2. Add a stop sequence after each slogan
  3. Lower the maximum length setting
  4. ✓ Raise the temperature setting
A developer wants the model to choose its next token only from the most likely candidates that together make up 90% of the probability, so the pool shrinks when the model is confident and grows when it isn't. Which parameter does this?
  1. Top K
  2. Temperature
  3. ✓ Top P
  4. Maximum length
A help desk tool asks a model to answer one customer question at a time. After answering, the model often keeps going, inventing extra "Customer:" questions and answering them too. Which setting fixes this MOST directly?
  1. ✓ Add "Customer:" as a stop sequence
  2. Lower the temperature to its minimum
  3. Raise the Top K setting
  4. Switch to a model with a bigger context window
Temperature
Controls randomness. Lower gives predictable, consistent answers; higher gives varied, creative ones. It doesn't add knowledge.
Top K
Limits the next-token choice to a fixed number of the most likely candidates, such as the top 50.
Top P
Limits the next-token choice to the top candidates whose probabilities add up to a set share, such as 90%. The pool size varies.
Maximum length (max tokens)
Caps how many tokens a response can contain, controlling cost and response time. Too low cuts answers off.
Stop sequence
A string that ends generation as soon as the model produces it. Use it to stop output running past the useful part.