Jump to content

Large language model (LLM): Difference between revisions

From Wikibase
No edit summary
 
(15 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[Category:Large language models]]
[[Category:Large language model]]
[[Category:Natural language processing]]
[[Category:Natural language processing]]
 
A '''large language model''' ('''LLM''') is an [[artificial neural network (ANN)]] with a very large parameter count, trained by [[machine learning]] on broad text corpora to model the distribution of token sequences, so that it can generate text in response to a prompt.
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>


== Architecture ==
== Architecture ==


At the time of writing (2026-08), the most widely adopted LLMs are [[Transformer]] models, specifically [[autoregressive decoder-only Transformer]]s.<ref>{{#cite:Q3130}}</ref>.
The dominant architecture at the time of writing (2026-11) is the [[autoregressive decoder-only Transformer]].<ref>{{#cite:Q3130}}</ref>  


== Scaling laws ==
== Scaling laws ==
Line 15: Line 14:
* training-data volume
* training-data volume
* computational budget
* computational budget
<ref>{{#cite:Q3141}}</ref>


== Language model loss ==
[[Language model loss]] and [[Chinchilla prescription]] describe the correlation.<ref>{{#cite:Q3141}}</ref><ref>{{#cite:Q3164}}</ref>
 
== Inference ==


Language-model loss follows a power law in compute $C$,
With [[tokenisation (machine learning)#Definition|token vocabulary]] $\mathcal{V}$, given input $x$, '''inference''' produces output [[token (machine learning)|token]] sequence $y=(y_1,\cdots,y_T) \in \mathcal{V}^T$ chosen probabilistically:


$$
$$
L(C)=aC^{-\alpha},
y\sim P_\theta(\cdot\mid x).
\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.<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>
{{Hidden example}}
 
With prompt $x=$ `"The capital of France is"`, 3 independent inferences with a typical, well-trained LLM may give:
== 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 scaling laws|Chinchilla prescription]] approximates the compute-optimal allocation by


$$
$$
D \approx 20N.
y^{(1)}=\texttt{"Paris."},\qquad
y^{(2)}=\texttt{"Paris, a city on the Seine."},\qquad
y^{(3)}=\texttt{"Lyon, argued some."}
$$
$$
{{End hidden}}


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
=== Computational limitation ===


The globally most probable output sequence
$$
$$
L_{\text{data}}(N,D_{\max})
y^\star=\arg\max_{y\in\mathcal{V}^T}P_\theta(y\mid x)
=
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.<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>
is calculated by a maximiser [[function]] over a space of size $|\mathcal{V}|^T \to \infty$, which cannot be enumerated for long sequences (large $T$). The output sequence must be generated sequentially in smaller steps (e.g., 1 to a few tokens).
 
== 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.<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
=== Typical implementation: sequential next token prediction ===


[[File:Sequential next-token prediction.png|thumbnail|'''Sequential next token prediction''' starting with prompt <code>the</code> with ChatGPT3.]]
$$
$$
\mathcal{O}(T^2d)
\vec{z}_t=f_\theta\left(x,y_{1:t-1}\right)\in\mathbb{R}^{|\mathcal{V}|},\\
\quad\text{and}\quad
y_t\sim\operatorname{Categorical}\left(\mathrm{softmax}\left(\vec{z}_t\right)\right).
\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.<ref>{{#cite:Q3192}}</ref>
where $f_\theta$ is the model [[forward pass]] with [[model parameters]] $\theta$, and $\operatorname{Categorical(\cdot)}$ denotes the [[categorical distribution]] given probability vector $\cdot$.


At each decoding step, a token is sampled from


$$
<blockquote>
x_t \sim P(x_t\mid x_{1:t-1}; \theta).
In '''sequential next token prediction''', the LLM first determines $y_1$ based on $x$, then determines $y_2$ based on $x,y_1$, $y_3$ based on $x,y_1,y_2$, so on so forth.
$$
</blockquote>


Temperature sampling replaces $P$ by
== Application ==


$$
=== Thinking partner ===
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
For example, [[Person:Yoochul Kim]] employed various LLMs as his thinking partner for his philosophical thought experiments [[OntoMotoOS]].<ref>{{#cite:Q3426}}</ref>
 
$$
\sum_{x\in\mathcal{S}_p}
P(x\mid x_{1:t-1})
\ge p.
$$

Latest revision as of 14:38, 17 November 2026

A large language model (LLM) is an artificial neural network (ANN) with a very large parameter count, trained by machine learning on broad text corpora to model the distribution of token sequences, so that it can generate text in response to a prompt.

Architecture

The dominant architecture at the time of writing (2026-11) is the autoregressive decoder-only Transformer.[1]

Scaling laws

The performance of LLMs improves predictably with

  • model size
  • training-data volume
  • computational budget

Language model loss and Chinchilla prescription describe the correlation.[2][3]

Inference

With token vocabulary $\mathcal{V}$, given input $x$, inference produces output token sequence $y=(y_1,\cdots,y_T) \in \mathcal{V}^T$ chosen probabilistically:

$$ y\sim P_\theta(\cdot\mid x). $$

Computational limitation

The globally most probable output sequence $$ y^\star=\arg\max_{y\in\mathcal{V}^T}P_\theta(y\mid x) $$

is calculated by a maximiser function over a space of size $|\mathcal{V}|^T \to \infty$, which cannot be enumerated for long sequences (large $T$). The output sequence must be generated sequentially in smaller steps (e.g., 1 to a few tokens).

Typical implementation: sequential next token prediction

Sequential next token prediction starting with prompt the with ChatGPT3. · Open in a new tab

$$\begin{gathered} \vec{z}_t=f_\theta\left(x,y_{1:t-1}\right)\in\mathbb{R}^{|\mathcal{V}|},\\ y_t\sim\operatorname{Categorical}\left(\mathrm{softmax}\left(\vec{z}_t\right)\right). \end{gathered}$$

where $f_\theta$ is the model forward pass with model parameters $\theta$, and $\operatorname{Categorical(\cdot)}$ denotes the categorical distribution given probability vector $\cdot$.


In sequential next token prediction, the LLM first determines $y_1$ based on $x$, then determines $y_2$ based on $x,y_1$, $y_3$ based on $x,y_1,y_2$, so on so forth.

Application

Thinking partner

For example, Yoochul Kim employed various LLMs as his thinking partner for his philosophical thought experiments OntoMotoOS.[4]