Members: Pulkit ChaudharyUG, Sayor SinghaUG, Amiya HarishHS, Srinithin GaneshHS Faculty advisor: Professor Bernhard Firner

A jumping spider studies a maze from above, then solves it once dropped inside, on a brain far smaller than the networks normally pointed at navigation problems. We wanted to know how small a network can be and still do the same thing, and which resource actually binds: capacity, training data, or memory.
The answer we ended on is the one sentence worth taking away from this page. A small network that remembers beats a large network that sees everything, which is how the real animal does it.

Every maze in every number on this page is brand new, generated at test time. Nothing is memorised.

There are two views of a maze in this project and they are not the same task, so every number below names its view.
From above the network receives the whole grid: four wall channels, its own position, and the goal. First-person it receives only the cells immediately around it, which is the version a real spider faces and the harder problem by a wide margin. A number from one view says nothing about the other.
"Success" means the spider reached the goal within a step cap, running closed loop on its own predictions. Mazes in the early CNN experiments are not seeded, so re-running moves those numbers by roughly a point. The tuning study in the last section is fully seeded and reproduces exactly. Rows from different tables are not directly comparable, and nothing below about one point should be read as a real difference.
Sample sizes vary across the sections below and are stated wherever they matter. The first-person comparison in particular was evaluated more than once at different sizes, and we report every run we have rather than the best one.

Blue is the spider, red is the goal, and green is the one route between them. From above, the maze reaches the network as six layers: one for each of the four wall directions, one marking where the spider is, and one marking where the goal is. First-person, it gets only the walls of the cell it is standing in, which is the whole reason the same maze is so much harder from inside.
The baseline is a plain CNN: two conv layers (6 to 16 to 32 channels, 3x3 kernels), a flatten, one 128-unit hidden layer, five outputs. It picks a move, the view is redrawn from the new position, and it runs again. The deeper models in the results below extend this to three, four, and five conv layers.
That design has one specific failure mode, and it is the thing that shaped the whole project. The network is a pure function of the current frame, so it has no memory of where it has been. One wrong move puts it in a state that appears on no optimal path in training, and it does not come back.
On 3x3 mazes the first full pipeline solved 997 of 1000. We then made the network bigger four separate ways, adding layers, batch normalization and four times the compute, and it barely moved.
Sorting the same model's results by how long the maze's answer is shows why.

Perfect on short mazes, falling to zero past roughly 20 steps. The network had learned what common mazes look like rather than how to solve one. The same shape appears across separate training runs, so it is not a single unlucky model.


Over 2,000 fresh 7x7 mazes, viewed from above, the baseline solved 639, or 31.9%. Of those 639, the number solved after making at least one wrong move was zero. Every failure took one of two shapes: bouncing between the same two cells until the step cap, or pushing into a wall that was visible in its own input.
The cause is structural rather than statistical. On a perfect maze one wrong turn is always terminal, and because the policy depends only on the current frame, two adjacent cells whose predictions point at each other form a fixed point with no way out. The prediction that follows is that no amount of data or capacity can fix it, and that is what we see: across all 32 configurations in our parameter sweep, overall success moves from 0.020 to 0.826 while the recovery rate stays at exactly 0.000 in every single row.
More data helps and then flattens. On 5x5, 5,000 mazes give 84%, 10,000 give 94%, and 15,000 give 98%.

More parameters do almost nothing by comparison. Doubling the training data at a fixed network size added 17.3 points, while going from 0.90M to 2.0M parameters changed nothing we can measure.


And the compute cost is the real problem. Against a plain breadth-first search, our CNN was hundreds of millions of operations to do something normally done in ten. Each step up that axis is a factor of ten.

We were building an extremely inefficient maze solver. This is where the project changed direction.
Moving training onto the GPU gave roughly 3.5x at batch size 32, rising to about 6x at large batches, measured on an M4 Pro.

The model worked on 3x3 and stalled around 40% on 5x5. That particular pattern, strong on the tiny case and stuck on the slightly larger one, usually means a bug rather than a hard problem, and it did here.
Three of the five parts of the network were receiving zero learning signal. The convolutional front end, the part that reads the maze, had never trained at all and had been frozen at its random initialisation all summer. One line was passing a stale copy of the state instead of the live one.

Same code, same data, same model size. The only difference is that the network's eyes were finally allowed to learn: 5.7% to 98.3% on 5x5 from above. The lesson we would pass on is to confirm every part of a model is actually training before tuning anything.
Instead of one pass from maze to move, the model splits into a slow planner and a fast worker that loop and exchange state before committing to a move, and it carries memory forward from one move to the next.

The full model, as built: a global pass builds a high-level plan once, then for every physical step a local view is combined with that plan and the current memory, refined by a reasoning core, and checked by a confidence test that decides whether to think again or commit to a move.


Three configurations of the same task. Seeing the whole maze from above: 98%. Dropped inside with only local sight and no memory: 6%, a total collapse. Dropped inside with memory: 66%.
Memory does the job that sight was doing, and memory is far cheaper. That is the project's result in one figure.
We measured this comparison more than once, and the runs are worth reporting together rather than picking the most favourable one. Both are 5x5.
| Evaluation | Mazes | From above | First-person, no memory | First-person, with memory |
|---|---|---|---|---|
| The run in the figure above | not recorded | 98% | 6% | 66% |
| Final evaluation table | 30 | 96.7% (CNN) | 43.3% (CNN) | 76.7% |
| Tuning sweep | 200 | not measured | 11% (CNN) | not measured |
The direction is the same every time and it is a large effect, but the exact values move between runs, and the first-person baseline moves most: 6%, 11% and 43.3% across three evaluations. Thirty mazes is a small sample, and the 200-maze sweep is the most reliable estimate of the memoryless baseline we have. Treat the headline figure as the shape of the result rather than three precise numbers. A single evaluation of all three configurations at 200 or more mazes, with error bars, is the outstanding measurement, and it is the first thing we would run next.
For completeness, the final evaluation also recorded a variant with learned rather than hand-written memory, which reached 20% first-person, so the hand-written no-backtrack rule is doing much of the work in the 66% figure. Making that memory learned is on the future work list below.
The failure without memory is not a near miss. It wanders and stays lost.

The same maze, the same starting cell, run twice. Without memory it takes 162 steps and never gets out. With memory it is done in 19.

Repeated across three separate training runs, with error bars, the ordering holds rather than depending on one lucky model.

The confidence check in the architecture above means the model spends a variable amount of computation per move. It turns out to spend it in a sensible place: 5.76 thinking steps on its very first move, and 1.29 on every move afterwards. It works hard once to orient itself, then coasts on the memory it has built.

It also spends about 18% less thinking on long mazes, which is the right instinct, since long mazes are mostly corridors with one available move.

Training the same network five times, changing one setting each time, every configuration with memory beat the old memoryless model, and the half-size network tied for best.

Left panel is the maze from above, for our benefit. Right panel is everything the spider actually receives.

Two runs where it matched the optimal path exactly, from inside, with no map. The 9x9 has a shortest path of 29 steps and it took 29.


The final model is roughly 36% smaller than the CNN it replaced, 0.77M parameters against 1.21M, and better at the first-person task that matters.

The advantage widens as mazes get bigger, so it is not an artefact of small grids.

After the presentation we ran a controlled tuning study on the overhead-view 7x7 task, changing one variable at a time from a configuration that reproduces the original baseline exactly, training each run from scratch on the same seeds and scoring all of them on the same 500 held-out mazes. Thirty-two configurations, fully reproducible from the repository.
Depth is the strongest architectural lever in that study, moving the reference from 0.406 to 0.826 at five layers. The natural explanation is reach: a 3x3 kernel moves information one cell per layer, so a two-layer network has a receptive field of 5, and on a 7x7 maze the cell the spider occupies cannot see the far corner at all.
That hypothesis makes a sharp prediction, that any change buying the same reach should buy the same accuracy, and it fails.
| Configuration | Receptive field | Parameters | Success |
|---|---|---|---|
| depth 4, 3x3 kernels | 9 | 901,461 | 0.686 |
| depth 2, 5x5 kernels | 9 | 216,725 | 0.410 |
| depth 2, 7x7 kernels | 13 | 231,317 | 0.340 |
Two networks with identical reach differ by 27.6 points, and buying reach through kernel size alone does nothing: 7x7 kernels, which let every cell see the entire grid, make it worse.
Parameter count does not explain it either. At a matched budget of roughly 0.9 million parameters, a deeper network scores 0.686 against 0.558 for a wider one, and 811,413 parameters spent on a larger dense layer score 0.402, no better than the 206,997-parameter reference.
What depth has that width and kernel size do not is sequential steps: each layer applies another nonlinearity to the output of the last. If the task rewards successive rounds of computation, the expensive way to buy them is to stack layers, and the cheap way is to apply one block repeatedly and carry state, which is what the planner and worker design does.
The direction we would take next is a world model: instead of reacting to what it can see, the network predicts what it would see before it moves, and navigates against that prediction.
