Behavior is learned, not programmed
No one writes rules into an LLM. Its knowledge and habits come from the training objective, the data and post-training, and are stored implicitly across the weights. Examples placed in a prompt can change its behavior with no weight change at all (in-context learning). Its characteristic failures, such as confident errors, flattery and odd blind spots, trace back to these same mechanisms. Interpretability research looks inside the activations, where concepts often turn out to be directions in the vector space.
What the animation says
Nobody wrote the rules
No engineer wrote a rule saying be polite, or that Paris is the capital of France. Yet the model does both. It also invents citations, and agrees with users who are wrong. What it does have is one fixed function with billions of adjustable numbers, called weights. Training nudges those numbers, step by step, so its predictions of the next piece of text get better. So where does a fact like Paris live inside it?
Pressure from the objective
It's spread out, and it's there because it helped the training goal. In pretraining, that goal is predicting each actual next word. If the next word really is Paris and the model gave it ninety percent, the penalty is small: about a tenth. At one percent, the penalty jumps to about four point six. Training shrinks this, averaged over the whole corpus. Then post-training nudges the weights toward answers people rated well. Suppose raters tend to like answers that agree with them. What gets pushed in?
A confident error
Agreement gets reinforced, so the model flatters. Pretraining causes a failure of its own. Prompt: Dr. Lee was born in. The training data never states Dr. Lee's birth year. Real documents almost always follow such text with a year, so the model puts ninety percent on: a year comes next. It spreads that over about twenty plausible years, roughly four and a half percent each. Sampling picks one, nineteen sixty-two, and prints it fluently. The sentence shows no doubt. Tap the number that shows how sure the model was about nineteen sixty-two.
Same weights, new input
The output looks like documents, and documents rarely say unknown. That's the pressure behind confident errors. A third source of behavior changes no weights at all. Here the prompt holds two examples: sea otter, loutre de mer; cheese, fromage. Then: house. The model answers maison. The weights are exactly what they were a second ago. Only the input changed, so the internal vectors it computes, the activations, changed. That's in-context learning.
A concept is a direction
Look inside at those activations, and concepts often show up as directions. This simulation hides a French direction in fake activations: French examples get pushed three units along it. Average the French activations, subtract the English average, and the estimate matches the hidden direction: about point nine four. To score a new input, project it onto that direction. French lands near two point eight, English near zero, give or take one. Two new inputs just arrived. Tap the one the model reads as French.
Remember this
So nobody programmed the behavior. The objective, the data and post-training pushed it into the weights. Prompts steer the model without touching those weights. Failures come from the same pressures: fluent text hides uncertainty, and rewarded agreement becomes flattery. And inside, concepts often appear as directions in activation space.
Billions of numbers, shaped by pressure
The three sources of behavior
Tracing a confident error
A concept as a direction
import numpy as np
rng = np.random.default_rng(0)
d = 64
u = rng.normal(size=d); u /= np.linalg.norm(u) # hidden concept direction
noise = lambda n: rng.normal(size=(n, d))
fr = noise(100) + 3 * u # activations on French text
en = noise(100) # activations on English text
est = fr.mean(0) - en.mean(0); est /= np.linalg.norm(est)
print(round(est @ u, 2)) # ~0.94: direction recovered
new_fr, new_en = noise(1)[0] + 3 * u, noise(1)[0]
print(round(new_fr @ est, 1), round(new_en @ est, 1)) # ~2.8 vs ~0, each +/- about 1
Remember this
On Bytewise this lesson comes in small steps with a check at the end, and the app brings it back right before you would forget it.
Bytewise
All courses