Downloads · 30 days
33
26% of all-time downloads
veggiebird/MATPO-14b
MATPO-14b is a machine learning model from veggiebird. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
Downloads · 30 days
33
26% of all-time downloads
All-time downloads
129
Public
Parameters
14.8B
29.5 GB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors29.5 GB · 100%
From the Hugging Face model README
Train Multiple Agent Roles Within a Single LLM via Reinforcement Learning.
<!-- [](https://arxiv.org/pdf/2510.04678) [](LICENSE) [](https://www.python.org/downloads/) [](https://github.com/mzf666/MATPO) --> <!-- <hr> --> <div align="center"> </div> </div> <div align="center"> <table> <tr> <td align="center"> <img src="assets/main_gaia.png" width="220px" alt="GAIA Results"><br> <em>GAIA Results</em> </td> <td align="center"> <img src="assets/main_frameqa.png" width="220px" alt="FRAMES Results"><br> <em>FRAMES Results</em> </td> <td align="center"> <img src="assets/main_webwalkerqa.png" width="220px" alt="WebWalkerQA Results"><br> <em>WebWalkerQA Results</em> </td> </tr> </table> </div> <p align="center"> <img src="assets/multi_agent_framework.png" width="500px" alt="MATPO Framework"> </p> <p align="center"> <em>MATPO allows planner and worker agents to coexist within a single LLM and be trained via RL, achieving an 18.38% relative improvement over single-agent baselines on GAIA-text, FRAMES, and WebWalker-QA.</em> </p>MATPO (Multi-Agent Tool-Integrated Policy Optimization) is a novel reinforcement learning framework that enables training multiple specialized agent roles (planner and worker agents) within a single large language model.
Current single-agent approaches for multi-turn tool-integrated planning face critical limitations:
MATPO introduces a multi-agent-in-one-model architecture where:
MATPO employs a hierarchical multi-agent framework where a single LLM serves multiple roles:
User Query → Planner Agent → Subtask 1 → Worker Agent → Result 1
→ Subtask 2 → Worker Agent → Result 2
→ ...
→ Final Answer
<p align="center">
<img src="assets/single_agent.png" width="600px" alt="Single-agent GRPO Framework">
<img src="assets/multi_agent_RL_rollout.png" width="600px" alt="MATPO Framework">
</p>
<p align="center">
<em>Comparison between the rollout trajectories between the single-agent GRPO (top) and the multi-agent MATPO (bottom).</em>
</p>
Planner Agent:
Worker Agent:
Credit Assignment:
Prerequisites:
Clone the repository.
git clone https://github.com/mzf666/MATPO.git
cd MATPO
For prerequisites installation (CUDA, cuDNN, Apex), we recommend following the verl prerequisites guide which provides detailed instructions for:
Setup environment and install dependencies.
conda create -n matpo python==3.10 -y
conda activate matpo
bash examples/sglang_multiturn/install.sh
Setup Node.js for Serper API support.
MCP (Model Context Protocol) requires Node.js to run MCP servers. Node.js version 18+ is recommended for optimal compatibility with MCP tools.
target_path=YOUR_TARGET_PATH
# Download Node.js binary (example for Linux x64)
wget https://nodejs.org/dist/v24.2.0/node-v24.2.0-linux-x64.tar.xz
# Extract to your target path
tar -xf node-v24.2.0-linux-x64.tar.xz -C $target_path
# Add to PATH
export NODEJS_HOME=$target_path/node-v24.2.0-linux-x64
export PATH=$NODEJS_HOME/bin:$PATH
export NODE_SHARED=$target_path/node-shared/node_modules
export PATH=$NODE_SHARED/.bin:$PATH
# Verify installation
node --version
npm --version
# Install serper mcp server
mkdir -p $target_path/node-shared
cd $target_path/node-shared
npm init -y
npm install serper-search-scrape-mcp-server
Configure the Node.js paths and HTTP / HTTPS proxies (if necessary) in the examples/sglang_multiturn/launch.sh script properly.
Download the training and testing datasets to the data directory. The prerpocessed datasets can be downloaded here.
Train a Qwen3-14B-base model with MATPO on the MuSiQue dataset and evaluate on the GAIA-text datasets:
# tested on 16 x (8 x 80G-A800) nodes
export SERPER_API_KEY="YOUR_SERPER_API_KEY" && \
export OPENAI_API_KEY="YOUR_OPENAI_API_KEY" && \
export WANDB_API_KEY="YOUR_WANDB_API_KEY" && \
export SINGLENODE=true && \
export RAY_DEBUG=legacy && \
export HYDRA_FULL_ERROR=1 && \
source YOUR_CONDA_PATH activate matpo && \
cd YOUR_PROJECT_PATH && \
bash examples/sglang_multiturn/launch.sh \
examples/sglang_multiturn/qwen3-14b_musique_MATPO.sh
MATPO consistently outperforms single-agent GRPO baselines across all benchmarks:
| Method | GAIA-text | WebWalkerQA | FRAMES | Relative Average Improvement |
|---|---|---|---|---|
| Single-Agent GRPO | 32.16% | 30.14% | 56.22% | - |
| MATPO (Ours) | 42.60% | 33.00% | 63.64% | +18.38% |
We release the trained Qwen3-14B-base model checkpoints at the 180th training step of both single-agent GRPO and MATPO.
The associated model rollouts across various training steps can be found here.
More Stable Training: MATPO exhibits more stable learning curves and avoids catastrophic performance drops observed in single-agent training
Robustness to Noise: Multi-agent decomposition effectively isolates noisy tool responses, preventing them from interfering with high-level planning
Better Credit Assignment: Principled reward distribution across planner and worker rollouts leads to more effective learning
Based on our experiments, we recommend:
If you find MATPO helpful in your research, please consider citing our paper:
@misc{mo2025multiagenttoolintegratedpolicyoptimization,
title={Multi-Agent Tool-Integrated Policy Optimization},
author={Zhanfeng Mo and Xingxuan Li and Yuntao Chen and Lidong Bing},
year={2025},
eprint={2510.04678},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2510.04678},
}
We would like to thank:
MATPO uses a single LLM to play multiple agent roles via different system prompts, rather than deploying separate models. This offers:
Yes! MATPO is model-agnostic. You can use any decoder-only LLM that supports tool calling and multi-turn conversations. We've tested with Qwen3-14B-base, but models like Llama 3, Mistral, or other reasoning-capable LLMs should work.
</details> <details> <summary><b>Q: How many GPUs do I need for training?</b></summary>For Qwen3-14B-base, we recommend:
MATPO extends GRPO with principled credit assignment:
See our paper for more details.
</details> <details> <summary><b>Q: Can I use MATPO for tasks other than web search?</b></summary>Absolutely! While our paper focuses on web search, MATPO's framework is general. You can extend it to:
MATPO is significantly more stable. Our experiments show:
See Figure 4 in our paper for training curves.
</details> <details> <summary><b>Q: Do I need to block HuggingFace URLs during training?</b></summary>For research integrity, yes - especially if your evaluation benchmarks are hosted on HuggingFace. This prevents models from "cheating" by finding ground-truth answers online.
For production systems with no data leakage concerns, this is optional.
</details>