liveBook · Manning

Parameter

As explained in Build a Large Language Model (From Scratch)

An adjustable value in a neural network that is learned during training.

A parameter is a trainable value that learning adjusts during model training. In an LLM, weight parameters are stored in linear layers and shape how modules such as multi-head attention and the GPTModel transform data. section 5.0

PyTorch exposes parameters at two useful levels:

  • Access a linear layer's weights through its .weight attribute after creating it with torch.nn.Linear(...). section 5.0
  • Collect all trainable parameters, including weights and biases, through model.parameters() for training. section 5.0

Inspecting parameters

Create a layer with new_layer = torch.nn.Linear(...), inspect its learned weight with new_layer.weight, or retrieve the model's complete trainable parameter collection with model.parameters(). section 5.0

How Build a Large Language Model (From Scratch) covers it

How deep it goes
Defines weights as trainable values and shows PyTorch access, but does not explain parameter-update mathematics or tensor shapes.
Examples
Uses a torch.nn.Linear layer, its .weight attribute, and model.parameters() as concrete parameter-access examples.
What it assumes
Assumes familiarity with linear layers, multi-head attention, and GPTModel implementation while defining trainable parameters directly.
What you can do after
Apply it via PyTorch by inspecting layer weights and collecting model weights and biases for training.
How it connects
Connects parameters to linear layers, biases, multi-head attention, GPTModel, pretraining, and fine-tuning.

Also explained in

Compare how 31 books explain parameter →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build a Large Language Model (From Scratch). The section links point to the parts of the book it draws on.