liveBook · Manning

Training

As explained in Grokking AI Algorithms, Second Edition

Training is the process of adjusting a model's parameters using examples so that its predictions better match desired outcomes.

Training adjusts a model’s parameters using examples so its predictions better match desired outcomes. In an artificial neural network (ANN), the adjustable parameters are weights; its architecture and configuration stay fixed during training. section 9.8

A basic ANN training loop:

  • Initialize the weights; one option is to draw them from a normal distribution. section 9.8
  • Run forward propagation on an example and compare the prediction with its actual class to calculate the cost, or prediction error. section 9.8
  • Adjust the weights using gradient descent and the chain rule, then repeat until a chosen stopping condition is reached. section 9.8

A prediction error

If an ANN predicts 0.7 when the actual value is 1.0, the loss is 0.3. Training uses this error to guide weight adjustments. section 9.8

Figure 9.25 Example of adjusting a weight by using gradient descent
09_25

See how gradient descent adjusts a weight. section 9.8

An LLM workflow prepares text data, converts it into token IDs, uses self-attention to learn relationships among tokens, and decodes internal representations into language for predictions and generation. Training choices can also include Transformer configurations and attention heads. section 11.4

Figure 11.7 An overview of the LLM training workflow
11_07

View the stages of the LLM training workflow. section 11.4

How Grokking AI Algorithms, Second Edition covers it

How deep it goes
Explains ANN cost, initialization, weight updates, and stopping, while outlining the LLM workflow without its update mechanics.
Examples
Traces an ANN prediction of 0.7 against a target of 1.0 and outlines text-to-token-ID processing for an LLM.
What it assumes
Assumes familiarity with forward propagation and distinguishes trainable ANN weights from fixed architecture and configuration.
What you can do after
Apply gradient descent to adjust ANN weights from prediction error and describe the main stages of an LLM training workflow.
How it connects
Links training to forward propagation, loss, gradient descent, self-attention, tokenization, and Transformer configuration.

Also explained in

Compare how 24 books explain training →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking AI Algorithms, Second Edition. The section links point to the parts of the book it draws on.