Skip to content
runhaoli-creatorPublic

About

Decentralized Epistemic Alignment for Multimodal Swarms with MA-GRPO across heterogeneous VLMs.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

DEAMS: Decentralized Epistemic Alignment for Heterogeneous Multimodal Swarms

Python PyTorch License

Official implementation of "DEAMS: Decentralized Epistemic Alignment for Heterogeneous Multimodal Swarms".

DEAMS is a training-free multi-agent framework that aggregates predictions from diverse Vision-Language Models (VLMs) through uncertainty-weighted soft voting using semantic entropy. It achieves state-of-the-art accuracy on multimodal reasoning benchmarks by combining heterogeneous model diversity with principled uncertainty estimation.

Key Results

Method MMMU MathVista MMStar Avg
Best Single Model (7-8B) 44.3 70.8 64.6 59.9
Self-Consistency (K=5) 44.8 68.2 61.8 58.3
Majority Vote (3 agents) 44.3 68.8 64.2 59.1
DEAMS (Ours) 49.0 70.0 67.2 62.1

Architecture

┌──────────────────────────────────────────────────────────┐
│                     DEAMS Pipeline                        │
│                                                          │
│  ┌─────────┐  ┌─────────┐  ┌─────────┐                  │
│  │ Agent 1  │  │ Agent 2  │  │ Agent 3  │  VLM Swarm     │
│  │ Qwen2.5  │  │InternVL3 │  │ Idefics3 │                │
│  │  -VL-7B  │  │   -8B    │  │   -8B    │                │
│  └────┬─────┘  └────┬─────┘  └────┬─────┘                │
│       │              │              │                     │
│       ▼              ▼              ▼                     │
│  ┌─────────────────────────────────────┐                  │
│  │      Stochastic Sampling (K=5)      │                  │
│  │   + Answer Normalization            │                  │
│  └──────────────┬──────────────────────┘                  │
│                 │                                         │
│       ┌─────────┼─────────┐                               │
│       ▼         ▼         ▼                               │
│  ┌─────────────────────────────────────┐                  │
│  │     Semantic Entropy Estimation     │                  │
│  │   MC: direct letter entropy         │                  │
│  │   Free-form: Phi-3.5 entailment    │                  │
│  └──────────────┬──────────────────────┘                  │
│                 │                                         │
│       ┌─────────┼─────────┐                               │
│       ▼         ▼         ▼                               │
│  ┌─────────────────────────────────────┐                  │
│  │     BeliefTuple Construction        │                  │
│  │   {id, role, class, uncertainty,    │                  │
│  │    feature_vector, belief_dist}     │                  │
│  └──────────────┬──────────────────────┘                  │
│                 │                                         │
│                 ▼                                         │
│  ┌─────────────────────────────────────┐                  │
│  │   Uncertainty-Weighted Soft Vote    │                  │
│  │   w_i = exp(-U_i)                  │                  │
│  │   p_agg(c) = Σ w_i·p_i(c) / Σ w_i │                  │
│  └──────────────┬──────────────────────┘                  │
│                 │                                         │
│                 ▼                                         │
│           Final Answer                                    │
└──────────────────────────────────────────────────────────┘

Project Structure

DEAMS/
├── deams/                          # Core package
│   ├── types.py                    # BeliefTuple, ConsensusResult, AgentSpec
│   ├── config.py                   # YAML configuration loader
│   ├── consensus/
│   │   └── ecl.py                  # Epistemic Consensus Layer
│   ├── models/
│   │   └── adapters_real.py        # VLM adapters (Qwen, InternVL, Idefics3, etc.)
│   ├── data/
│   │   └── loaders_pub.py          # Dataset loaders (MMMU, MathVista, MMStar)
│   ├── uq/
│   │   └── semantic_judge_real.py  # Semantic entropy via Phi-3.5 entailment
│   ├── evaluation/
│   │   └── metrics.py              # Success rate, ECE
│   ├── training/
│   │   ├── magrpo_real.py          # MAGRPO trainer
│   │   └── topology.py             # Swarm topology definitions
│   ├── utils/
│   │   └── entropy.py              # Entropy utilities
│   └── distributed/
│       └── launcher.py             # DeepSpeed launch support
├── scripts/
│   ├── run_phase23.py              # Main evaluation script (DEAMS + baselines)
│   └── run_magrpo_training.py      # MAGRPO training script
├── configs/                        # YAML experiment configs
├── paper/                          # NeurIPS 2026 submission
│   ├── deams_neurips2026.tex       # Full paper
│   ├── neurips_2026.sty            # Style file
│   └── results_summary.txt         # Results in plain text
├── tests/                          # Unit tests
├── pyproject.toml                  # Package configuration
└── environment.yml                 # Conda environment

Installation

Prerequisites

  • Python 3.12+
  • CUDA 12.0+ with compatible NVIDIA GPUs (tested on 8× RTX PRO 6000 Blackwell, 96GB)
  • At least 3 GPUs with 16+ GB VRAM each (for the 3-agent swarm)
  • Conda or Mamba

Setup

# Clone the repository
git clone [email protected]:zhengtaoyao/DEAMS.git
cd DEAMS

# Create conda environment
conda create -n deams_env python=3.12 -y
conda activate deams_env

# Install the package
pip install -e ".[dev]"

# Set HuggingFace token (required for model downloads)
export HF_TOKEN="your_huggingface_token"

Model Downloads

The following models are automatically downloaded from HuggingFace on first run:

Model Size Role HuggingFace ID
Qwen2.5-VL-7B-Instruct ~17 GB Perception Qwen/Qwen2.5-VL-7B-Instruct
InternVL3-8B ~16 GB Reasoning OpenGVLab/InternVL3-8B
Idefics3-8B-Llama3 ~17 GB Verification HuggingFaceM4/Idefics3-8B-Llama3
Phi-3.5-mini-instruct ~8 GB Entropy Judge microsoft/Phi-3.5-mini-instruct

Usage

Evaluation (Main Experiment)

Run the full DEAMS evaluation pipeline on MMMU, MathVista, and MMStar:

# Full evaluation (3 benchmarks × 500 episodes each)
python scripts/run_phase23.py --episodes 500 --output-dir outputs/results

# Quick test (10 episodes per benchmark)
python scripts/run_phase23.py --episodes 10 --output-dir outputs/smoke_test

GPU Assignment (configurable in scripts/run_phase23.py):

  • GPU 0: Qwen2.5-VL-7B (Perception Agent)
  • GPU 1: CoT/SC baselines (parallel thread)
  • GPU 2: InternVL3-8B (Reasoning Agent)
  • GPU 4: Idefics3-8B-Llama3 (Verification Agent)
  • GPU 6: Phi-3.5-mini (Semantic Entropy Judge)

Training (MAGRPO)

Fine-tune VLM agents with Multi-Agent Group Relative Policy Optimization:

# Train on a single dataset
python scripts/run_magrpo_training.py \
    --dataset vsbench \
    --steps 100 \
    --lr 2e-5 \
    --lora-rank 16 \
    --output-dir outputs/training

# Train on all datasets sequentially
python scripts/run_magrpo_training.py \
    --dataset ALL \
    --steps 60 \
    --output-dir outputs/training

Unit Tests

pytest tests/ -v

Core Components

1. BeliefTuple (deams/types.py)

The structured message exchanged between agents:

@dataclass
class BeliefTuple:
    agent_id: str                         # Unique agent identifier
    agent_role: str                       # perception | reasoning | verification
    semantic_class: str                   # Most probable answer
    uncertainty: float                    # Semantic entropy (≥ 0)
    feature_vector: list[float]           # 64-dim latent features
    belief_distribution: dict[str, float] # Probability over answer classes

2. Semantic Entropy (deams/uq/semantic_judge_real.py)

Clusters stochastic model outputs by semantic equivalence using bidirectional entailment (Phi-3.5-mini), then computes entropy over clusters:

$$U_i = -\sum_{m=1}^{M} \frac{|S_m|}{K} \log \frac{|S_m|}{K}$$

3. Epistemic Consensus Layer (deams/consensus/ecl.py)

Optional Bayesian belief fusion between agents:

$$p_{j,\text{new}}(c) = (1 - \alpha_i) \cdot p_j(c) + \alpha_i \cdot p_i(c), \quad \alpha_i = \min(e^{-U_i} \cdot 0.4, 1.0)$$

4. Soft Aggregation

Final prediction via uncertainty-weighted voting across all agents:

$$w_i = e^{-U_i}, \quad \hat{c} = \arg\max_c \frac{\sum_i w_i \cdot b_i(c)}{\sum_i w_i}$$

Configuration

Experiments are configured via YAML files in configs/ or directly in the script. Key parameters:

Parameter Default Description
num_samples 5 Stochastic samples per agent per question
temperature 1.0 Sampling temperature
top_p 0.9 Nucleus sampling threshold
max_new_tokens 1024 Maximum generation length
consensus_rounds 0 ECL rounds (0 = soft-agg only, recommended)

Benchmarks

Dataset Split Size Type Source
MMMU validation 420 Multiple-choice College-level multimodal
MathVista testmini 500 MC + free-form Mathematical reasoning
MMStar val 500 Multiple-choice Vision-indispensable

Citation

@inproceedings{deams2026,
  title={DEAMS: Decentralized Epistemic Alignment for Heterogeneous Multimodal Swarms},
  author={Anonymous},
  booktitle={Advances in Neural Information Processing Systems (NeurIPS)},
  year={2026}
}

License

This project is licensed under the Apache License 2.0. See LICENSE for details.

About

Decentralized Epistemic Alignment for Multimodal Swarms with MA-GRPO across heterogeneous VLMs.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages