liveBook · Manning

Objective function

As explained in Building Specialized AI Systems

Training loss is the loss value measured on the examples used to optimize a model's parameters.

A loss function converts a model’s predictions and target outputs into one number measuring error on the training examples. Lower loss indicates a better fit; higher loss indicates a worse fit. section 3.1.2

During fine-tuning, the loss supplies the signal for gradient descent. Each parameter configuration creates a point in a high-dimensional loss landscape, and optimization moves toward lower regions. section 3.1.2

Sentiment prediction

A model assigns the correct label, “positive,” only 30% softmax probability. Cross-entropy loss penalizes this uncertainty, encouraging greater confidence in the correct answer. section 3.1.2

A training step uses the loss as the bridge between predictions and parameter updates:

  • Load input-target pairs from a data loader. section 3.1.2
  • Compute model outputs and evaluate them with a loss function. section 3.1.2
  • Clear accumulated gradients, backpropagate the loss, and let the optimizer update parameters. section 3.1.2
  • Monitor the reported loss while evaluating validation loss for generalization; high validation loss alongside good training loss can indicate overfitting. section 2.3.1
Figure 3.5 Gradient descent principle illustrated with a single weight variable. For LLMs, the same principle applies to billions of parameters.

Shows how changing a single weight changes the loss landscape and illustrates the downhill direction used by gradient descent. section 3.1.2

How Building Specialized AI Systems covers it

How deep it goes
Explains scalar error, cross-entropy, and the loss landscape, but does not develop detailed loss-function formulas.
Examples
Uses uncertain positive sentiment predictions, cross-entropy, a training loop, and contrasting training and validation loss.
What you can do after
Apply it via a training loop to measure prediction error, backpropagate gradients, update parameters, and monitor overfitting.
How it connects
Connects loss functions with gradient descent, backpropagation, optimizers, model parameters, and validation loss.

Also explained in

Compare how 42 books explain objective function →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Building Specialized AI Systems. The section links point to the parts of the book it draws on.