Memory and Storage

Understanding SI, Part 1: How Does SI Actually Know Anything?

What a language model’s knowledge is: tokens, weights, attention, and next-token training, what researchers see inside, and why memory bandwidth sets the speed.

On this page 11 sections

A language model does not look facts up. When ChatGPT, Claude, or Gemini answers, the model underneath has no database and no copy of the web to search. An assistant can be handed a search tool, but the model itself has none. It has a fixed set of trained numbers called weights, and every reply comes from multiplying the question through them. Meta’s Llama 3 paper counts 405B of them in its largest model.

Tokens going through trained weights to the next tokenThree word tokens on the left feed into a large grid of shaded cells, the model's trained weights, with one row lit up as the token selects it. An arrow on the right leads to the next token the model writes.GUIDE / UNDERSTANDING SI, PART 1Tokens in, the next token outTOKENS · TRAINED WEIGHTS · NEXT TOKENTOKENSTRAINED WEIGHTSNEXT

I come at this from storage, where the weights are data. For that model they come to about 810GB in a 16-bit format. They sit on an SSD, load into DRAM, and live in HBM beside the accelerator. A dense model reads all of them again for every word it writes. Where they sit in the memory and storage hierarchy decides how fast the answer comes.

Text goes in as numbers

Before a model sees anything, a tokenizer cuts the text into tokens, which are whole words, pieces of words, or punctuation. Each token is swapped for its position in a fixed list called the vocabulary. Llama 3 uses a vocabulary of 128K tokens, so every token becomes an ID between 0 and about 128,000. An ID works as an address. A model keeps an embedding table with one row per vocabulary entry, and the ID picks one row. Each row is a list of numbers called a vector. That row is all the rest of the model ever sees of the word. Its length is the model’s width, 16,384 numbers in Llama 3 405B.

Text goes in as numbers

A token ID is an address into a stored table

Text, then token IDs, then one stored row per token

A diagram in three stages, top to bottom. Stage one: the text The capital of France is is cut into five tokens, shown as chips. Stage two: each token becomes an ID, a number in a fixed vocabulary; Llama 3 has a vocabulary of 128K tokens, so an ID runs from 0 to about 128,000. Stage three: a tall stored table with one row per vocabulary entry, 128K rows in all. The ID of one token, France, points at one row, outlined in copper. Each row holds 16,384 numbers in Llama 3 405B, and that row is all the rest of the model sees of the word.01 TEXTThecapitalofFranceis02 TOKEN IDSIDIDIDIDID03 EMBEDDING TABLE128K rowsselected row16,384 numbers per rowText and IDsStored tableRow the ID picks
Figure 1 · In Llama 3 405B, each token ID selects one stored row of 16,384 numbers. Source: Llama Team, The Llama 3 Herd of Models (2024).

128K rows × 16,384 numbers is about 2.1 billion numbers. At 2 bytes each, that is about 4.2GB of storage spent before a single layer has run.

Nobody fills those rows in by hand. Training sets them, and tokens that turn up in similar places in text end up with similar rows.

Weights: where the knowledge is kept

A weight is one number that an input gets multiplied by. Layers are mostly large grids of them, where each output sums the inputs after scaling each one by its weight. Every part of the model is stored this way, from the embedding table through the attention and feed-forward layers to the final layer that turns a vector back into token scores.

Counted up, they are the parameter number. Llama 3 405B has 405 billion trainable parameters across 126 layers. BF16 is a 16-bit number format, so each parameter takes 2 bytes. That makes 405 billion × 2 bytes = 810GB of weights. At BF16 the model does not fit in the GPU memory of one machine with eight NVIDIA H100 GPUs, so Meta served it across 16 GPUs on two machines.

Weights: where the knowledge is kept

Every part of the model is grids of weights, 810GB in all

Each output sums its inputs after scaling each one by a weight

A diagram in two parts. Top: three inputs each pass through a copper box marked times weight, and the three scaled results feed one sum box that gives one output. Bottom: the parts of the model that are stored this way, the embedding table, the attention and feed-forward layers, and the final layer that turns a vector into token scores. Below them the arithmetic for Llama 3 405B: 405 billion parameters times 2 bytes each equals 810GB of weights.01 ONE OUTPUTinput× weightinput× weightinput× weightsumoutput02 EVERY PART IS STORED THIS WAYEmbeddingtableAttention andfeed-forwardFinal layer:token scores405 billion × 2 bytes = 810GBLlama 3 405B weights in BF16Stored weightsScaling stepData moving
Figure 2 · A weight scales one input; Llama 3 405B stores 405 billion of them at 2 bytes each in BF16. Source: Llama Team, The Llama 3 Herd of Models (2024).

No weight holds “Paris is the capital of France”. A fact the model states reliably is spread over many weights, and each weight takes part in many facts. Training keeps no list of sources either, so a model cannot say which document taught it something, and it can be wrong in the same confident tone it uses when it is right.

Attention reads the tokens before it

An embedding row carries no context, so “bank” starts as the same vector in “river bank” and in “bank account”. Attention is the core of the transformer introduced in the 2017 paper “Attention Is All You Need”, and it lets every token pull in information from the tokens before it.

Each token’s vector is multiplied by three weight matrices to make three new vectors called query, key, and value. For the current token, its query is compared with every earlier token’s key by a dot product. The result is one number that grows when the two vectors point the same way. A softmax turns those scores into shares that add up to one, and the token takes that mix of the earlier tokens’ values. In the paper’s notation it is Attention(Q, K, V) = softmax(QKᵀ / √dₖ) V, where Q, K, and V are the query, key, and value matrices and dₖ is the length of a key vector. When a model writes text, a mask keeps each token from reading anything that comes after it.

Attention reads the tokens before it

Each token weighs the earlier tokens, then takes a mix of them

The word bank starts the same in river bank and in bank account

A diagram in three panels, left to right, for the token bank. Panel one, compare: the query of bank is compared with the key of each earlier token, The and river, by a dot product that gives one score each. Panel two, weigh: a softmax turns the scores into shares that add up to one, drawn as two bars of different heights for The and river, with no values. Panel three, mix: the values of The and river are blended in those shares into one weighted mix, which becomes a new vector for bank that carries its context.01 COMPARE02 WEIGH03 MIXquery:bankkey:Thekey:riverDot product givesone score per keyTheriverShares add up to oneSoftmax turnsscores into sharesvalue:Thevalue:riverWeighted mixof the valuesNew vectorfor “bank”Stored vectorsStep that mixes
Figure 3 · The current token’s query is compared with earlier keys, the scores become shares, and the shares mix the earlier values; bar heights are illustrative. Source: Vaswani et al., Attention Is All You Need (2017).

Llama 3 405B runs 128 attention heads side by side in each layer and stacks 126 layers, so a token’s vector is rewritten over and over by what it reads. Each layer also has a feed-forward block made of weight matrices with a nonlinearity between them, and it works on every token separately.

Attention costs memory, and the cost grows with the conversation. Every new token needs the keys and values of all the tokens before it, so a running model keeps them instead of recomputing them. Pope and colleagues at Google call this store the key-value (KV) cache. Unlike the weights, it changes while the model answers.

One token per pass

After the last layer, the vector at the final position goes through one more weight matrix that scores every vocabulary entry. A softmax turns the scores into probabilities, which the transformer paper describes as converting the decoder output to next-token probabilities. That list is the model’s whole output for one step, and it gives each of the 128K tokens a probability of coming next.

One token per pass

A model writes one token per full pass through its layers

The loop that turns a prompt into an answer

A loop of four boxes read clockwise from the top left. One, look up: the newest token selects its embedding row, and the keys and values of earlier tokens are already held in the KV cache. Two, layers: attention and then feed-forward, layer by layer, 126 layers in Llama 3 405B, with every weight read once. Three, score, outlined in copper: the last layer gives a probability for every token in the vocabulary, 128K for Llama 3. Four, append: one token is picked and added to the text, and the whole pass runs again from step one. The center reads repeat for every token.01 LOOK UPThe newest token picksits embedding row.Earlier keys and valueswait in the KV cache.02 LAYERSAttention, thenfeed-forward, layer bylayer: 126 layers inLlama 3 405B.03 SCOREA probability for everytoken in the vocabulary:128K for Llama 3.04 APPENDOne token is picked andadded to the text. Thewhole pass runs again.Repeat for every tokenStep in the passStep that scoresOrder
Figure 4 · Each token written takes one full pass, and each pass reads every weight. Source: Vaswani et al. (2017); Llama Team (2024); Pope et al. (2022).

A program then picks one token, either the most likely or a random draw weighted by the probabilities, appends it to the text, and runs the entire model again. Say an answer runs 200 tokens, which takes 200 full passes. Between passes nothing carries over except the text so far and its KV cache, and each pass starts from the same frozen weights.

A setting called temperature controls how random that draw is. Set low, it pushes the draw toward the single most likely token. When I set up Google’s Gemma on my PC that way, it got stuck writing the same table row over and over until I raised the temperature.

“It just predicts the next word” is accurate about the output. Putting a sharp probability on the token after “The capital of France is” still needs the computation to carry what a capital is, which country is meant, and which city goes with it. So I think “just” is the wrong word.

Nobody wrote the weights

Training starts from random numbers and has one task, which is to predict each next token of a stretch of real text. Whatever probability the model gave the token that actually came next is scored, and the error becomes a small change to every weight. Each change goes in whichever direction would have made that token more likely. Carrying those changes back through many layers is backpropagation, which Rumelhart, Hinton, and Williams set out in Nature in 1986. Repeat it over enough text and the weights settle into values that predict well.

Nobody wrote the weights

Training repeats predict, score, adjust until the weights settle

No step in the loop says to store a fact

A diagram in three parts, top to bottom. Start: random weights and a stretch of real text. Middle: a row of three boxes joined by arrows, predict, score and adjust, with a return arrow from adjust back to predict labeled repeat over enough text. Bottom, outlined in copper: the result, weights that predict real text well. No step in the loop says to store a fact.01 STARTRandom weights and a stretch of real text02 PREDICTThe model givesodds for thenext token.03 SCOREThe odds it gavethe real nexttoken is checked.04 ADJUSTThe error becomesa small change toevery weight.Repeat over enough textResult: weights thatpredict real text wellStep in the loopResultRepeat
Figure 5 · Backpropagation carries each error back through the layers as a small change to every weight. Source: Rumelhart, Hinton and Williams (1986); Llama Team (2024).

For Llama 3 405B, enough meant 15.6T text tokens and 3.8 × 10²⁵ floating-point operations of pre-training. No step in that run says “store this fact”. A fact gets into the weights because text that mentions it is easier to predict with it than without it, and the same pressure teaches grammar, arithmetic patterns, code structure, and the habits of an argument.

Pre-training gives a model that continues text. Assistants are trained further. Llama 3’s post-training ran several rounds of fine-tuning on example instructions and answers and of tuning on human judgments of which answer is better, each changing the weights again. A finished assistant knows what was common and consistent in its training text up to the date that text was collected, and it knows rare facts poorly.

Where the weights live

Weights are files. A served model sits on an SSD as a set of tensor files, is read into the host’s DRAM, and is copied into the HBM stacked beside each accelerator. Once the weights and the KV cache fit in HBM, nothing reads the SSD again while the model answers. The memory and storage hierarchy page gives the speed of each level on that path, and current memory ICs lists the HBM parts.

Where the weights live

The SSD loads the model once, then HBM feeds it for every token

What is read at load time, and what is read for every token

Two panels, one above the other. The first, load time, happens once: the weights are stored as files on an SSD, the host stages them in its DRAM, and they are copied into the HBM beside the accelerator, after which, with the weights and key-value cache held in HBM, the SSD is not read again while the model answers. The second, outlined in copper, happens for every token: for Llama 3 405B in the 16-bit BF16 format the weights are 810GB, and all of them are read from HBM to the compute units for every token written, along with the key-value cache that sits beside them. How fast the accelerator writes one answer is set by how fast the HBM can feed it.01 LOAD, ONCESSDweight filesDRAMhost stages themHBMbeside acceleratorRead once at load; the SSD isnot read again while it answers02 EVERY TOKENHBMweights + KV cache810GB per tokenplus the KV cacheCompute unitsacceleratorSpeed per answer is set by howfast HBM can feed the computeHeld in memoryRead for every tokenData moving
Figure 6 · Llama 3 405B in BF16: the SSD is read once at load, and all 810GB in HBM is read again for every token written. Source: Llama Team (2024); Pope et al. (2022).

A dense model uses every weight for every token, so writing one token means reading every weight. Llama 3 405B is dense, so each token reads all 810GB. Google’s inference paper adds the KV cache to that load. Parameters and cache both move from HBM into the compute cores at every step, so a latency target is a memory bandwidth target.

An NVIDIA H200 has 141GB of HBM3E at 4.8TB/s. Eight of them hold 8 × 141GB = 1,128GB, enough for the 810GB of weights plus a KV cache. Together they read at 8 × 4.8TB/s = 38.4TB/s. 810GB / 38.4TB/s is about 21ms per token. That is an estimated floor for one answer being written, before any compute time or traffic between GPUs. That works out to about 47 tokens a second at most, however fast the arithmetic units are.

Servers get more out of each read by working on many answers at once, since one pass over the weights serves every answer in the batch. A KV cache does not share that way, because each conversation has its own. In Pope’s example of a model over 500B parameters with standard multi-head attention, a batch of 512 at a context of 2,048 tokens needs a 3TB KV cache. That is three times the size of that model’s weights.

I see the same effect at desk scale. I run Google’s Gemma 4 26B locally through Ollama on my RTX 4090, which NVIDIA rates at 24GB of memory. In the Q4_K_M build Ollama serves, the model is a 17GB download. Ollama 0.33.3 reported 21.7GB in use on the card with a 64K-token context and 23.1GB with 128K, still entirely on the GPU. I took one reading at each size. Both runs used the same weights, so the extra 1.4GB is the price of the longer context. At 256K the model didn’t fit anymore, spilled into system memory, and the whole PC lagged.

My advice is to read an accelerator’s spec sheet from the memory lines up. For serving a model this size, HBM capacity and bandwidth say more than the compute figure. Bandwidth sets the 21ms floor for one answer. Capacity sets how large a batch’s KV caches can grow beside the weights.

Inside the model: what tracing has found

“Spread over many weights” leaves out what researchers can now see. With tools that are slow and cover small pieces of a model, they can find where some knowledge sits and watch some of it in use.

Facts in the feed-forward layers

Feed-forward blocks hold two-thirds of a transformer’s parameters, and a study led by Mor Geva shows they behave like key-value memories. Each key responds to a pattern in the input text, and its value pushes the output toward the tokens that tend to follow that pattern, with shallow patterns in the lower layers and patterns of meaning higher up.

Meng and colleagues’ ROME paper (Rank-One Model Editing) went further with OpenAI’s GPT-2 XL. They gave the model a factual prompt, added noise to the subject’s words, and restored one internal state at a time to see which one brought the right answer back. Feed-forward blocks in the middle layers, at the last token of the subject’s name, were decisive. Changing the weights of one of those layers by a small, targeted amount made the model state that the Space Needle is in Paris.

Traced steps inside Claude

In 2025 Anthropic traced how Claude 3.5 Haiku works through short prompts, mapping which internal features feed which. The full paper, “On the Biology of a Large Language Model”, has the case studies, and four of them bear directly on how a model knows things.

  • Asked for the capital of the state that contains Dallas, the model activates a feature for “Dallas is in Texas”, then one for “the capital of Texas is Austin”. When the researchers swapped the Texas features for California ones, the answer changed to Sacramento.
  • Writing a rhyming couplet, the model picks the rhyme word before it writes the line. With “rabbit” planned and then removed, it wrote a line ending in “habit” instead.
  • For 36 + 59, one path estimates the rough size of the sum while another works out the last digit, and the two combine to give 95. Asked how it added, the model describes carrying the 1, though it did not use that method.
  • Declining is the default. A circuit that says “not enough information” stays on unless a “known entity” feature switches it off. When a name is familiar but the facts behind it are not, that switch can fire wrongly, and the model makes something up.

Inside the model: what tracing has found

Researchers can find some knowledge and watch it in use

A stored key-value memory, and a traced chain of features

Two panels. Left, feed-forward memory: a pattern in the input text matches a key in a feed-forward block, and the paired value pushes the output toward the tokens that tend to follow that pattern; shallow patterns sit in the lower layers and patterns of meaning higher up. Right, a traced chain in Claude: the prompt about Dallas activates a feature that Dallas is in Texas, then a feature that the capital of Texas is Austin, and the answer is Austin. Swapping the Texas features for California ones changes the answer to Sacramento.01 FEED-FORWARD MEMORY02 TRACED IN CLAUDEPattern in theinput textKey in afeed-forward blockValue pushes towardtokens that followShallow patterns low,meaning higher upDallasfeature: Dallas isin Texasfeature: capital ofTexas is AustinAnswer: AustinSwap Texas for California:the answer is SacramentoInputStored or traced partOutput
Figure 7 · Left, feed-forward blocks behave like key-value memories; right, one traced prompt runs through two features to its answer. Source: Geva et al. (2020); Anthropic, Tracing the thoughts of a large language model (2025).

Anthropic is plain about the limits. Even on short prompts the method captures only a fraction of the computation, and understanding the circuits for a prompt of tens of words takes a few hours of human work.

Why written steps help

A model gets one pass per token, and a pass has a fixed number of layers. That suggests why writing steps out helps. Steps that one pass can’t hold in sequence can be spread across many passes. Each written token is read back through attention on the next pass, so the text and its KV cache work as scratch memory, and each of those tokens costs a full pass. When I first ran Gemma with its thinking mode on, it spent its whole output budget thinking and never wrote the answer I’d asked for, so I run it with thinking off.

Why written steps help

Written steps spread the work across many passes

Each written token is read back through attention on the next pass

Two rows. Top, one pass: a prompt goes through a single pass with a fixed number of layers and out comes the answer. Bottom, written steps: the prompt goes into a pass, which writes a step as text; the next pass reads that step back and writes another; a final pass gives the answer. A bracket under the written steps says that the text and its KV cache work as scratch memory, and each step costs a full pass.01 ONE PASSPromptOne pass through afixed number of layersAnswer02 WRITTEN STEPSPromptPassStepPassStepPassAnswerWritten text and its KV cachework as scratch memoryEach step costs a full passPass through the layersWritten stepPrompt or answer
Figure 8 · With one pass the work must fit a fixed number of layers; written steps become text and cache that later passes read. Source: Wei et al. (2022); Pope et al. (2022).

A Google study led by Jason Wei tested chain-of-thought prompting. That puts worked examples with their steps written out into the prompt. The study found that it improved arithmetic, commonsense, and symbolic reasoning. With eight such examples, Google’s PaLM 540B set the best result at the time on GSM8K, a set of math word problems.

At the 2025 International Mathematical Olympiad (IMO), the competition’s own coordinators scored an SI result. Google DeepMind reports that an advanced version of Gemini Deep Think solved five of the six problems in full for 35 of 42 points, working in natural language within the 4.5-hour limit. IMO coordinators judged that score gold-medal standard, and DeepMind was in the first group of labs to get that verdict. DeepMind also says it trained this version with new reinforcement learning methods and gave it a curated set of solved problems and hints. DeepMind adds that the coordinators’ review didn’t extend to validating the system behind the answers.

Written reasoning can differ from the computation behind it. On a hard calculation, Anthropic’s tracing found no sign of the steps Claude wrote out as its working.

What to watch

Tracing has to scale before anyone can check where a fact sits outside small cases like the Space Needle edit. At hours of human work for a prompt of tens of words, I don’t expect to see tracing follow a model the size of Llama 3 405B through a real conversation soon.

Then there’s grading. An OpenAI paper led by Adam Tauman Kalai argues that wrong answers come from the same training that produces right ones, because a model is rewarded for guessing instead of saying it is unsure. It ties a lower bound on the error rate to how many facts appear only once in the training data. Claude’s default-decline circuit fits that reading. If the paper’s right, I’d watch how models are graded well ahead of how large they get.

On the hardware side, Memory and Storage for SI, Part 2: High Bandwidth Flash looks at flash as a memory tier beside the accelerator, a place for weights and KV caches besides HBM. If that works, flash would be read while a model answers, and not only when it loads.

What to watch

Watch tracing, grading, and a flash tier beside the accelerator

Three open questions, two about the model and one about the hardware

Three panels. One, tracing: a small network of nodes in three layers with one traced path lit in copper; tracing has to scale because it follows only small pieces of a model, slowly. Two, grading: two boxes, guess and unsure, with a copper arrow from a reward box to guess only, showing that grading rewards a guess over saying it is unsure. Three, hardware: a stack of memory tiers, HBM, flash and SSD, with flash outlined in copper as a tier beside the accelerator that would be read while a model answers.01 TRACING02 GRADING03 HARDWARERewardGuessUnsureHBMFlashSSDTracing has to scale:it follows smallpieces of a model,slowly.Grading rewards aguess over sayingit is unsure.Flash beside theaccelerator, readwhile a modelanswers.Focus of the panelEverything else
Figure 9 · Tracing covers small pieces so far, grading may reward guessing, and flash would be read while a model answers. Source: Anthropic (2025); Kalai et al. (2025); Memory and Storage for SI, Part 2.
KEEP GOING / NEXT CHAPTERContinue to Part 2

Sources

Primary is the original paper, standard or datasheet. Secondary is a review, a vendor summary or a news report. Measured is my own test data.

Show all 14 sources, 13 primary