Add comprehensive model card for Chain-of-Agents (AFM)
Browse filesThis PR adds a comprehensive model card for the Chain-of-Agents (AFM) model, based on the paper [Chain-of-Agents: End-to-End Agent Foundation Models via Multi-Agent Distillation and Agentic RL](https://huggingface.co/papers/2508.13167).
It includes essential metadata such as the `pipeline_tag` (`text-generation`) and `library_name` (`transformers`), ensuring proper discoverability on the Hugging Face Hub (e.g., at https://huggingface.co/models?pipeline_tag=text-generation).
Additionally, the model card provides links to the paper, project page, and GitHub repository, along with a concise overview, key features, performance highlights, and a practical Python usage example, to help users quickly get started with the model.
README.md
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
pipeline_tag: text-generation
|
| 4 |
+
library_name: transformers
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
# Chain-of-Agents: End-to-End Agent Foundation Models via Multi-Agent Distillation and Agentic RL
|
| 8 |
+
|
| 9 |
+
This repository contains the official release of the **Agent Foundation Model (AFM)**, as presented in the paper [Chain-of-Agents: End-to-End Agent Foundation Models via Multi-Agent Distillation and Agentic RL](https://huggingface.co/papers/2508.13167).
|
| 10 |
+
|
| 11 |
+
[\ud83c\udfe0 Project Page](https://chain-of-agents-afm.github.io/) | [\ud83d\udcbb Code (GitHub)](https://github.com/OPPO-PersonalAI/Agent_Foundation_Models) | [\ud83d\udcda Paper (arXiv)](https://arxiv.org/abs/2508.13167) | [\ud83e\udd17 Models Collection](https://huggingface.co/collections/PersonalAILab/afm-689200e11d0b21a67c015ba8) | [\ud83d\udcbe Datasets Collection](https://huggingface.co/collections/PersonalAILab/afm-datasets-6892140eaad360ea5ccdcde1)
|
| 12 |
+
|
| 13 |
+
<div align="center">
|
| 14 |
+
<img src="https://github.com/OPPO-PersonalAI/Agent_Foundation_Models/raw/main/assets/afm.png" width="85%" height="auto" />
|
| 15 |
+
</div>
|
| 16 |
+
|
| 17 |
+
## Overview
|
| 18 |
+
**Chain-of-Agents (CoA)** is a novel paradigm of LLM reasoning that enables native end-to-end complex problem-solving in the same way as a multi-agent system (i.e., multi-turn problem solving with multiple tools and multiple agents) within one model. The **Agent Foundation Model (AFM)** is the resulting model, trained via a multi-agent distillation framework and agentic reinforcement learning to elicit these complex problem-solving abilities.
|
| 19 |
+
|
| 20 |
+
AFM establishes new state-of-the-art performance across diverse benchmarks in both web agent and code agent settings. The entire research, including model weights, training/evaluation code, and training data, is fully open-sourced.
|
| 21 |
+
|
| 22 |
+
## Key Features
|
| 23 |
+
| Feature Category | Supported Capabilities|
|
| 24 |
+
| - | - |
|
| 25 |
+
| **Core Paradigm** | β
Chain-of-Agents (CoA) for end-to-end problem-solving<br>β
Single-model simulation of multi-agent collaboration<br>β
Dynamic activation of tool agents and role-playing agents |
|
| 26 |
+
| **Training Framework** | β
Multi-Agent Distillation pipeline<br>β
Agentic Reinforcement Learning support<br>β
Mask fine-tuning for selective learning |
|
| 27 |
+
| **Agent Capabilities** | β
Web interaction (Web Agent)<br>β
Multi-hop question answering (MHQA Agent)<br>β
Code execution (Code Agent) |
|
| 28 |
+
| **Tool Integration** | β
Web search and crawling servers<br>β
Secure code sandbox (via nsjail) <br>β
Configurable multi-tool collaboration |
|
| 29 |
+
| **Evaluation** | β
Multi-scenario benchmark testing<br>β
Custom reward model integration<br> |
|
| 30 |
+
|
| 31 |
+
## Performance
|
| 32 |
+
AFM models demonstrate strong performance across various agentic benchmarks:
|
| 33 |
+
|
| 34 |
+
<div align="center">
|
| 35 |
+
<img src="https://github.com/OPPO-PersonalAI/Agent_Foundation_Models/raw/main/assets/performance.png" width="85%" height="auto" />
|
| 36 |
+
</div>
|
| 37 |
+
|
| 38 |
+
For instance, the 32B AFM model achieves an average success rate of **55.3% (Pass@1)** on the GAIA benchmark, **11.1%** on BrowseComp, **63.0%** on WebWalker, and **18.0%** on HLE. Test-time scaling (AFM-Bo3, AFM-Pass@3) further enhances performance significantly.
|
| 39 |
+
|
| 40 |
+
## Quick Start (Inference Example)
|
| 41 |
+
|
| 42 |
+
First, install the necessary dependencies, including `transformers`. You may need other dependencies as outlined in the [GitHub repository](https://github.com/OPPO-PersonalAI/Agent_Foundation_Models#running-examples) for specific training or evaluation setups.
|
| 43 |
+
|
| 44 |
+
```bash
|
| 45 |
+
pip install transformers torch
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
+
You can then load and use the model with the `transformers` library:
|
| 49 |
+
|
| 50 |
+
```python
|
| 51 |
+
import torch
|
| 52 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 53 |
+
|
| 54 |
+
# Replace "PersonalAILab/AFM-WebAgent-7B-RL" with the specific AFM model checkpoint you want to use
|
| 55 |
+
model_id = "PersonalAILab/AFM-WebAgent-7B-RL"
|
| 56 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
|
| 57 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 58 |
+
model_id,
|
| 59 |
+
torch_dtype=torch.bfloat16, # or torch.float16 depending on your hardware
|
| 60 |
+
device_map="auto",
|
| 61 |
+
trust_remote_code=True
|
| 62 |
+
)
|
| 63 |
+
|
| 64 |
+
# Example chat interaction
|
| 65 |
+
messages = [
|
| 66 |
+
{"role": "user", "content": "Hello, how can you help me today?"}
|
| 67 |
+
]
|
| 68 |
+
|
| 69 |
+
# Apply chat template and tokenize
|
| 70 |
+
input_ids = tokenizer.apply_chat_template(
|
| 71 |
+
messages,
|
| 72 |
+
add_generation_prompt=True,
|
| 73 |
+
return_tensors="pt"
|
| 74 |
+
).to(model.device)
|
| 75 |
+
|
| 76 |
+
# Generate response
|
| 77 |
+
output_ids = model.generate(
|
| 78 |
+
input_ids,
|
| 79 |
+
max_new_tokens=512,
|
| 80 |
+
do_sample=True,
|
| 81 |
+
temperature=0.7,
|
| 82 |
+
top_p=0.9
|
| 83 |
+
)
|
| 84 |
+
|
| 85 |
+
response = tokenizer.decode(output_ids[0][input_ids.shape[-1]:], skip_special_tokens=True)
|
| 86 |
+
print(response)
|
| 87 |
+
|
| 88 |
+
```
|
| 89 |
+
|
| 90 |
+
For more detailed usage, including training and evaluation scripts, please refer to the [official GitHub repository](https://github.com/OPPO-PersonalAI/Agent_Foundation_Models).
|
| 91 |
+
|
| 92 |
+
## Citation
|
| 93 |
+
If you find `AFM` useful in your research or applications, we would appreciate it if you could cite our work:
|
| 94 |
+
|
| 95 |
+
```bibtex
|
| 96 |
+
@misc{li2025chainofagentsendtoendagentfoundation,
|
| 97 |
+
title={Chain-of-Agents: End-to-End Agent Foundation Models via Multi-Agent Distillation and Agentic RL},
|
| 98 |
+
author={Weizhen Li and Jianbo Lin and Zhuosong Jiang and Jingyi Cao and Xinpeng Liu and Jiayu Zhang and Zhenqiang Huang and Qianben Chen and Weichen Sun and Qiexiang Wang and Hongxuan Lu and Tianrui Qin and Chenghao Zhu and Yi Yao and Shuying Fan and Xiaowan Li and Tiannan Wang and Pai Liu and King Zhu and He Zhu and Dingfeng Shi and Piaohong Wang and Yeyi Guan and Xiangru Tang and Minghao Liu and Yuchen Eleanor Jiang and Jian Yang and Jiaheng Liu and Ge Zhang and Wangchunshu Zhou},
|
| 99 |
+
year={2025},
|
| 100 |
+
eprint={2508.13167},
|
| 101 |
+
archivePrefix={arXiv},
|
| 102 |
+
primaryClass={cs.AI},
|
| 103 |
+
url={https://arxiv.org/abs/2508.13167},
|
| 104 |
+
}
|
| 105 |
+
```
|