Two Kinds of Numbers
Inside a running LLM, not all numbers have the same origin or lifetime.
Weights
Learned parameter values produced during training. They are saved as part of the trained model and reused during inference.
Activations
Intermediate numerical values created while a particular input is being processed through the model.
Training creates the learned weights. A prompt creates activations as those weights are used.
Before the Prompt Arrives
Imagine our AI service is running and the LLM has already been loaded.
loaded and ready in accelerator-accessible memory
INFERENCE RUNTIME
ready for work
NO NEW USER PROMPT YET
The trained parameter values already exist. They do not need Craig's question in order to exist.
They were learned earlier during training and stored with the model.
Then the Prompt Arrives
Now enter our familiar question:
The service prepares the model input, tokenizes it, obtains token IDs, and constructs the numerical representations that enter the transformer.
As those representations pass through layer after layer, the model generates intermediate numerical results.
Those changing intermediate values are activations.
A Weight Is Not an Activation
×
LEARNED WEIGHT MATRIX
↓
matrix / tensor computation
↓
NEW ACTIVATION
The weight participates in the transformation. The activation is part of the changing state produced by that transformation.
Then the new activation becomes input to further operations.
Training: Change the Weights
During training, examples are processed, an error or training objective is evaluated, and an optimization procedure repeatedly adjusts model parameters.
Across enormous numbers of training examples and updates, useful statistical structure becomes encoded in the model's parameter values.
Inference: Use the Weights
Ordinary inference is different.
Your prompt changes the current computation and its temporary state. It does not ordinarily retrain the underlying LLM.
This Explains an Important Mystery
If a conversation influences the next answer, yet ordinary inference is not continually rewriting the model weights, where is the changing information?
Part of the answer is in the current input context and temporary computational state.
Weights
Relatively stable learned parameters reused across prompts.
Context
The tokens supplied to the current inference request: instructions, conversation history, user input, and other included information.
Activations
Intermediate values created as that context is processed through the network.
And Then There Is the KV Cache
We met the KV cache on the Generation Loop page. Now we can place it more precisely.
During transformer attention, key and value representations are computed. During autoregressive generation, previously computed key/value data can be retained so it does not have to be recomputed from scratch for every generated token.
ACTIVATIONS — intermediate values created during processing
KV CACHE — retained per-sequence attention state used across decode steps
The KV cache is temporary runtime state associated with the active sequence. It is not another permanent set of learned model weights.
Three Different Lifetimes
Model Lifetime
Weights. Saved persistently and reusable after shutdown and restart.
Request / Sequence Lifetime
KV cache and other request state. Useful while processing and generating the active sequence.
Operation / Layer Lifetime
Many activations and temporary buffers. Produced, consumed, and often released or reused as computation proceeds.
Actual memory-management strategies vary by runtime and hardware, but this lifetime distinction is extremely useful for understanding the system.
Where Do These Numbers Physically Live?
On a GPU-based inference system, model and request data occupy real memory.
└── persistent model files
│ load
▼
RAM / GPU VRAM
├── model weights
├── active tensors / activations
├── KV cache
└── temporary working buffers
│
▼
GPU EXECUTION RESOURCES
└── arithmetic transforms the numerical data
Not every implementation places everything in exactly the same location. Models may be sharded across accelerators or partly offloaded to system memory. But none of this state is abstract magic: while running, it must be represented somewhere in physical memory.
The Weights May Stay Loaded
When one answer finishes, the system does not necessarily unload the entire LLM from VRAM.
A serving system commonly keeps model weights resident so the next request can use them without paying the cost of loading the model again.
├── temporary request state can be released / reused
├── KV cache for that sequence can be released / reused
└── model weights may remain loaded
Request B arrives
└── same loaded trained weights can process new input
Same Weights, Different Prompt
This gives us a useful experiment in thought.
Prompt A: Why is the sky blue?
→ activation pattern A
→ generated response A
Prompt B: Why is grass green?
→ activation pattern B
→ generated response B
The model parameters can remain the same while different inputs create different sequences of internal numerical state and different outputs.
Now Our Earlier Matrix Has a History
When we wrote:
we can now identify the roles:
WQ
A learned parameter matrix. Training established its values; inference uses them.
X
Current input representation—part of the changing state produced for this sequence.
Q
A newly computed representation—an activation produced during this forward computation.
The same conceptual distinction applies throughout the transformer: relatively persistent learned parameters operate on changing input-dependent state.
What the Model Keeps — What the Prompt Creates
The weights are the durable result of training.
The activations are transient results of running particular input through those weights.
The KV cache preserves selected per-sequence attention state so generation can proceed efficiently from one token to the next.
Three kinds of numerical state. Three different purposes. Three different lifetimes.
HAAW Checkpoint
- Weight
- A learned model parameter produced by training and reused during inference.
- Activation
- An intermediate numerical result produced while a particular input is processed.
- Training
- The process that adjusts model parameters using an optimization procedure.
- Inference
- The process that uses the trained model to transform supplied input and generate output.
- KV cache
- Temporary per-sequence attention state retained to avoid repeating certain computations during autoregressive decoding.
- Persistence
- Weights can be stored on persistent media and survive shutdown; activations and KV-cache state are runtime data.
- Physical reality
- While active, weights, activations, caches, and buffers occupy real memory and are operated on by real hardware.