Reading two sentences of a family tree, Gemma-3-27B produced 9,920 key-value pairs, but only 243 of them needed to carry the names for the model to keep answering correctly. Editing a few of those pairs planted a false memory that showed up from one side of the relationship only.
Reading two sentences of a family tree, Gemma-3-27B produced 9,920 key-value pairs, but only 243 of them needed to carry the names for the model to keep answering correctly. Editing a few of those pairs planted a false memory that showed up from one side of the relationship only.

turn by turn

Tell a language model that Alice has a daughter called Beth and Beth has a daughter called Carol, and it works out that Alice is Carol's grandmother. Researchers at Princeton looked inside the model and found no complete map of the family: it keeps pairwise links and walks them again, turn by turn, every time it is asked. Because the two directions of each relationship travel separate paths, they could tamper with one alone, and the model then said both that Beth is Alice's daughter and that Beth's mother is someone else.

If I tell you that Alice has a daughter called Beth and Beth has a daughter called Carol, nobody needs to add that Alice is Carol's grandmother. The relationship was never stated; you assemble it from the two sentences you were given.

Large language models do the same, and they keep doing it when the names are replaced with meaningless three-letter strings such as "axs" (Qin, Cohen and Reddy, 2026). Three researchers at Princeton asked how a model holds this small family tree, and to find out they reached into the model's internal numbers and moved pieces of them around. What they found resembles something psychologists have called a cognitive map for almost eighty years, with one difference that matters in practice: the map the model draws is the narrow kind.

tolman's rats and two kinds of map

What is a cognitive map? Edward Tolman, a psychologist at Berkeley, popularised the term in 1948 after years of running rats through mazes. His argument was that a rat learning a maze does not just memorise a chain of "turn here, go straight there". It builds something in its nervous system that works like a map and later steers its choices.

Tolman went a step further and said that maps differ. Some are narrow, like a strip showing a single simple path from where the animal stands to its goal; others are broad and comprehensive and cover a wider arc of the environment. He called the first a strip map and the second a comprehensive map, and pointed out that as long as nothing changes you cannot tell them apart from outside. The difference appears only when something in the environment changes. Move the animal's starting point or block a route, and the comprehensive map still lets it choose a new way, while the strip map carries over far less well.

You have used a strip map yourself. It is the set of directions a passer-by gives you: straight ahead, left at the bakery, second street on the right. It works as long as you start from where you were standing, and it is no help if you start one street over.

Twenty-odd years later the map turned out to have a home in the brain. In 1971 John O'Keefe found neurons in the rat hippocampus that fired only when the animal was at one particular spot in a room; they became known as place cells. In 2005 May-Britt and Edvard Moser found another kind of neuron, the grid cell, which generates a coordinate system for positioning. The three shared the 2014 Nobel Prize in Physiology or Medicine for what the committee called the brain's "inner GPS".

Since then many neuroscientists have suspected that the mechanism is not only about space. A 2018 review set out the idea that the map the brain draws for space may be one instance of a general way of organising knowledge of every kind, from the route home to the relationships inside a family. So a language model raises two separate questions: is there a map at all, and if there is, which kind?

grafting inside the model

How would you see where a model keeps a relationship? A language model reads text token by token, and because it is built from many layers working one after another, it produces a vector of numbers for every token at every layer. Whatever the model has understood from the text, such as who is whose daughter, has to live somewhere in those numbers, because the model's answer depends on the text only through them.

The Princeton group built a technique they call a mosaic experiment, which works rather like transplant surgery. The model reads two different texts and the researchers record the internal numbers for each. They then take a piece of the numbers from the second text, put it in place of the matching piece in the first, and ask the model a question while holding the grafted numbers fixed. The answer tells you what the graft carried with it.

They ran this on eleven open-weight models from the Gemma, Llama and Qwen families, ranging from 600 million to 70 billion parameters. Parameters are the numbers a model learns in training and then keeps fixed; the numbers being grafted here are a different thing, computed afresh every time the model reads a text. Each trial stated two relationships among three entities and asked about a third that was never stated. Sometimes it was a family tree, sometimes who is older than whom, sometimes which molecule activates or inhibits which, and sometimes whether two things are equal. Models above roughly ten billion parameters handled most of these.

names apart, roles apart

Where does the model put the names? Earlier work had found that models store what they learned in training about a person or a city on the representation of that name itself. So one possibility is that on reading "Alice has daughter Beth" the model tags Beth with something like "mother is Alice". The other is that the model keeps an empty skeleton of the family tree, separate from any names, and seats each name in a slot of that skeleton.

To tell these apart the researchers gave the model two families of the same shape: Alice, Beth and Carol, and a second family in which Daisy has a daughter Eve and Eve has a daughter Fiona. In the first family they removed the numbers the model had produced for the first mention of Beth and grafted in the numbers for Eve from the second.

Watch what happened. If the tagging account were right, the graft would carry "mother is Daisy" and the model should say Eve's mother is Daisy. It said Eve's mother is Alice. It also said Eve's daughter is Carol, and that Carol's grandmother is Alice. Eve had simply sat down in Beth's chair in the first family and inherited every relationship that came with it.

So the model keeps the structure of the tree apart from the names: three roles, for grandmother, middle and granddaughter, with names seated on them. The authors showed that the numbers for each name are close to the sum of two parts, one for the name and one for its role. Compute the difference between two roles, add it to one person and subtract it from another, and the model answers as if the two had swapped places in the tree.

Why does that separation matter? It explains why the model copes with nonsense names. The skeleton of a family tree is something the model has most likely learned in training from endless families in text, because all families share a shape even though the names change. Names are labels pinned to a familiar skeleton, and "axs" is a label like any other.

So the first question has an answer: there is a map. The second is which kind.

a map, or directions turn by turn

There are two ways a model could work with these roles. One resembles what an animal does walking in the dark, counting its steps and always knowing where it is relative to the start; neuroscientists call this path integration. A model working that way would place each new person on a coordinate system as each sentence arrives, so the link between Alice and Carol would already be written into their positions before any question came. The other way is to keep each sentence as a separate link between two roles and chain the links only when a question is asked.

To separate the two, the researchers wrote two texts that differed only in the first sentence. In the original Alice is Beth's mother, in the second Beth is Alice's mother, and both continue "Beth has daughter Carol". They took the numbers for the second sentence from the second text and grafted them into the original.

If the model placed people on coordinates, the graft would bring the whole history of the second text with it. In that text Alice and Carol are both Beth's daughters, so they are sisters, and the model should say so. If the model kept separate links, the graft would carry only "Beth's daughter is Carol", and at question time the model would combine it with the original first sentence and call Alice Carol's grandmother.

In most cases the model said Alice is Carol's grandmother. It had built the two-step relationship at question time out of two separate links and had not recorded it in advance on any map. The authors report an exception: in some family-tree queries the answers drifted toward the second text, which means some history does survive in the numbers, and they say they do not yet know why the model draws on it for some questions and not for others.

That puts the model's map closer to Tolman's strip map than to a comprehensive one, with one difference: instead of a single route, the model has a bundle of links it can chain in any order. But for every question it has to walk those links again, turn by turn. Asked who Carol's grandmother is, it goes from Carol to Beth and then from Beth to Alice.

The same picture explains something familiar. Bigger models do better at this, and models do better again when they are allowed to reason step by step before answering. The authors suggest that if answering really is a search over a graph of links, both size and step-by-step reasoning give that search more room. They add that the words a model writes while reasoning join the same internal numbers, so a model may redraw its map as it thinks.

a one-way false memory

Where are the links kept? Each token the model reads leaves behind, at every layer, several pairs: a key that later tokens use to find it, and a value that is handed over when it is found. Think of a theatre cloakroom. You get a number for your coat, and when you hand the number back, you get the coat.

The researchers' hypothesis was that two kinds of pair do the main work. Name-to-role pairs hold a name in the key and a role in the value; role-to-name pairs work the other way round. To answer "who is Beth's mother?", the model first uses a name-to-role pair to find Beth's chair, then finds the chair above it, and then uses a role-to-name pair to find who sits there.

The experiments supported this. In Gemma-3-27B, reading the two family sentences produced 9,920 key-value pairs. The researchers gradually erased the name information from these pairs, each time choosing the one whose erasure hurt the answer least, and found it was enough for just 243 pairs to carry names for the model to keep answering correctly. Do the division: 243 out of 9,920 is under two and a half percent. Of those, 112 were candidate name-to-role pairs and 131 role-to-name pairs, spread across the model's layers. The authors note that this set is sufficient, and not necessarily the only route the model has.

Then they planted a false memory. If the two directions of a relationship travel through different pairs, it should be possible to tamper with one direction alone. So they took the role-to-name pairs belonging to Alice, replaced their values with the matching values from Daisy's family, and touched nothing else.

The result is worth following step by step. "Who is Alice's daughter?" starts from Alice's name and travels through pairs nobody touched, so the model still says Beth. "Who is Beth's mother?" starts from Beth, arrives at Alice's chair and reads the name stored there, which is now the tampered value, so the model answers Daisy. The model now behaves as if Beth is Alice's daughter and Beth's mother is Daisy, two statements that fit no family tree.

what this means in practice

What does this mean for someone building systems on language models? The false memory was planted by hand, and the paper does not say how often inconsistencies like it arise in ordinary use. But it does show one thing clearly. There is no single map inside the model on which each person has exactly one place and which forces the two directions of a relationship to agree. Each direction is answered along its own path, and if one path goes wrong, the other does not find out.

In practice I take two habits from this. When you use a model to extract relationships from text, ask in both directions and compare. If you are pulling out of a legal file who is married to whom and which child is whose dependant, "who is A's spouse?" and "whose spouse is B?" are two separate questions to the model, so ask both. And for multi-step relationships, let the model write the steps out: it walks them at question time anyway, and it is better that the walk happens where you can see it.

There is good news too. Names are bound to roles through a few hundred pairs, and a mechanism that small can be found, edited, and its effect predicted. In my view that moves looking inside a model a step away from pure research and toward a way of locating errors, because you can point at the place where one is stored.

why brain and machine took the same road

Why would a model that nobody taught about family trees arrive at a structure resembling what neuroscientists propose for the brain? The authors suggest three ingredients that may be enough. The first is data whose patterns survive a change of names, the way all families share a shape. The second is a mechanism that can temporarily bind separate things together, which in a language model is the key-value pairs. The third is learning from prediction error: throughout training the model guesses the next word and learns from its mistakes.

The brain has all three. A rat moving between rooms meets geometric rules that recur in every room, and the hippocampus has long been proposed as the place where information from different brain systems is rapidly bound together. Some theories go further and hold that the hippocampal map, like the model, keeps the structure of an environment apart from the sensory detail of each place. The authors see this as another case of two systems made of entirely different stuff converging on similar computational principles. Biology has a name for something like it, convergent evolution: the bat's wing and the bird's wing came by separate routes, but because flight posed the same problem to both, they arrived at similar solutions.

The resemblance only goes so far. Through its grid cells, the Nobel committee wrote, the rat has a coordinate system that allows precise positioning and pathfinding, which is closer to Tolman's comprehensive map. The language model in these experiments leaned mostly on a list of pairwise links. In the same 1948 paper Tolman listed conditions that produce strip maps instead of comprehensive ones, two of which were an inadequate array of cues and an overdose of repetitions on the path first trained. Whether anything like those conditions applies to a model that has met the world only through text is a question the paper does not answer, and I think it is worth asking.

tolman's test

Tolman had a simple test for telling the two maps apart. As long as the animal starts from its usual place, both maps work equally well; the difference shows only when the starting point changes. The Princeton false memory was that test in another form. While the question was asked from Alice's side everything looked right, and only when the starting point moved to Beth did it become clear that the two sides of one relationship come by two separate routes.

The image I keep from this paper is of someone who knows the way from home to work street by street but carries no map of the city. Because they know those streets well, they rarely get lost. But every new route has to be walked afresh, and if they remember one street wrongly, only the routes through that street go astray, which is why it pays to ask for directions from both ends.

Related articles