liveBook · Manning

Objective function

As explained in Build a Text-to-Image Generator (from Scratch)

A loss function is a function that quantifies the discrepancy between a model's predictions and the desired outputs.

An objective function defines what training should minimize. A loss function quantifies the discrepancy between model predictions and desired outputs, turning a modeling goal into a measurable training signal. section 1.2.2 section 3.4

Training objectives take different forms according to the model and task:

  • Image classification selects an appropriate loss function and optimizer, then trains on batches before evaluating unseen test images. section 3.4
  • A variational autoencoder balances reconstruction accuracy against a smooth, continuous latent-space distribution. section 9.1.1
  • DALL-E mini minimizes cross-entropy between predicted image-token sequences and ground-truth sequences from a VQGAN encoder. section 12.1.1

Text-to-image training

Image–caption pairs provide the training data. A VQGAN encoder converts each image into discrete tokens, while a BART encoder processes its caption. A BART decoder then predicts the image tokens sequentially, and cross-entropy measures disagreement with the actual token sequence. section 12.1.1

Figure 12.2 Training pipeline of the DALL-E mini model

The pipeline diagram connects captions, pretrained encoders, autoregressive decoding, image tokens, and the training objective. section 12.1.1

How Build a Text-to-Image Generator (from Scratch) covers it

How deep it goes
Explains task-specific losses and multi-term balancing, but does not derive their mathematical formulas or optimization algorithms.
Examples
Uses CIFAR-10 classification, VAE image reconstruction, and DALL-E mini image-token prediction as concrete objective-function examples.
What it assumes
Assumes model predictions, target outputs, training data, and optimization workflows; introduces task-specific objectives through examples.
What you can do after
Apply it via a selected loss, optimizer, batches, and training loop for classification or generative modeling.
How it connects
Connects loss functions with optimizers, reconstruction loss, cross-entropy loss, variational autoencoders, transformers, and latent spaces.

Also explained in

Compare how 30 books explain objective function →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build a Text-to-Image Generator (from Scratch). The section links point to the parts of the book it draws on.