# What Are Parameters (Weights)?

> What model parameters and weights are, how training sets them, and what bigger models cost, explained simply for your AI interview.

**In short:** Parameters are the learned numbers inside a model, mainly its weights and biases, and training sets them. They decide how the model turns your input into an answer, and more of them cost more memory and time to run.

AI and LLM interview question Q018, LLM fundamentals. Beginner, common (our estimate). From Venkat R. Murty's free Interview Kit: https://designervenkat.online/interview/ai/what-are-parameters-weights

## Say it in 30 seconds

A parameter is a number inside an AI model that training learns. Most parameters are weights, which multiply each input, plus biases, which shift the result. Training sets them, and answering uses them without changing them. A model with more parameters has more room to learn, but it needs more memory and time, so the right size depends on the job.

## Say it in 2 minutes

A model is a long series of sums, and the numbers it uses are its parameters. Most of them are weights. A weight multiplies one input, so it sets how much that input counts. Some of those sums also add a bias, a number added on top.

Training is where those numbers get their values. The model makes a guess, measures how wrong it was, and nudges the weights a little to do better next time. It repeats that across huge amounts of text. Then the weights are saved as a checkpoint, a file of the learned numbers. When you ask a question, the model loads those weights and uses them as they are. A normal chat does not change them.

Size matters, but it comes with a price. A bigger model has more room for hard patterns, yet it needs more memory and answers more slowly. For a narrow job, such as sorting claim forms, a smaller model with good data and a clear test can win on cost. So I would measure on our own cases before choosing.

If the interviewer asks about fine-tuning, say it changes the weights again on one task, and LoRA, a cheaper method, changes only a small added set of weights. Then name the trade-off: more weights can help, but they cost memory, computing power and time.

## What are parameters, in plain words?

A model is a long series of sums. Its parameters are the numbers those sums use. Most parameters are weights, and a weight multiplies one input, so it sets how much that input counts. Some are biases, a number added on top so the output can shift. Training is how all of them get their values.

Google's machine learning glossary defines a parameter as "the weights and biases that a model learns during training". The word "weights" is the everyday name people use for most of them, so you will hear both.

Think of a bank's loan scorecard. Each factor, like income, years in the job or missed payments, earns points, and the points decide how much that factor counts. Those points are weights. A large language model works the same way, with a very large number of points, all set by training on past examples. No person types in each one.

- **Parameter:** A number inside the model that training learns. Weights and biases are the parameters.
- **Weight:** A number that multiplies an input, so it sets how much that input counts.
- **Bias:** A number added on top, so the model can shift its output up or down.
- **Hyperparameter:** A setting you pick before training, like the learning rate. Training does not learn it.
- **Checkpoint:** A saved copy of the parameters, taken during training or after it.

## How does a weight turn inputs into a score?

Here is the arithmetic in a made-up example. A bank's fraud screen scores a payment from two inputs: how unusual the amount is, and how new the payee is. The model has one weight per input and one bias. Say the weights are 0.6 and -0.3, the bias is 0.1, and the inputs are 1 and 2.

The score is 0.6 × 1, plus -0.3 × 2, plus 0.1. That makes 0.6 minus 0.6 plus 0.1, which is 0.1. Training is what finds the numbers 0.6, -0.3 and 0.1 in the first place. A large language model does many sums like this for every word it writes, across a very large number of weights.

Google's glossary says "Bias is a parameter in machine learning models". So the bias in our sum counts as a parameter too, even though it is not multiplied by an input.

## Who sets the parameters, and when?

Training sets them. The model compares its answers with the right ones, then nudges its weights to cut the error. Google's glossary says "Training is the process of determining a model's ideal weights". Once training ends, the weights are saved, and answering uses them.

*Diagram, Where the weights come from: Training reads a large amount of text and saves the learned numbers as a checkpoint. Answering then loads those saved weights and uses them unchanged, and the answer reaches you as text.*
1. Training reads the example text and adjusts the weights.
2. The learned numbers are saved as a checkpoint.
3. Answering loads the saved weights and uses them unchanged.
4. The model's answer comes out as text you read.

The glossary also says that in large language models, "the process of using a trained model to generate a response to an input prompt" is called inference. That is the phase you use every day. While it answers, the model does not change its weights.

A checkpoint is a saved file of these numbers. PyTorch's guide shows the model part of it as a dictionary that maps each layer to its parameter tensor, which is a grid of numbers.

> "Training is the process of determining a model's ideal weights; inference is the process of using those learned weights to make predictions." (Google, machine learning glossary)
>
> "In PyTorch, the learnable parameters (i.e. weights and biases) of an torch.nn.Module model are contained in the model's parameters (accessed with model.parameters())." (PyTorch)

Saved notes in an app are usually text added to the prompt, so a memory feature can change what the model says without changing its weights.

## What changes the weights, and what does not?

Training changes the parameter values. Normal use does not. Pretraining is the big first run. Fine-tuning is a second pass on one task. Google's glossary defines it as "a second, task-specific training pass performed on a pre-trained model to refine its parameters for a specific use case".

LoRA is a cheaper kind of fine-tuning. The glossary describes it as a technique that "freezes" the model's pre-trained weights and then inserts a small set of trainable weights into the model. So the big base stays as it is, and only the small added set learns.

*Diagram, What changes the weights, and what does not: Training changes the weights, so they get new values. A normal chat and searching your files leave them alone, so the saved model stays the same.*
1. Pretraining writes the first set of weights.
2. Fine-tuning refines those weights on one task.
3. A normal chat uses the weights as they are.
4. Searching your files adds text to the prompt, so the weights stay put.

So when a team says their model learned from a file, ask which part changed. If the file was searched at question time, the weights did not change. Quantisation is a separate idea: it stores the weights in fewer bits, as the memory section below explains.

## Does more parameters mean a better model?

Not on its own. More parameters give a model more room to learn hard patterns, but they cost memory, compute (the processing power used) and time per answer. In 2020, OpenAI's GPT-3 paper described it as "an autoregressive language model with 175 billion parameters", ten times more than any earlier non-sparse language model.

The scaling-laws paper by Kaplan and colleagues found that the loss, a measure of how wrong the model is, "scales as a power-law with model size, dataset size, and the amount of compute used for training". So model size is one of three things that set the loss, alongside data and compute.

- **Bigger model: More room to learn.** Can handle harder, more varied work. Costs more memory, compute and time for every answer.
- **Smaller model: Cheaper and faster.** Can do a narrow job well, like sorting claim forms, at a lower cost. Test it on your own cases first.

### How would you estimate the memory for a self-hosted model?

Start with the parameter count, then multiply by the bytes each number takes. Here is the sum for a made-up claims triage model, plus a made-up 7-billion-parameter model, in plain Python.

```python
# A made-up claims triage model: three layers, sized for this example.
layers = [(512, 1024), (1024, 1024), (1024, 8)]  # (inputs, outputs)

weights = sum(inputs * outputs for inputs, outputs in layers)
biases = sum(outputs for _, outputs in layers)
parameters = weights + biases
print(f"weights: {weights:,}")
print(f"biases: {biases:,}")
print(f"parameters: {parameters:,}")

# Each weight is stored as a 16-bit number, and 16 bits is 2 bytes.
print(f"memory for the weights: {parameters * 2 / 1_000_000:.2f} MB")

# The same arithmetic for a made-up 7-billion-parameter model.
big = 7_000_000_000
print(f"7B model, 2 bytes each: {big * 2 / 1_000_000_000:.0f} GB")
```

Output:

```text
weights: 1,581,056
biases: 2,056
parameters: 1,583,112
memory for the weights: 3.17 MB
7B model, 2 bytes each: 14 GB
```

Quantisation stores weights in fewer bits, so each number takes less memory. Hugging Face's guide says quantisation "stores a model's weights, and sometimes its activations, in fewer bits so the model needs less memory".

> **Tip:** Say the sum out loud, then add that the running text needs memory too. The weights alone understate the bill.

## What does the interviewer want to hear?

**A strong answer covers**

- [ ] A plain definition: the learned weights and biases that set how the model answers.
- [ ] Weights multiply inputs and biases shift the output. Training sets both.
- [ ] Training changes parameters. Normal use of a model does not.
- [ ] Bigger means more memory, compute and time, and it helps most on hard tasks.
- [ ] Learning rate and temperature are settings, not parameters.
- [ ] A worked count: parameters times bytes per number, plus the running text.

**Common traps**

- Trap: "Parameters are the settings I change, like temperature." Better: Those are settings. Parameters are the weights and biases that training learned.
- Trap: "The model learns from every chat I have." Better: Normal use does not change the weights. Training does. Your chat is text in the prompt.
- Trap: "More parameters always means a better answer." Better: Size helps on hard tasks but costs memory and speed. Measure on your own task before choosing.

## Can you spot the parameter?

**Spot the parameter:** An insurer's team shares four settings for its claims model. Which one is a parameter?

A. Learning rate set to 0.0002 for the training run
B. Context window of 8,000 tokens for each request
C. Temperature set to 0.2 on every API call
D. Trained weights and biases, saved at step 40,000

**Answer:** D. The learned weights and biases are the parameters. The learning rate is a hyperparameter you pick before training. Temperature (how varied the answers are) is a setting sent with each request. The context window is a limit on how much text fits in one request.

**Quick check:** The claims model is too slow and costs too much. Which change alone shrinks its parameter count?

A. Lower the temperature on each request
B. Use a smaller model with fewer weights
C. Raise top-p to 0.9
D. Write a longer system prompt

**Answer:** B. Only a model with fewer weights changes the parameter count. Temperature (how varied the answers are) and top-p (how many word choices are kept) are settings sent with each request, and a longer prompt is just more text.

## Can you answer these from memory?

**Flash cards**

- **What is a parameter?** A number the model learns in training. Weights and biases are the parameters.
- **Weight vs bias?** A weight multiplies an input. A bias is added on top to shift the output.
- **Who sets the parameters?** Training does. A normal chat uses them as they are and does not change them.
- **Give a hyperparameter.** The learning rate: a setting you pick before training. Training does not learn it.
- **What is a checkpoint?** A saved copy of the learned parameters, from during or after training.
- **Does more parameters mean better?** Not always. It also needs more memory, compute and data, and it answers more slowly.

## Likely follow-up questions

- Q015 What is pretraining? https://designervenkat.online/interview/ai/what-is-pretraining
- Q016 Pretraining vs fine-tuning vs instruction tuning? https://designervenkat.online/interview/ai/pretraining-vs-fine-tuning-vs-instruction-tuning
- Q019 What are scaling laws? https://designervenkat.online/interview/ai/what-are-scaling-laws
- Q025 Open-weight vs closed API models: trade-offs? https://designervenkat.online/interview/ai/open-weight-vs-closed-api-models
- Q284 What is LoRA? https://designervenkat.online/interview/ai/what-is-lora
- Q311 What is quantization? https://designervenkat.online/interview/ai/what-is-quantization

## Learn it in depth

- [Fine-tuning](https://designervenkat.online/learn/ai-engineering/fine-tuning)
