Language model loss: Difference between revisions
Appearance
Notation: loss is L, compute is C; fix \prop which is not a LaTeX command (via update-page on MediaWiki MCP Server) |
No edit summary |
||
| Line 1: | Line 1: | ||
[[Category:Large language model]] | |||
[[Category:Large language | |||
The '''language model loss''' measures how "surprised" a [[large language model (LLM)]] is by the true values of tokens it attempts to predict. | The '''language model loss''' measures how "surprised" a [[large language model (LLM)]] is by the true values of tokens it attempts to predict. | ||
| Line 16: | Line 13: | ||
<blockquote> | <blockquote> | ||
$\vec x=(x_1,\cdots,x_T)$ is a text [[token]] sequence of length $T$ (e.g., <code>('I','am','myself','.')</code>). | $\vec x=(x_1,\cdots,x_T)$ is a text [[token (machine learning)|token]] sequence of length $T$ (e.g., <code>('I','am','myself','.')</code>). | ||
</blockquote> | </blockquote> | ||
| Line 44: | Line 41: | ||
== Perplexity == | == Perplexity == | ||
See [[perplexity (LLM)]]. | |||
Revision as of 16:36, 11 November 2026
The language model loss measures how "surprised" a large language model (LLM) is by the true values of tokens it attempts to predict.
Formal definition
With model parameters $\theta$, the language model loss on training sample $\vec x=(x_1,\cdots,x_T)$:
$$ L(\theta) = -\frac{1}{T}\sum_{t=1}^{T}\log_b P_\theta(x_t \mid x_{1:t-1}) $$
$\vec x=(x_1,\cdots,x_T)$ is a text token sequence of length $T$ (e.g.,
('I','am','myself','.')).
Unit
The unit of the language model loss is determined by $b$.
| $b$ | Unit |
|---|---|
| 2 | Bit |
| e | Nat |
| 10 | Hartley |
Training reports conventionally quote $L_{\text{nat}}$.
Perplexity
See perplexity (LLM).