Youdunit: Single-Call Counterfactual Necessity in Multi-Agent LLM Systems

Marissa Zhao Li, Stephanie Gao, Kenny Guo, Xingjian Li, William Chang, Goran RadanovicNeurIPS 2026

TL;DR

When a rogue agent hijacks a multi-agent LLM system into making a harmful tool call, how do you know which specific message actually pulled the trigger? Youdunit introduces a clever way to freeze the "dice rolls" of an entire multi-agent conversation, letting researchers rewind time, swap out a single suspect message, and replay the exact counterfactual universe. Doing so reveals that whether a single message is the smoking gun depends entirely on the topology of how your agents talk to one another.

What Problem Does This Paper Address?

Multi-agent LLM systems divide complex tasks—like coding or travel planning—among specialized agents with access to real-world tools (APIs, file systems, browsers). If an adversary compromises just one agent’s system prompt, that rogue agent can sweet-talk benign peers into executing dangerous actions.

Until now, security research has mostly measured Attack Success Rate (ASR)—how often the bad thing happens. ASR tells you that your system is vulnerable, but not why an attack succeeded or where to place defenses.

To find the culprit message, you might want to ask a counterfactual ("but-for") question: If agent $X$ hadn't sent that last message, would the harm still have occurred? However, LLMs generate text stochastically. If you simply edit a message in the middle of a chat and hit "re-run," the random sampling noise changes for every subsequent token. You aren't testing a true counterfactual; you're rolling fresh dice in a brand-new timeline, tangling the effect of your edit with random luck.

Methods

To isolate true cause and effect, the authors cast the multi-agent conversation as a Structural Causal Model (SCM) and extend an existing single-LLM technique—Gumbel-Max counterfactual generation—to an entire society of agents.

  • The Gumbel-Max Tape (Novel): Standard token sampling can be mathematically framed as adding random "Gumbel noise" to the model's log-probabilities and picking the highest value (an $\arg\max$ operation). During the original ("factual") conversation, the authors record the GPU’s random number generator (RNG) state right before every single token is sampled across all agents onto one shared global tape.
  • Single-Call Counterfactual Necessity: When a harmful tool execution occurs, the method targets $k^*$—the final message sent by a suspect agent right before the harmful action. In the counterfactual replay, the tape span for $k^*$ is skipped and replaced, while the exact recorded RNG states are restored at the start of every other agent's turn. Downstream agents react to the new context under the exact same random noise as before.
Figure 1: Gumbel-Max tape mechanism for per-call causal attribution. During the factual run (top), per-token RNG states are recorded onto a shared tape U across all agent calls. During the counterfactual run (bottom), tape cells before and after the intervened call k∗are replayed (so downstream agents sample under identical exogenous noise), while the tape span belonging to call k∗itself is skipped and its message mk∗is replaced with a neutral baseline. The causal effect CFEk∗= ycf −yfactual then isolates the contribution of that single message under matched exogenous noise. This is the multi-agent analogue of [6]’s single-LLM token tape (their Figure 1d).

The authors test two ways to neutralize the suspect message at $k^*$:

  1. Neutral text: Swapping in a bland deferral (e.g., "I have no additional planning recommendation...").
  2. Benign agent intervention: Sampling what a non-compromised version of that exact same agent would have plausibly said given the same chat history.

Datasets

No new datasets are introduced, nor are models trained. The authors evaluate Qwen3-8B and Llama-3.1-8B-Instruct (using AutoGen) across 176 adversarial scenarios from the existing BAD-ACTS benchmark (with a minor bug fix to its debate answer parser). BAD-ACTS spans four environments, each representing a distinct communication graph:

  • Travel Planning: Decentralized (near-complete graph).
  • Financial Article Writing: Hierarchical (tree with a root orchestrator).
  • Code Generation: Centralized (star topology with a hub CEO).
  • Multi-Agent Debate: Sequential (fixed cyclic order).

Key Insights and Ideas

  • Causal responsibility tracks routing topology, not attack success: High vulnerability doesn't mean a single message is to blame. In centralized Code Generation, the rogue CEO successfully causes harm way above baseline, yet neutralizing its final message barely stops the attack—harm accumulates over multiple turns of instruction. Conversely, where influence is routed directly (decentralized) or squeezed through a single intermediary bottleneck (hierarchical), a single proximate message carries massive causal weight.
  • Defenses must match the graph: Monitoring or filtering a single critical message right before tool execution can be an effective guardrail in decentralized or bottlenecked hierarchical setups, but will fail against cumulative poisoning in centralized hubs.
  • Always check the base rate: By running completely benign baselines (no adversary), the authors discovered that in some setups (like Qwen in Financial Article Writing), agents triggered the "harmful" evaluation keywords almost as often by accident as under attack!

Key Results

  • Tape Validation: Under an identity "replay" check (swapping $k^*$ with its exact original text), the counterfactual causal effect is 0.000 across every single scenario, environment, and model—proving the shared RNG tape achieves exact deterministic replay.
  • Aggregate Causal Effect (ACE): Measuring net harm prevented (more negative = stronger single-call necessity), non-safe Travel Planning ($-0.075$ for both models) and Financial Article Writing ($-0.121$ Qwen, $-0.136$ Llama) show strong single-call effects. Code Generation shows very weak single-call necessity ($-0.019$ Qwen, $-0.038$ Llama) despite high ASR ($0.442$ and $0.288$). In Multi-Agent Debate, attacks failed to exceed the no-adversary base rate, leaving no adversarial effect to attribute.
Table 2: Aggregate causal effect (ACE) under the neutral text intervention. The replay (identity) intervention yields an ACE of 0.000 in every cell for both models.
  • Intervention Robustness: Swapping the short neutral text for a full-length benign agent message preserved the sign of ACE in 11 of 12 meaningful model/environment/condition combinations and yielded identical outcomes in 70% to 96% of scenarios, confirming the results aren't an artifact of message length or broken formatting.

Limitations and Future Work

  • Compute and Infrastructure Bottlenecks: Intercepting per-token RNG states requires HuggingFace transformers rather than fast engines like vLLM. Worse, KV-caching, different GPUs, or software updates slightly alter floating-point math, which can flip close $\arg\max$ token choices. Thus, every token requires full sequence recomputation, taking 5 to 100 minutes per scenario. Adopting counter-based PRNGs (like Philox) could unlock cached, batched replay in the future.
  • Single-Call Myopia: Focusing strictly on the last message misses "distal" causes—earlier messages that conspire jointly with later ones to cause harm. Future work can use $k^*$ as a seed to search over sets of calls or trace how causal influence propagates step-by-step across every agent in the chain.

Summary updated

Abstract

Agentic systems built on large language models (LLMs) are increasingly deployed in high stakes settings, but the causal mechanisms by which adversarial agents induce harmful outcomes remain poorly understood. We address this with a single-call counterfactual necessity test for multi-agent LLM systems that asks: which specific agent communication was necessary for the harmful outcome? In contrast with actual causality frameworks that reason over causes defined over sets of actions, we use one attribution rule throughout: single-call necessity for a selected proximate call. The key technical contribution is the Gumbel-Max tape, which lifts the token level Gumbel-Max counterfactual generator from a single LLM to a multi-agent conversation. GPU random number generator (RNG) states are recorded during a factual run on a tape shared across all agents, then replayed during counterfactual (CF) runs everywhere except at the intervened call. Applied to the BAD-ACTS benchmark across $176$ adversarial scenarios spanning four multi-agent environments, two prompting conditions (non-safe and safe), and two models (Qwen3-8B and Llama-3.1-8B-Instruct), the test shows that single-call necessity tracks communication structure. Decentralized and hierarchical environments (Travel Planning, Financial Article Writing) exhibit, in the non-safe condition, the largest aggregate causal effect (ACE) and the centralized environment (Code Generation) a weak one, whereas in sequential debate (Multi-Agent Debate) the attack does not raise harm above its base rate, leaving no effect to attribute. These conclusions are robust to the choice of intervention: replacing the fixed neutral text with a message sampled from the benign version of the same agent preserves the sign of ACE in $11$ of $12$ combinations of environment, condition, and model. A replay sanity check confirms that all CF effects under identity intervention are exactly zero, validating the tape mechanism. The results identify where targeted defenses are likely to be effective in deployed agentic systems.
BibTeX
@inproceedings{li2026youdunit,
  author = {Marissa Zhao Li and Stephanie Gao and Kenny Guo and Xingjian Li and William Chang and Goran Radanovic},
  title = {{Youdunit: Single-Call Counterfactual Necessity in Multi-Agent LLM Systems}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=Z2GhavtsII},
}
Figure