TRANSMISSION // 2406.18505v2

Can language models understand how AI agents act?

Source published

Researchers tested whether large language models could infer reinforcement-learning agents’ actions and their effects on simulated environments. The models showed some ability, but performance varied by task and prompt, and common-sense assumptions sometimes got in the way.

AI-generated conceptual illustration for Can language models understand how AI agents act?
AI-generated conceptual illustration; not documentary evidence.

A language model can describe an AI agent’s behaviour—but does it actually track what the agent is likely to do, and how its actions change the world? This study tested that question using interaction histories from simulated reinforcement-learning tasks.

What does it mean to understand an agent?

Reinforcement-learning (RL) agents learn to act by interacting with an environment, such as a simulated car, pendulum or robot arm. Their internal decision-making can be difficult for people to inspect. The researchers ask whether a large language model (LLM), given a record of an agent’s past states, actions and rewards, can build a useful picture of that agent’s behaviour.

They call this ability agent mental modelling. In this study, it means predicting what an agent will do and anticipating how the environment will change—not demonstrating human-like thought or uncovering the agent’s actual internal reasoning.

How the test worked

The researchers developed an evaluation framework called LLM-Xavier. They tested four models—Llama 3 8B, Llama 3 70B, GPT-3.5 and GPT-4o—on offline interaction records from seven simulated tasks. These included MountainCar, Acrobot, LunarLander, a pendulum-control task and three Fetch robot tasks. The records contained about 2,000 query samples in total.

For each test, a model received a task description and a recent slice of the agent’s history. The researchers asked it to predict or infer an action, or to predict a state change. State means the environment’s current condition—for instance, a car’s position and velocity. The team compared predictions with the recorded agent actions and simulator states. For continuous values, they sometimes assessed whether predictions fell into the same one of ten bins; for state changes, they often asked whether a variable would rise, fall or stay the same.

The prompts also varied. The researchers changed how much history was supplied and examined the effects of including task instructions, equations describing the environment, and indices marking the order of events. All models were prompted to provide reasoning before answering.

What the models could—and couldn’t—do

The models showed some ability to follow an agent’s behaviour. In MountainCar, they predicted actions with more than 75% accuracy in one reported setting, compared with a one-in-three chance baseline for that task’s three possible actions. But performance was not consistent across tasks. The paper reports weaker results as tasks involve more complex state or action spaces; predictions were particularly challenging in the Fetch tasks, which use high-dimensional states and continuous actions.

More history was not always better. Adding examples often helped at first, but the improvement could level off or reverse. The best history length depended on the model and task. In some cases, clearly numbering the history entries also helped, suggesting that presentation format affected how well models handled the sequence.

The authors found that models could also be led by expectations about what an agent should do. In MountainCar, for example, a model sometimes favoured cautious actions to avoid overshooting, even when the recorded agent accelerated toward the finish. That mismatch matters: an explanation that sounds sensible may describe a model’s own assumptions rather than the behaviour of the agent it is meant to explain.

Performance also depended on what was being predicted. In the pendulum task, models did better when asked to estimate continuous action values than when asked to classify those values into bins. The researchers suggest that the extra categorisation step may have contributed to the difference, but the result is specific to their test setup.

Why the results need care

These experiments test prediction on selected simulated tasks, not broad understanding of real-world agents. The inputs were text and numerical state records, rather than images, sound or touch. The study also uses particular models, prompts and datasets, so its findings do not establish how all current language models would perform in other settings.

The evaluation measures whether answers match recorded actions or state changes. That is a practical test, but it does not prove that a model has built a complete or faithful internal account of an agent. The paper’s manual review of explanations identified errors involving task interpretation, logic, history, physics and arithmetic. The authors therefore caution against relying on LLM-generated accounts without expert auditing.

The paper is a preprint hosted on arXiv; the supplied source does not establish that it has undergone peer review. Its results are best read as an early evaluation of a promising idea, not evidence that language models can reliably explain opaque AI systems. The authors suggest that more demonstrations, domain-specific training and richer inputs could be worth studying, but those possibilities remain future work.

The central takeaway is measured: language models can sometimes use interaction histories to predict what an RL agent will do, but their performance depends on the task and the way information is presented. Plausible-sounding explanations are not, by themselves, proof of reliable understanding.

Automatically matched by shared topic keywords. These links do not imply that the sources agree or establish a consensus.