Skip to content
Skip to lesson
Back to Topics
LearnCore LLM FoundationsDecoding Strategies: Greedy to Nucleus
MediumNLP Fundamentals13 min read

Decoding Strategies: Greedy to Nucleus

The most likely next token can begin a weaker full sequence. Trace one probability row from stable softmax and greedy search through beam search, temperature, nucleus sampling, and grammar masks.

On this page

Feed an autoregressive language model the prefix The autumn light is across three requests. One run ends immediately with bright. Another produces fading fast. A third writes a fresh continuation every time. Identical weights, identical prompt, identical tokenizer: all that changed is the decoding code turning raw next-token scores () into emitted . Because each emitted token alters the conditioning context for every later step, decoding controls fluency, repetition, diversity, and schema validity.

Trace every strategy on one twelve-token row where each word is one token and eight rare tail tokens each hold 0.01 probability so the row sums to 1.00:

TokenProbabilityPlausible continuation
bright0.45bright .
fading0.30fading fast
soft0.15soft gold
pale0.02rare adjective
tail0.08eight rare tokens at 0.01 each

Greedy decoding locks onto bright (0.45). Stochastic sampling can draw fading (0.30) into fading fast or soft (0.15) into soft gold. at p = 0.90 retains bright, fading, and soft (0.45 + 0.30 + 0.15 = 0.90), renormalizing them to 0.500, 0.333, and 0.167. For low-latency serving, drafts tokens with a smaller model and verifies them in parallel with exact rejection sampling so the target distribution stays unchanged.[1]

Two-step branching decoding tree from prefix "The autumn light is". At step 1, bright (0.45) and fading (0.30) are kept by beam width 2 while soft (0.15) and nine tail tokens (0.10) are pruned. At step 2, bright expands to period (x0.40 = 0.180, greedy choice), today (x0.35 = 0.158), and now (x0.25 = 0.113), while fading expands to fast (x0.90 = 0.270, beam winner) and slowly (x0.10 = 0.030). Aligned score bars on the right confirm fading fast (0.270) outscores bright . (0.180).
Each terminal score multiplies the first-step probability by its conditional continuation probability. Beam width 2 keeps fading alive, letting fading fast (0.270) outscore greedy's bright . (0.180).

From logits to numerically stable probabilities

maps raw logits z∈R∣V∣z \in \mathbb{R}^{|V|} to probabilities. Calling exp(z) directly overflows FP16 above z≈11.09z \approx 11.09 (max ≈ 65,504), FP32 above z≈88.72z \approx 88.72 (max ≈ 3.4e38), and FP64 above z≈709.78z \approx 709.78. Subtracting m=max⁡jzjm = \max_j z_j leaves every ratio exact while keeping all exponents ≤0\le 0:[2]

pi=exp⁡(zi−m)∑j=1∣V∣exp⁡(zj−m),log⁡pi=(zi−m)−log⁡∑j=1∣V∣exp⁡(zj−m)p_i = \frac{\exp(z_i - m)}{\sum_{j=1}^{|V|} \exp(z_j - m)}, \qquad \log p_i = (z_i - m) - \log \sum_{j=1}^{|V|} \exp(z_j - m)

The right-hand log-sum-exp form lets decoders sum across long sequences without underflowing to zero. Masked −∞-\infty entries map cleanly to 0, while an all-masked vector must raise an error instead of returning NaN:

stable-softmax-overflow.py
import numpy as np

def stable_softmax(logits) -> np.ndarray:
    z = np.asarray(logits, dtype=np.float64)
    if np.isnan(z).any() or np.isposinf(z).any():
        raise ValueError("NaN and +inf are invalid logits")
    if not np.isfinite(z).any():
        raise ValueError("all tokens are masked")
    w = np.exp(z - np.max(z))
    return w / w.sum()

for dtype, hi in [(np.float16, 12.0), (np.float32, 90.0), (np.float64, 1000.0)]:
    vec = np.array([hi, hi - 1.0, hi - 2.0], dtype=dtype)
    with np.errstate(over="ignore", invalid="ignore"):
        naive = np.exp(vec) / np.exp(vec).sum()
    print(f"{dtype.__name__:7s} naive={naive.tolist()} | stable={stable_softmax(vec).round(3).tolist()}")

print("masked:", stable_softmax([2.0, -np.inf, 1.0]).round(3).tolist())
try:
    stable_softmax([-np.inf, -np.inf])
except ValueError as exc:
    print("all masked:", exc)
Max-shifted softmax prevents overflow
float16 naive=[nan, 0.0, 0.0] | stable=[0.665, 0.245, 0.09]
float32 naive=[nan, nan, 0.0] | stable=[0.665, 0.245, 0.09]
float64 naive=[nan, nan, nan] | stable=[0.665, 0.245, 0.09]
masked: [0.731, 0.0, 0.269]
all masked: all tokens are masked

Greedy decoding picks the step-by-step argmax, wt=arg⁡max⁡w∈VP(w∣w<t)w_t = \arg\max_{w \in V} P(w \mid w_{<t}). It costs O(∣V∣)O(|V|) after logits arrive, uses no randomness, and makes a clean baseline for classification or deterministic extraction. Its blind spot is myopia: by the chain rule P(w1:T)=∏t=1TP(wt∣w<t)P(w_{1:T}) = \prod_{t=1}^T P(w_t \mid w_{<t}), taking the step-one leader can miss a stronger full sequence. Here bright (0.45) splits across . (0.40), today (0.35), and now (0.25), while fading (0.30) concentrates on fast (0.90), so greedy locks into bright . (0.18) and misses fading fast (0.27). On long generations, greedy argmax also falls into verbatim repetition loops.[3][4]

Exhaustive search over ∣V∣T|V|^T paths is intractable. retains the top BB partial prefixes at each step, expands each survivor, sums log-probabilities, and prunes back to BB. Pruned prefixes never return, so width B=2B = 2 rescues fading fast (0.27) while discarding soft (0.15). Because each added token contributes a non-positive log-probability, raw sums reward short outputs that emit EOS early. Google's Neural Machine Translation (GNMT) system divided sequence log-probability by a tunable length factor:[5]

score(Y)=log⁡P(Y)(5+∣Y∣)α/6α\text{score}(Y) = \frac{\log P(Y)}{(5 + |Y|)^\alpha / 6^\alpha}

Setting α=0\alpha = 0 restores raw log-probability; raising α\alpha relieves penalty pressure on longer completions (counting tokens before EOS). Length-normalized scores can rise when a prefix adds a near-certain token, so early-stopping logic must not assume monotone decline.

beam-search-and-length-penalty.py
vocab = ["bright", "fading", "soft", "pale"]
first_probs = np.array([0.45, 0.30, 0.15, 0.02])
continuations = {
    "bright": {".": 0.40, "today": 0.35, "now": 0.25},
    "fading": {"fast": 0.90, "slowly": 0.10},
    "soft": {"gold": 0.70, "gray": 0.30},
}

greedy_w1 = vocab[int(np.argmax(first_probs))]
greedy_w2 = max(continuations[greedy_w1], key=continuations[greedy_w1].get)
beam_idx = np.argsort(-first_probs, kind="stable")[:2]
step_two = sorted(
    [(f"{vocab[int(i)]} {w2}", float(first_probs[i]) * p) for i in beam_idx for w2, p in continuations[vocab[int(i)]].items()],
    key=lambda x: x[1],
    reverse=True,
)
print(f"greedy: {greedy_w1} {greedy_w2} ({first_probs[0] * continuations[greedy_w1][greedy_w2]:.2f})")
print("beam top-2:", [(t, round(s, 3)) for t, s in step_two[:2]])

# GNMT length normalization (alpha = 0.6) flips short-sequence bias.
texts = ["bright.", "fading across hills now ."]
log_probs, lengths = np.array([-1.00, -1.08]), np.array([2, 5])
norm_scores = log_probs / (((5.0 + lengths) / 6.0) ** 0.6)
print("raw winner:", texts[int(np.argmax(log_probs))], "| length-norm winner:", texts[int(np.argmax(norm_scores))])
assert step_two[0][0] == "fading fast" and texts[int(np.argmax(norm_scores))] == "fading across hills now ."
Greedy vs beam search and GNMT length normalization
greedy: bright . (0.18)
beam top-2: [('fading fast', 0.27), ('bright .', 0.18)]
raw winner: bright. | length-norm winner: fading across hills now .

Beam search excels on tightly conditioned tasks like translation, yet in open-ended dialogue maximizing likelihood favors generic clichés while holding up to BB divergent suffix paths in memory.[3][6]

Temperature scaling

Stochastic sampling draws from the conditional distribution. T>0T > 0 divides raw logits before softmax:

PT(wi)=exp⁡((zi−zmax⁡)/T)∑j=1∣V∣exp⁡((zj−zmax⁡)/T)P_T(w_i) = \frac{\exp((z_i - z_{\max}) / T)}{\sum_{j=1}^{|V|} \exp((z_j - z_{\max}) / T)}

Pairwise odds scale exponentially as exp⁡((zA−zB)/T)\exp((z_A - z_B)/T): for zA−zB=2.0z_A - z_B = 2.0, P(A)/P(B)P(A)/P(B) is 7.39x at T=1.0T = 1.0, 54.60x at T=0.5T = 0.5, and 3.79x at T=1.5T = 1.5. Shannon entropy H(PT)=−∑iPT(wi)log⁡2PT(wi)H(P_T) = -\sum_i P_T(w_i)\log_2 P_T(w_i) is monotone nondecreasing in TT: route temperature = 0 to an explicit greedy branch rather than dividing by zero,[7][8] and always scale every individual token before summing tail buckets (at T=1.5T = 1.5, scaling all eight 0.01 tail tokens lifts combined tail mass from 8.0% to 21.07%):

TokenT=0.3T = 0.3T=1.0T = 1.0T=1.5T = 1.5
bright0.77850.450.3331
fading0.20150.300.2542
soft0.02000.150.1602
pale0.0000240.020.0418
eight-token tail0.0000190.080.2107
entropy HH (bits)0.862.092.75
Line chart comparing a twelve-token next-word distribution after The autumn light is across temperatures 0.3, 1.0, and 1.5. Original probabilities are bright 45 percent, fading 30, soft 15, pale 2, and eight 1-percent tail tokens totaling 8 percent. Rescaling all twelve tokens before summing the tail shifts bright from 77.8 percent at T=0.3 to 33.3 percent at T=1.5 while the grouped tail rises from under 0.01 percent to 21.1 percent, with Shannon entropy increasing from 0.86 to 2.09 to 2.75 bits.
Each curve rescales all twelve logits before summing the eight tail tokens. Raising temperature from 0.3 to 1.5 flattens the mode and lifts combined tail mass above 21%.

Top-k, top-p, and min-p truncation

Even at moderate temperature, tens of thousands of unlikely tail tokens retain nonzero probability. Truncation filters cut that tail before sampling:

Side-by-side probability bar and cumulative distribution plots comparing peaked (72, 20, 5, 2, 1 percent) and flat (40, 20, 15, 11.5, 3.5, plus ten 1-percent tokens) distributions. Fixed top-k 3 keeps three tokens in both. Top-p 0.90 adapts from two to five tokens via cumulative mass, while min-p 0.10 adapts from two to four tokens by scaling the cutoff from 7.2 percent to 4.0 percent.
Fixed top-k = 3 keeps three tokens in both regimes. top-p = 0.90 expands from two to five tokens on the flat curve, while min-p = 0.10 drops its cutoff from 7.2% to 4.0% and retains four tokens.
temperature-nucleus-and-minp.py
import math
import torch

base_probs = torch.tensor([0.45, 0.30, 0.15, 0.02] + [0.01] * 8, dtype=torch.float64)
logits = torch.log(base_probs)

def nucleus_size(probs: torch.Tensor, p: float = 0.90) -> int:
    sp, _ = torch.sort(probs, descending=True)
    return int(((torch.cumsum(sp, dim=0) - sp) < p).sum())

for temp in [0.3, 1.0, 1.5]:
    dist = torch.softmax(logits / temp, dim=-1)
    h = float(-(dist[dist > 0] * torch.log2(dist[dist > 0])).sum())
    print(f"T={temp}: bright={float(dist[0]):.4f}, tail={float(dist[4:].sum()):.4f}, H={h:.2f}b, top-p={nucleus_size(dist)}")

# Min-p before vs after T=2 on [0, -2, -4] with rho=0.1.
z = torch.tensor([0.0, -2.0, -4.0])
before = torch.nonzero(z >= z.max() + 1.0 * math.log(0.1)).flatten().tolist()
after = torch.nonzero(z >= z.max() + 2.0 * math.log(0.1)).flatten().tolist()
print(f"min-p before T=2: {before} | after T=2: {after}")
assert before == [0, 1] and after == [0, 1, 2]
Temperature expands top-p and shifts min-p cutoff
T=0.3: bright=0.7785, tail=0.0000, H=0.86b, top-p=2
T=1.0: bright=0.4500, tail=0.0800, H=2.09b, top-p=3
T=1.5: bright=0.3331, tail=0.2107, H=2.75b, top-p=9
min-p before T=2: [0, 1] | after T=2: [0, 1, 2]

Penalties, grammar masks, and non-commuting pipelines

A multiplicative repetition penalty θ>1\theta > 1 (commonly 1.1–1.2) breaks verbatim loops using a sign-aware rule once per distinct seen token ID: divide positive logits by θ\theta and multiply negative logits by θ\theta so every seen token drops.[12][7] Because sign-aware scaling is not shift-invariant, always apply it before subtracting max(z) for softmax stability, or centering flips positive scores to negative and can reverse the argmax winner:

repetition-penalty-sign-and-centering.py
def apply_repetition_penalty(logits: torch.Tensor, seen_ids: set[int], penalty: float = 1.2) -> torch.Tensor:
    out = logits.clone()
    idx = torch.tensor(sorted(seen_ids), dtype=torch.long)
    out[idx] = torch.where(out[idx] > 0, out[idx] / penalty, out[idx] * penalty)
    return out

raw = torch.tensor([2.4, -0.5, 0.7])
print("sign-aware [2.4, -0.5, 0.7]:", [round(float(v), 3) for v in apply_repetition_penalty(raw, {0, 1}, 1.2)])

scores = torch.tensor([2.4, 2.1, 1.2, 0.3])
names = ["bright", "clear", "warm", "pale"]
p_first = apply_repetition_penalty(scores, {0}, 1.2)
c_first = apply_repetition_penalty(scores - scores.max(), {0}, 1.2)
print("penalty first:", names[int(torch.argmax(p_first))], "| center first:", names[int(torch.argmax(c_first))])
assert int(torch.argmax(p_first)) == 1 and int(torch.argmax(c_first)) == 0
Sign-aware penalty and centering order
sign-aware [2.4, -0.5, 0.7]: [2.0, -0.6, 0.7]
penalty first: clear | center first: bright

Additive frequency (α\alpha) and presence (β\beta) penalties subtract directly using token counts: logitadjusted=logit−α⋅count(token)−β⋅1[count(token)>0]\text{logit}_{\text{adjusted}} = \text{logit} - \alpha \cdot \text{count}(\text{token}) - \beta \cdot \mathbb{1}[\text{count}(\text{token}) > 0]. Because all three operate on raw token IDs without syntax awareness, heavy values can suppress repeated code identifiers or required JSON keys.

Serving engines chain logit processors in a fixed order because stages do not commute: (1) logit biases and −∞-\infty grammar masks, (2) history penalties before centering, (3) temperature == 0 greedy branch after checking that at least one finite logit remains, (4) temperature scaling, top-kk, stable softmax, top-pp/min-pp, renormalization, and PRNG draw, and (5) EOS, stop-string, and max_tokens checks.[7]

To enforce JSON Schema, regex, or SQL syntax, grammar-constrained decoding pairs generation with an automaton that masks every invalid token to −∞-\infty before softmax.[13][14] Always mask invalid tokens before top-kk/top-pp/min-pp: if probabilities are [0.6, 0.3, 0.1] and only token 2 is legal, running top-p = 0.80 first drops token 2 and leaves an empty pool, whereas masking first renormalizes token 2 to 1.0. Remember also that syntax enforcement does not verify facts, and local step-by-step masking can distort full-sequence probabilities relative to conditioning on valid complete strings.[15][16] See Structured Outputs & Constrained Generation for compiled masks and grammar-aligned sampling.

Three aligned stages of a production sampler pipeline on four candidate tokens: bright, clear, warm, and pale. Stage 1 shows raw logits [2.4, 2.1, 1.2, 0.3] with bright leading. Stage 2 applies repetition penalty theta = 1.2 to seen token bright, dropping it from 2.4 to 2.0 below clear (2.1) and flipping greedy argmax to clear. Stage 3 sorts softmax probabilities [0.404, 0.365, 0.164, 0.067] and plots cumulative mass crossing top-p = 0.90 at rank 3 warm (CDF 0.933), cutting pale (0.067).
Repetition penalty pushes bright below clear (changing greedy output to clear), while top-p = 0.90 cuts pale and lets stochastic sampling draw from clear, bright, or warm.
production-sampler-and-grammar-order.py
import random
import torch

def sample_next_token(logits: torch.Tensor, seen_ids: list[int], penalty: float, temperature: float, top_p: float, rng: random.Random) -> int:
    adjusted = logits.clone()
    if seen_ids:
        idx = torch.tensor(sorted(set(seen_ids)), dtype=torch.long)
        adjusted[idx] = torch.where(adjusted[idx] > 0, adjusted[idx] / penalty, adjusted[idx] * penalty)
    if torch.isneginf(adjusted).all() or torch.isnan(adjusted).any():
        raise ValueError("need at least one finite unmasked logit")
    if temperature == 0:
        return int(torch.argmax(adjusted))
    probs = torch.softmax(adjusted / temperature, dim=-1)
    sp, sidx = torch.sort(probs, descending=True)
    keep = ((torch.cumsum(sp, dim=0) - sp) < top_p) & (sp > 0)
    return rng.choices([int(i) for i in sidx[keep]], weights=[float(w) for w in sp[keep]], k=1)[0]

names = ["bright", "clear", "warm", "pale"]
logits = torch.tensor([2.4, 2.1, 1.2, 0.3])
print("greedy:", names[sample_next_token(logits, [0], 1.2, 0.0, 0.90, random.Random(0))])
print("sampled:", names[sample_next_token(logits, [0], 1.2, 1.0, 0.90, random.Random(0))])

scores = torch.log(torch.tensor([0.6, 0.3, 0.1]))
grammar_first = scores.masked_fill(~torch.tensor([False, False, True]), -torch.inf)
chosen = sample_next_token(grammar_first, [], 1.0, 1.0, 0.80, random.Random(0))
print("grammar-first token:", chosen)
assert chosen == 2

try:
    sample_next_token(torch.full((3,), -torch.inf), [], 1.0, 0.0, 0.80, random.Random(0))
except ValueError as err:
    print("empty pool rejected:", err)
Sampler pipeline and grammar-before-truncation
greedy: clear
sampled: warm
grammar-first token: 2
empty pool rejected: need at least one finite unmasked logit

Choosing settings, runtime limits, and troubleshooting

Setting temperature = 0 removes randomness and seed fixes PRNG draws, yet batching and GPU floating-point reduction differences can still flip near-tied logits unless batch-invariant modes (VLLM_BATCH_INVARIANT=1) are active.[8][17] Hosted reasoning APIs frequently lock or ignore temperature and top_p while reasoning is enabled; rely on prompt grounding and structured schemas when sampling knobs are unavailable.[18][19]

Start sweeps from how much the task tolerates, changing one knob at a time on held-out prompts:

TaskTemperature sweepSampler candidatesPrimary metrics
Code generation0.0, 0.2, 0.5Greedy, top-p = 0.95Tests passed, format validity
Factual QA0.0, 0.2, 0.5Greedy, top-p = 0.90Grounded accuracy, unsupported claims
General dialogue0.3, 0.7, 1.0Top-p = 0.90, min-p = 0.10Helpfulness, repetition
Creative writing0.7, 1.0, 1.3Top-p = 0.95, min-p = 0.05Novelty, coherence
SymptomRoot causeFix
NaN in custom softmaxNaive exp(z) overflowed FP16/FP32Subtract max(z) before exp (log-sum-exp)
Crash at temperature = 0Divided logits by zeroRoute T == 0 to greedy argmax before scaling
Generic chat with beam searchHigh likelihood favors boilerplateSwitch to calibrated sampling
Lower TT still hallucinatesPositive TT preserves token rankFix retrieval grounding or verification
Empty pool with JSON schemaTruncation ran before grammar maskApply −∞-\infty masks before top-kk/top-pp
Drift after runtime swapProcessor order or tie-break differsVerify logit-processor ordering
Check your understanding

Mastery Check

Check each question as you go, or answer all of them and check together. Score 75% or higher to complete this lesson.

0 of 5 answered
1.First-token probabilities are A: 0.52, B: 0.28, C: 0.20. After A, A1-A4 tie equally; after B, B1-B2 tie equally; after C, C1 has probability 1.0. Breaking ties in ID order, what do greedy, width-2 beam, and exhaustive search return?
2.A complete-only decoder uses GNMT length normalization (alpha = 1, length excludes EOS). Completed S has log-prob -1.4 (len 2); completed L has -1.6 (len 4); active U hits the cap at -1.0 (len 4) without EOS. Which candidate wins?
3.Probabilities are leader 0.36 and four separate tail tokens of 0.16 each. Apply T = 0.5 to each individual token, then sum the tail. What are leader and combined tail?
4.Tokens A/B/C have logits [3, -1, 2] and counts [2, 1, 0]. Apply sign-aware repetition penalty 2.0 once per distinct seen token, then frequency 0.25 and presence 0.5. What are the adjusted logits and winner?
5.A/B/C/D have probabilities [0.52, 0.24, 0.16, 0.08], and a grammar permits only D. Running top-p = 0.85 first emptied the set. Fixing order to grammar-first, and separately passing all -inf logits to T = 0 greedy, gives what?

5 questions remaining.

References

Fast Inference from Transformers via Speculative Decoding.

Leviathan, Y., Kalman, M., & Matias, Y. · 2023 · ICML 2023

https://arxiv.org/abs/2211.17192

Accurate Computation of the Log-Sum-Exp and Softmax Functions

Blanchard, P., Higham, D. J., & Higham, N. J. · 2019

https://arxiv.org/abs/1909.03469

The Curious Case of Neural Text Degeneration.

Holtzman, A., et al. · 2020 · ICLR 2020

https://arxiv.org/abs/1904.09751

DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning.

DeepSeek Team · 2025

https://arxiv.org/abs/2501.12948

Google's Neural Machine Translation System: Bridging the Gap between Human and Machine Translation.

Wu, Y., et al. · 2016

https://arxiv.org/abs/1609.08144

If Beam Search is the Answer, What was the Question?.

Meister, C., Cotterell, R., & Vieira, T. · 2020 · EMNLP 2020

https://arxiv.org/abs/2010.02650

Transformers logits processors: repetition penalties and sampling boundaries

Hugging Face contributors · 2026

https://github.com/huggingface/transformers/blob/main/src/transformers/generation/logits_process.py

vLLM sampling_params.py

vLLM Project · 2026

https://github.com/vllm-project/vllm/blob/main/vllm/sampling_params.py

Hierarchical Neural Story Generation.

Fan, A., Lewis, M., & Dauphin, Y. · 2018 · ACL 2018

https://arxiv.org/abs/1805.04833

Turning Up the Heat: Min-p Sampling for Creative and Coherent LLM Outputs.

Nguyen, M. N., Baker, A., Neo, C., Roush, A., Kirsch, A., & Shwartz-Ziv, R. · 2025 · ICLR 2025 Oral

https://arxiv.org/abs/2407.01082

Min-p, Max Exaggeration: A Critical Analysis of Min-p Sampling in Language Models

Schaeffer, R., Kazdan, J., & Denisov-Blanch, Y. · 2025

https://arxiv.org/abs/2506.13681

CTRL: A Conditional Transformer Language Model for Controllable Generation.

Keskar, N. S., et al. · 2019

https://arxiv.org/abs/1909.05858

Efficient Guided Generation for Large Language Models

Willard, B. T. & Louf, R. · 2023 · arXiv preprint

https://arxiv.org/abs/2307.09702

XGrammar: Flexible and Efficient Structured Generation Engine for Large Language Models

Dong, Y., Ruan, C. F., Cai, Y., et al. · 2024

https://arxiv.org/abs/2411.15100

Structured model outputs

OpenAI · 2026

https://developers.openai.com/api/docs/guides/structured-outputs

Grammar-Aligned Decoding

Park, K., Wang, J., Berg-Kirkpatrick, T., Polikarpova, N., and D'Antoni, L. · 2024 · NeurIPS 2024

https://papers.neurips.cc/paper_files/paper/2024/file/2bdc2267c3d7d01523e2e17ac0a754f3-Paper-Conference.pdf

Create chat completion

OpenAI · 2026

https://developers.openai.com/api/reference/resources/chat/subresources/completions/methods/create

Using GPT-6

OpenAI · 2026

https://developers.openai.com/api/docs/guides/latest-model

Migrating to API version 2026-10-21

Anthropic · 2026

https://platform.claude.com/docs/en/api/migration-2026-10-21

Discussion

Questions and insights from fellow learners.

Discussion loads when you reach this section.