Skip to content
runhaoli-creatorPublic

About

Partner-Adaptive Grounded Communication for cooperative multi-agent reinforcement learning.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PAGC: Partner-Adaptive Grounded Communication

Partner-Adaptive Grounded Communication for Cooperative Multi-Agent Reinforcement Learning

PAGC is a Centralized Training with Decentralized Execution (CTDE) multi-agent reinforcement learning framework that learns structured, human-interpretable communication grounded in natural language. Agents learn when, what, and how to communicate through a gated messaging system with a four-term objective that jointly optimizes task performance, language grounding, message utility, and communication efficiency.


Model Architecture

PAGC follows a modular 7-component pipeline. Each agent processes observations, generates/receives messages, reasons about teammates, and produces actions:

  Observation
      │
      ▼
┌─────────────┐
│ ObsEncoder  │  2-layer MLP (obs_dim → 128 → obs_embed_dim)
└──────┬──────┘
       │
       ├──────────────────────────────────┐
       │                                  ▼
       │                         ┌────────────────┐
       │                         │ MessageEncoder │  Encodes received messages
       │                         │  (vocab embed  │  (token embeddings + latent
       │                         │   + latent)    │   → msg_embed_dim)
       │                         └───────┬────────┘
       │                                 │
       │         ┌───────────────────────┐│
       │         │                       ││
       │         ▼                       ▼│
       │  ┌──────────────┐      ┌────────┴────────┐
       │  │  Teammate    │      │                  │
       │  │  Encoder     │      │                  │
       │  │ (action/msg  │      │                  │
       │  │  history →   │      │                  │
       │  │  teammate    │      │                  │
       │  │  embed)      │      │                  │
       │  └──────┬───────┘      │                  │
       │         │              │                  │
       ▼         ▼              ▼                  │
  ┌──────────────────────────────┐                 │
  │        PolicyCore            │                 │
  │  Feedforward MLP             │                 │
  │  (concat all embeddings      │                 │
  │   → hidden_dim → hidden_dim) │                 │
  └──────────┬───────────────────┘                 │
             │                                     │
        ┌────┴────────────────┐                    │
        │                     │                    │
        ▼                     ▼                    │
  ┌───────────┐   ┌─────────────────────┐          │
  │ ActionHead│   │    MessageHead      │          │
  │ (→ action │   │  token logits +     │          │
  │  logits)  │   │  latent vector      │          │
  └───────────┘   └─────────┬───────────┘          │
                            │                      │
                            ▼                      │
                   ┌────────────────┐              │
                   │  MessageGate   │              │
                   │  (sigmoid →    │──────────────┘
                   │   send/mute)   │  gate ∈ [0,1]
                   └────────────────┘

Component Details

Component Description Parameters
ObsEncoder 2-layer MLP encoding raw observations into a dense embedding obs_dim → 128 → obs_embed_dim (128)
MessageEncoder Processes received discrete tokens (via embedding lookup) and continuous latent vectors from other agents vocab_size (64) × max_tokens (8) + latent_dim (32) → msg_embed_dim (64)
TeammateEncoder Temporal model over a sliding window of teammate actions and messages to capture behavioral patterns window=10, action+msg embeddings → teammate_embed_dim (32)
PolicyCore Feedforward MLP that fuses observation, message, and teammate embeddings into a shared hidden representation concat → 128 → hidden_dim (128)
ActionHead Linear head mapping hidden state to action logits (Categorical policy) hidden_dim → action_dim
MessageHead Produces discrete token logits and a continuous latent vector for outgoing messages hidden_dim → token logits (vocab_size × max_tokens) + latent_dim
MessageGate Sigmoid gate deciding whether to broadcast the message (learned communication budget) hidden_dim → 1, target rate 0.5

Four-Term Training Objective

$$\mathcal{L} = \mathcal{L}_{\text{RL}} + \alpha \cdot \mathcal{L}_{\text{ground}} + \beta \cdot \mathcal{L}_{\text{utility}} + \gamma \cdot \mathcal{L}_{\text{budget}}$$

Term Default Weight Purpose
$\mathcal{L}_{\text{RL}}$ — MAPPO policy gradient + value loss + entropy bonus
$\mathcal{L}_{\text{ground}}$ α = 1.0 Cosine-similarity loss grounding messages to sentence-transformer embeddings
$\mathcal{L}_{\text{utility}}$ β = 0.5 Encourages messages to carry task-relevant information
$\mathcal{L}_{\text{budget}}$ γ = 0.1 Regularizes communication frequency toward a target rate

Training uses MAPPO (Multi-Agent PPO) with parameter sharing, GAE (λ=0.95), and entropy annealing (0.05 → 0.01).


Project Structure

pagc_release/
├── pagc/
│   ├── agents/           # Agent architecture
│   │   ├── pagc_agent.py       # Full PAGC agent (orchestrates all modules)
│   │   ├── policy_core.py      # Feedforward policy core
│   │   ├── obs_encoder.py      # Observation encoder MLP
│   │   ├── action_head.py      # Action distribution head
│   │   ├── critic.py           # Centralized critic (state-based)
│   │   ├── init_utils.py       # Weight initialization utilities
│   │   └── teammate_encoder.py # Temporal teammate modeling
│   ├── comms/            # Communication modules
│   │   ├── message.py          # MessageHead + MessageGate
│   │   └── ic3net_channel.py   # IC3Net-style gated channel
│   ├── envs/             # Environment wrappers
│   │   ├── base.py             # Base environment interface
│   │   ├── mpe_spread.py       # MPE Simple Spread wrapper
│   │   ├── lbf.py              # Level-Based Foraging wrapper
│   │   ├── overcooked.py       # Overcooked-AI wrapper
│   │   └── vec_env.py          # Vectorized environment runner
│   ├── evaluation/       # Evaluation suite
│   │   ├── evaluate.py         # Full evaluation pipeline
│   │   └── comm_metrics.py     # Communication analysis metrics
│   ├── language/         # Language grounding
│   │   └── grounding.py        # Sentence-transformer grounding
│   ├── losses/           # Objective functions
│   │   └── objectives.py       # Four-term PAGC objective
│   ├── training/         # Training loop
│   │   ├── train.py            # Main training script
│   │   ├── buffer.py           # Rollout buffer
│   │   └── mappo_trainer.py    # MAPPO trainer
│   └── utils/            # Utilities
│       ├── logging.py          # TensorBoard logging
│       └── misc.py             # Device, seeding, etc.
├── configs/              # YAML configuration files
│   ├── default.yaml            # Default hyperparameters
│   ├── mpe_spread.yaml         # MPE-specific overrides
│   ├── lbf.yaml                # LBF-specific overrides
│   └── overcooked.yaml         # Overcooked-specific overrides
├── paper/                # Publication materials
│   ├── pagc_paper.tex          # Full paper (LaTeX)
│   └── publication_results.txt # Complete results tables
├── scripts/              # Shell scripts
│   ├── train.sh                # Training launcher
│   └── evaluate.sh             # Evaluation launcher
├── pyproject.toml        # Package configuration
└── README.md             # This file

Installation

Requirements

  • Python ≥ 3.10
  • PyTorch ≥ 2.0 (with CUDA for GPU training)

Setup

# Clone the repository
git clone https://github.com/zhengtaoyao/PAGC.git
cd PAGC

# Create a conda environment (recommended)
conda create -n pagc python=3.10 -y
conda activate pagc

# Install PyTorch (adjust for your CUDA version)
# See https://pytorch.org/get-started/locally/
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu121

# Install PAGC and all dependencies
pip install -e .

Datasets / Environments

PAGC is evaluated on three cooperative multi-agent environments. No separate dataset download is needed — all environments are installed automatically via pip dependencies.

1. MPE Simple Spread

  • Source: PettingZoo MPE
  • Install: pip install pettingzoo[mpe] (included in dependencies)
  • Task: 3 agents must cover 3 landmarks while avoiding collisions
  • Obs dim: 18 | Action dim: 5 | Max steps: 25

2. Level-Based Foraging (LBF)

  • Source: lbforaging
  • Install: pip install lbforaging (included in dependencies)
  • Task: 2 agents cooperatively forage food items on an 8×8 grid
  • Obs dim: 12 | Action dim: 6 | Max steps: 50 | force_coop: True

3. Overcooked-AI

  • Source: overcooked-ai
  • Install: pip install overcooked-ai (included in dependencies)
  • Task: 2 agents collaborate in a cramped kitchen to prepare and deliver dishes
  • Obs dim: 520 | Action dim: 6 | Max steps: 400 | Layout: cramped_room

Training

Quick Start

# Train on MPE Simple Spread (default)
python -m pagc.training.train --env_name mpe_spread --seed 0

# Train on Level-Based Foraging
python -m pagc.training.train --env_name lbf --seed 0

# Train on Overcooked
python -m pagc.training.train --env_name overcooked --seed 0 --gpu_id 0

Using Shell Scripts

# bash scripts/train.sh <env_name> <gpu_id> <seed>
bash scripts/train.sh mpe_spread 0 0
bash scripts/train.sh lbf 1 42
bash scripts/train.sh overcooked 2 0

Key Training Arguments

Argument Default Description
--env_name mpe_spread Environment: mpe_spread, lbf, overcooked
--total_timesteps 1000000 Total training timesteps
--lr 3e-4 Learning rate
--seed 0 Random seed
--gpu_id 0 GPU device ID
--output_dir outputs/<env> Output directory for checkpoints and logs
--n_envs 8 Number of parallel environments
--rollout_length 128 Rollout buffer length
--entropy_coef 0.05 Initial entropy coefficient
--alpha 1.0 Grounding loss weight
--beta 0.5 Utility loss weight
--gamma_comm 0.1 Budget loss weight

Checkpoints are saved to <output_dir>/checkpoint_best.pt and <output_dir>/checkpoint_latest.pt.


Evaluation

# Evaluate a trained checkpoint
python -m pagc.evaluation.evaluate --checkpoint outputs/mpe_spread/seed_0/checkpoint_best.pt

# Evaluate with specific settings
python -m pagc.evaluation.evaluate \
    --checkpoint outputs/overcooked/seed_0/checkpoint_best.pt \
    --env overcooked \
    --n_episodes 100 \
    --gpu_id 0

# Using the script
bash scripts/evaluate.sh outputs/lbf/seed_0/checkpoint_best.pt --n_episodes 50

Results are saved as JSON to the same directory as the checkpoint.


Results

Main Results (mean ± std over 5 seeds)

Method Overcooked ↑ LBF (success) ↑ MPE (reward) ↑
NoComm 606.4 ± 21.4 0.95 ± 0.02 -62.3 ± 1.1
CommNet 562.6 ± 111.5 0.94 ± 0.01 -59.7 ± 2.3
DIAL 604.8 ± 34.2 0.92 ± 0.03 -57.8 ± 2.2
LangGround 526.9 ± 80.7 0.95 ± 0.02 -63.4 ± 1.7
OracleComm 586.6 ± 49.2 0.93 ± 0.05 -62.6 ± 3.4
PAGC (ours) 625.8 ± 8.0 0.92 ± 0.05 -62.8 ± 1.2

Key findings:

  • Overcooked: PAGC achieves the highest mean return (625.8) with 8× lower variance than the next-best method, demonstrating superior stability in complex coordination tasks.
  • LBF: All methods achieve high success rates (≥ 0.92). The cooperative foraging task is relatively simple and saturates quickly.
  • MPE: DIAL leads on raw reward; PAGC remains competitive while providing interpretable, grounded communication.

Citation

If you find this work useful, please cite:

@inproceedings{pagc2025,
  title={Partner-Adaptive Grounded Communication for Cooperative Multi-Agent Reinforcement Learning},
  author={PAGC Team},
  year={2025}
}

License

This project is licensed under the MIT License.

About

Partner-Adaptive Grounded Communication for cooperative multi-agent reinforcement learning.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages