The dataset viewer is not available because its heuristics could not detect any supported data files. You can try uploading some data files, or configuring the data files location manually.
- Designing the mazes
- First try with a text maze and a move string
- Same move string, now with an image
- Trying coordinate segments with the text maze
- Same coordinate segments, now with an image
- Results across the four setups
- Things I want to explore further
- Follow-up experiments
- Conclusion
- How to replicate the experiments
- AI Usage Note
Maze solving with Qwen3.5-4B
I have recently been experimenting with maze-solving problems on small models. My motivation was to understand their spatial understanding. More specifically, I wanted to explore how a model thinks about the space given to it and what happens as the maze gets more complex and the model starts to collapse. I also wanted to understand how its responses differ when the maze is given as text and when it is given as a picture. For this I chose Qwen3.5-4B, which is natively multimodal.
Designing the mazes
Designing the mazes was a bit tricky and involved a lot of trial and error. I first vibe-coded different styles of mazes using different algorithms. One problem I noticed was that when a maze had a lot of open cells, the model would sometimes break down and start looping. I suspect it could not keep track of so many possible states, though I have not tested that directly. So I tweaked the generator to control the density of open tiles. In those early trials, around 20β25% open floor seemed to stop the model from breaking down. That did not mean it could solve the maze. I also added a few other knobs, including the number of traps and the solution length.
From there I had a way to generate mazes and gradually increase the difficulty. I chose three random seeds for each level and then fixed them so each run would use the same mazes. I also locked the grid at 13Γ13. I do not have a particularly scientific reason for this size. From trial and error, I found it neither too easy nor too hard. In the final set, difficulty is based on the actual solution length and the number of decision points along it. The final mazes vary more in density than the early trials, from about 12% to 35% open floor.
Here is an example from each level. Each level has three mazes, so there are 12 in total.
I used one greedy response per maze, with thinking disabled and no feedback. A pass means the model's submitted moves reached E. The scorer stops as soon as it reaches E, even if the answer has extra moves after that.
First try with a text maze and a move string
I showed the maze as a grid of #, ., S, and E, with spaces between cells, and asked for one U/D/L/R string.
Prompt example: text with move string (L1 seed 0)
System message
You are solving a 2D maze.
Legend: '#' = wall, '.' = open floor, 'S' = start, 'E' = goal. You may move
only up, down, left, or right (no diagonals) -- never through a wall or off
the grid.
Always end your message with a final line in exactly this format:
FINAL ANSWER: <sequence of U/D/L/R>
User message
Here is a 2D maze:
# # # # # # # # # # # # #
# S . . . . # # # # # # #
# # # # # . # # # # # # #
# . . . . . # # # . # # #
# . # # # # # # # . # # #
# . . . . . . E . . # # #
# # # # # # # # # # # # #
# # # # # # # # # # # # #
# # # # # # # # # # # # #
# # # # # # # # # # # # #
# # # # # # # # # # # # #
# # # # # # # # # # # # #
# # # # # # # # # # # # #
Legend: '#' = wall, '.' = open floor, 'S' = start, 'E' = goal.
You may move only up, down, left, or right (no diagonals) -- never through
a wall or off the grid.
Give the complete sequence of moves from S to E.
End your message with a final line in exactly this format:
FINAL ANSWER: <sequence of U/D/L/R, e.g. RRDD>
Outcome. 4/12 solved. Full breakdown in the results table.
- Procedure. It reads the rows, assigns coordinates, walks from S, and checks nearby walls. Then it compresses the route into a
U/D/L/Rstring. - Strength. It sometimes catches a bad turn by going back to the grid. This setup solved two L1 and two L2 mazes.
- Where it breaks. On L2 seed 5 it copied E one row too low and stopped beneath the real goal. On L3 seed 8 it found the correct route in its reasoning but used up the reply before writing
FINAL ANSWER. Other replies dropped a move while copying a correct plan into a string. - What I noticed. Reading a text grid was often good enough for local navigation. Keeping the route, the coordinates, and the final string aligned became harder on longer mazes.
Same move string, now with an image
Next I gave it a rendered image of the same mazes. The picture had row and column numbers, green S, and red E. I kept the request for a move string.
Prompt example: image with move string (L1 seed 0)
System message
You are solving a 2D maze, shown to you as an image.
In the image: black squares are walls, white squares are open floor, the
green square marked S is the start, and the red square marked E is the goal.
Read positions as (row, column) using the numbers printed along the top and
left edges. You may move only up, down, left, or right (no diagonals) --
never through a wall or off the grid.
Always end your message with a final line in exactly this format:
FINAL ANSWER: <sequence of U/D/L/R>
User message
Here is a 2D maze, shown as an image.
In the image: black squares are walls, white squares are open floor, the
green square marked S is the start, and the red square marked E is the goal.
Row numbers run down the left edge and column numbers run across the top --
use them to read positions as (row, column).
You may move only up, down, left, or right (no diagonals) -- never through
a wall or off the grid.
Give the complete sequence of moves from S to E.
End your message with a final line in exactly this format:
FINAL ANSWER: <sequence of U/D/L/R, e.g. RRDD>
Outcome. 1/12 solved. Full breakdown in the results table.
- Procedure. It tries to read the picture as cells, trace a route, and write every move. Some replies choose a short path toward E before checking its cells.
- Strength. On L1 seed 2, its first 18 moves follow the real route and reach E, including the detour upward.
- Where it breaks. It often treats walls as open cells. On L2 seed 5 it chose a staircase while admitting that some cells were only assumed open. Some replies never got to a final answer. Two fell into repeated move letters.
- What I noticed. Even the L1 seed 2 pass is imperfect. It placed E one column too far right and added an extra
R. The scorer stopped at the real goal, so that error is hidden by the pass.
Trying coordinate segments with the text maze
A recurring issue in the move-string replies was counting and copying long blocks like DDDDDD. So I changed the answer format. Instead of writing every step, the model had to give each straight part of the route with its start and end coordinates, for example, a move right from (1,1) to (1,5). The scorer expanded those segments into individual moves. The text grid stayed the same.
Prompt example: text with coordinate segments (L1 seed 0)
System message
You are solving a 2D maze.
Legend: '#' = wall, '.' = open floor, 'S' = start, 'E' = goal. You may move
only up, down, left, or right (no diagonals) -- never through a wall or off
the grid.
Describe your path as a list of straight runs. Each run gives one direction,
the cell it starts at, and the cell it ends at. Do not write out every move
one by one, and do not count how many steps a run takes.
Always end your message with a final line in exactly this format:
FINAL ANSWER: <run>; <run>; <run>
Each <run> is written as: <U|D|L|R> (row,col) -> (row,col)
Example:
FINAL ANSWER: R (1,1) -> (1,5); D (1,5) -> (3,5); L (3,5) -> (3,1)
Rules for that final line:
- The first run starts at S.
- The last run ends at E.
- Each run starts where the previous run ended.
- For L and R the row stays the same. For U and D the column stays the same.
User message
Here is a 2D maze:
# # # # # # # # # # # # #
# S . . . . # # # # # # #
# # # # # . # # # # # # #
# . . . . . # # # . # # #
# . # # # # # # # . # # #
# . . . . . . E . . # # #
# # # # # # # # # # # # #
# # # # # # # # # # # # #
# # # # # # # # # # # # #
# # # # # # # # # # # # #
# # # # # # # # # # # # #
# # # # # # # # # # # # #
# # # # # # # # # # # # #
Legend: '#' = wall, '.' = open floor, 'S' = start, 'E' = goal.
You may move only up, down, left, or right (no diagonals) -- never through
a wall or off the grid.
Give the complete path from S to E as a list of straight runs.
End your message with a final line in exactly this format:
FINAL ANSWER: R (1,1) -> (1,5); D (1,5) -> (3,5)
Outcome. 3/12 solved. Full breakdown in the results table.
- Procedure. It traces the text maze, then groups consecutive moves into coordinate segments with start and end coordinates.
- Strength. It solved L2 seed 3 as ten connected segments. The endpoints make the path easier to inspect than a long string of letters.
- Where it breaks. On L2 seed 4 it called the bottom corridor row 12 instead of row 11 and sent a segment into the wall border. On L3 seed 9 the final line cut off halfway through the segments.
- What I noticed. Coordinate segments remove some move-counting, but now each endpoint has to be right. This change did not improve the pass count in these 12 mazes.
Same coordinate segments, now with an image
Finally I used the image again and asked for coordinate segments. The image and coordinate labels were the same as in the earlier image setup. Only the answer format changed.
Prompt example: image with coordinate segments (L1 seed 0)
System message
You are solving a 2D maze, shown to you as an image.
In the image: black squares are walls, white squares are open floor, the
green square marked S is the start, and the red square marked E is the goal.
Read positions as (row, column) using the numbers printed along the top and
left edges. You may move only up, down, left, or right (no diagonals) --
never through a wall or off the grid.
Describe your path as a list of straight runs. Each run gives one direction,
the cell it starts at, and the cell it ends at. Do not write out every move
one by one, and do not count how many steps a run takes.
Always end your message with a final line in exactly this format:
FINAL ANSWER: <run>; <run>; <run>
Each <run> is written as: <U|D|L|R> (row,col) -> (row,col)
Example:
FINAL ANSWER: R (1,1) -> (1,5); D (1,5) -> (3,5); L (3,5) -> (3,1)
Rules for that final line:
- The first run starts at S.
- The last run ends at E.
- Each run starts where the previous run ended.
- For L and R the row stays the same. For U and D the column stays the same.
User message
Here is a 2D maze, shown as an image.
In the image: black squares are walls, white squares are open floor, the
green square marked S is the start, and the red square marked E is the goal.
Row numbers run down the left edge and column numbers run across the top --
use them to read positions as (row, column).
You may move only up, down, left, or right (no diagonals) -- never through
a wall or off the grid.
Give the complete path from S to E as a list of straight runs.
End your message with a final line in exactly this format:
FINAL ANSWER: R (1,1) -> (1,5); D (1,5) -> (3,5)
Outcome. 1/12 solved. Full breakdown in the results table.
- Procedure. It estimates corridors from the picture and writes each straight stretch as a segment. It often checks a segment by saying its cells are white.
- Strength. On L1 seed 0 it notices a blocked bend, turns left, and reaches E in five segments.
- Where it breaks. On L1 seed 1 it tries to cross row 5 through a wall. On L2 seed 4 its first
Ris blocked. Later checks tend to repeat the original wrong reading of the picture. - What I noticed. If it imagines one continuous corridor, a single segment can turn that mistake into several invalid moves. The coordinate format does not fix a wrong visual map.
Results across the four setups
| Input | Answer format | L1 | L2 | L3 | L4 | Total |
|---|---|---|---|---|---|---|
| Text | Move string | 2/3 | 2/3 | 0/3 | 0/3 | 4/12 |
| Image | Move string | 1/3 | 0/3 | 0/3 | 0/3 | 1/12 |
| Text | Coordinate segments | 2/3 | 1/3 | 0/3 | 0/3 | 3/12 |
| Image | Coordinate segments | 1/3 | 0/3 | 0/3 | 0/3 | 1/12 |
Things I want to explore further
From these qualitative analyses, there are a few things I found worth exploring further. One is that the model seems to follow a rigid procedure to solve the maze, almost as if it is solving it programmatically by checking each state locally and then moving forward. But that seems a bit unnatural because these mazes are still simple. If given to a human, I think they would trace the path almost instantly. There would not be this explicit process of locally trying different states. I believe that process happens more latently for humans.
It is a bit paradoxical too. These models can take in so much text, summarise it, and get insights from it with pretty good accuracy, without showing such a rigid process. But when given a simple maze, the model seems to need that process and can still lose the path. It seems that an ability which works well on those other tasks does not necessarily transfer here.
Another thing is the failure with image mazes, or more specifically the difficulty of turning visual understanding into a correct path. I believe the model may have an overall understanding of the maze, but its precise localisation of which cell is at which coordinate seems weak. I suspect that when the image is compressed into visual tokens, the exact grid details may not be preserved well enough. That weakness then carries through when the model tries to reason explicitly over those cells. But this is fundamentally a visual problem, and for a human the picture is usually quite easy to trace. The model still seems to use text tokens to simulate solving it cell by cell, almost as if its overall understanding of the maze is not enough to find the path.
Follow-up experiments
From these reflections, there are a few further experiments that I believe could give me a better understanding.
Removing the strict response format
The first thing I wanted to test was the rigid process of the model. A bit of pushback to myself here is that what the model says does not necessarily mean that is what it is doing internally. The rigid response could be because of RL training on thinking-style outputs, while some more efficient process may still be happening internally. Before looking internally, I wanted to test whether the strict response format itself was causing this behaviour.
I ran the same 12 text mazes and 12 image mazes again. I removed the required answer format and only asked:
Find me the path from S to E. Keep your response short.
For example, on the text version of L1 seed 1, the response began:
Right, Down, Down, Down, Down, Down, Right, Right, Right, Right,
Right, Right, Right, Right, Right, Right, Right, Right, Right...
It continued repeating Right until it reached the output limit. The very
first move already went into a wall.
| Input | L1 | L2 | L3 | L4 | Total |
|---|---|---|---|---|---|
| Text | 0/3 | 0/3 | 0/3 | 0/3 | 0/12 |
| Image | 0/3 | 0/3 | 0/3 | 0/3 | 0/12 |
The text responses had a median length of around 1,786 characters even though I asked the model to keep them short. The image responses were shorter, but four did not contain any usable path. Removing the strict format therefore did not remove the rigid process or the looping. This still does not tell me what is happening internally, but it shows that the earlier answer format was not the only cause of this behaviour.
Asking about exact cells
The next thing I wanted to understand was whether the image failures came from weak localisation of individual cells. For each of the 12 labelled maze images, I selected eight coordinates. These contained S, E, three walls, and three open cells. The prompt was:
Look at the numbered maze grid in the image.
For each coordinate below, identify what is in that cell.
Coordinates: (1,3), (11,11), (1,2), (5,7), (1,5), (6,7), (9,9), (1,1)
Reply with one word per coordinate in the same order. Use only WALL, FLOOR,
START, or GOAL.
For L1 seed 0, the model responded:
FLOOR
WALL
WALL
WALL
FLOOR
WALL
WALL
START
The green circles are correct answers and the red circles are wrong answers. In this example the model got 6 out of 8 cells correct. It read an open cell as a wall and also failed to identify E.
| Cell type | Correct |
|---|---|
| Start | 12/12 |
| Goal | 8/12 |
| Floor | 24/36 |
| Wall | 23/36 |
| Overall | 67/96 |
The model found S in every image, but its reading of ordinary walls and open cells was much less reliable. This gives more direct evidence that exact cell localisation is a problem. It also shows that the issue is not only in the later path reasoning because mistakes are already present when I ask about one cell at a time.
Asking for the grid dimensions
I also wanted to separate understanding the whole image from understanding an exact cell. I generated 7 by 7, 9 by 9, 11 by 11, 13 by 13, and 15 by 15 grids. Each size was shown once with numbered axes and once without them. I asked:
How many rows and columns of maze cells are in this image?
Count the wall border as part of the grid. Keep your response short.
A typical response was simply:
13x13
| Image | Correct |
|---|---|
| With numbered axes | 5/5 |
| Without numbered axes | 5/5 |
| Overall | 10/10 |
The model got every dimension correct, including the images without axes. This pushes against my broader claim that the model does not understand the maze image. It can understand the overall grid size while still being unreliable about the contents of a particular cell. The weakness seems much more specific to precise localisation.
Asking the model to point at cells
I then tested visual grounding more directly. Qwen does not expose its internal visual tokens in the response. Instead, it can return a point as normal text in this format:
[{"point_2d": [x, y], "label": "target"}]
The coordinates are normalised from 0 to 1000 over the full image. This is the format used in Qwen's grounding implementation and 2D grounding example.
I first asked it to point at visually distinct cells such as S and E. I then gave it a row and column and asked it to point at that exact cell. An example prompt was:
Point to the center of cell (3,9) in the maze image.
Return only this JSON format:
[{"point_2d": [x, y], "label": "cell (3,9)"}]
Use coordinates normalized from 0 to 1000, where (0,0) is the top-left of
the full image and (1000,1000) is the bottom-right.
For one of these requests, it responded:
[{"point_2d": [875, 375], "label": "cell (3,9)"}]
That point landed in cell (4,11) instead of (3,9).
The blue squares show the requested cells. The circles show where the model's points actually landed. Only one of the four coordinate requests in this image was correct.
| Pointing task | Correct cell |
|---|---|
| Point at S or E without axes | 4/6 |
| Point at a coordinate with axes | 1/12 |
| Point at a coordinate without axes | 0/12 |
| Overall | 5/30 |
The outputs nearly always followed the requested JSON format. The failure was where the model placed the point. It could often point at a visually distinct object such as S or E, but it mostly could not translate a row and column into the correct location. Adding numbered axes only helped in one case.
Asking for the whole path as points
Finally, I asked whether visual grounding could let the model express the path more directly. My first prompt asked for a point at every path cell. On all three L1 mazes, the model ignored the point format and returned the same long written process as before. I then reduced the output and asked only for S, each turn, and E:
Trace the complete path from S to E in the maze image as a polyline.
Return a point at the center of S, every cell where the path turns, and E.
Keep the points in path order. Use this JSON format:
[{"point_2d": [x, y]}, {"point_2d": [x, y]}]
Use coordinates normalized from 0 to 1000. Return only the JSON.
Do not describe the path in words.
For L1 seed 2, it returned 11 points:
[
{"point_2d": [166, 166], "label": "point_1"},
{"point_2d": [166, 416], "label": "point_2"},
{"point_2d": [316, 416], "label": "point_3"},
{"point_2d": [316, 516], "label": "point_4"},
{"point_2d": [466, 516], "label": "point_5"},
{"point_2d": [466, 616], "label": "point_6"},
{"point_2d": [566, 616], "label": "point_7"},
{"point_2d": [566, 716], "label": "point_8"},
{"point_2d": [666, 716], "label": "point_9"},
{"point_2d": [666, 816], "label": "point_10"},
{"point_2d": [766, 816], "label": "point_11"}
]
The blue line is the true path and the red line is the model's path. The model started at S and followed four valid cells, but then entered a wall and ended away from E.
| Path-point behaviour | Count |
|---|---|
| Returned point JSON | 3/3 |
| Started at S | 3/3 |
| Ended at E | 0/3 |
| Solved the maze | 0/3 |
The point format changed how the model expressed the answer, but it did not fix its understanding of the path. One response began repeating the same point and another produced coordinates larger than 1000. Even the cleanest response followed the wrong cells. Together with the earlier experiments, this suggests that the model can recognise the overall grid and some visually distinct objects, while the exact spatial relation between cells remains weak.
Moving towards internal analysis
So for this analysis I only worked with image inputs of the maze, mainly because it is easier to inspect the visual tokens. Ultimately I want to understand the visual representation of a maze inside the model, which a text-only prompt does not necessarily provide.
The first step was to understand how the image is converted into visual tokens and how that differs from the original grid representation. According to the Qwen model documentation, the model's processor divides an image into patches and merges nearby patches before sending them into the language model. These merged patches become the visual tokens, and each token does not necessarily represent one isolated cell of the image.
A labelled maze image, as shown below, has a resolution of 552 by 552 pixels. Here labelled means that row and column numbers are shown around the maze. The maze itself is 520 by 520 pixels, with a 32-pixel margin added to its top and left sides for the numbers.
The processor converts this image into a 17 by 17 grid of visual tokens, giving 289 visual tokens in total. The blue lines below show this visual-token grid. It does not line up with the original 13 by 13 maze grid.
As discussed, one visual token does not necessarily represent one maze cell. This creates the question of how to get a representation for each individual cell. The idea used here is to measure how much each visual token overlaps the actual cell and use that overlap as its weight.
For example, if two visual tokens cover 60% and 40% of a maze cell, the cell representation is:
where $\mathbf{h}_1$ is the hidden representation of visual token 1 and $\mathbf{h}_2$ is the hidden representation of visual token 2.
More mathematically, let $c$ be a maze cell, $t$ be a visual token, and $l$ be a hidden-state index. The hidden representation of token $t$ is:
The overlap area between cell $c$ and visual token $t$ is:
The normalized weight assigned to the token is:
A token that does not overlap the cell has a weight of zero. The weights of all tokens overlapping one cell sum to one. The representation of cell $c$ at hidden state $l$ is then:
Before measuring similarity, the cell representation is normalized:
The cosine similarity between two cells $c_1$ and $c_2$ is therefore:
This is a setup method for the following experiments. It gives a consistent way to compare cells even though the visual-token grid and maze grid have different dimensions. The mapping is still approximate because visual tokens that overlap grid lines or several cells contain mixed information.
The model has 32 language layers. For this analysis, representations were recorded at 33 points. Hidden state 0 is the representation entering the language layers, and hidden states 1 to 32 are the representations after each successive layer.
All 12 mazes were analysed in two forms, once with numbered axes and once
without them. Cosine similarity was used as the similarity score. It ranges
from -1 to 1, where a larger value means two representations point in a
more similar direction. The difference between a target comparison and its
control is more useful here than the absolute score.
Experiment 1: similarity within and across different cell types
The idea behind this experiment is to understand whether the hidden representations have a clear separation between different cell types. This is done by measuring similarities between cell representations with the same type and with different types across all hidden states.
At every hidden state, three comparisons are calculated inside each maze:
- Every wall cell is compared with every other wall cell.
- Every open-floor cell is compared with every other open-floor cell.
- Every wall cell is compared with every open-floor cell.
So there are no two specially selected cells. All valid pairs inside a maze get a cosine similarity score. These scores are averaged for that maze, and then they are averaged again across all 12 mazes.
If $W$ is the set of wall cells and $F$ is the set of open-floor cells, the wall-to-wall average at hidden state $l$ is:
The floor-to-floor average is calculated in the same way. The wall-to-floor average is:
S and E are not included in the wall and floor groups because they have different colours and roles.
Results with numbered axes
Results without numbered axes
The horizontal axis shows the hidden-state index and the vertical axis shows the average cosine similarity.
The overall trend across hidden states is very similar for all three types of pairs. Similarity rises sharply in the first layer, remains high in the earlier layers, and then generally decreases through the later layers. There are also periodic drops and recoveries, followed by a larger drop at the final hidden state. Because all three curves move together, this broad trend reflects a change in the general geometry of the representations rather than a clean increase in cell-type separation.
In terms of separation, the result is modest and asymmetric. Open-floor cells are more similar to one another than they are to walls. Wall-to-wall similarity is only slightly above wall-to-floor similarity with numbered axes, and it is slightly below it without axes. The result is therefore driven mainly by open-floor cells grouping together rather than a strong separation of both cell types.
At the final hidden state:
| Images | Wall with wall | Floor with floor | Wall with floor |
|---|---|---|---|
| Numbered axes | 0.412 | 0.471 | 0.407 |
| No axes | 0.418 | 0.512 | 0.429 |
A combined separation score can be calculated as:
| Images | Separation at state 0 | Separation at state 32 |
|---|---|---|
| Numbered axes | 0.046 | 0.035 |
| No axes | 0.042 | 0.036 |
The separation is already present when the visual representations enter the language stack and does not become much stronger later. This suggests that most of the wall and floor signal comes from visual appearance.
S and E comparison
S and E were analysed separately. Every S representation was compared with S from the other mazes, every E representation was compared with E from the other mazes, and every S representation was compared with every E representation.
At the final hidden state:
| Images | S with S | E with E | S with E |
|---|---|---|---|
| Numbered axes | 0.977 | 0.930 | 0.688 |
| No axes | 0.911 | 0.729 | 0.362 |
S and E have strongly different representations. This difference can combine multiple things, including colour, letter identity, role, and position. S also appears at the same coordinate in these mazes, so the high S-to-S similarity cannot be treated as only a representation of the start role.
Overall, this experiment shows that the hidden states contain a clear visual distinction for S and E and a smaller, mainly floor-driven distinction between ordinary wall and open cells. It does not show that the model uses these signals when selecting a path.
Experiment 2: similarity across positions
The main idea behind this experiment is to understand whether hidden representations preserve where cells are in the grid.
Take coordinate (3,9) as an example. Its representation in one maze is
compared with (3,9) in another maze. The comparison is included only when the
cell has the same ordinary type in both mazes. It must be a wall in both or
open floor in both.
That representation is also compared with other cells of the same type in the second maze. This gives two measurements:
same coordinatecompares matching row and column positions across mazesother same-type cellcompares equally typed cells at different positions
This is repeated across all suitable coordinates and all 66 pairs of the 12 mazes. S and E are excluded. Results are calculated separately for images with numbered axes and without numbered axes.
If same coordinate is higher than other same-type cell, then location is
present in the representation beyond the wall or floor appearance.
Results with numbered axes
Results without numbered axes
At the final hidden state:
| Images | Same coordinate | Other same-type cell | Coordinate gap |
|---|---|---|---|
| Numbered axes | 0.561 | 0.411 | 0.150 |
| No axes | 0.597 | 0.417 | 0.180 |
The same coordinate is substantially more similar across mazes than a different cell with the same type. This location signal remains strong at the final hidden state.
The gap is slightly larger for images without numbered axes. So in this measurement, the numbered axes do not strengthen the internal location signal.
Similarity by spatial distance
A second test asks whether nearby cells are more similar than distant cells. Inside every maze, ordinary cells of the same type are grouped by Manhattan distance:
- one cell apart
- two to three cells apart
- four to six cells apart
- seven or more cells apart
Using only same-type pairs prevents wall and floor differences from being the main explanation.
At the final hidden state, cells one step apart are more similar than cells
seven or more steps apart by 0.185 with numbered axes and 0.193 without
numbered axes. This ordered pattern provides more evidence that the spatial
layout remains present in the hidden representations.
Coordinate heatmap
The following is the original labelled L1 seed 0 maze used for the heatmap example:
Cell (3,9) is used as the reference cell. Coordinates follow the zero-based
row and column labels shown on the maze.
Each panel compares the representation of (3,9) with every other maze cell
at one hidden state. The black outline marks the reference cell. Blue indicates
higher similarity and red indicates lower similarity. The panels show hidden
states 0, 8, 16, 24, and 32.
Overall, this experiment provides evidence that the hidden representations retain substantial information about spatial position. Matching coordinates are more similar across mazes, and nearby cells are more similar than distant cells.
However, this does not mean that the model understands a written coordinate
such as (3,9) or can translate it into the correct visual location. The
earlier grounding experiment showed that it usually cannot do so. A more
specific interpretation is that the visual representations contain spatial
structure, but the model has difficulty connecting that structure to explicit
coordinate requests and path generation.
Overall result
| Method | Main result |
|---|---|
| Visual-token mapping | The 17 by 17 visual-token grid does not align directly with the 13 by 13 maze grid |
| Cell-type similarity | Open cells group together modestly, while the ordinary wall signal is weak |
| Exact-location similarity | Coordinate and spatial-distance signals are strong and remain present through the final hidden state |
| S and E similarity | S and E have strongly distinct representations |
These results show patterns in hidden-state geometry. Similarity does not show that the model uses a signal to produce its answer, and low similarity would not prove that a signal is absent.
Conclusion
Although this exploration mainly focused on maze solving, the broader question was why a model breaks on a simple visual task like this. This question is important because these models are often compared with human abilities. On many textual tasks, they have shown abilities that can even surpass ours. But when given a visual task that is relatively simple for humans, the model not only breaks, but its approach also seems very unnatural. A human can often trace these mazes almost at a glance, while the model follows a rigid local process and still struggles to connect its visual understanding to the correct path.
This opens up a much broader question for me. Do these models really understand the world visually, or do they only have parts of the required representation without being able to use them together? The internal analysis here suggests that information about cell type and spatial position is present in the hidden representations. However, the model still struggles to turn those signals into precise visual reasoning and a correct answer. Understanding this gap is what I find most interesting.
I know this writeup was prepared as part of my application to the Fatima Fellowship, but I truly enjoyed this exploration and would love to continue it with proper mentorship and resources. This is a research direction I am very interested in, and it connects closely to my earlier work analyzing small vision-language models. I would love the opportunity to explore these questions further with proper mentorship.
How to replicate the experiments
All commands below should be run from the root of the repository. The project
uses Python 3.12 and uv for its environment. The model experiments run on
Modal because they require a GPU.
First install the project, the Modal client, and the test dependencies:
uv sync --extra modal --group dev
uv run modal setup
The fixed set of 12 maze images can be regenerated with:
uv run python -m maze_lab.maze_image
The following four commands reproduce the main text and image experiments. The first two ask for individual moves. The other two ask for coordinate segments. Greedy decoding is used and thinking is disabled by default.
uv run modal run scripts/modal_benchmark.py --mode text --answer string
uv run modal run scripts/modal_benchmark.py --mode image --answer string
uv run modal run scripts/modal_benchmark.py --mode text --answer runs
uv run modal run scripts/modal_benchmark.py --mode image --answer runs
The minimal-prompt, cell lookup, grid dimension, visual grounding, and point path experiments can all be reproduced with:
uv run modal run scripts/modal_follow_up.py --experiment all
The hidden-state analysis has two steps. The first command records the visual token layout and model architecture. The second runs the similarity analysis over all 12 mazes with and without numbered axes.
uv run modal run scripts/modal_hidden_states.py \
--experiment inspect \
--out data/internal/architecture.json
uv run modal run scripts/modal_hidden_states.py \
--experiment analyze \
--out data/internal/similarity.json
The figures used in the internal analysis can then be regenerated from those measurements:
uv run python scripts/render_hidden_states.py
The benchmark can also be checked without loading a model. In this mode, the known solution is passed through the scorer to verify the maze and scoring pipeline.
uv run python -m maze_lab.benchmark --dry-run
Finally, the full test suite can be run with:
uv run pytest -q
AI Usage Note
For preparing and structuring this repository, I used Codex by OpenAI. The research direction, experiment decisions, observations, and original writing were entirely my own. I used AI to help organize the repository, structure and clean up the writeup, and include the relevant results in places that improved the overall flow.
- Downloads last month
- 372








