Algorithm Search⌘K

Techniqueintro

Temperature sampling

Also called softmax temperature.

Sample the next token from softmax(z / T). T below 1 sharpens the distribution toward greedy, T above 1 flattens it toward uniform.

Temperature sampling draws the next token of an autoregressive language model from the softmax of the logits divided by a number T>0T > 0, the temperature: qT(i)=ezi/T/∑jezj/Tq_T(i) = e^{z_i / T} / \sum_j e^{z_j / T}. With T=1T = 1 it is plain ancestral sampling from the model. A temperature below 1 makes the distribution sharper, so the likely tokens get even more of the mass, and as T→0T \to 0 it becomes greedy decoding. A temperature above 1 makes it flatter, and as T→∞T \to \infty it becomes uniform over the allowed tokens. The order of the tokens never changes; only how strongly the draw follows it. The name comes from the Boltzmann distribution of statistical physics, where the same formula with an energy in place of the logit describes a system at a temperature. The temperature is a heuristic setting, tuned by hand for each use; no value is correct in general.

In plain words

The model gives every possible next word a score. Temperature is a knob that sets how much you trust those scores when you draw the next word at random. Turn it down and you almost always get the top word, so the text is safe but can be dull and repeat itself. Turn it up and the weaker words get more chances, so the text is more varied but can drift into nonsense. At the middle setting of 1 you draw words with exactly the chances that the model gives.

When it applies

Temperature applies whenever a token is drawn at random from a softmax over logits: plain sampling, and also top-k sampling, nucleus sampling and typical sampling, which apply it before they cut the distribution. It does not change greedy decoding or beam search on its own, because dividing all logits by the same positive TT keeps their order. The same formula appears outside decoding, for example to soften the outputs of a teacher model in knowledge distillation, and as the acceptance rule of simulated annealing.

The template

The step takes the logits zz and a number uu drawn uniformly from [0,1)[0, 1).

  1. TEMPERATURE-SAMPLE(z, T, u) ▷ z = logits, T > 0, u uniform in [0, 1)
  2. 1m ← max over i of z[i] ▷ subtract it so that no exp overflows
  3. 2for each i do w[i] ← exp((z[i] − m) / T)
  4. 3Z ← sum of w[i]
  5. 4r ← u · Z
  6. 5return the first i with w[1] + ... + w[i] > r

Each weight is at most 1 and the largest is exactly 1, so the sum is at least 1 and nothing overflows or divides by 0. A logit of −∞-\infty, as used to forbid a token, gets weight 0 and is never drawn. The proof is in proofs/correctness.md: the step draws from qTq_T, the entropy of qTq_T never decreases as TT grows, and the limits for T→0T \to 0 and T→∞T \to \infty are the uniform distributions on the tokens of largest logit and on the allowed tokens.

Classic examples

Three logits. For the logits z=(2,1,0)z = (2, 1, 0):

TT qTq_T entropy (nats)
0.25 (0.98169, 0.01798, 0.00033) 0.0930
0.5 (0.86681, 0.11731, 0.01588) 0.4411
1 (0.66524, 0.24473, 0.09003) 0.8324
2 (0.50648, 0.30720, 0.18632) 1.0202
4 (0.41923, 0.32650, 0.25428) 1.0781
100 (0.33667, 0.33332, 0.33001) 1.0986

The entropy rises from near 0 toward log⁡3=1.0986\log 3 = 1.0986, the entropy of the uniform distribution on three tokens.

The power form. If p=q1p = q_1 is the distribution at T=1T = 1, then qT(i)∝pi1/Tq_T(i) \propto p_i^{1/T}. At T=0.5T = 0.5, the probabilities are squared and renormalized: 0.665242=0.442540.66524^2 = 0.44254, 0.244732=0.059890.24473^2 = 0.05989, 0.090032=0.008110.09003^2 = 0.00811, with sum 0.510540.51054, which gives (0.86681,0.11731,0.01588)(0.86681, 0.11731, 0.01588) again. So temperature can be applied to probabilities as well as to logits.

Ties. For z=(2,2,0)z = (2, 2, 0), a temperature near 0 does not pick one token; it gives (0.5,0.5,0)(0.5, 0.5, 0). The limit of temperature sampling is greedy decoding only when the largest logit is unique.

In practice. Holtzman et al. 2020 compared sampling at T=0.9T = 0.9 and top-k = 40 at T=0.7T = 0.7 with other decoders on GPT-2 Large. Lowering the temperature reduced the incoherent text of pure sampling but brought back some of the repetition of greedy decoding: top-k = 40 at T=0.7T = 0.7 repeated 8.86% of the time, against 0.78% for top-k = 40 at T=1T = 1.

Variations

  • Temperature with truncation. Apply TT to the logits, then top-k, top-p or typical truncation. The kept set of top-k does not depend on TT; those of top-p and typical sampling do.
  • The Gumbel-max form. Draw gig_i from a standard Gumbel distribution and return the argmax of zi/T+giz_i / T + g_i. This draws from qTq_T too (Gumbel-max trick), and it is the basis of stochastic beam search.
  • Schedules. Change TT during the generation, for example a higher temperature for the first tokens of a story and a lower one later. This is a heuristic with no general result.
  • Entropy targets. Pick TT at each step so that the entropy of qTq_T hits a target value. Theorem 4 of the proof (the entropy grows with TT) makes a bisection on TT work.
  • Temperature in training. Divide the logits by TT in the loss, as in knowledge distillation, to give more weight to the small probabilities of a teacher.

Pitfalls

  • Overflow. Computing ezi/Te^{z_i / T} directly overflows for a small TT: with z=1000z = 1000 and T=0.01T = 0.01 the exponent is 10510^5. Subtract the largest logit first, as in line L1.
  • T=0T = 0. The formula divides by 0. Treat T=0T = 0 as greedy decoding with a stated tie rule, not as a temperature.
  • The order of operations. Temperature then top-p and top-p then temperature give different distributions, because the nucleus depends on the values. Libraries differ; state what you do.
  • High temperature with a large vocabulary. With tens of thousands of tokens, even T=1.5T = 1.5 moves a lot of mass to the tail, and the output can fall apart within a few tokens. Combine a high temperature with truncation.
  • No single best value. The best temperature depends on the model, the task and how the output is judged. Values from 0.7 to 1 are common for open-ended text, and 0 (greedy) for tasks with one answer.

Code

Each implementation follows the pseudocode above. A comment @line links a line of code to a line of the pseudocode. Point at a line of the pseudocode to see the matching code. The build runs the native tests of each language.

nlslog.pyI0RawGitHub
# SPDX-License-Identifier: MIT
# Shared helper of the natural-language-and-speech pages of https://algorithm.tamnd.com/. The authors are listed in prov/.

"""Log-space arithmetic and semirings for the natural-language-and-speech pages.

Every log is the natural log. A probability of 0 is NEG_INF (float("-inf")),
never a large negative number. A cost is -log p, so a probability of 0 is a
cost of POS_INF.

The semirings are (K, plus, times, zero, one) as on the weighted-automaton page:

    PROB      probabilities         plus = +        times = *   zero = 0       one = 1
    LOG       log probabilities     plus = log_add  times = +   zero = -inf    one = 0
    VITERBI   log probabilities     plus = max      times = +   zero = -inf    one = 0
    TROPICAL  costs -log p          plus = min      times = +   zero = +inf    one = 0
    LOG_COST  costs -log p          plus = -log_add(-a, -b), times = +, zero = +inf, one = 0
    BOOLEAN   truth values          plus = or       times = and zero = False   one = True
    COUNTING  path counts           plus = +        times = *   zero = 0       one = 1

This module holds no algorithm of any page: no forward, Viterbi, CKY, Eisner,
CTC or DTW recursion. The pages build their dynamic programs on top of it.
"""

import math
from dataclasses import dataclass
from typing import Any, Callable, Iterable, List, Sequence

NEG_INF = float("-inf")
POS_INF = float("inf")


def safe_log(p) -> float:
    """Return log p, and NEG_INF for p = 0. Raise ValueError for p < 0."""
    if p < 0:
        raise ValueError("log of a negative number")
    if p == 0:
        return NEG_INF
    return math.log(p)


def log_add(a: float, b: float) -> float:
    """Return log(exp(a) + exp(b)) = max(a, b) + log(1 + exp(-|a - b|)).

    log_add(NEG_INF, NEG_INF) is NEG_INF. No exp of a large number is taken.
    """
    if a < b:
        a, b = b, a
    if b == NEG_INF or a == POS_INF:
        return a
    return a + math.log1p(math.exp(b - a))


def log_sum(xs: Iterable[float]) -> float:
    """Return log(sum of exp(x)) over xs. An empty input gives NEG_INF."""
    xs = list(xs)
    if not xs:
        return NEG_INF
    m = max(xs)
    if m == NEG_INF or m == POS_INF:
        return m
    return m + math.log(math.fsum(math.exp(x - m) for x in xs))


def log_normalize(xs: Sequence[float]) -> List[float]:
    """Return the list x - log_sum(xs): log values whose exps sum to 1.

    Raise ValueError if every value is NEG_INF (nothing to normalize).
    """
    z = log_sum(xs)
    if z == NEG_INF:
        raise ValueError("every weight is zero")
    return [x - z for x in xs]


def log_softmax(xs: Sequence[float]) -> List[float]:
    """Return log softmax(xs): the logits xs turned into log probabilities."""
    return log_normalize(xs)


def softmax(xs: Sequence[float], temperature: float = 1.0) -> List[float]:
    """Return the probabilities exp(x / temperature) / sum, computed stably.

    The temperature must be positive. Logits of NEG_INF get probability 0.
    """
    if not temperature > 0:
        raise ValueError("the temperature must be positive")
    m = max(xs)
    if m == NEG_INF:
        raise ValueError("every logit is -inf")
    es = [math.exp((x - m) / temperature) for x in xs]
    s = math.fsum(es)
    return [e / s for e in es]


def argmax(xs: Sequence[Any]) -> int:
    """Return the first index of a largest value. Raise ValueError if xs is empty."""
    if len(xs) == 0:
        raise ValueError("argmax of an empty sequence")
    best = 0
    for i in range(1, len(xs)):
        if xs[i] > xs[best]:
            best = i
    return best


@dataclass(frozen=True)
class Semiring:
    """A semiring (K, plus, times, zero, one). idempotent is True when a plus a = a."""

    name: str
    plus: Callable[[Any, Any], Any]
    times: Callable[[Any, Any], Any]
    zero: Any
    one: Any
    idempotent: bool


def _add(a, b):
    return a + b


def _mul(a, b):
    return a * b


def _log_add_cost(a: float, b: float) -> float:
    return -log_add(-a, -b)


PROB = Semiring("probability", _add, _mul, 0, 1, False)
LOG = Semiring("log", log_add, _add, NEG_INF, 0.0, False)
VITERBI = Semiring("viterbi", max, _add, NEG_INF, 0.0, True)
TROPICAL = Semiring("tropical", min, _add, POS_INF, 0.0, True)
LOG_COST = Semiring("log-cost", _log_add_cost, _add, POS_INF, 0.0, False)
BOOLEAN = Semiring("boolean", lambda a, b: a or b, lambda a, b: a and b, False, True, True)
COUNTING = Semiring("counting", _add, _mul, 0, 1, False)


def sr_sum(sr: Semiring, xs: Iterable[Any]) -> Any:
    """Return the semiring sum of xs, and sr.zero for an empty input."""
    acc = sr.zero
    for x in xs:
        acc = sr.plus(acc, x)
    return acc


def sr_prod(sr: Semiring, xs: Iterable[Any]) -> Any:
    """Return the semiring product of xs, and sr.one for an empty input."""
    acc = sr.one
    for x in xs:
        acc = sr.times(acc, x)
    return acc
temperature_sampling.py 60 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/temperature-sampling/. The authors are listed in prov/C3YE2Y.jsonl.

"""Temperature sampling of the next token.

The input is a list of logits z, one per token of the vocabulary, in the
order of the vocabulary. A logit of float("-inf") means a token that is
not allowed. The random source is any object with a random() method that
returns u in [0, 1), such as random.Random(seed). The code takes the logits
of the model as given; it does not run or train a network.
"""

import math
from typing import List, Sequence

from nlslog import NEG_INF, softmax


def temperature_distribution(logits: Sequence[float], temperature: float) -> List[float]:
    """Return softmax(z / T), computed after subtracting the largest logit."""
    return softmax(logits, temperature)


def temperature_sample(logits: Sequence[float], temperature: float, rng) -> int:
    """Draw one token index from softmax(z / T) without forming the normalized list.

    The weights exp((z_i - m) / T) are at most 1, so nothing overflows, and
    r = u Z replaces the division by Z.
    """
    if not temperature > 0:
        raise ValueError("the temperature must be positive")
    m = max(logits)  # @line L1
    if m == NEG_INF:
        raise ValueError("every logit is -inf")
    w = [math.exp((x - m) / temperature) for x in logits]  # @line L2
    z = math.fsum(w)  # @line L3
    r = rng.random() * z  # @line L4
    c = 0.0
    for i, x in enumerate(w):  # @line L5
        c += x
        if r < c:
            return i
    return max(i for i, x in enumerate(w) if x > 0)


def limit_distribution(logits: Sequence[float], which: str) -> List[float]:
    """Return the limit of softmax(z / T) as T goes to 0 ("zero") or to infinity ("inf").

    As T goes to 0, the mass goes uniformly to the tokens of largest logit.
    As T grows, it goes uniformly to the tokens of finite logit.
    """
    m = max(logits)
    if which == "zero":
        keep = [x == m for x in logits]
    elif which == "inf":
        keep = [x != NEG_INF for x in logits]
    else:
        raise ValueError("which must be 'zero' or 'inf'")
    n = sum(keep)
    return [1.0 / n if k else 0.0 for k in keep]
test_temperature_sampling.py 110 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/temperature-sampling/. The authors are listed in prov/C3YE2Y.jsonl.

import math
import random

from nlslog import NEG_INF, argmax
from temperature_sampling import limit_distribution, temperature_distribution, temperature_sample

Z = [2.0, 1.0, 0.0]


def entropy(p):
    return -math.fsum(x * math.log(x) for x in p if x > 0)


def test_check_values() -> None:
    for t, want in (
        (1.0, (0.66524, 0.24473, 0.09003)),
        (0.5, (0.86681, 0.11731, 0.01588)),
        (2.0, (0.50648, 0.30720, 0.18632)),
    ):
        got = temperature_distribution(Z, t)
        for g, w in zip(got, want):
            assert abs(g - w) < 5e-6
    assert abs(entropy(temperature_distribution(Z, 1.0)) - 0.8324) < 1e-4


def test_power_form_is_the_same() -> None:
    # softmax(z / T) equals p^(1/T) renormalized, with p = softmax(z)
    rng = random.Random(1)
    for _ in range(200):
        z = [rng.uniform(-4, 4) for _ in range(6)]
        t = rng.uniform(0.2, 5)
        p = temperature_distribution(z, 1.0)
        powered = [x ** (1 / t) for x in p]
        s = math.fsum(powered)
        for a, b in zip(temperature_distribution(z, t), (x / s for x in powered)):
            assert abs(a - b) < 1e-12


def test_entropy_grows_with_the_temperature() -> None:
    rng = random.Random(2)
    temps = [0.05 * j for j in range(1, 101)]
    for _ in range(100):
        z = [rng.uniform(-3, 3) for _ in range(5)]
        hs = [entropy(temperature_distribution(z, t)) for t in temps]
        for a, b in zip(hs, hs[1:]):
            assert b >= a - 1e-12
        assert hs[-1] <= math.log(5) + 1e-12


def test_limits() -> None:
    assert limit_distribution(Z, "zero") == [1.0, 0.0, 0.0]
    assert limit_distribution([2.0, 2.0, 0.0], "zero") == [0.5, 0.5, 0.0]
    assert limit_distribution([2.0, NEG_INF, 0.0], "inf") == [0.5, 0.0, 0.5]
    for z in (Z, [2.0, 2.0, 0.0], [3.0, NEG_INF, 1.0, 0.5]):
        cold = temperature_distribution(z, 0.01)
        hot = temperature_distribution(z, 1e6)
        for a, b in zip(cold, limit_distribution(z, "zero")):
            assert abs(a - b) < 1e-6
        for a, b in zip(hot, limit_distribution(z, "inf")):
            assert abs(a - b) < 1e-5


def test_shift_does_not_matter_and_masked_tokens_stay_out() -> None:
    rng = random.Random(3)
    for _ in range(100):
        z = [rng.uniform(-3, 3) for _ in range(4)]
        c = rng.uniform(-100, 100)
        for a, b in zip(temperature_distribution(z, 0.7), temperature_distribution([x + c for x in z], 0.7)):
            assert abs(a - b) < 1e-9
    z = [1.0, NEG_INF, 0.0]
    for t in (0.1, 1.0, 50.0):
        assert temperature_distribution(z, t)[1] == 0.0
        assert all(temperature_sample(z, t, rng) != 1 for _ in range(300))


def test_sampling_frequencies_and_gumbel_max() -> None:
    rng = random.Random(4)
    draws = 20000
    for t in (0.5, 2.0):
        want = temperature_distribution(Z, t)
        direct = [0, 0, 0]
        gumbel = [0, 0, 0]
        for _ in range(draws):
            direct[temperature_sample(Z, t, rng)] += 1
            # a second method: argmax of z / T plus Gumbel noise
            g = [x / t - math.log(-math.log(1.0 - rng.random())) for x in Z]
            gumbel[argmax(g)] += 1
        for a, b, w in zip(direct, gumbel, want):
            assert abs(a / draws - w) < 0.01
            assert abs(b / draws - w) < 0.01


def test_huge_logits_do_not_overflow() -> None:
    p = temperature_distribution([1000.0, 999.0], 0.01)
    assert p[0] > 0.999999 and p[1] < 1e-6
    rng = random.Random(5)
    assert temperature_sample([1e6, 0.0], 1.0, rng) == 0


def test_bad_temperature() -> None:
    for t in (0.0, -1.0):
        try:
            temperature_sample(Z, t, random.Random(6))
        except ValueError:
            pass
        else:
            raise AssertionError("no ValueError")

Exercises

  1. Show that adding the same constant to all logits does not change qTq_T, and use it to justify line L1.
  2. Prove that qT(i)∝pi1/Tq_T(i) \propto p_i^{1/T}, where p=q1p = q_1.
  3. Show that the entropy of qTq_T satisfies dH/dβ=−βVar⁡β(z)dH / d\beta = -\beta \operatorname{Var}_\beta(z) with β=1/T\beta = 1/T, and conclude that it does not decrease in TT.
  4. For z=(2,1,0)z = (2, 1, 0), find the temperature at which the most probable token has probability exactly 0.5. (Use bisection, since the probability is monotone in TT.)
  5. Show that the argmax of zi/T+giz_i / T + g_i, with independent standard Gumbel gig_i, has the distribution qTq_T.
Proof: Temperature sampling draws from softmax(z / T), its entropy grows with T, and its limits are greedy and uniformfull

We use the notation of the page. The logits are z1,…,znz_1, \ldots, z_n, with at least one finite value; a logit of −∞-\infty marks a token that is not allowed. The temperature is T>0T > 0, and we write β=1/T\beta = 1 / T. The distribution is

qT(i)=ezi/T∑jezj/T,q_T(i) = \frac{e^{z_i / T}}{\sum_j e^{z_j / T}},

with e−∞=0e^{-\infty} = 0. All logs are natural logs.

Lemma 1 (the draw). TEMPERATURE-SAMPLE returns each token ii with probability qT(i)q_T(i), and never returns a token with zi=−∞z_i = -\infty.

Proof. Let m=max⁡izim = \max_i z_i (line L1), which is finite. Line L2 computes wi=e(zi−m)/T=ezi/Te−m/Tw_i = e^{(z_i - m)/T} = e^{z_i / T} e^{-m/T}, so the wiw_i are the numerators of qTq_T times the same positive constant, and wi/∑jwj=qT(i)w_i / \sum_j w_j = q_T(i). Each wiw_i lies in [0,1][0, 1], so no exponential overflows, and the token of largest logit has wi=1w_i = 1, so the sum ZZ of line L3 is at least 1. Lines L4 and L5 are inverse transform sampling with r=uZr = uZ uniform on [0,Z)[0, Z): the walk returns ii when rr falls in an interval of length wiw_i, which happens with probability wi/Z=qT(i)w_i / Z = q_T(i). A token with zi=−∞z_i = -\infty has wi=0w_i = 0 and an empty interval. □\square

Lemma 2 (the power form). Let p=q1p = q_1 be the distribution at T=1T = 1. Then qT(i)=pi1/T/∑jpj1/Tq_T(i) = p_i^{1/T} / \sum_j p_j^{1/T}.

Proof. pi=ezi/Sp_i = e^{z_i} / S with S=∑jezjS = \sum_j e^{z_j}, so pi1/T=ezi/TS−1/Tp_i^{1/T} = e^{z_i / T} S^{-1/T}. The factor S−1/TS^{-1/T} is the same for all ii and cancels in the ratio. □\square

Lemma 3 (shift). Adding the same constant cc to every logit does not change qTq_T.

Proof. Every numerator and the denominator are multiplied by ec/Te^{c/T}. □\square

Theorem 4 (the entropy grows with the temperature). Let H(T)H(T) be the entropy of qTq_T. Then HH does not decrease in TT, and it is strictly increasing unless all the finite logits are equal.

Proof. Restrict to the tokens of finite logit; the others have probability 0 at every TT. Write qβ(i)=eβzi/A(β)q_\beta(i) = e^{\beta z_i} / A(\beta) with A(β)=∑jeβzjA(\beta) = \sum_j e^{\beta z_j}. Then

H=−∑iqβ(i)(βzi−log⁡A(β))=log⁡A(β)−β Eβ[z],H = -\sum_i q_\beta(i) (\beta z_i - \log A(\beta)) = \log A(\beta) - \beta \, \mathbb{E}_\beta[z],

where Eβ\mathbb{E}_\beta is the mean under qβq_\beta. Since ddβlog⁡A(β)=Eβ[z]\frac{d}{d\beta} \log A(\beta) = \mathbb{E}_\beta[z] and ddβEβ[z]=Var⁡β(z)\frac{d}{d\beta} \mathbb{E}_\beta[z] = \operatorname{Var}_\beta(z),

dHdβ=Eβ[z]−Eβ[z]−βVar⁡β(z)=−βVar⁡β(z)≤0.\frac{dH}{d\beta} = \mathbb{E}_\beta[z] - \mathbb{E}_\beta[z] - \beta \operatorname{Var}_\beta(z) = -\beta \operatorname{Var}_\beta(z) \le 0.

So HH does not increase in β\beta, and since β=1/T\beta = 1/T decreases as TT grows, HH does not decrease in TT. The variance is 0 only when zz is constant on the support, which is the case where qTq_T is uniform for every TT; otherwise it is positive for every β>0\beta > 0 and HH is strictly increasing in TT. □\square

The family qβq_\beta is an exponential family with the logits as the sufficient statistic, and Theorem 4 is the standard fact that the derivative of its mean is its variance.

Theorem 5 (the limits). Let M={i:zi=m}M = \{i : z_i = m\} and F={i:zi>−∞}F = \{i : z_i > -\infty\}. As T→0T \to 0, qTq_T tends to the uniform distribution on MM. As T→∞T \to \infty, qTq_T tends to the uniform distribution on FF.

Proof. Use the weights wi=e(zi−m)/Tw_i = e^{(z_i - m)/T} of Lemma 1. For i∈Mi \in M, wi=1w_i = 1 at every TT. For i∉Mi \notin M with ziz_i finite, zi−m<0z_i - m < 0 and wi→0w_i \to 0 as T→0T \to 0. So Z→∣M∣Z \to |M| and qT(i)→1/∣M∣q_T(i) \to 1/|M| on MM and 0 elsewhere. As T→∞T \to \infty, wi→e0=1w_i \to e^0 = 1 for every i∈Fi \in F and wi=0w_i = 0 outside FF, so qT(i)→1/∣F∣q_T(i) \to 1/|F| on FF. □\square

So a small temperature gives the argmax of greedy decoding when the largest logit is unique, and a uniform choice among the tied tokens otherwise; a large temperature gives the uniform distribution over the allowed tokens, whatever the model says. The tests check Lemma 1 by sampling and by a second method, the Gumbel-max trick, Lemma 2 and Lemma 3 numerically, Theorem 4 on a fine grid of temperatures, and Theorem 5 at T=0.01T = 0.01 and T=106T = 10^6.

References

  1. Ari Holtzman, Jan Buys, Li Du, Maxwell Forbes and Yejin Choi, The curious case of neural text degeneration, ICLR 2020, Section 3.3 (sampling with temperature, Equation 4, with the reference to Ackley, Hinton and Sejnowski 1985) and Table 1 (sampling with t = 0.9 and top-k = 40 with t = 0.7)
  2. Nitish Shirish Keskar, Bryan McCann, Lav R. Varshney, Caiming Xiong and Richard Socher, CTRL, a conditional transformer language model for controllable generation, arXiv 1909.05858, 2019, Section 4.1 (Sampling), Equation 1, with the remarks that T near 0 approximates greedy decoding and a large T flattens the distribution toward uniform

Where this leads

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH2 full proof
  • correctness: no review record reviews/C3YE2Y/proof-correctness.yaml
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
Code (python)I0 not checked yet
  • the tests did not run in this build
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW2 basic
  • three classic examples