nielsr HF Staff commited on
Commit
0d3dfd3
Β·
verified Β·
1 Parent(s): cc3a445

Add comprehensive model card for Chain-of-Agents AFM

Browse files

This PR adds a comprehensive model card to the repository, which previously had placeholder content.

The model card now includes:
* Links to the associated paper ([Chain-of-Agents: End-to-End Agent Foundation Models via Multi-Agent Distillation and Agentic RL](https://huggingface.co/papers/2508.13167)), the project page, and the GitHub repository.
* Essential metadata: `license: apache-2.0`, `library_name: transformers`, and `pipeline_tag: text-generation`, enhancing discoverability on the Hugging Face Hub.
* A detailed overview of the Chain-of-Agents (CoA) paradigm and Agent Foundation Models (AFM), incorporating key features and performance highlights.
* A Python code snippet demonstrating how to use the model for inference with the `transformers` library, including usage of the Qwen2 chat template.
* The appropriate BibTeX citation for the work.

Please review and merge this PR.

Files changed (1) hide show
  1. README.md +114 -0
README.md ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ library_name: transformers
4
+ pipeline_tag: text-generation
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 model 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). This work introduces Chain-of-Agents (CoA), 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 resulting models are called Agent Foundation Models (AFMs).
10
+
11
+ - πŸ“š [**Paper**](https://huggingface.co/papers/2508.13167)
12
+ - 🌐 [**Project Page**](https://chain-of-agents-afm.github.io/)
13
+ - πŸ’» [**GitHub Repository**](https://github.com/OPPO-PersonalAI/Agent_Foundation_Models)
14
+ - πŸ€— [**Models Collection**](https://huggingface.co/collections/PersonalAILab/afm-689200e11d0b21a67c015ba8)
15
+ - πŸ“Š [**Datasets Collection**](https://huggingface.co/collections/PersonalAILab/afm-datasets-6892140eaad360ea5ccdcde1)
16
+
17
+ <div align="center">
18
+ <img src="https://github.com/OPPO-PersonalAI/Agent_Foundation_Models/raw/main/assets/afm.png" width="85%" height="auto" alt="Chain-of-Agents Overview">
19
+ </div>
20
+
21
+ ## Overview
22
+
23
+ Recent advances in large language models (LLMs) and multi-agent systems have demonstrated remarkable capabilities in complex problem-solving tasks. Chain-of-Agents (CoA) addresses inefficiencies in existing multi-agent systems by enabling end-to-end complex problem-solving within a single model. The model dynamically activates different tool agents and role-playing agents to simulate multi-agent collaboration in an end-to-end fashion. Agent Foundation Models (AFMs) are trained using a multi-agent distillation framework and agentic reinforcement learning, establishing new state-of-the-art performance across diverse benchmarks in both web agent and code agent settings.
24
+
25
+ ### Quick Feature Summary
26
+
27
+ | Feature Category | Supported Capabilities |
28
+ | :--------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------- |
29
+ | **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 |
30
+ | **Training Framework** | βœ… Multi-Agent Distillation pipeline<br>βœ… Agentic Reinforcement Learning support<br>βœ… Mask fine-tuning for selective learning |
31
+ | **Agent Capabilities** | βœ… Web interaction (Web Agent)<br>βœ… Multi-hop question answering (MHQA Agent)<br>βœ… Code execution (Code Agent) |
32
+ | **Tool Integration** | βœ… Web search and crawling servers<br>βœ… Secure code sandbox (via nsjail) <br>βœ… Configurable multi-tool collaboration |
33
+ | **Evaluation** | βœ… Multi-scenario benchmark testing<br>βœ… Custom reward model integration |
34
+
35
+ ## Performance Highlights
36
+
37
+ AFM achieves state-of-the-art performance across multiple benchmarks in both web agent and code agent settings. For instance, our 32B AFM model reaches 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 further enhances AFM's performance across all benchmarks.
38
+
39
+ <div align="center">
40
+ <img src="https://github.com/OPPO-PersonalAI/Agent_Foundation_Models/raw/main/assets/performance.png" width="85%" height="auto" alt="Performance Table">
41
+ </div>
42
+
43
+ ## Usage
44
+
45
+ This model can be loaded and used with the Hugging Face `transformers` library. Ensure `trust_remote_code=True` is set for proper functionality, as this model uses custom code.
46
+
47
+ ```python
48
+ from transformers import AutoModelForCausalLM, AutoTokenizer
49
+ import torch
50
+
51
+ # Replace "PersonalAILab/AFM-32B" with the specific model ID you wish to use,
52
+ # e.g., "PersonalAILab/AFM-CodeAgent-32B-rl" or "PersonalAILab/AFM-WebAgent-32B-RL"
53
+ model_id = "PersonalAILab/AFM-32B" # Example model ID
54
+
55
+ tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
56
+ model = AutoModelForCausalLM.from_pretrained(
57
+ model_id,
58
+ device_map="auto", # Automatically loads the model across available devices (GPUs/CPU)
59
+ torch_dtype=torch.bfloat16, # Uses bfloat16 for efficient memory and computation
60
+ trust_remote_code=True # Required for custom modeling and tokenization
61
+ )
62
+
63
+ # Example chat interaction for a multi-hop question answering task
64
+ messages = [
65
+ {"role": "system", "content": "You are a helpful assistant."},
66
+ {"role": "user", "content": "What is the capital of France and what is its population?"}
67
+ ]
68
+
69
+ # Apply chat template and tokenize inputs for proper Qwen2-based chat formatting
70
+ text = tokenizer.apply_chat_template(
71
+ messages,
72
+ tokenize=False,
73
+ add_generation_prompt=True
74
+ )
75
+
76
+ model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
77
+
78
+ # Generate response
79
+ generated_ids = model.generate(
80
+ model_inputs.input_ids,
81
+ max_new_tokens=512,
82
+ do_sample=True,
83
+ temperature=0.7,
84
+ top_k=20,
85
+ top_p=0.8,
86
+ repetition_penalty=1.05
87
+ )
88
+
89
+ # Decode only the newly generated tokens
90
+ generated_ids = [
91
+ output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
92
+ ]
93
+ response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
94
+ print(response)
95
+
96
+ # For more detailed usage, including training, evaluation, and tool integration,
97
+ # please refer to the official GitHub repository.
98
+ ```
99
+
100
+ ## Citation
101
+
102
+ If you find `AFM` useful in your research or applications, we would appreciate it if you could cite our work:
103
+
104
+ ```bibtex
105
+ @misc{li2025chainofagentsendtoendagentfoundation,
106
+ title={Chain-of-Agents: End-to-End Agent Foundation Models via Multi-Agent Distillation and Agentic RL},
107
+ 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},
108
+ year={2025},
109
+ eprint={2508.13167},
110
+ archivePrefix={arXiv},
111
+ primaryClass={cs.AI},
112
+ url={https://arxiv.org/abs/2508.13167},
113
+ }
114
+ ```