LLM Learning Hub

workspace/llm-course/home

Model Parameters

Model parameters are the learned weights and biases that define a model's behavior. In transformers, these include embedding matrices, attention weight matrices (Q, K, V, O), FFN weights, and LayerNorm parameters. The total count defines the model's 'size'.

What is Model Parameters?

Model parameters are the learned weights and biases that define a model's behavior. In transformers, these include embedding matrices, attention weight matrices (Q, K, V, O), FFN weights, and LayerNorm parameters. The total count defines the model's 'size'.

Model parameters are the learned weights and biases that define a model's behavior. In transformers, these include embedding matrices, attention weight matrices (Q, K, V, O), FFN weights, and LayerNorm parameters. The total count defines the model's 'size'.

Where is it used?

GPT-3 has 175B parameters, LLaMA-2 70B, and GPT-4 an estimated 1.8T (MoE). Parameters are stored as float16 or bfloat16 in checkpoints (`.safetensors` or `.bin` files) and loaded into GPU VRAM for inference.

How to build it

Count them: `sum(p.numel() for p in model.parameters())` in PyTorch. To inspect a specific layer: `for name, p in model.named_parameters(): print(name, p.shape, p.numel())`. Save with `torch.save(model.state_dict(), 'model.pt')`.