Abstract Counterfactuals for Language Model Agents

Edoardo Pona, Milad Kazemi, Yali Du, David Watson, Nicola Paoletti
6/3/2025
cs.LG

No confident code implementation found for this paper.

Abstract

Counterfactual inference is a powerful tool for analysing and evaluating autonomous agents, but its application to language model (LM) agents remains challenging. Existing work on counterfactuals in LMs has primarily focused on token-level counterfactuals, which are often inadequate for LM agents due to their open-ended action spaces. Unlike traditional agents with fixed, clearly defined action spaces, the actions of LM agents are often implicit in the strings they output, making their action spaces difficult to define and interpret. Furthermore, the meanings of individual tokens can shift depending on the context, adding complexity to token-level reasoning and sometimes leading to biased or meaningless counterfactuals. We introduce \emph{Abstract Counterfactuals}, a framework that emphasises high-level characteristics of actions and interactions within an environment, enabling counterfactual reasoning tailored to user-relevant features. Our experiments demonstrate that the approach produces consistent and meaningful counterfactuals while minimising the undesired side effects of token-level methods. We conduct experiments on text-based games and counterfactual text generation, while considering both token-level and latent-space interventions.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{pona2025abstract,
  title  = {Abstract Counterfactuals for Language Model Agents},
  author = {Edoardo Pona and Milad Kazemi and Yali Du and David Watson and Nicola Paoletti},
  year   = {2025},
  eprint = {2506.02946},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2506.02946v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2506.02946.svg)](https://codeofpaper.com/paper/2506.02946)

Discussion