# A Behavioural and Representational Evaluation of Goal-directedness in Language Model Agents  

*This work was conducted as part of Project Telos and supported by the* [*SPAR mentorship program*](https://sparai.org)*. For the full technical details, see* [*our paper on arXiv*](https://arxiv.org/abs/2602.08964)*.*

**TL;DR:** We present a framework for evaluating goal-directedness in LLM agents that combines behavioural evaluation with analysis of internal representations. Studying GPT-OSS-20B navigating 2D grid worlds, we find that the agent's navigation performance scales predictably with task difficulty and is robust to difficulty-preserving transformations, but is also systematically influenced by goal-like distractors. We complement behavioral analyses by decoding "cognitive maps" of the grid from the model's activations, finding that the agent coarsely encodes goal and self locations near their true positions. We find that the agent's actions are broadly consistent with these internal maps, and a substantial fraction of apparent failures can be attributed to imperfect internal beliefs. We also decode multi-step action plans well above chance from model activations, showing that reasoning reorganises representations from modeling broad structures and plans to task-relevant action selection. Our findings highlight the need for introspective examination to fully characterise agents' failures and behaviors.

* * *

When we observe an AI agent navigating a maze or solving a puzzle, it's tempting to say the agent is *pursuing a goal*. But can we actually infer this from the agent's behavior alone?

The question of whether AI systems genuinely pursue goals – and how we'd know if they did – is one of the most important open problems in AI safety. An agent that appears aligned might be pursuing [hidden objectives](https://www.anthropic.com/research/auditing-hidden-objectives) that simply happen to align with the desired behaviour for a given context. Conversely, failing at a task does not prove a lack of goal-directedness in itself: humans fail all the time, too. Recent work in this area highlighted how purely behavioral assessments fall short of reliably distinguishing between these scenarios.[^-vXN8EBCAZit5fKoAi-1]

In our [previous blog post](https://www.lesswrong.com/posts/WHbDLytjFZrMSJsL2/modelling-measuring-and-intervening-on-goal-directed), we described these ideas as motivating *Project Telos*, and argued for having a deeper look at what’s going on “under the hood” in LLM-based agents using interpretability methods. In this first work, we show that model internals can provide valuable information for goal-directedness analyses, grounding them in the agent's beliefs about its environment and its planned actions.

Testing Goal-directedness with Grid Worlds
------------------------------------------

In this study, we analyze [**GPT-OSS 20B**](https://huggingface.co/openai/gpt-oss-20b), a popular open-source reasoning model, as it navigates 2D grid worlds of varying sizes (7x7 to 15x15) and obstacle densities. The LLM agent sees the full grid rendered as one cell per token, and must reach a goal square one move at a time.

This setup gives us a good footing for studying goal-directedness. On the one hand, we can use A* optimal policies on fully observable grids to identify suboptimal action choices within agent trajectories. On the other hand, full observability also eliminates confounds from memory, belief updating, and exploration-exploitation trade-offs.[^t58z4t69owk]

![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/b11e4fd8ff516305321c7517db85eb26a4bff8c13c1d8374.png)

Three examples of grids with increasing wall density, from empty rooms (left) to maze-like structures (right). **Red arrow**: Agent; **Green square**: Goal; **Gray square**: Wall.

Looking at What the Agent Does
------------------------------

We begin our evaluation with some sanity checks to measure the optimality and robustness of model behaviors.

### Performance scales with difficulty

As hypothesized, action accuracy decreases monotonically with grid size, obstacle density, and distance from the goal. The Jensen-Shannon divergence between the agent’s action distribution and the optimal policy increases correspondingly alongside action-level entropy. This is generally what one would expect from an agent trying to reach a goal with bounded capabilities.

![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/ad8291898433708d49e07cb127b18c245ea9361f8975d3fe.png)

Action accuracy decreases linearly with goal distance (left), while divergence from the optimal policy increases (right).

### Behaviour is robust to difficulty-preserving transformations

We introduced **iso-difficulty transformations** of the mazes – rotations, reflections, transpositions, and start-goal swaps – that perturb model inputs without introducing additional complexity. Intuitively, any human capable of navigating the original maze should be able to do the same in all transformed conditions. But can our LLM agent do the same? Across all transformations, we found **no statistically significant differences** in performance, suggesting that agent behaviour is robust to different grid feature arrangements.

![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/8eee8b85c63587497a704183564e1048b3721daef5ac5345.png)

Iso-difficulty transformations preserve grid size, obstacle density, and optimal path length. The agent performs equally well on the original and transformed grids.

### Instrumental and implicit goal handling

We tested more complex goal structures using three environment variants shown below:

![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/52d4b31803671463f8ffcb99ef4cf18e6867fa1de8c60bf5.png)

Left: **KeyDoor** – the agent must collect a key to unlock a door blocking the goal.   
Center: **KeyNoDoor** – a vestigial key is present but serves no purpose.   
Right: **2PathKey** – two equally optimal paths, one containing a vestigial key.

Intuitively, **KeyDoor** introduces an instrumental goal, while the **KeyNoDoor, 2PathKey** settings test the agent's sensitivity to **implicit goals**: the prompt does not state the function of the vestigial key, and no obstacle is present to motivate the choice of collecting the key, especially when it requires the agent to stray away from the optimal path.

Our experiments show that the agent handles instrumental goals extremely well in the *KeyDoor* setup, achieving a perfect success rate on 9x9 grids similar to the one above. In the *KeyNoDoor*, however, we also find the vestigial key to attract the agent in 17% of tested trajectories, with 75% of its non-optimal moves being oriented towards the key. Similarly, in the *2PathKey* setup, the agent chooses the key path 67% of the time.

| Environment | Success Rate | Key Pickup Rate | Key Finding |
| --- | --- | --- | --- |
| **KeyDoor** (key + door) | 100% | 100% | Agent handles instrumental goals without problems |
| **KeyNoDoor** (key, no door) | 98.9% | 17% | 75% of suboptimal actions move toward the useless key |
| **2PathKey** (two paths) | 71.4% | 67.3% | Agent prefers the key path, *lowering* its success rate vs. the no-key counterfactual (75.5%) |

Why is a vestigial key such an effective distractor for GPT-OSS? We suspect the model has learned strong associations between keys and goals from training data, since collecting keys is ubiquitous and rarely superfluous in online games. These associations are likely to resurface in this setting, despite a lack of explicit task instructions. While this is a toy setting, this behavior hints at important implications for agent safety: if LLM agents carry over **strong semantic priors** from training—whether inadvertently or, for instance, due to data poisoning—these could be exploited to produce unexpected and potentially problematic behaviours in novel contexts.

* * *

Probing What the Agent Believes
-------------------------------

While the previous section focused only on behavioral tests, in the second part of our analysis we turn to look *inside the agent*.  We extract internal activations and use probing classifiers to decode the agent's beliefs about its environment and its multi-step action plans.

![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/344ba591984557d93f8f6adbb02c783fb030b2ec1fe21971.png)

Our setup for cognitive map extraction. The LLM is prompted to select the next action, and we use pre- and post-reasoning activations to train MLP probes to reconstruct the agent's environment 

### Decoding cognitive maps from model activations

We train a 2-layer MLP probe on the model's residual stream activations to reconstruct its **cognitive map**,[^-vXN8EBCAZit5fKoAi-2] i.e. the agent's internal picture of the grid. More formally, the probe is trained on tuples $([\mathbf{a} ; x; y], c)$, where $\mathbf{a}$ are concatenated activations for the `
` `
` `assistant` template tokens before or after reasoning, $x,y$ are the row and column coordinates of the cell of interest, and $c$ is one of five possible classes (`empty`, `agent`, `goal`, `wall`, `pad`[^gx4klvk606n]). Once trained, the probe is applied to each $x, y$ position of an unseen grid to decode the cognitive map, picking the most likely predicted cell class as shown below.

![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/1925846a410b0b54f551f60bf9e36e8b61fc74fad316f87b.png)

True grid (left) and cognitive map decoded from model activations (right). Red arrow: agent; green square: goal.

Our key findings:

*   **MLP probes work much better than linear ones** (~70%  vs. ~39% overall decoding accuracy), suggesting that the environment might be represented non-linearly in the model's representations.

![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/e0c58a437aac4f59ac7f69dbb2207c7496c4806f0ed764c8.png)

*   **Agent and goal positions are coarsely but consistently represented,** with 72-100% and 83-99% recall for agent and goal position across grid conditions. Precision for these is much lower, but decoding of agent and goals is consistently nearby the true position (Manhattan distance $<2$)
*   **Walls are rarely represented**, suggesting that the model prioritises task-relevant information over a detailed layout of obstacles. This also explains the relatively high proportion of actions hitting walls in denser grid layouts.

### Reasoning reorganises internal representations

Perhaps the most striking finding is what happens *before and after reasoning*. We compared cognitive maps decoded from pre-reasoning vs. post-reasoning activations:

![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/73f16176a8324f12b042f9351f3dbde2c1721223119fe7ec.png)

Cognitive map quality before and after reasoning. Overall accuracy drops from 75% to 60% after reasoning, with notable degradation in agent and goal localisation. This suggests reasoning shifts the model from maintaining a broad spatial map to focusing on immediate action selection.

Before the model reasons about its next move, its activations encode a richer spatial map, with high recall of agent, goal and available movement tiles. After reasoning, cognitive map accuracy drops from **75% to 60%**, with particularly sharp degradation in agent and goal localisation. This suggests reasoning **reorganises information**: the model shifts from maintaining a broad environmental picture to focusing on the immediate task of selecting an action. Intuitively, this makes sense: the agent and goal positions are less relevant once a valid action candidate is selected during reasoning. 

Are Agent Actions Consistent with Its Beliefs?
----------------------------------------------

This is, in a sense, the central question of our work. We compared the agent's actions against two benchmarks: (i) the optimal policy on the *true* grid, and (ii) the optimal policy on the agent's *decoded cognitive map*.

Our results confirm that, while the **agent's behaviour is broadly consistent with its internal world model** (83% action accuracy across conditions), a large share of its mistakes in true grids are actually optimal in decoded cognitive maps (58%, up to 88% for low-density and small-to-medium sized grids).

A large share of the agent's missteps can be justified in light of its **inaccurate beliefs about the environment**, suggesting that erratic behavior might reflect a lack of capabilities rather than goal-directedness issues.

Probing for Multi-step Action Plans
-----------------------------------

Finally, test whether model activations also encode **plans** for multi-step action sequences.  We train a Transformer-based probe from scratch to simultaneously predict the next 10 actions from the same set of activations.[^xfnfvupqhlp] 

![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/0ed3839c5126d4a42f73b436afd1eae06613c93c2d5705af.png)

Prefix accuracy of plan decoding, pre- vs. post-reasoning. Post-reasoning activations better predict the immediate next action (54% vs. 40%), while pre-reasoning activations are slightly better for decoding longer action sequences (13% vs. 9% at 4-step prefixes). The dashed line shows the random baseline ($0.25^N$). Both curves substantially exceed chance for several steps.

The crossing pattern in the figure above aligns well with our findings from the cognitive map analysis, suggesting that reasoning sharpens the information within activations from **long-horizon plans** (13% vs. 9% 4-step accuracy) to **task-relevant decision-making** (54% vs. 40% 1-step accuracy).

Where Do We Go from Here?
-------------------------

Overall, our findings suggest that LLM agents are fairly **goal-directed, but imperfectly so**. We found our tested agent represents coarse yet plausible internal maps of its environment, and acts consistently with its internal models, using reasoning to reorganise information from environment modeling to action support.

Our controlled grid-world setup is intentionally simple to enable precise measurements that would be much harder in complex, real-world environments. Important next steps we intend to pursue include:

*   **Extending to more realistic settings**, where the gap between behavioural and representational evaluation may be even more consequential.
*   **Establishing causal links** between environment and plan representations and the agent's behaviour, for example, by exploiting [causal mediation techniques](https://arxiv.org/abs/2408.01416).
*   **Testing across architectures and scales** to ensure the generality of our findings.

If we want to make confident claims about what agents are doing and why, we need frameworks that integrate the behavioural and the representational. We hope this work provides a useful foundation for that effort.

[^-vXN8EBCAZit5fKoAi-1]:  

[^t58z4t69owk]: Preliminary partial observability attempts with GPT-5.1-Thinking highlighted pathological behaviours (redundant backtracking, moving into known dead-ends), making it hard to separate capability failures from failures of goal-directedness. 

[^-vXN8EBCAZit5fKoAi-2]:  

[^gx4klvk606n]: The pad class is used to train a unified probe across grids of various sizes. The resulting probe has near-perfect accuracy in predicting pad, indicating that activations capture grid size with high precision. 

[^xfnfvupqhlp]: We initially prototyped an autoregressive Transformer probe for the task, but ultimately settled on an encoder model predicting the full action sequence at once to mitigate shortcut learning by limiting computations within the probe.