Concept icon
Concept

Objective Function for Training Text Generative Models

A Text Generative Model (TGM) is a neural language model that estimates the probability distribution of tokens. It learns parameters θ\theta by minimizing the following negative log-likelihood objective function over a dataset D\mathcal{D}:

L(pθ,D)=−∑j=1∣D∣∑t=1∣x(j)∣log⁡pθ(xt(j)∣x1(j),…,xt−1(j))\mathcal{L}(p_{\theta}, \mathcal{D}) = - \sum_{j=1}^{|\mathcal{D}|} \sum_{t=1}^{|\textbf{x}^{(j)}|} \log p_{\theta}(x_t^{(j)} \mid x_1^{(j)}, \dots, x_{t-1}^{(j)})

Where:

  • xi∈Vx_i \in \mathcal{V} is a token from the vocabulary of words.
  • textbf{x} = (x_1, dots, x_{|textbf{x}|}) is a text sequence.
  • p∗(x)p_*(\textbf{x}) is the reference distribution.
  • D\mathcal{D} is a finite set of text sequences drawn from p∗p_*.
  • pθ(xt∣x1,…,xt−1)p_{\theta}(x_t \mid x_1, \dots, x_{t-1}) is the model's predicted probability of the next token given the previous tokens in the sequence.

0

1

Concept icon
Updated 2026-06-26

Tags

Data Science