AgentInstruct: Toward Generative Teaching with Agentic Flows

Arindam Mitra, Luciano Del Corro, Guoqing Zheng, Shweti Mahajan, Dany Rouhana, Andrés Codas, Yadong Lu, Weige Chen, Olga Vrousgos, Corby Rosset, Fillipe Silva, Hamed Khanpour, Yash Lara, Ahmed AwadallaharXiv 2024 · DOI

Abstract

High-quality synthetic data is crucial for training large language models (LLMs), yet current methods often suffer from limited diversity and the risk of "model collapse." We introduce AgentInstruct, a framework that leverages multi-agent workflows to autonomously transform raw, unstructured data into a massive, high-quality synthetic dataset. By applying AgentInstruct to diverse sources like Wikipedia and source code, we generated 25 million instruction-response pairs. Training a Mistral-7B model on this data produced Orca-3, which demonstrates significant performance gains across reasoning, coding, and math benchmarks, outperforming Mistral-7B-Instruct and GPT-3.5-turbo.

Introduction

The scaling of LLMs has increasingly relied on synthetic data to overcome the scarcity of high-quality human-annotated datasets. However, simple prompting for data generation often leads to repetitive outputs and a lack of deep reasoning capabilities in student models—a phenomenon known as "model collapse." Traditional synthetic data generation also relies heavily on existing prompt sets as "seeds," which constrains the variety and complexity of the resulting data.

To address these challenges, we propose "Generative Teaching," a paradigm where a powerful teacher model uses agentic workflows to create complex, diverse "lessons" for smaller models. AgentInstruct embodies this paradigm by using multi-agent flows to turn raw documents into sophisticated training pairs without intensive human curation.

Methods: The AgentInstruct Framework

The AgentInstruct framework consists of three primary agentic flows designed to maximize the utility of raw seed data:

  1. Content Transformation Flow: Raw seeds (e.g., textbook chapters, source code) are transformed into intermediate representations such as debate transcripts, meeting summaries, or API lists. This makes the content more conducive to diverse instruction generation.
  2. Seed Instruction Generation Flow: Using a comprehensive taxonomy of over 100 subcategories across 17 skills (e.g., math, coding, RAG), agents generate diverse prompts based on the transformed content.
  3. Instruction Refinement Flow: This stage employs an iterative "Suggester-Editor" loop. A "Suggester" agent proposes ways to increase the complexity or nuance of the prompt (e.g., adding distractors), and an "Editor" agent rewrites the prompt and response accordingly.
The AgentInstruct framework utilizes three distinct agentic flows to transform raw data into high-quality instruction-response pairs.

By incorporating tools like code interpreters and search APIs, these agentic flows allow the teacher model to produce data that exceeds its own single-shot performance capabilities.

Results and Evaluation

Using seeds from KnowledgePile, AutoMathText, OpenStax, and Apache-2.0 licensed code, we generated 22 million new pairs, combined with 3.8 million from previous Orca iterations. The resulting model, Orca-3 (fine-tuned from a Mistral-7B base), showed dramatic improvements over the standard Mistral-7B-Instruct.

Orca-3 shows significant performance gains over Mistral-7B-Instruct across multiple benchmarks, including a 53.7% boost in GSM8K and a 38.3% boost in BBH.

Key performance highlights include:

  • Reasoning & Math: A 53.7% improvement on GSM8K and a 38.3% improvement on Big Bench Hard (BBH).
  • General Knowledge: A 40.2% improvement on AGIEval and 19.4% on MMLU.
  • Hallucination Reduction: A 31.34% reduction in hallucinations during abstractive summarization tasks.
  • Competitive Performance: Orca-3 consistently outperformed larger or more established models like Llama-3-8B-Instruct and GPT-3.5-turbo on several key benchmarks.

Discussion and Conclusion

AgentInstruct demonstrates that starting from raw, unstructured seeds rather than existing prompts prevents models from being "boxed in" by the biases of existing benchmarks. The iterative "Suggester-Editor" pattern is highly effective at creating "hard" examples—such as questions with subtle traps or multi-step reasoning requirements—that are rarely found in organic datasets.

While designing these agentic flows still requires human expertise and significant computational resources, the "agentic intelligence boost" provides a much higher ceiling for student model training. Future work will focus on automating the construction of these flows and exploring how this framework can be used for self-improvement in even larger, more capable models.

Summary updated

BibTeX
@misc{mitra2024agentinstruct,
  author = {Arindam Mitra and Luciano Del Corro and Guoqing Zheng and Shweti Mahajan and Dany Rouhana and Andrés Codas and Yadong Lu and Weige Chen and Olga Vrousgos and Corby Rosset and Fillipe Silva and Hamed Khanpour and Yash Lara and Ahmed Awadallah},
  title = {{AgentInstruct: Toward Generative Teaching with Agentic Flows}},
  year = {2024},
  eprint = {2407.03502},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2407.03502},
}
Figure