
quence features, entirely independent of the LM
being probed. Given a textual sequence of
n
words,
we call the first
n−1
words the prompt and the
n
th word the target. We focus on the task of pre-
dicting the target given the prompt, i.e., predicting
the last word in a sequence given its prefix.
3
Such
predictions can be based on either generalization
or memorization, and we are interested in isolat-
ing memorized cases to study model behavior on
them. Particularly, we are looking for sequences
for which success in this task implies memorization
recall.
We argue that the following criteria are sufficient
for detecting such memorized sequences:
1. Single target, independent of context:
We re-
quire that the target is the only correct continua-
tion, regardless of the textual context where the
prompt is placed.4
2. Irreducible prompt:
The target is the single
correct completion only if the entire prompt is
given exactly. Changing or removing parts from
the prompt would make the correct target non-
unique.
Claim 2.1.
Assume a sequence fulfills the above
criteria. Then, if a LM correctly predicts the tar-
get, it is highly likely that this prediction involves
memory recall.
Justification.
First, observe that most natural-
language prompts have many possible continua-
tions. For example consider the sentence “to get
there fast, you can take this ____”. Likely con-
tinuations include “route”,“highway”,“road”,
“train”,“plane”,“advice”, inter alia. Note that
there are several divergent interpretations or con-
texts for the prompt, and for each, language offers
many different ways to express similar meaning.
A prediction that is a product of generalization
— i.e., it is derived from context and knowledge
of language — always has plausible alternatives,
depending on the context and stylistic choice of
words. Hence, the relationship between the entire
prompt and the target, where the target is the single
correct continuation, is something that needs to be
memorized rather than derived via generalization.
A LM that predicts the single correct continuation
either memorized this relationship, or used “cues”
3
In cases where tokenization divides the target to sub-
tokens, our task becomes predicting the target’s first token.
4
We assume that contexts are naturally-occurring and not
adversarial.
from the prompt that happen to provide indica-
tion towards the correct continuation. To illustrate
the latter, consider the sequence “it’s raining cats
and ____” which has a single correct continuation,
“dogs”, but a LM might predict it without observing
this sequence during training, due to the seman-
tic proximity of “cats” and “dogs”. Our second
criterion excludes such cases by requiring that the
correct continuation is only likely given the entire
sequence.
Therefore, a LM that correctly completes a se-
quence that fulfills both criteria, is likely to have
recalled it from memory.
In the next section, we argue that idioms are a
special case of such sequences, and are thus useful
for studying memorization (§3).
3 The Utility of Idioms for Studying
Memorization
An idiom is a group of words with a meaning that
is not deducible from the meanings of its individual
words. For example, consider the phrase “play it
by ear” — there is a disconnect between its non-
sensical literal meaning (to play something by a
human-body organ called ‘ear’) and its intended
idiomatic meaning (to improvise).
A key observation is that idioms often satisfy our
criteria (§2), and therefore can probe memoriza-
tion. First, by definition, idioms are expected to
be non-compositional (Dankers et al.,2022). They
are special “hard-coded” phrases that carry a spe-
cific meaning. As a result, their prompts each have
a single correct continuation, regardless of their
context (criterion 1). For example, consider the
prompt “crying over spilt ____” — a generaliz-
ing prediction would predict that this slot may be
filled by any spillable item, like wine, water or
juice, while a memorized prediction will retrieve
only milk in this context. Notably, while this is an
empirical characterization of many idioms, there
might be exceptions, e.g., contexts that are adver-
sarially chosen to change the completion. Second,
many idioms are “irreducible”, for example, the
sub-sequences “crying over” or “over spilt” by
themselves have but a scant connection to the word
“milk”.
Still, not all idioms fulfill the criteria. For exam-
ple, even when the idiom is far from literal, its con-
stituents sometimes strongly indicate the correct
continuation, such as with the case of “it’s raining
cats and ____” (as explained in §2). To construct