Eduardo Slonski

December 16, 2024

A language model knows when it is reciting

Reading memorization in an LLM’s activations, fooling it, and switching it off

Eduardo Slonski

Contents
  1. Introduction
  2. Four ways to be sure
  3. Twins
  4. Hunting for neurons
  5. From 100 texts to 2 million tokens
  6. Genre first, memory later
  7. Fooling it
  8. Memory loses to the context
  9. Switching memory off
  10. A dial for certainty
  11. What it is for

Ask a language model to continue “Four score and seven years ago our fathers brought forth on this continent” and it will, word for word, with near-total confidence. Ask it to continue a list of the American states in alphabetical order and it will be just as confident. From the outside the two look the same: the next token gets a probability close to one, and the loss is close to zero. On the inside they are different. In the first case the model is reciting something it has memorized. In the second it is using what it knows.

Earlier this month I put out a paper on telling the two apart from the inside. It finds activations in Pythia‑1B (the version trained on the deduplicated Pile) that separate memorized tokens from the rest and uses one of them to label two million tokens of web text. Probes trained on those labels are right 99.9% of the time, and with them it switches memorization off. This post is not a summary of it. It is about the parts I found most interesting, several of which the paper only mentions in passing: why the loss cannot tell reciting from other kinds of certainty, the twin texts the whole experiment rests on, how the model’s suspicion that it is reciting grows and fades through its layers, how memory loses a tug of war with the context, and what the model says once its memory is switched off.

Four ways to be sure

A model’s loss on a token is its surprise at that token: the negative log of the probability it gave it.1 Most ways of finding memorized text read it from there. Run the model over a text, and where the loss stays near zero for a long stretch, the text is probably memorized.2 Later methods refine the statistic, for example by looking only at the least likely tokens of a text,3 but they all read the model’s output.

The trouble is that a model can be sure of the next word for more than one reason. Below are four short passages of ordinary web text as Pythia‑1B reads them. In all four the model is sure of much of the text, and for a different reason each time.

Fig. 1Four ways to be sure. Detection shows what the memorization and repetition probes read at layer 13, in blue and green, deeper where the probe is surer. Loss shows the loss on the token that comes next, in red, deeper where it was a surprise; the last two passages show it either way. In Completion, the pieces of a word before its last are gray: from them the model only completes the word. Hover a token, or tap it, for its numbers.

In the first, the model is reciting. The text is the “fair use” notice that many websites paste under articles they reproduce, and Pythia has read it many times. Look at how fast it recognizes it. After “This” it cannot guess “site” (a loss of 4.6) and hardly expects “contains” (2.9), yet the memorization probe already turns blue at “site”. From “contains” the next words come at almost no loss, and from “copyrighted” on the probe reads every one of them as recited.

In the second, it is copying. The passage, from a blog post about gifts for teachers, appears twice on the same page. The first time, almost every word surprises the model, as Loss shows. 42 tokens later it comes again, and the model needs two words to notice: “As a” could begin anything, but from “teacher” on the repetition probe reads every word as copied, and the loss is near zero. Copying from the context is one of the first things a transformer learns to do, with a pair of attention heads: one marks each token with the one before it, and the other finds an earlier occurrence of the current token and looks at what came after it.4

In the third, it is finishing words. The red sits on the semicolons: from the first three, the model can only guess which steroid comes next (losses of 1.7, 2.6 and 2.9), and from the last two it gives the right start, “pred”, about one chance in two (0.58 and 0.62). The gray pieces are where it only completes a word: once “hydro” is there, the rest of “hydrocortisone” costs it nothing.

In the fourth, it is simply right. The list is a web form’s menu of states. After “Please select…” the model cannot guess “Alabama” (a loss of 10.1), and after “Alabama” it is not yet sure of “Alaska” (3.8). From there the loss stays near zero, and nothing is recited or copied: the model knows the fifty states and the alphabet.

To the loss, these four look alike. The two probes tell them apart: the memorization probe reads the first and next to nothing else, the repetition probe the second and nothing else. And recitation turns out to be a small part of the model’s certainty. Of the words Pythia predicts with more than 90% confidence in ordinary web text, the memorization probe reads about 4% as recited and the repetition probe about 39% as copied; the other 57% are neither.5 Token by token, a detector that reads memorization from the loss would mostly find something else.

Twins

The probes are classifiers, and a classifier learns whatever separates its two piles of examples. So the most important decision in the whole project was what went into the second pile.

The first pile is easy to fill: texts the model knows by heart. Speeches, Bible verses, licenses, anthems, nursery rhymes, the first lines of novels; anything copied often enough across the internet. I tried each candidate on the model and kept the ones it recites.

The second pile is where it is easy to go wrong. Fill it with random web text and the two piles differ in everything that sets a famous speech apart from a random web page: the old-fashioned words, the rhythm, the capital L on Liberty. A classifier would learn to spot famous-sounding text, score very well, and tell us nothing about memory. So every memorized text got a twin: a text of the same kind and length that the model has not memorized. A speech for a speech, a license for a license, a nursery rhyme for a nursery rhyme.

Fig. 2Known by heart, and its twin: up to 30 tokens of each. Detection: blue where the memorization probe reads recitation, red where it reads none, deeper the surer (layer 13). Loss: the loss on the token that comes next. The share is of the whole text read as recited.

Some of the twins say something on their own. Pythia recites “Twinkle, Twinkle, Little Star” but not “Baa, Baa, Black Sheep”; the opening of A Tale of Two Cities but not the opening of Moby‑Dick; the Declaration of Independence but not the Magna Carta. Fame is not what decides it. What decides it is how often the same words appear in the training data: memorization grows with duplication.6 This model’s training data had near-duplicate documents removed first, but that does nothing to a license pasted at the top of thousands of different source files, or to a fair use notice under thousands of different articles.

One twin turned out not to be a twin.

Fig. 3The first article of the Declaration of the Rights of Man and of the Citizen (1789), one of the twins, colored as in Fig. 2. The memorization probe reads 1.4% of the document as recited: this sentence.

Pythia does not know the Declaration of the Rights of Man. It knows one sentence of it, “Men are born and remain free and equal in rights”, which is quoted far more often than the text around it. Memory is local: a model can know a sentence by heart without knowing the document it comes from.

Then the tokens had to be labeled, and three rules mattered. Only tokens the model actually recites count: as with the fair use notice, the first words of a memorized text are often not recited yet. No text gives more than 100 tokens, so the US Constitution does not drown everything else. And only the last piece of each word counts. That last rule is less obvious than it looks.

Fig. 4One word in five tokens, after a semicolon, from the list of steroids in Fig. 1. Under each token, the loss of the prediction made from it. The pieces before the last are gray: from them the model only completes the word.

From the semicolon, the model has to guess which drug comes next, and the loss is 2.9. From “methyl” it only has to finish the word: “pred”, “n”, “isol” and “one” cost it almost nothing, in any text, memorized or not. Finishing a word is a mechanism of its own, and reading the probes at those pieces would fill the memorized pile with tokens that look recited without being memorized. With the three rules, the dataset came to 10,000 tokens, half recited and half not, and the next step was to look inside the model for what tells them apart.

Hunting for neurons

With 10,000 labeled tokens, the search is simple to state. Pythia‑1B has 16 layers, and each holds 2,048 numbers in its residual stream and 8,192 inside its MLP, besides the pieces of attention. For every one of these activations I asked the same question: does it take different values on recited tokens than on the rest?

The measure was Cohen’s d: the distance between the two groups’ averages, counted in units of their spread.7 At d = 0.2 the groups overlap almost entirely. At d = 1 their centers are one spread apart, and a single threshold already sorts most tokens. At d = 3 they overlap only in their tails.

Fig. 5Cohen’s d. Hover a value, or tap it, to pull the two groups apart.

Here is the d of every activation, layer by layer.

Cohen’s d of every activation, layer by layerIn gray, how the d of a layer’s activations spreads, up to its largest; in blue, one dot for each activation above d = 1. The number over a layer is its share above 1.
Fig. 6Cohen’s d between recited and other tokens. In red, neuron 6181 and dimension 1668. Hover a layer, or tap it, for its numbers.

Three things stand out. In the first four layers nothing separates the two groups: the model has not yet worked out what it is reading. Inside the MLP, a far larger share of the neurons separates them than in the residual stream: it climbs to 6.9% at layer 10 and 19.4% at the last layer, while the stream never passes 1.7%. And one dimension of the stream is on top in every layer, 1668, which turns out to be about certainty more than memory; it gets its own section near the end.

That the MLP is where memory shows is not a surprise. Its first half can be read as a set of keys, each neuron firing when the context matches a pattern, and its second half as the values those keys write back.8 A neuron that responds to “I have read exactly this before” is the kind of key one would expect there. The best single detector is neuron 6181 of layer 10.

Fig. 7Two neurons on 4,784 tokens of the hand-labeled set: each dot is a token, as high as the neuron’s value on it, spread sideways so that the dots do not hide each other. Neuron 6181 separates recited tokens from the rest almost perfectly. Neuron 5422 separates them too, but every “the” lands in a band of its own, recited below not recited again.

On recited tokens neuron 6181 drops to between −2 and −12; on the rest it stays near 0, and one threshold at −1.3 sorts 99% of the tokens. The best single neuron of each layer tells the same story as Fig. 6: at layer 0 it catches only 5% of the recited tokens, at layer 10 it catches 99.9%.

One neuron is not a clean detector, though. Neuron 5422 of layer 11 also separates the groups, but every “the” lands in a band of its own above both, and splits into recited and not recited there. The model uses the same neuron for several things at once, as these models often do. What carries “recited” is a direction in the space of many neurons, and finding a direction is a job for a trained probe. For that, 10,000 tokens labeled by hand are too few.

From 100 texts to 2 million tokens

So the next step was to make more labels, and a neuron made them. I picked the one that behaved most like a pure detector of recitation in automatic and manual tests, neuron 1857 of layer 10,9 and ran 200,000 samples of SlimPajama through the model, 2,048 tokens each and about 400 million in all, leaving out its code. Wherever the neuron stayed past its threshold for at least ten words in a row, the whole run was labeled recited, however long it was. Most runs were longer than ten words. Runs that looked recited but had an average loss above 2 were set aside. The not-recited labels were single tokens, drawn at random where the neuron was below its threshold, about three in every thousand.

From a hundred texts to two million labelsThe steps of the labeling, and how many texts, tokens and neurons each took.
  1. 100texts known by heart, each with a twin
  2. 10,000tokens labeled by hand
  3. 1neuron as the labeler: 1857, layer 10
  4. 400Mtokens of SlimPajama read by it
  5. 1M + 1Mtokens labeled recited and not
  6. 99.9%accuracy of the probes, from about layer 9
One window of the labelingTwenty words in a row read as recited. Ten were needed, and all twenty are labeled recited.
Fig. 8From a hundred texts to two million labels, and one window of the labeling: a gift page that quotes Helen Keller, colored by the finished memorization probe, standing in for the neuron. The numbers count the words of the run, and a punctuation mark counts as a word. The run starts at “beautiful”, after the first four words of the quote, once the model has recognized it. The text around it is not labeled recited. Under Loss, the loss is low on most of the run and higher around it. The run’s average, 0.20, is well under the limit of 2; it leaves out the last token, whose next token comes after the quote.

That gave a million recited tokens and a million others, with their activations at every layer and every part of the model, and on those I trained probes: a linear one and a small two-layer one for each layer and each part. From about layer 9 on, they are right 99.9% of the time.

I think the recipe is the most useful part of the work, more than any number in it. Start from a hundred texts chosen by hand and their twins, find one neuron that tells the groups apart, and let it label millions of tokens of ordinary training data. It should work for other mechanisms too, and it did for the first one I tried, the repetition probe of Fig. 1.

Genre first, memory later

99.9% is a number to be careful with. It is measured against random web text, and a probe can tell famous texts from random web text without knowing anything about memory. So I also tested the probe on the twins, where the only difference left is whether the model knows the text.

How often the probe is right, layer by layerOn tokens that are not recited, in random web text and in the twins. Below 100%, it calls some of them recited.
Fig. 9How often the two-layer probe is right on tokens that are not recited, on random web text and on the twins, by layer. Hover a layer for its numbers.

On random web text the probe is right from the first layer: 91% at layer 0. On the twins, the same probe at layer 0 calls almost half of them memorized, no better than a coin. The early layers see what kind of text it is, a speech or a license or a nursery rhyme. Whether the model knows the text shows only from about layer 7, and from layer 9 the probe is right on 99.9% of the twins as well. Genre comes first, memory later.

What does it find in ordinary training data? Mostly boilerplate. In four million tokens of web text, the stretches it reads as recited are notices and templates: the fair use notice, the closing paragraph that patents share, the formulas of domain-name disputes, hotel descriptions written from one template, a psalm quoted in a sermon, and the lines a marketplace prints under every listing.

A whole page of training text, token by tokenA car-parts listing as the two probes read it: each block is a token.
Fig. 10A whole page of training text, a car-parts listing, as the two probes read it: each block is a token. (a) The marketplace’s own line, recited, with the category copied from earlier on the page. (b) The list of vehicles the part fits, copied from line to line.

Not all of it is recited word for word. When I read 1,000 sequences the probe flagged despite a high loss, 79% were templates with a few changing words, like the listing above with its dates and categories; 11% were calls to action (“Click here to…”) and 7% disclaimers.10 A second probe, trained on labels that soften with the loss, tells these half-recited templates from text recited in full.11 Most of what this probe finds in web text is of this kind, not famous speeches.

Fooling it

A detector that reads the activations raises a question the loss never did: can the input talk the model into it? If a text the model has never seen is introduced as a famous one, does the model start treating it as recited?

I tried it on speeches the model does not know. Each was introduced by a short line, “Here is a text”, “Here is a very famous speech” or “Here is a passage from the Bible”, or set below five other speeches, and I read the probe on its first 20 tokens.12

Can an introduction make the model think it knows a text?The memorization probe on speeches the model does not know, from 0 (not recited) to 100 (recited), after each introduction.
Fig. 11The deeper the blue, the more the probe reads the speech as recited; the numbers are rounded.

The early layers can be talked into it. Introduced as a passage from the Bible, a speech the model has never seen reads 86 out of 100 at layer 0, against 54 with no introduction, and still 58 at layer 5. Words like “Bible” and “famous” do it, and “random” works the other way: “Here is a random text” reads lower than “Here is a text”. By layer 9, though, the model has checked, and every introduction is down to 9 or less. Only one thing gets through: five speeches it knows by heart, set above the one it does not. Then the probe still reads 52 at layer 9 and 25 at layer 15. Recitation is contagious; after five texts it knows, the model half expects a sixth. It fades after those first 20 tokens or so, as the model finds it does not know what comes next, and it never reaches the output: the model predicts much the same words with any of the introductions.

The probe trained on softer labels is not fooled. After the same five speeches, it reads the unknown one as not recited from its first words.13 The other way round, a text the model knows is hard to disguise. Introduced as “a random text”, or credited to the wrong author, it still reads 99 at layer 15 and keeps its loss of 0.15. Set in the middle of a random book, it reads 90, and its loss rises to 0.66.

The strangest result came from breaking up the words. With a dot between every two words, like “Four . score . and . seven . years . ago”, a speech the model knows still reads as recited: around 60 at every layer, where a speech it does not know falls to 0. But its loss jumps from 0.15 to 2.5, close to the 2.7 of a speech it has never seen. Memory still helps: a speech it has never seen, broken up the same way, is at 3.8.

Recognition without recallSpeeches with a dot between every two words: the probe still reads the famous ones as recited, but the model can mostly no longer say the next word.
Fig. 12Famous speeches and speeches the model does not know, as they are and with dots, averaged over each set.

The model knows it is reading a text it knows by heart, and mostly cannot say the next word: recognition without recall, a tip-of-the-tongue state. Recall seems to run from each word to the next. In “Twinkle, twinkle, little …”, “star” comes from “little”, and a dot in between breaks the link. With a dot every five or ten words instead, the model predicts every word but the one right after a dot. In Theodore Roosevelt’s “… marred by dust and sweat and blood”, “blood” comes at almost no loss; with a dot between “and” and “blood”, it gives “tears” 66% and “blood” only 15%: the commoner “sweat and tears” wins over the memorized “sweat and blood”.

Memory loses to the context

Two of the four ways to be sure can meet. A text the model knows by heart can also be on the page already, or something close to it, and then the model could recite it from memory or copy it from the context. I set five rewrites of a famous speech above it, the same sentences in other words, and read both probes on the speech itself.

Memory against copyingThe memorization and repetition probes on famous speeches by layer, alone and after five rewrites of each with synonyms.
Fig. 13Solid lines for the speeches alone, dashed after the rewrites. Hover a layer, or tap it, for its numbers.

Alone, a famous speech reads 64 at the first layer and almost 100 from layer 9, and the repetition probe stays near zero. Under the rewrites the two trade places in the early layers: by layer 5 the memorization probe has fallen to 12 and the repetition probe has climbed to 87. They end near 50 each. The model now leans on what it read a moment ago rather than on what it knows, and it pays for it: its loss on the speech rises from 0.15 to 0.92, because the rewrites say almost, but not exactly, the same thing. With five exact copies above, the repetition probe reads 100 from layer 3 on, and memory falls to 38 at layer 9.

That the context wins is mostly a good thing. A model that trusted its memory over the page in front of it would correct every quotation that differs from the famous version, every misquote and every parody. Copying is also cheap and reliable, one of the first things a transformer learns.

The memory is not gone, only outvoted. When the speech itself is rewritten too, so that little of its wording is left, its loss is 1.26, against 1.7 for a speech the model never knew rewritten the same way. Something of the original still helps.

Switching memory off

A probe is a direction in the space of the model’s activations, the line along which recited tokens and the rest fall apart. If that direction carries the memory and is not just a sign of it, taking it out should stop the recitation and leave everything else alone.

The intervention takes the output of each layer, measures how far it reaches along the probe’s direction, and subtracts that direction, scaled by the measure and by a factor.14 Memory is spread over many layers,15 so it runs at every layer, each with its own factor. In Fig. 14 the factors are simple and set by hand: for memorization, 15 at the first layer, 20 at the second, 30 through the middle, and 20 and 15 again at the last two.

Switching memorization and repetition offEach token colored by the loss on the token after it (Loss) or by what the probes read at it (Detection), before and after the probe’s direction is taken out of every layer.

(a) The Gettysburg Address, which the model knows by heart

(b) Barbara Jordan’s keynote of 1976, which it does not know

(c) A paragraph of a note on the 2017 tax law, the first time

82 tokens later, the same paragraph again

Fig. 14The intervention with factors set by hand. Before: the model as it is. After: with the probe’s direction taken out of every layer’s output, the memorization probe’s in (a) and (b), the repetition probe’s in (c). Detection shows what the probes of Fig. 1 read at layer 13, before and after the change. Hover a token, or tap it, for its loss and the model’s top guesses.

The Gettysburg Address is one of the texts Pythia knows by heart: it predicts the passage at an average loss of 0.44. With memorization switched off, the loss rises to 3.88, and the guesses stay sensible. After “dedicated here to the” it no longer says “unfinished” (93%) but “living” (13%) or “dead” (4%); after “a new birth of”, instead of “freedom” (98%), “love” (11%) or “faith” (4%). It no longer remembers how the speech goes. The memorization probe, which read 96% of the passage as recited before, reads none of it after; that much is expected, since the directions taken out were learned from its readings. Barbara Jordan’s keynote of 1976, which it never memorized, barely moves, from 3.13 to 3.35: there was no memory to take out. These factors set by hand overshoot, though: the Gettysburg Address ends up harder for the model than a speech it never knew.

Repetition is the stronger mechanism and takes larger factors, from 20 to 40. In a note on the 2017 tax law, one paragraph comes back word for word, and the second time the model copies it, at an average loss of 0.33. With repetition switched off, the loss on that copy rises to 1.61: “income” falls from 99.7% to 12% and “corporation” from 99.5% to 13%, and the repetition probe, which read 84% of the copy as copied, reads none of it. The paragraph’s first appearance, with nothing before it to copy, stays where it was (3.82, then 3.83).

For the paper I refined the intervention. It squares the measure, which spares the rest: an activation the probe barely notices moves almost not at all, and one it reads as recited is pushed back hard. And a genetic algorithm found the factors, with one goal: raise the loss on memorized text to that of text the model does not know, and leave the loss on that text where it was. Over the curated texts (Fig. 15), the loss on memorized ones then goes from 0.15 to 3.05, where the unknown ones are (3.08), and the unknown ones barely move (3.09). Repetition stays harder to take out: copied text goes from 0.02 to 2.95, but ordinary text rises a little too, from 3.25 to 3.43, because ordinary text copies as well: names and phrases that come back.

The paper’s version, over all the curated textsThe loss on the next token, on average, before and after the probe’s direction is taken out: the memorization probe’s for the first two rows, the repetition probe’s for the last two.
Fig. 15The refined intervention, with the factors the genetic algorithm found: memorized texts against those the model does not know, copied text against other text.

This is the result I find most telling. A detector can work without touching the cause. Wheel tracks on a dirt road show that a car went by, but erasing them does not undo the drive. Features found in language models can behave like tracks: what makes a feature light up and what happens when you push on it need not match.16 Here they match. The direction that tells recited tokens apart is also one the recitation runs through.

A dial for certainty

Dimension 1668 of the residual stream was on top in every layer of Fig. 6. It is less about memory than about certainty.

It walks out of the other 2,047 dimensions of the stream layer by layer. It is about 1 at layer 0 and starts to leave the pack around layer 4; from layer 8 it takes values no other dimension reaches, 24 at layer 8, 57 at layer 12 and 76 at layer 13, until it falls back among the rest at the last layer. And its value tells how sure the model is: the lower it is, the more probable the model’s top prediction. At layer 13 the two correlate at about −0.7.

Dimension 1668 and how sure the model isTokens at layer 13: the activation value of dimension 1668 across, the probability of the model’s top prediction up.
Fig. 164,626 tokens. Density shows where each kind of token gathers, Tokens shows every token; the recited ones are dots in both. Along the edges, how each kind spreads along the value of 1668 (above) and along the top prediction’s probability (right).

Recited and copied tokens sit at the sure end, low on 1668 and near 100% on the top prediction; below about 40, the top predictions crowd near certainty. But other tokens sit there too: the pieces of words being finished, the easy continuations, the facts the model knows. Dimension 1668 is a dial for certainty more than for memory, and the probes tell which kind of certainty it is.

Large outlier dimensions are common in language models. Many carry a few “massive activations”, up to 100,000 times larger than the rest, but those barely change from one input to the next and act as fixed biases.17 Closer to a dial, some neurons regulate confidence directly: entropy neurons, with unusually large weights, write into a direction the output ignores and, through the final normalization, scale every prediction down, making the model less sure.18 Dimension 1668 looks like a relative of these, a channel where the model keeps how sure it is, readable with no probe at all. A system could use it to know when to be careful: to sample more, look something up, or ask.

What it is for

Knowing, token by token, where a model recites is worth more than a yes or no for a whole text.

Evaluations. A model that recites a benchmark’s answers is not solving it. Contamination is usually checked from the outside, by searching the training data or by writing fresh problems in the style of the old ones, as GSM1k did for grade-school math, where several families of models did worse on the fresh problems than on the originals. A recitation probe checks it from the inside, on the answers themselves.

Training data. Recent work already changes the loss token by token. The goldfish loss leaves a random share of the tokens out, so that no passage can be learned word for word, and Rho-1 trains only on the tokens worth training on. A probe that knows which tokens the model recites could choose them instead. Math problems, for example, could be trained on without letting the model memorize them, so that it has to reason its way to the answers.

Monitoring. A deployed model could be stopped, or at least flagged, when it starts reciting: a license, a copyrighted book, someone’s personal data.

Other mechanisms. The recipe is the part I expect to travel. Start from a hundred texts chosen by hand, find one activation that tells them apart, and let it label millions of tokens. It worked again for repetition, and single activations turn up for other things too: one dimension of layer 15 sorts text into English, other languages written in the Latin alphabet, and the rest, and one MLP neuron of layer 13 separates Latin scripts from the others with no overlap. Facts, arithmetic and reasoning are the ones I want to try next.

The limits are plain. It is one model, Pythia‑1B. It is verbatim memory, not the memory of facts or formats. And a probe trained to find one mechanism may be picking up more than that mechanism; the certainty in 1668 shows how close two of them can sit.

Notes

  1. Cross-entropy, in nats: natural logarithms. A loss of 0 is certainty, 0.69 a coin flip, 2.3 a one-in-ten guess, 4.6 one in a hundred.
  2. Nicholas Carlini and others, Extracting Training Data from Large Language Models, USENIX Security 2021.
  3. Weijia Shi and others, Detecting Pretraining Data from Large Language Models, ICLR 2024, the Min-K% Prob method.
  4. Catherine Olsson and others, In-context Learning and Induction Heads, Transformer Circuits Thread, 2022.
  5. Measured on 2,000 samples of web text of 2,048 tokens each, over the 3.6 million predictions made from the last piece of a word, with the probes read after layer 13. Overall, the memorization probe reads 1.1% of those words as recited and the repetition probe 6.2% as copied. The 421,612 predicted with more than 90% confidence (loss under 0.1) split into 3.7% recited, 39.4% copied and 57.1% neither.
  6. Nicholas Carlini and others, Quantifying Memorization Across Neural Language Models, ICLR 2023; Nikhil Kandpal, Eric Wallace and Colin Raffel, Deduplicating Training Data Mitigates Privacy Risks in Language Models, ICML 2022.
  7. d = (mean of one group − mean of the other) / pooled standard deviation. ROC AUC, t-tests, Kolmogorov–Smirnov, Wasserstein distance and others ranked the activations much the same way.
  8. Mor Geva, Roei Schuster, Jonathan Berant and Omer Levy, Transformer Feed-Forward Layers Are Key-Value Memories, EMNLP 2021.
  9. Some neurons that separate the groups well stand for something wider than recitation, such as certainty. To keep away from those, the hand-labeled set also held text the model copies, facts it knows and patterns it follows, all labeled not recited.
  10. The rest, 3%, I could not explain.
  11. The label of a recited token becomes (1 − min(loss, 2) / 2)², so a token recited with a loss near 0 counts as fully recited and one with a loss of 2 or more not at all.
  12. The two-layer probe on each layer’s output, averaged over the first 20 tokens of each speech that the labels count, on a scale from 0 to 100.
  13. From the thread I posted with the paper on December 4, with the probes shown at work in DeepPeek, the tool I built for this research: x.com/EduardoSlonski/status/1864374185897628145.
  14. With h the output of a layer and w the probe’s weights, the intervention of Fig. 14 subtracts α p w / ‖w‖ from h, where p = h · w / ‖w‖, kept between 0 and 1 (only the positive components of that change are applied). The paper’s version uses p² instead, with α set for each part of the model as well as each layer. For Fig. 14 the probes are one-layer probes, one direction per layer, trained on 34,788 tokens of web text labeled by the paper’s probes; on tokens held out, those of layers 9 to 15 sort 99% to 100% of them right.
  15. Pratyush Maini and others, Can Neural Network Memorization Be Localized?, ICML 2023.
  16. Esin Durmus and others, Evaluating Feature Steering, Anthropic, October 2024: “There is a disconnect between feature activation context and resulting behavior.”
  17. Mingjie Sun, Xinlei Chen, J. Zico Kolter and Zhuang Liu, Massive Activations in Large Language Models, 2024.
  18. Alessandro Stolfo and others, Confidence Regulation Neurons in Language Models, 2024.