Hank and the Worm

What can we see and do when we look inside an LLM?

Before we dive in, let me provide some background so you can get a sense of the significance of what we’re doing today.

Background and motivation

I’m sure you’ve heard about AI at this point. But what you might not have heard is that we don’t have a clear grasp of how it works. At least not in the sense of how we understand most software.

You see, Large Language Models (LLMs), the type of models provided through services like ChatGPT or Claude, grow into their capabilities. With most software, capabilities are written by code that tells the computer exactly what to do.Whether the code is correct or not is a completely different question.

With LLMs, we give them a string of text and then they somehow respond with an answer.

Input

What is mechanistic interpretability?

LLM
Output

Mechanistic interpretability is a field of AI research that aims to understand how neural networks actually work internally…

An LLM takes in a question and responds with an answer. We don't write the exact process it takes to get from the question to the answer.

Imagine you were tasked with writing a response for every possible question.

if question == "What is mechanistic interpretability?" then
  answer = "Mechanistic interpretability is a field of AI research…"
else if question == "What is the capital of France?" then
  answer = "The capital of France is Paris."
else if question == "How do I boil an egg?" then
  answer = "Lower it into boiling water for about ten minutes."
# …and so on, for every question anyone could ask
else
  answer = "Sorry, I don't know."
With most software we would have to write a response for every question. Think of how long that would take.

Thankfully no one had to do that. And yet, LLMs still always have something to say.

With a huge corpus of data1, very powerful computers2, and the magical process of gradient descentThink of gradient descent as a walk downhill. LLMs generally improve in capabilities as they get closer to the bottom., LLMs grow into the structure people designed3 and begin churning out legible outputs.

Gradient descent walking downhill toward the bottoms of a surface. The bluer an area, the lower it is. Here we can see that, depending on where we start, gradient descent ends up at different bottoms. Gradient descent in 2D by Gpeyre, CC BY-SA 4.0.
Two contour plots side by side. On the left, stochastic gradient descent zigzags back and forth on its way to the center. On the right, plain gradient descent goes in a straight line.
In practice, stochastic gradient descent is used for efficiency. Its path (left) looks like a drunken walk downhill, unlike plain gradient descent (right). Image from GeeksforGeeks.

And those legible outputs have already led to amazing results like solving the Riemann Hypothesis4, which stood unsolved since 1859, and identifying existing drugs that can be repurposed to treat diseases like liver fibrosis5.

This is quite remarkable. It’s the stuff of science fiction if we’re being honest.

But I think it’s normal to feel wary of the fact that despite the incredible things AI is helping humans accomplish, we don’t quite understand how it’s doing it.

It raises the question: how can we be sure the values of LLMs are aligned with the values of humans? Put simply, how can we be sure they don’t lead us astray?This is commonly referred to as the alignment problem.

Well, I can’t say I have the answer to that question, but the field of mechanistic interpretability6 is working to give us better insight into the internals of LLMs so we can start to answer it.

And the field has already made progress.

In the rest of this post we’ll imagine a bird named Hank. Hank is a very hungry bird, and he is looking to catch his favorite meal, a worm. With Hank, we’ll work to answer a few questions:

  1. Can we see which way an LLM will move Hank before it finishes deciding?
  2. Can we reliably change which way an LLM will move Hank by changing what happens inside the LLM?
  3. Is the LLM guessing a word, or choosing a direction?

Really ponder that third question as we move through the first two.LLMs are commonly described as stochastic parrots, in other words fancy autocomplete that only predicts the next word. Is that a fair analogy?

Hank, a hungry blue cartoon bird with a wide white eye and an empty beak, facing left, with a brown worm lying on the ground to its left.
If we ask an LLM to move Hank left or right, which direction will it choose, and could we change that?

Which way, Hank?

As we know, Hank’s favorite snack is worms. But, unfortunately, he has poor vision and needs help finding them.

Now suppose Hank and a worm are on a number line. If we know the position of Hank and the position of the worm, we can tell Hank to move either left or right to catch the worm.

We can see the worm is to the right of Hank. Let's help him out and tell him to move right.

If we instead asked an LLM to help Hank, would it be able to correctly tell him to move left or right? Let’s find out.

We’ll give an LLM the position of Hank and the worm, and ask it to output either -1 to tell Hank to move left, or +1 to tell Hank to move right.

Prompt
A bird is on a number line at position 194. A worm is at position 201.
Which direction should the bird move to get closer to the worm?
Reply with exactly -1 for LEFT or +1 for RIGHT.
LLM
Output
?
We tell the LLM that Hank is at position 194 and the worm is at position 201. The LLM is asked to reply with one of two answers: -1 to send Hank left, or +1 to send him right.

If we showed a two-year-old a picture of Hank and the worm, they would be able to point Hank in the right direction. So, it comes as no surprise that the LLM is able to get each answer right.

Prompt

A bird is on a number line at position 194. A worm is at position 201.Which direction should the bird move to get closer to the worm? Reply with exactly -1 for LEFT or +1 for RIGHT.

Output

…

 

For multiple scenarios, the LLM tells Hank the correct direction to catch the worm.

To make this interesting, let’s take a look at what’s happening inside the LLM. The model we are using is Qwen3.8-27B7. Don’t worry about what those numbers mean. What you need to know is that this model is composed of 64 transformer blocks.

You can think of each block as a station on an assembly line. Each one looks at the work so far, adds its own piece, and passes it along. After 64 stations, we are left with the final decision about where Hank goes.8

LLMBlock 1readsaddsBlock 2Block 3Block 63Block 64blocks 4–62PROMPTHank at 194,worm at 201OUTPUT+1LLMBlock 1readsaddsBlock 2Block 3Block 63Block 64blocks 4–62PROMPTHank at 194, worm at 201OUTPUT+1
In the LLM assembly line, the prompt goes onto a conveyor belt. And each of the 64 stations read what's on the belt and adds its own contribution back on. Whatever is on the belt after the last block becomes the reply.

Now pretend you are asked to play a guessing game. In this game your goal is to predict which way the LLM will send Hank. The rules are:

  1. You can’t know the input.
  2. You must make your guess based on what you see in the middle of the conveyor belt.
  3. You are allowed notes about how the belt looked at each block for previous left and right outputs.

Could you win this game?

LLMBlock 1Block 2Block 63Block 64−1 or +1?belt hereoutput−1+1−1+1PROMPTOUTPUT?LLMBlock 1Block 2Block 63Block 64−1 or +1?belt hereoutput−1+1−1+1PROMPTOUTPUT?
You're on the floor and ready to play. Just by looking at the conveyor belt, and with your notes you'll guess which way Hank will be sent.

Let me tell you, this game will be no problem for you. You took the time to look over your notes and, at block 49, you noticed a pattern. When the belt looks a certain way, the LLM sends Hank left, and when it looks another way, it sends him right.

Now, let’s play. Can you get six out of six?

Round 1 of 6
Score0/ 6
Prompt

A bird is on a number line at position . A worm is at position .Which direction should the bird move to get closer to the worm? Reply with exactly -1 for LEFT or +1 for RIGHT.

LLM
block 49
Output

?

Typical −1 at block 49Current belt at block 49Typical +1 at block 49

What will the LLM say?

Can you predict which way the LLM will send Hank? At block 49, take a look at what the belt typically looks like when Hank is sent left, what it looks like when he's sent right, and compare both to what the belt currently looks like.

How’d it go?

What you just did is called probing.9 You took a look at the state of an LLM at some point in the middle and checked if it gave away which way it will move Hank. If the LLM does, it has already worked out its answer, at least in part, by that point.

Hank, turn around

We just guessed which way the LLM would move Hank by probing block 49. Let’s now see if we can make it move him the other way.

The plan is to take the typical belt at block 49 when the LLM sends Hank right, and subtract the typical belt for when it sends him left. What’s left is something that points from -1 toward +1. This something is called a steering vector.10 Add some of it to the belt at block 49, and the LLM is pushed toward +1. Remove some of it, and the LLM is pushed toward -1. The adding and subtracting is called steering.

1Build
Typical +1 at block 49
−
Typical −1 at block 49
=
−1/+1 steering vector
2Steer
Prompt

Hank at 194, worm at 189

LLM
steering at block 49
Output

−1 +1

Belt after block 49LLM outputs −1
+
−1/+1 steering vector× strength
=
Belt into block 50LLM outputs +1
After the steering vector is built, our hope is that adding or subtracting enough of it flips which way the LLM sends Hank.

If we steer hard enough with our vector, we can consistently change which way the LLM will send Hank. But don’t just take my word for it, try it out below.

promptoutput

Belt after block 49
+
−1/+1 steering vector× strength
=
Belt into block 50
none
Steer the LLM to move Hank away from the worm, he's had enough.

Pretty neat, huh?11 But how can we be sure this wasn’t just plain luck? Let’s try something else. Instead of using our steering vector, let’s steer with a random one.

Bird 194Worm 201

promptoutput

Belt after block 49
+
Random vector× strength
=
Belt into block 50
none
This time let's steer with a random vector. What happens?

With our steering vector, we only had to push to a strength of at most 30 before the LLM sent Hank the wrong way. With the random vector, the LLM kept sending Hank toward the worm all the way up to strength 320. And, by strength 480, it only stopped sending Hank toward the worm because it was outputting nonsense.

This suggests a random vector won’t flip which way the LLM sends Hank. Our steering vector is specifically influencing that decision. Let’s take a second to really appreciate this. You were able to both predict what an LLM will say, and change what it will say, well before the LLM produced it’s output.

Let’s have some fun next. I took some time to find a special steering vector. Apply it and see what it does to our LLM.

Bird 194Worm 201

promptoutput

Belt after block 49
+
Mystery vector× strength
=
Belt into block 50
none
When you get to strength 28, what does the LLM say?

With a new James Bond movie in the works, it seems like we got the LLM a bit distracted from helping Hank.

Congrats on the successful steering! We just saw that by intentionally selecting steering vectors, we can control what an LLM outputs.

But are we only swapping words, or is something deeper going on?

The stochastic parrot

We’re finally at the question I asked you to ponder. But before we look for an answer, let’s think about what it means to point.

You probably learned the concept of direction at a very young age. Maybe it took a little longer to learn the difference between the words “left” and “right”, but I’m sure pointing is something you don’t remember learning.12 We’re going to find out if our LLM ever learned how to point.

To start, we’ll change our prompt. Instead of telling the LLM to output -1 to turn Hank left and +1 to turn Hank right, let’s tell it to use ← for left and → for right.

Prompt
A bird is on a number line at position 194. A worm is at position 201.
Which direction should the bird move to get closer to the worm?
Reply with exactly ← for LEFT or → for RIGHT.
LLM
Output
→
We're still asking the LLM to move Hank left or right, but now with ← for left or → for right. Here it answers →, sending Hank right.

With this change, if we go back to our block 49, would we still be able to steer the LLM to send Hank the wrong way? To find out let’s make a new steering vector for block 49 just like we did before.

1Build
Typical → at block 49
−
Typical ← at block 49
=
←/→ steering vector
2Steer
Prompt

Hank at 194, worm at 189

LLM
steering at block 49
Output

← →

Belt after block 49LLM outputs ←
+
←/→ steering vector× strength
=
Belt into block 50LLM outputs →
Just like before, the hope is our new steering vector can flip the direction the LLM sends Hank.

Now, try it out on the same examples.

promptoutput

Belt after block 49
+
←/→ steering vector× strength
=
Belt into block 50
none
Steer with the new ←/→ vector at block 49. Can you send Hank the wrong way again?

Nice! With enough strength, we can still make the LLM send Hank the wrong way.

What if we moved closer to the end of the assembly line? Could we still steer? We’ll use block 59, just 5 blocks away from the end. I went ahead and made a new steering vector using the same process as before. Try to see if you can still make the LLM send Hank the wrong way.

promptoutput

Belt after block 59
+
Block 59 ←/→ steering vector× strength
=
Belt into block 60
none
This time we build the ←/→ vector from block 59, close to the end of LLM assembly line. Can you still steer with it?

If you look at the scale of the slider, you’ll notice it takes a stronger setting, but we can still make the LLM send Hank the wrong way.

Suppose we go back to our -1/+1 output format. If we made a steering vector for it’s block 59, would we also be able to flip the LLM’s output? The answer (and you can trust me on this one) is yes.

Let’s add a twist. What if we took the -1/+1 steering vector for block 59 and tried applying it to the block 59 for ←/→? If our LLM understands how to point, then the label shouldn’t matter and we should still be able to flip the direction the LLM sends Hank.

promptoutput

Belt after block 59
+
Block 59 −1/+1 steering vector× strength
=
Belt into block 60
none
Using the -1/+1 steering vector for block 59, can you flip a ← to a →, and vice versa?

Looks like steering doesn’t work anymore. In fact, in a couple examples, we see something peculiar. When Hank is at position 194 and the worm is at 189 (second example), if we apply a strength of at least -280, the LLM outputs a -1 instead of the expected ←. That suggests the LLM doesn’t know how to point, and we can only change what word it outputs.

Before we throw in the towel, what would happen if we tried something similar at block 49? If you take the -1/+1 steering vector and apply it to block 49 for ←/→, could you make the LLM send Hank the wrong way?

promptoutput

Belt after block 49
+
−1/+1 steering vector× strength
=
Belt into block 50
none
Using the -1/+1 vector from block 49 on the ←/→ prompt, can you flip the LLM's output?

Look at that! We can make the LLM flip Hank. At block 59 our LLM definetly doesn’t know how to point, but, this suggests at block 49 our LLM does in fact know how to point. At block 49 the LLM has an understanding of the concept of direction, at least between left and right.Researchers would call this a feature. Our -1/+1 vector also worked on ←/→, which suggests the model keeps one internal representation of “left” and “right,” whatever labels it uses. The idea that a concept can be captured by a single vector you add or subtract is called the linear representation hypothesis.

Zooming out

Today, you were able to predict an LLM’s output without knowing it’s input, and you were even able to change what it would eventually say.

We also saw evidence suggesting our model has some understanding of the concept of “left” and “right”. And perhaps that seems like a trivial example, but our model, Qwen2.8-27B is relatively small. The largest open-source model at the time of this writing, Kimi K3, is 100 times larger.

That begs the question:

As models get larger, are they able to learn increasingly complex concepts like truth, empathy, or even deception?

That seems like something worth pondering.

Footnotes

  1. Meta’s Llama 4, released in 2025, was trained on a mix of data roughly equivalent to 250 million books. ↩

  2. AI training commonly runs on clusters of specialized chips like NVIDIA’s H100, a GPU with 80GB of memory built for AI workloads. ↩

  3. Most modern LLMs share a design called the transformer, introduced in Vaswani et al.’s Attention Is All You Need (2017). For a visual walkthrough, see Jay Alammar’s The Illustrated Transformer. ↩

  4. Anthropic mathematician Levent Alpöge, working with Claude, released the proof on November 20, 2026 as a Lean library of 17 million lines of code. Lean is software that checks every step of a proof. ↩

  5. Google DeepMind’s Co-Scientist proposed three drugs for Stanford’s Gary Peltz to test on live human liver cells. Two of the three blocked fibrosis, and one of those two, the cancer drug vorinostat, blocked 91% of a damage response that can drive liver scarring. ↩

  6. For a deeper dive, take a peek at Olah et al.’s Zoom In: An Introduction to Circuits (Distill, 2020). It proposes a circuits approach to look inside neural networks, using image models as its example. Its first claim, that networks are built from meaningful features, is the idea this post builds on. ↩

  7. Specifically, I used its 4-bit MLX conversion with thinking turned off, running on Apple Silicon through MLX LM. The checkpoint is mlx-community/Qwen3.8-27B-4bit, pinned to revision b935172e4bb5dcd0543774a34748fb92422e3027. ↩

  8. In reality it’s much more complex than this, but for our purposes the analogy suffices. To dive deeper into LLM architecture, 3Blue1Brown’s neural networks series is a good start. ↩

  9. Researchers usually train a small model to do the guessing instead of eyeballing it, and call it a probe. ↩

  10. One additional mathy detail: I rescaled the steering vectors to a length of 1 (their L2 norm). This makes strength a consistent dial for all our demos. For more on steering vectors, see this paper. ↩

  11. Earlier we probed at block 49, and now we steered at the same block. It’s not always possible to steer a block you can probe at. I picked one where we can for the sake of this demonstration. ↩

  12. Babies typically start pointing around their first birthday. (Moore et al., 2019). ↩

Citation

For attribution in academic contexts, please cite this work as

Ensastegui, A. (2026). Hank and the Worm. https://alanensastegui.xyz/blog/hank-and-the-worm/

BibTeX citation

@misc{ensastegui2026hank,
  author = {Ensastegui, Alan},
  title = {Hank and the Worm},
  year = {2026},
  howpublished = {\url{https://alanensastegui.xyz/blog/hank-and-the-worm/}}
}

Back to the library