Decoding & Sampling: Temperature, Top-p & Inference-Time Control

How do decoding rules select a token from the model's probabilities?

The idea

Reshape the distribution, then draw from it: temperature sharpens or flattens the probabilities without ever changing their order, and top-p deletes the unlikely tail and renormalizes what is left.

Builds on Maximum Likelihood and Scaled Dot-Product Attention & Transformer Layers.

The picture

A language model produces a score, or logit, for each token in its vocabulary. Softmax turns those scores into probabilities, and decoding selects the next token. We apply temperature and top-p sampling to the same distribution: temperature changes how concentrated the probabilities are but never sets any to zero, and top-p keeps the most probable tokens until their total reaches pp and removes the rest. This notebook uses probabilities and softmax.

Greedy or sample. Greedy decoding always takes the most probable word, so the same prompt always gives the same text. Sampling draws a word in proportion to its probability, so an unlikely word is picked now and then. The figure's bars are the distribution a sample is drawn from.

Temperature. Before the softmax, divide every logit by a temperature τ\tau. Below 1, the gaps between logits grow and the top word takes more of the probability; above 1, they shrink and the probability spreads out. The order never changes, and no word ever reaches zero.

Top-p. Then walk down the words from the most probable, keep them until their probabilities add up to pp, and delete the rest. The kept words are renormalized so they sum to 1 again. How many words survive depends on the shape of the distribution: few when the model is confident, many when it is not.

Decoding is not a cosmetic detail. It trades determinism against diversity, and it decides whether an unreliable tail word can be drawn at all.

Predict first

The model reads I drank a cup of … and, at temperature 1, gives tea 63%, coffee 23%, water 8%, milk 4% and ink 2%. You raise the temperature to 2. Before you touch the figure: what happens?

From one token to a complete output

Did the model stop, or did we stop it?

A next-token probability is only one edge of a path. To find the chance of a whole output, multiply the probabilities of its actual draws—and keep the reason it ended.

This small example uses three tokens: A, B and EOS (end of sequence). The logits depend only on the previous token: one row applies at the start and one after each of A and B. This example is separate from the five-word figure above and the ten-token demo further down.

The maximum counts EOS. Drawing EOS ends the output, even on the last allowed step. Reaching the limit without EOS is a cutoff; no extra token is drawn. Try reducing the maximum from 2 to 1 first, then restore 2 and change top-p to 0.75.

  1. At the startAdraw probability 0.5
  2. After AEOSdraw probability 0.5

0.5 × 0.5 = 25% of all runs. Ended by drawing EOS.

Extracted answer: A under the rule below.

What counts as an answer here? Only a nonempty output that ends with EOS. Its last ordinary token is the answer: B → A → EOS means A. An output that is just EOS, and every cutoff, give no answer. This is the rule we chose for this example, not a rule for all models.

Where all the probability goes
  • EOS, answer A25%
  • EOS, answer B6.25%
  • EOS, empty25%
  • Length limit, no answer43.75%

Total: 100%. The probability of cutoffs stays in this distribution. Discarding it and rescaling the rest would answer a different, conditional question.

Inspect the three next-token rows and every complete output

The logits are log(weights). Apply temperature, then top-p, separately after each history. Ties use A, B, EOS order; keep the first token that reaches the threshold. No top-k is applied.

Token order in every vector: A, B, EOS
HistoryWeightsAfter temperatureAfter top-p
Start2, 1, 10.5, 0.25, 0.250.5, 0.25, 0.25
Last token A1, 1, 20.25, 0.25, 0.50.25, 0.25, 0.5
Last token B1, 2, 10.25, 0.5, 0.250.25, 0.5, 0.25
All 7 possible outputs, including any the filter gives zero probability
OutputProbabilityEnded byAnswer
EOS25%EOSNone
A → A12.5%length limitNone
A → B12.5%length limitNone
A → EOS25%EOSA
B → A6.25%length limitNone
B → B12.5%length limitNone
B → EOS6.25%EOSB
Use this distribution to choose an answer

Draw two independent outputs with these exact settings. Suppose A is the correct answer, but use a flawed ranker: B outranks A, which outranks no answer. Ties keep the first output. The ranking does not estimate correctness.

Within one output, multiply probabilities conditioned on its history; its tokens need not be independent. Independence is a separate assumption, made only between the two complete outputs.

One draw answers A
25%
Two draws contain A
43.75%
The ranker returns A
40.625%

The middle quantity is coverage: 1 − (1 − qA)². The last requires at least one A and no B: (1 − qB)² − qNone². Here qA, qB and qNone are the probabilities of answer A, answer B and no answer found above. Every control change recomputes them.

For example, the pair A → EOS and B → EOS contains A, but the ranker returns B. Reversing the draw order does not repair that preference.

Continue to test-time compute to investigate coverage and selection under a budget. That lesson starts from a different, assumed distribution over four outputs (50, 25, 18 and 7 percent), not one derived from this decoder.

Every output is enumerated exactly from hand-picked logits; nothing is sampled from a model or measured. Real serving systems may apply further processing. Numbers are rounded for display.

The mathematics

Let ziz_i be the logits for token i∈Vi \in \mathcal V at some step.

Temperature rescales logits

Temperature τ>0\tau > 0 produces:

pτ(i)=ezi/τ∑jezj/τ.p_\tau(i) = \frac{e^{z_i/\tau}}{\sum_j e^{z_j/\tau}}.
  • Smaller τ\tau sharpens (more deterministic).
  • Larger τ\tau flattens (more exploratory).

Nucleus (top-p) truncation deletes the tail, then renormalizes

Let SpS_p be the smallest set of tokens whose probability mass is at least pp (after sorting by probability):

Sp=min⁡{S:∑i∈Sp(i)≥p},p′(i)=p(i) 1[i∈Sp]∑j∈Spp(j).S_p = \min\left\{S: \sum_{i\in S} p(i) \ge p\right\}, \qquad p'(i) = \frac{p(i)\,\mathbf 1[i\in S_p]}{\sum_{j\in S_p} p(j)}.

Then you sample from p′p', the truncated and renormalized distribution.

This is why top-p changes behaviour: it changes the distribution you sample from (Holtzman et al., 2020, §3.1). Top-k sampling is the fixed-size version: it keeps the kk most probable tokens whatever their total probability (Fan et al., 2018).

From conditional draws to a terminal record

The optional sequence investigation uses a different, hand-built model with tokens A, B and EOS (end of sequence). In that token order, the logit weights are [2, 1, 1] at the start, [1, 1, 2] after A, and [1, 2, 1] after B. A logit is the natural logarithm of its weight. Only the last ordinary token affects the next row. Apply temperature first and then top-p to that row, with ties in A, B, EOS order. There is no top-k filter.

Let qτ,p(x∣h)q_{\tau,p}(x\mid h) be this transformed probability of token xx given history hh. Let LL be the maximum number of emitted tokens, including EOS. A record ends on its first EOS, or at LL tokens if none is EOS. For a record y=(y1,…,ym)y=(y_1,\ldots,y_m) in this finite event space, its probability is

Qτ,p,L(y)=∏t=1mqτ,p(yt∣y<t),{ym=EOS, m≤L:sampled end,yt≠EOS for every t, m=L:length cutoff.Q_{\tau,p,L}(y)=\prod_{t=1}^{m}q_{\tau,p}(y_t\mid y_{<t}),\quad \begin{cases} y_m=\mathrm{EOS},\ m\le L &: \text{sampled end},\\ y_t\ne\mathrm{EOS}\text{ for every }t,\ m=L &: \text{length cutoff}. \end{cases}

No history in the product contains an earlier EOS. In particular, a cutoff has no extra EOS factor. EOS drawn on step LL is still a sampled end. The exhaustive records sum to one, including cutoff mass. Filtering can make some records impossible; their probability is zero rather than missing.

At τ=1,p=1,L=2\tau=1,p=1,L=2, A → EOS has probability q(A∣∅)q(EOS∣A)=1212=14q(A\mid\varnothing)q(\mathrm{EOS}\mid A)=\tfrac12\tfrac12=\tfrac14. The second factor comes from the after-A row, not the start row. A → A has probability 1214=18\tfrac12\tfrac14=\tfrac18, and ends by cutoff.

  • EOS: probability 1/4; ends by EOS; no answer because it is empty.
  • A → EOS: probability 1/4; ends by EOS; answer A.
  • B → EOS: probability 1/16; ends by EOS; answer B.
  • A → A: probability 1/8; length limit; no answer.
  • A → B: probability 1/8; length limit; no answer.
  • B → A: probability 1/16; length limit; no answer.
  • B → B: probability 1/8; length limit; no answer.

Our answer rule accepts only a nonempty EOS-ended record, using its last ordinary token as the answer. At L=3L=3, for example, both A → A → EOS and B → A → EOS contribute to answer A. Empty EOS and every cutoff have no answer under this rule. A consumer that accepts truncated text would need a different extraction rule; it cannot reuse these answer probabilities.

Write qA,qB,q∅q_A,q_B,q_\varnothing for the sums of QQ over these three answer classes. At the default they are 1/4,1/16,11/161/4,1/16,11/16. For two independent records, stipulate that A is correct, but let a flawed ranker prefer B over A over no answer, breaking ties in favour of the first record. Then

Pr⁡(at least one A)=1−(1−qA)2=716,Pr⁡(return A)=(1−qB)2−q∅2=1332.\Pr(\text{at least one A})=1-(1-q_A)^2=\frac7{16},\qquad \Pr(\text{return A})=(1-q_B)^2-q_\varnothing^2=\frac{13}{32}.

The latter event is “no B, but at least one A.” Changing temperature, top-p or LL requires recomputing QQ and these answer probabilities. Dropping cutoff records and rescaling would instead condition on not being cut off.

What comes from the source. Holtzman et al. §§3.1 and 3.3 define nucleus sampling and temperature; in §4.1 their generated passages end at an end-of-document token or a 200-token limit. The three-token example, the length convention, the answer rule and the ranker above are this page's own choices, not a reproduction of their experiment or of any provider's API.

Try it

First a worked example, then one to finish, then problems on your own. Check your answer before you look at the solution. Answers typed here are not kept when you leave.

  1. 1 · Worked example

    Temperature 1, top-p 0.9, by hand

    Logits z=[3, 2, 1, 0.2, −0.5]z = [3,\ 2,\ 1,\ 0.2,\ -0.5] for tea, coffee, water, milk, ink. Temperature τ=1\tau = 1, top-p p=0.9p = 0.9. Which words can be drawn, and with what probabilities?

    1. Scale. Divide by τ=1\tau = 1: the logits are unchanged.

    Say the next step to yourself first.
  2. 2 · Finish it

    Turn the temperature down

    Same logits, now at τ=0.5\tau = 0.5 and with no filter. The first steps are done. What is tea's probability? Give three decimal places.

    1. Scale. Divide by 0.50.5: [6, 4, 2, 0.4, −1][6,\ 4,\ 2,\ 0.4,\ -1].

    2. Exponentiate. [403.429, 54.598, 7.389, 1.492, 0.368][403.429,\ 54.598,\ 7.389,\ 1.492,\ 0.368]; the total is 467.276467.276.

    3. Your turn.

  3. 3 · On your own

    The same p, a different nucleus

    Same logits, top-p p=0.9p = 0.9, but now τ=2\tau = 2. How many of the five words can be drawn?

  4. 4 · On your own

    Which filter lets water through?

    At τ=1\tau = 1, top-k with k=3k = 3 and top-p with p=0.9p = 0.9 keep the same three words. Now set τ=0.5\tau = 0.5. Which filter still lets water be drawn?

    Choose one

  5. 5 · Finish it

    Raise the temperature, and a word comes back

    Four words A, B, C, D have logits [ln⁡16, ln⁡4, 0, −ln⁡4][\ln 16,\ \ln 4,\ 0,\ -\ln 4], chosen so that the exponentials and probabilities are exact fractions. Top-p is p=0.7p = 0.7. At τ=1\tau = 1 only A survives the filter. At τ=2\tau = 2, what is B's probability after the filter? Give a fraction or three decimal places.

    1. At τ=1\tau = 1. The exponentials are [16, 4, 1, 1/4][16,\ 4,\ 1,\ 1/4], with total 85/485/4, so A has 64/85≈0.75364/85 \approx 0.753. That already reaches 0.70.7, so the nucleus is A alone.

    2. At τ=2\tau = 2. Halve every logit. The exponentials are [4, 2, 1, 1/2][4,\ 2,\ 1,\ 1/2], with total 15/215/2, so the probabilities are [8/15, 4/15, 2/15, 1/15][8/15,\ 4/15,\ 2/15,\ 1/15].

    3. Your turn.

  6. 6 · On your own

    Add the same number to every logit

    Keep the four words at τ=2\tau = 2 and p=0.7p = 0.7, and add ln⁡4\ln 4 to every logit. What changes?

    Choose one

  7. 7 · Finish it

    Change the filter; rebuild the answer probability

    In the separate A/B/EOS example, keep temperature 1 and maximum 2 emitted tokens, but set top-p to 0.75. What is the probability of A → EOS? Explain both conditional factors, root-EOS mass and total cutoff mass. Why is this a new unconditional law, rather than the old law with cutoff runs discarded? You may use the figure.

    1. Find the rows. The start row is [1/2,1/4,1/4][1/2,1/4,1/4] and the after-A row is [1/4,1/4,1/2][1/4,1/4,1/2] in A, B, EOS order.

    2. Keep and rescale. Ties keep the earlier token. At the start, A and B reach 3/43/4; after A, EOS and A reach 3/43/4.

    3. Your turn.

  8. 8 · On your own

    Read the stop reason before extracting an answer

    Under the last-token rule, what answer does A → B → EOS yield at limit 3? What does A → B yield at limit 2? Before reusing the answer probabilities in a downstream selector, what would you check about how each output stopped and how its answer was extracted? What do this toy's results not establish about a paper or real model? This is an optional self-check; the explanation and figure stay available.

The code

import numpy as np

def softmax(z):
    z = z - z.max()
    ez = np.exp(z)
    return ez / ez.sum()

def top_p_filter(p, probs):
    idx = np.argsort(-probs)
    keep = np.zeros_like(probs, dtype=bool)
    cum = 0.0
    for i in idx:
        keep[i] = True
        cum += probs[i]
        if cum >= p:
            break
    q = probs * keep
    return q / q.sum()

rng = np.random.RandomState(0)
logits = np.array([3.0, 2.0, 1.0, 0.2, -0.5])  # 5 tokens

for tau, p in [(1.0, 1.0), (0.7, 0.9), (1.4, 0.9)]:
    probs = softmax(logits / tau)
    probs = top_p_filter(p, probs)
    samples = rng.choice(len(probs), size=20000, p=probs)
    counts = np.bincount(samples, minlength=len(probs)) / len(samples)
    print("tau=", tau, "top_p=", p, "freqs=", np.round(counts, 3))

Enumerate every stopped record

This standard-library Python code lists every possible output directly: each sequence of A and B tokens, with or without a final EOS. It does not sample or call a model, and it runs on your machine, not in the page. max_tokens includes EOS. The returned table keeps outputs whose probability is zero.

from itertools import product
from math import prod

TOKENS = ("A", "B", "EOS")
WEIGHTS = {"start": (2, 1, 1), "A": (1, 1, 2), "B": (1, 2, 1)}

def terminal_law(temperature=1, top_p=1, max_tokens=2):
    if temperature not in (0.5, 1, 2):
        raise ValueError("Unsupported temperature")
    if top_p not in (0.5, 0.75, 1):
        raise ValueError("Unsupported top_p")
    if max_tokens not in (1, 2, 3):
        raise ValueError("Unsupported max_tokens")
    rows = {}
    for context, weights in WEIGHTS.items():
        # exp(log(weight) / temperature) = weight**(1 / temperature).
        raw = [w ** (1 / temperature) for w in weights]
        probabilities = [v / sum(raw) for v in raw]
        order = sorted(range(3), key=lambda i: (-probabilities[i], i))
        kept, mass = [], 0.0
        for i in order:
            kept.append(i)
            mass += probabilities[i]
            if mass >= top_p:
                break
        rows[context] = [probabilities[i] / mass if i in kept else 0.0
                         for i in range(3)]

    events = []
    for length in range(max_tokens):
        events.extend(prefix + ("EOS",)
                      for prefix in product(("A", "B"), repeat=length))
    events.extend(product(("A", "B"), repeat=max_tokens))
    records = []
    answers = {"A": 0.0, "B": 0.0, "none": 0.0}
    for tokens in events:
        factors = [rows["start" if i == 0 else tokens[i - 1]][TOKENS.index(token)]
                   for i, token in enumerate(tokens)]
        probability = prod(factors)
        stop = "EOS" if tokens[-1] == "EOS" else "length-limit"
        answer = tokens[-2] if stop == "EOS" and len(tokens) > 1 else None
        answers[answer or "none"] += probability
        records.append(dict(tokens=tokens, probability=probability,
                            factors=factors, stop=stop, answer=answer))

    # Enumerate both independent draws. The flawed ranker favours B over A.
    rank = {None: 0, "A": 1, "B": 2}
    covered = selected = 0.0
    for first, second in product(records, repeat=2):
        mass = first["probability"] * second["probability"]
        covered += mass if "A" in (first["answer"], second["answer"]) else 0
        winner = second if rank[second["answer"]] > rank[first["answer"]] else first
        selected += mass if winner["answer"] == "A" else 0
    assert abs(sum(r["probability"] for r in records) - 1) < 1e-12
    return dict(records=records, answers=answers,
                coverageA=covered, selectedA=selected)

if __name__ == "__main__":
    for settings in ((1, 1, 2), (1, 0.75, 2), (1, 1, 1), (2, 1, 3)):
        law = terminal_law(*settings)
        print("temperature, top_p, max_tokens:", settings)
        for record in law["records"]:
            print(record)
        print("Answer masses:", law["answers"])
        print("A coverage / selected:", law["coverageA"], law["selectedA"])

Keep it

  1. Can changing the temperature change which word is most likely? Why?

    Answer from memory, then check

    No. Temperature divides every logit by the same positive τ\tau, which scales the gaps but keeps their order. It changes how much the top word leads, not which word leads.

  2. What happens to the distribution as τ→0\tau \to 0, and as τ→∞\tau \to \infty?

    Answer from memory, then check

    As τ→0\tau \to 0 every gap grows without limit and all the probability goes to the top word: sampling becomes greedy decoding. As τ→∞\tau \to \infty the gaps vanish and every word tends to the same probability.

  3. What exactly does top-p with p=0.9p = 0.9 keep, and what happens to the rest?

    Answer from memory, then check

    The smallest set of most probable words whose probabilities add up to at least 0.9. Every other word gets probability 0, and the kept probabilities are divided by their total so they sum to 1 again.

  4. Why does top-p sometimes keep two words and sometimes four, at the same pp?

    Answer from memory, then check

    Its size follows the shape of the distribution: a confident model reaches pp with few words, a flat one needs many. With the logits [3,2,1,0.2,−0.5][3, 2, 1, 0.2, -0.5] and p=0.9p = 0.9 it keeps two words at τ=0.5\tau = 0.5, three at τ=1\tau = 1 and four at τ=2\tau = 2. Top-k always keeps kk.

  5. Two words' logits differ by 1. At temperature τ\tau, how many times likelier is the higher one?

    Answer from memory, then check

    e1/τe^{1/\tau}: 7.39 at τ=0.5\tau = 0.5, 2.72 at τ=1\tau = 1, 1.65 at τ=2\tau = 2. The ratio depends only on the gap and τ\tau, not on the other words, and renormalizing after top-p leaves it unchanged.

  6. Why can a softmax subtract the largest logit before exponentiating?

    Answer from memory, then check

    Adding the same constant cc to every logit multiplies every exponential, and their total, by ec/τe^{c/\tau}, which cancels. Probabilities depend only on differences between logits, so subtracting the maximum changes nothing except keeping the exponentials from overflowing.

Recalling an answer from memory makes it last longer than rereading it (Roediger and Karpicke, 2006). Add these 6 cards and they come back tomorrow, then after gaps of 3, 7, 16, 35 and 75 days while you still remember them. They stay in this browser only.

The edge

The arithmetic is exact; the right settings are not. Holtzman et al. (2020) showed that always choosing the likeliest words makes a language model's text bland and repetitive, while sampling from the whole distribution lets in the unreliable tail. Nucleus sampling was their answer to both, found by measuring text, not derived. The most probable output can be a poor one: for some translation models, exact search finds that the single most probable translation is often the empty one (Stahlberg and Byrne, 2019). Why the most probable text is so often not the best text is still argued. One proposal is that good text is typical rather than maximal, made of words about as surprising as the model expects on average (Meister et al., 2023). Which rule and which temperature suit a given task is still found by trying.

Next thoughtEvery word drawn costs one full pass through a large model. Could a small model draft several words and the large one check them all at once, without changing the distribution it would have sampled from?Speculative Decoding: Lossless Multi-Token Generation →
The full instrument: ten tokens, three scenarios, top-k, a repetition penalty and seeded runs

Limits of this page

  • Five words and hand-picked logits; a real model scores tens of thousands of tokens at every step, from logits it computes.
  • Temperature is applied before top-p here, as in the code below; libraries may order or combine the steps differently.
  • The first figure covers one next-word distribution. The optional three-token example has its own hand-picked probabilities, end-token rule, length limit and answer rule; neither is any provider's implementation.
  • The figure shows the distribution a sample is drawn from, not a sample; the full instrument draws seeded samples.
  • The Python runs on your machine, not in the page.

Sources

  1. Holtzman et al. (2020). The Curious Case of Neural Text Degeneration.

    Shows that choosing the likeliest words gives bland, repetitive text and full sampling draws from an unreliable tail; proposes nucleus (top-p) sampling (§3.1) and discusses top-k (§3.2) and temperature (§3.3) (ICLR 2020).

  2. Fan, Lewis, and Dauphin (2018). Hierarchical Neural Story Generation.

    Generates stories by sampling at each step from the k = 10 most likely next words, the top-k sampling scheme used in the instrument on this page (ACL 2018).

  3. Stahlberg and Byrne (2019). On NMT Search Errors and Model Errors: Cat Got Your Tongue?

    Runs exact search on a neural translation model and finds that for more than half of the sentences the single most probable translation is the empty one (EMNLP-IJCNLP 2019).

  4. Meister et al. (2023). Locally Typical Sampling.

    Argues that good text uses words whose information content is close to the model's expected information content, not the most probable words, and proposes a sampling rule that keeps them (TACL 11, 2023).

  5. Jurafsky and Martin (2026). Speech and Language Processing (3rd edition draft).

    Textbook treatment of greedy decoding, random sampling, temperature, top-k and top-p sampling.

What the claims rest on

Central claim: How decoding settings reshape the next-token distribution before a token is drawn: temperature, nucleus (top-p) sampling, and why the decoding rule changes what a model writes.

Each claim below lists the passages it cites and how far it has been checked against them. These are the site’s own checks, not independent replication.

Claim (checked against the cited passages): Decoding settings reshape the next-token distribution at inference time: temperature rescales probabilities, while nucleus sampling truncates the unreliable tail and renormalizes the remaining dynamic token set.

Sources: The Curious Case of Neural Text Degeneration

What the sources support: Holtzman et al. define nucleus sampling as the smallest top-p vocabulary whose cumulative probability reaches p, then rescale that truncated distribution for sampling; the set of candidates changes with the shape of the distribution. §3.3 defines the temperature softmax over logits. The page's math, code and figures are small examples of this reshaping.

On this page: the note on The Curious Case of Neural Text Degeneration, Equation 1, Equation 2, Code example 1, the figure

Caveat: This covers temperature and top-p. Which settings give good text for a task, and how top-k, repetition penalties, beam search and library samplers behave, are outside the claim; the figures use hand-picked logits.

Claim (checked against the cited passages): In the small A/B/EOS example, a complete output's probability is the product of its conditional draws; these sum to 1 only if outputs ended by sampling EOS and outputs cut off at the length limit are both kept. Changing the decoder changes the draws, so answer probabilities must be recomputed.

Sources: The Curious Case of Neural Text Degeneration

What the sources support: Holtzman et al. §§3.1 and 3.3 define nucleus renormalization and temperature, and §4.1 distinguishes an end-of-document token from a maximum length. The output probabilities, the answer rule and the two-output ranker are this page's own derivations, checked by enumerating every case in Python.

On this page: the note on The Curious Case of Neural Text Degeneration, Equation 3

Caveat: A hand-built three-token example, separate from the page's other examples. No model is run and nothing is measured; a different answer-extraction rule gives different answer probabilities.

Connections

Builds on Maximum Likelihood and Scaled Dot-Product Attention & Transformer Layers.

Leads to Speculative Decoding: Lossless Multi-Token Generation.

Cite this page

Continuous Function. “Decoding & Sampling: Temperature, Top-p & Inference-Time Control.” Revised 2026-10-10. https://continuousfunction.ai/domains/llm-systems/decoding-sampling/

BibTeX
@misc{cf-decoding-sampling,
  title = {Decoding & Sampling: Temperature, Top-p & Inference-Time Control},
  author = {{Continuous Function}},
  year = {2026},
  note = {Revised 2026-10-10},
  url = {https://continuousfunction.ai/domains/llm-systems/decoding-sampling/}
}