Contextual Counterfactual Credit Assignment for Multi-Agent Reinforcement Learning in LLM Collaboration

Yanjun Chen, Yirong Sun, Hanlin Wang, Xinming Zhang, Xiaoyu Shen +2 more
3/6/2026
cs.LGcs.AI

Official code: EIT-EAST-Lab/C3 (44 stars, Apache-2.0, last commit 2026-03-10). 1 more implementation below.

Abstract

Cooperative multi-agent reinforcement learning (MARL) systems powered by large language models (LLMs) are frequently optimized via sparse terminal-only feedback. This shared signal entangles upstream decisions, obstructing accurate decision-level credit assignment. To address this trajectory-level diffusion, we introduce Contextual Counterfactual Credit Assignment (\textbf{\texttt{C3}}). Instead of distributing rewards across an entire episode, \textbf{\texttt{C3}} isolates the causal impact of individual messages by freezing the exact transcript-derived context, evaluating context-matched alternatives via fixed-continuation replay, and applying a leave-one-out (LOO) baseline. This localized intervention extracts unbiased, low-variance marginal advantages for standard policy-gradient optimization. Evaluated across five mathematical and coding benchmarks under matched budgets, \textbf{\texttt{C3}} improves terminal performance over established baselines. Mechanistic diagnostics further show that these gains are accompanied by higher credit fidelity, lower contextual variance, and stronger inter-agent causal dependence. Our code is available at https://github.com/EIT-EAST-Lab/C3.

View on arXivView PDF

Code Implementations(2)

EIT-EAST-Lab/C3Official100%
Apache-2.0

Official implementation of the paper "Contextual Counterfactual Credit Assignment for Multi-Agent Reinforcement Learning in LLM Collaboration". (by Yanjun Chen)

440CSS, TeXMar 6, 20267 months agoApache-2.0
Battam1111/C3Community70%
Apache-2.0

Personal implementation of the paper "Contextual Counterfactual Credit Assignment for Multi-Agent Reinforcement Learning in LLM Collaboration".

20CSS, TeXMar 6, 20267 months agoApache-2.0

Similar Papers

Cite this paper

@article{chen2026contextual,
  title  = {Contextual Counterfactual Credit Assignment for Multi-Agent Reinforcement Learning in LLM Collaboration},
  author = {Yanjun Chen and Yirong Sun and Hanlin Wang and Xinming Zhang and Xiaoyu Shen and Wenjie Li and Wei Zhang},
  year   = {2026},
  eprint = {2603.06859},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2603.06859v1}
}

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/2603.06859.svg)](https://codeofpaper.com/paper/2603.06859)

Discussion