Jump to content

Large language model (LLM): Difference between revisions

From Wikibase
Remove blank lines inside the data-constrained loss display, which split the $$ block into 3 paragraphs — AI-assisted (RonzzWikiCowriter) (via update-page on MediaWiki MCP Server)
Merge LLM here, dedupe the scaling-law formulas, fix temperature-sampling notation and BOS convention, add citations to 7 new source items — AI-assisted (RonzzWikiCowriter) (via update-page on MediaWiki MCP Server)
Line 1: Line 1:
[[Category:Large language models]]
[[Category:Large language models]]
[[Category:Natural language processing]]
[[Category:Natural language processing]]
<!-- add citations -->
A '''large language model''' ('''LLM''') is an [[artificial intelligence]] system built as a [[neural network]] with a very large parameter count, typically based on the [[Transformer]] architecture, trained by [[machine learning]] on broad text corpora to generate text in response to prompts.<ref>{{#cite:Q3130}}</ref> This self-supervised objective, usually [[next-token prediction]], requires no human labels because the supervision signal is derived from the text itself.
A '''large language model''' ('''LLM''') is a [[neural network]] with a very large parameter count, typically based on the [[Transformer (deep learning architecture)|Transformer]] architecture, trained on broad text corpora to predict tokens in sequence. This self-supervised objective, usually [[next-token prediction]], requires no human labels because the supervision signal is derived from the text itself.


== Architecture and pretraining objective ==
== Architecture and pretraining objective ==


Most modern LLMs are autoregressive decoder-only Transformers. Given a token sequence $\mathbf{x}=(x_1,x_2,\dots,x_T)$, the pretraining objective maximises the conditional likelihood
At the time of writing (2026-08), the most widely adopted LLMs are Transformer models, specifically autoregressive decoder-only Transformers.<ref>{{#cite:Q3130}}</ref> Given a token sequence $\mathbf{x}=(x_1,x_2,\dots,x_T)$, the pretraining objective maximises the conditional likelihood


$$
$$
Line 15: Line 14:
$$
$$


where $\theta$ denotes the model parameters. The causal attention mask ensures that the prediction for position $t$ depends only on $x_{1:t-1}$, not on future tokens.
where $\theta$ denotes the model parameters. The term for $t=1$ is conditioned on the empty context $x_{1:0}$, supplied in practice by a begin-of-sequence token. The causal attention mask ensures that the prediction for position $t$ depends only on $x_{1:t-1}$, not on future tokens.


== Scaling laws ==
== Scaling laws ==


The performance of LLMs improves predictably with model size, training-data volume, and computational budget, a relationship known as '''scaling laws'''. Language-model loss follows a power law in compute $C$,
The performance of LLMs improves predictably with model size, training-data volume, and computational budget, a relationship known as '''scaling laws'''.<ref>{{#cite:Q3141}}</ref> Language-model loss follows a power law in compute $C$,


$$
$$
L(C)=a \cdot C^{-\alpha},
L(C)=aC^{-\alpha},
\qquad \alpha \approx 0.05,
\qquad \alpha\approx 0.05,
$$
$$


so diminishing returns are intrinsic: halving the loss would require roughly $10^{6}$ times more compute. The [[Chinchilla scaling laws|Chinchilla prescription]] refines this picture by balancing parameters and data, recommending approximately 20 tokens per parameter. The finite supply of high-quality public text, however, places a practical ceiling on data scaling, with estimates suggesting a “data wall” may arrive by the late 2020s.
so diminishing returns are intrinsic: halving the loss would require roughly $10^{6}$ times more compute. The [[Chinchilla scaling laws|Chinchilla prescription]] refines this picture by balancing parameters and data, recommending approximately 20 tokens per parameter.<ref>{{#cite:Q3164}}</ref> The finite supply of high-quality public text, however, places a practical ceiling on data scaling, with estimates suggesting a “data wall” may arrive by the late 2020s.<ref>{{#cite:Q3181}}</ref>


== Data scaling and the data wall ==
== Data scaling and the data wall ==


Let $N$ denote the number of trainable parameters, $D$ the number of training tokens, and $C$ the computational budget. The [[Chinchilla scaling laws|Chinchilla prescription]] approximates the compute-optimal allocation by
Let $N$ denote the number of trainable parameters, $D$ the number of training tokens, and $C$ the computational budget. Under a fixed $C$, the [[Chinchilla scaling laws|Chinchilla prescription]] approximates the compute-optimal allocation by


$$
$$
D \approx 20N,
D \approx 20N.
$$
 
and models loss as a power law in $C$:<!-- suggestion: $D \approx 20N$ and the power law $L(C)=a \cdot C^{-\alpha}$ with $\alpha \approx 0.05$ are already given in the Scaling laws section above. Consider deriving them once and only cross-referencing them here, so that the two slightly different renderings of the same 2 formulas do not diverge later. -->
 
$$
L(C)=aC^{-\alpha},\qquad \alpha\approx 0.05.
$$
$$


Line 54: Line 47:
$$
$$


where $L_{\infty}$ is the irreducible loss, and $N_c$, $D_c$, $\alpha_N$, and $\alpha_D$ are fitted constants. The [[data wall]] is the regime in which further gains must come primarily from $N$, [[algorithmic efficiency]], or [[synthetic data]], rather than from additional human-written text.
where $L_{\infty}$ is the irreducible loss, and $N_c$, $D_c$, $\alpha_N$, and $\alpha_D$ are fitted constants.<ref>{{#cite:Q3174}}</ref> The [[data wall]] is the regime in which further gains must come primarily from $N$, [[algorithmic efficiency]], or [[synthetic data]], rather than from additional human-written text.<ref>{{#cite:Q3181}}</ref>


== Inference ==
== Inference ==


At inference time, an LLM generates text by repeatedly sampling or selecting a token according to the conditional distribution $P(x_t \mid x_{1:t-1};\theta)$ and appending it to the context. Decoding strategies such as greedy search, beam search, temperature sampling, and top-$p$ (nucleus) sampling trade off diversity against coherence. The computational cost of self-attention grows quadratically with context length, motivating techniques such as [[KV caching]] and efficient attention variants.
At inference time, an LLM generates text by repeatedly sampling or selecting a token according to the conditional distribution $P(x_t \mid x_{1:t-1}; \theta)$ and appending it to the context. Decoding strategies such as greedy search, beam search, temperature sampling, and top-$p$ (nucleus) sampling trade off diversity against coherence.<ref>{{#cite:Q3198}}</ref> The computational cost of self-attention grows quadratically with context length, motivating techniques such as [[KV caching]] and efficient attention variants.<ref>{{#cite:Q3130}}</ref>


For a context of length $T$, causal [[self-attention]] computes a $T\times T$ score matrix, so its time and memory costs scale as
For a context of length $T$, causal [[self-attention]] computes a $T\times T$ score matrix, so its time and memory costs scale as
Line 68: Line 61:
$$
$$


respectively, where $d$ is the hidden dimension. [[KV caching]] removes redundant recomputation of past keys and values during autoregressive decoding, reducing the per-token attention cost from $\mathcal{O}(T^2d)$ to $\mathcal{O}(Td)$, at the expense of storing $2Td$ cached scalars per layer.
respectively, where $d$ is the hidden dimension. [[KV caching]] removes redundant recomputation of past keys and values during autoregressive decoding, reducing the per-token attention cost from $\mathcal{O}(T^2d)$ to $\mathcal{O}(Td)$, at the expense of storing $2Td$ cached scalars per layer.<ref>{{#cite:Q3192}}</ref>


At each decoding step, a token is sampled from
At each decoding step, a token is sampled from


$$
$$
x_t \sim P(x_t\mid x_{1:t-1};\theta).
x_t \sim P(x_t\mid x_{1:t-1}; \theta).
$$
$$


Line 81: Line 74:
P_\tau(x_t\mid x_{1:t-1})
P_\tau(x_t\mid x_{1:t-1})
=
=
\frac{\exp(z_t/\tau)}
\frac{\exp(z_{x_t}/\tau)}
{\sum_{j}\exp(z_j/\tau)},
{\sum_{v\in\mathcal{V}}\exp(z_v/\tau)},
$$
$$


where $z_j$ are logits and $\tau>0$ is the temperature.<!-- suggestion: the index $t$ on the left of the equation marks a position in the sequence, but the softmax on the right runs over the vocabulary. Consider naming the realised token separately, for instance $P_\tau(x_t\mid x_{1:t-1}) = \exp(z_{x_t}/\tau) \big/ \sum_{v\in\mathcal{V}}\exp(z_v/\tau)$, with $z_v$ the logit of vocabulary entry $v$ and $\mathcal{V}$ the vocabulary. This would also match the index convention used on the [[Softmax]] page. --> Top-$p$ (nucleus) sampling restricts the support to the smallest set $\mathcal{S}_p$ such that
where $z_v$ is the logit assigned to vocabulary entry $v\in\mathcal{V}$, and $\tau>0$ is the temperature. Top-$p$ (nucleus) sampling restricts the support to the smallest set $\mathcal{S}_p$ such that


$$
$$

Revision as of 12:58, 11 November 2026

Languages: English · français · Esperanto

A large language model (LLM) is an artificial intelligence system built as a neural network with a very large parameter count, typically based on the Transformer architecture, trained by machine learning on broad text corpora to generate text in response to prompts.[1] This self-supervised objective, usually next-token prediction, requires no human labels because the supervision signal is derived from the text itself.

Architecture and pretraining objective

At the time of writing (2026-08), the most widely adopted LLMs are Transformer models, specifically autoregressive decoder-only Transformers.[1] Given a token sequence $\mathbf{x}=(x_1,x_2,\dots,x_T)$, the pretraining objective maximises the conditional likelihood

$$ \mathcal{L}_{\text{LM}} = \sum_{t=1}^{T} \log P(x_t \mid x_{1:t-1}; \theta), $$

where $\theta$ denotes the model parameters. The term for $t=1$ is conditioned on the empty context $x_{1:0}$, supplied in practice by a begin-of-sequence token. The causal attention mask ensures that the prediction for position $t$ depends only on $x_{1:t-1}$, not on future tokens.

Scaling laws

The performance of LLMs improves predictably with model size, training-data volume, and computational budget, a relationship known as scaling laws.[2] Language-model loss follows a power law in compute $C$,

$$ L(C)=aC^{-\alpha}, \qquad \alpha\approx 0.05, $$

so diminishing returns are intrinsic: halving the loss would require roughly $10^{6}$ times more compute. The Chinchilla prescription refines this picture by balancing parameters and data, recommending approximately 20 tokens per parameter.[3] The finite supply of high-quality public text, however, places a practical ceiling on data scaling, with estimates suggesting a “data wall” may arrive by the late 2020s.[4]

Data scaling and the data wall

Let $N$ denote the number of trainable parameters, $D$ the number of training tokens, and $C$ the computational budget. Under a fixed $C$, the Chinchilla prescription approximates the compute-optimal allocation by

$$ D \approx 20N. $$

Because high-quality public text is finite, data scaling cannot continue indefinitely at fixed $N$. If $D_{\max}$ is the available token stock, a data-constrained loss model is

$$ L_{\text{data}}(N,D_{\max}) = L_{\infty} + \left(\frac{N_c}{N}\right)^{\alpha_N} + \left(\frac{D_c}{D_{\max}}\right)^{\alpha_D}, $$

where $L_{\infty}$ is the irreducible loss, and $N_c$, $D_c$, $\alpha_N$, and $\alpha_D$ are fitted constants.[5] The data wall is the regime in which further gains must come primarily from $N$, algorithmic efficiency, or synthetic data, rather than from additional human-written text.[4]

Inference

At inference time, an LLM generates text by repeatedly sampling or selecting a token according to the conditional distribution $P(x_t \mid x_{1:t-1}; \theta)$ and appending it to the context. Decoding strategies such as greedy search, beam search, temperature sampling, and top-$p$ (nucleus) sampling trade off diversity against coherence.[6] The computational cost of self-attention grows quadratically with context length, motivating techniques such as KV caching and efficient attention variants.[1]

For a context of length $T$, causal self-attention computes a $T\times T$ score matrix, so its time and memory costs scale as

$$ \mathcal{O}(T^2d) \quad\text{and}\quad \mathcal{O}(T^2), $$

respectively, where $d$ is the hidden dimension. KV caching removes redundant recomputation of past keys and values during autoregressive decoding, reducing the per-token attention cost from $\mathcal{O}(T^2d)$ to $\mathcal{O}(Td)$, at the expense of storing $2Td$ cached scalars per layer.[7]

At each decoding step, a token is sampled from

$$ x_t \sim P(x_t\mid x_{1:t-1}; \theta). $$

Temperature sampling replaces $P$ by

$$ P_\tau(x_t\mid x_{1:t-1}) = \frac{\exp(z_{x_t}/\tau)} {\sum_{v\in\mathcal{V}}\exp(z_v/\tau)}, $$

where $z_v$ is the logit assigned to vocabulary entry $v\in\mathcal{V}$, and $\tau>0$ is the temperature. Top-$p$ (nucleus) sampling restricts the support to the smallest set $\mathcal{S}_p$ such that

$$ \sum_{x\in\mathcal{S}_p} P(x\mid x_{1:t-1}) \ge p. $$

  1. ↑ ↑ ↑ Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A. N., Kaiser, Ł., & Polosukhin, I. (2017). Attention Is All You Need. 5998–6008. https://doi.org/10.48550/arXiv.1706.03762
  2. ↑ Kaplan, J., McCandlish, S., Henighan, T., Brown, T. B., Chess, B., Child, R., Gray, S., Radford, A., Wu, J., & Amodei, D. (2020). Scaling Laws for Neural Language Models. https://arxiv.org/abs/2001.08361
  3. ↑ Hoffmann, J., Borgeaud, S., Mensch, A., Buchatskaya, E., Cai, T., Rutherford, E., de Las Casas, D., Hendricks, L. A., Welbl, J., Clark, A., Hennigan, T., Noland, E., Millican, K., van den Driessche, G., Damoc, B., Guy, A., Osindero, S., Simonyan, K., Elsen, E., … Sifre, L. (2022). Training Compute-Optimal Large Language Models. https://doi.org/10.48550/arXiv.2203.15556
  4. ↑ ↑ Villalobos, P., Ho, A., Sevilla, J., Besiroglu, T., Heim, L., & Hobbhahn, M. (2024). Will we run out of data? Limits of LLM scaling based on human-generated data. https://doi.org/10.48550/arXiv.2211.04325
  5. ↑ Muennighoff, N., Rush, A. M., Barak, B., Le Scao, T., Piktus, A., Tazi, N., Pyysalo, S., Wolf, T., & Raffel, C. (2023). Scaling Data-Constrained Language Models. https://doi.org/10.48550/arXiv.2305.16264
  6. ↑ Holtzman, A., Buys, J., Du, L., Forbes, M., & Choi, Y. (2020). The Curious Case of Neural Text Degeneration. https://doi.org/10.48550/arXiv.1904.09751
  7. ↑ Pope, R., Douglas, S., Chowdhery, A., Devlin, J., Bradbury, J., Levskaya, A., Heek, J., Xiao, K., Agrawal, S., & Dean, J. (2023). Efficiently Scaling Transformer Inference. https://doi.org/10.48550/arXiv.2211.05102