Abstract
Open large language models (LLMs) have achieved remarkable performance in standard NLP tasks but continue to lag significantly behind commercial models like ChatGPT and GPT-4 when acting as autonomous agents. Agentic tasks require LLMs to serve as central controllers for planning, memorization, and tool utilization, necessitating robust reasoning capabilities. In this work, we present AgentTuning, a general method to enhance the agent abilities of LLMs without compromising their general capabilities. We construct AgentInstruct, a lightweight instruction-tuning dataset of high-quality interaction trajectories, and employ a hybrid instruction-tuning strategy. By applying AgentTuning to the Llama 2 series, we produce AgentLM. Our evaluations demonstrate that AgentLM-70B achieves parity with GPT-3.5-turbo on unseen agent tasks, providing a powerful open-source alternative for complex agentic workflows.
Introduction
While LLMs excel at summarization and translation, they often struggle in dynamic environments that require multi-step reasoning and tool use. This "agentic gap" between open-source and proprietary models has historically been addressed through narrow, task-specific fine-tuning. However, such approaches often lead to "catastrophic forgetting," where a model gains a specific skill but loses its general reasoning breadth and fails to generalize to novel scenarios. AgentTuning aims to bridge this gap by providing a balanced training regime that preserves the model's "general intelligence" while unlocking its potential as an autonomous agent.
Methodology: AgentInstruct and Hybrid Tuning
The AgentTuning framework consists of two primary components: high-quality data curation and a balanced training strategy.
AgentInstruct Dataset
Rather than relying on noisy, scraped data, the authors curated AgentInstruct, a dataset of 1,866 high-quality interaction trajectories across six diverse categories, including Operating Systems, Databases, and Knowledge Graphs.
- Trajectory Generation: GPT-4 was utilized as a "teacher" to interact with environments using ReAct prompting, ensuring the model recorded its internal reasoning (Chain-of-Thought) alongside its actions.
- Reward Filtering: To ensure the model learns only from optimal behavior, only trajectories resulting in successful outcomes (high rewards) were included.
Hybrid Instruction Tuning
To maintain general reasoning abilities, the authors combined AgentInstruct with general-domain data from ShareGPT. Empirical testing revealed that a hybrid ratio—roughly 20% agent data to 80% general data—served as the optimal balance, preventing the model from becoming over-specialized while significantly boosting its agentic performance.
Experimental Results
AgentLM was evaluated on both "held-in" tasks (tasks seen during training) and "held-out" tasks (entirely novel environments) to test generalization.
Performance and Scaling
The results indicate that the benefits of AgentTuning scale dramatically with model size. While the 7B and 13B versions showed significant gains, the AgentLM-70B model achieved a staggering 176% improvement on held-out tasks compared to the base Llama 2 Chat model. Most notably, AgentLM-70B reached a performance level comparable to GPT-3.5-turbo on these unseen tasks.
Preserving General Abilities
Crucially, AgentLM maintained its performance on standard benchmarks like MMLU and GSM8K. This confirms that the hybrid tuning strategy successfully avoids the pitfalls of catastrophic forgetting, allowing the model to act as a specialized agent without losing its core linguistic and mathematical reasoning capabilities.
Key Insights and Discussion
- The Reasoning Anchor: Training exclusively on agent data was found to actually decrease performance on new tasks. General-domain data acts as a necessary anchor, allowing the model to generalize its agentic training to unfamiliar environments.
- Quality Over Quantity: The relatively small size of AgentInstruct (under 2k trajectories) highlights that high-quality, reward-verified data with Chain-of-Thought rationales is far more effective than massive, unverified datasets.
- Error Reduction: Qualitative analysis showed that AgentTuning significantly reduced "elementary" agent errors, such as formatting inconsistencies, repetitive loops, or unnecessary refusals to perform valid tasks.
Conclusion
AgentTuning provides a scalable path for open-source models to match the agentic capabilities of commercial giants. By combining high-quality interaction trajectories with general-domain instructions, AgentLM-70B serves as a robust, generalized agent capable of tackling complex, unseen tasks. Future work will focus on expanding task diversity and exploring self-distillation methods to reduce dependency on proprietary "teacher" models like GPT-4.
Summary updated