AI360Xpert
Glossary
Definition

Temperature

A setting that controls how random or predictable a language model's output is. Turn it low and the model plays safe, picking the most likely next word; turn it high and it takes more risks and sounds more creative.

Think of It Like This

It's a creativity dial — low for focused answers, high for wilder ones.

Temperature reshapes the model's probability distribution over the next token just before it samples. Divide the scores by a number below 1 and the peaks get sharper, so the model almost always picks its top choice. Divide by a number above 1 and the distribution flattens out, giving less likely words a real chance to show up.

Think of It Like This

Near 0, the model is a careful editor always reaching for the safest word. Up near 2, it's a brainstorming partner happy to surprise you.

import numpy as np
def apply_temperature(logits: np.ndarray, t: float) -> np.ndarray:    """Scale scores by temperature before softmax; lower t = sharper, safer picks."""    return logits / t