TrainerAgent: Customizable and Efficient Model Training through LLM-Powered Multi-Agent System

Haoyuan Li, Hao Jiang, Tianke Zhang, Zhelun Yu, Aoxiong Yin, Hao Cheng, Siming Fu, Yuhao Zhang, Wanggui HearXiv 2023 · DOI

Introduction

Developing custom AI models is traditionally a "daunting and time-consuming" process, even for seasoned algorithm engineers. The lifecycle involves a tedious loop of data cleaning, model selection, hyperparameter tuning, and deployment. For non-experts, this barrier is often insurmountable. While existing tools like AutoML-GPT or Prompt2Model attempt to automate parts of this pipeline, they frequently suffer from rigidity, requiring specific input formats, or lack support for private databases and diverse domains.

TrainerAgent is a multi-agent system powered by Large Language Models (LLMs) that automates the entire AI lifecycle. By coordinating four specialized agents—Task, Data, Model, and Server—the system bridges the gap between natural language business requirements and complex algorithm engineering. It is designed to handle "messy" real-world requirements, manage the full stack of model development, and ensure the safety and feasibility of requested tasks.

System Architecture and Methodology

The core of TrainerAgent is a multi-agent framework where each agent is powered by GPT-4 and guided by specific System Prompts and Standard Operating Procedures (SOPs). The workload is divided into four distinct roles that interact through a "planning-action-response" loop, allowing the system to adapt to errors or new constraints mid-process.

Overview of the TrainerAgent multi-agent framework, illustrating the interaction between the Task, Data, Model, and Server agents alongside the internal operational loop.
  1. Task Agent (The Hub): Acts as the project manager. It parses user intent into structured JSON, creates a global plan, coordinates the other agents, and manages the user interface.
  2. Data Agent: Manages the data pipeline, including collection, cleaning, and automatic labeling or augmentation using LLMs to handle small or noisy datasets.
  3. Model Agent: Responsible for the technical execution of machine learning tasks. It selects pre-trained models, performs hyperparameter tuning, executes training scripts, and handles model compression.
  4. Server Agent: The DevOps specialist. It estimates hardware requirements (e.g., GPU memory), converts models to efficient formats like TensorRT or ONNX, and sets up the online service with API documentation and monitoring.

End-to-End Workflow Implementation

The system's capabilities were evaluated using real-world business scenarios from the Taobao e-commerce platform, such as Visual Grounding (localizing products in live-streaming video) and Text Classification (identifying promotional benefit information). Unlike many automated tools, TrainerAgent can work with private, internally constructed datasets rather than just public benchmarks.

A detailed example of the TrainerAgent workflow for a Visual Grounding task, showing the transition from a natural language user requirement to a fully deployed online service.

In the Visual Grounding task, the system successfully moved from a natural language request ("I want to develop a model to box products...") to a fully deployed online service with continuous monitoring. The Task Agent parsed the requirement, the Data Agent retrieved and cleaned frames/ASR text, the Model Agent initialized a pre-trained model for training, and the Server Agent handled the final deployment script and API documentation.

Key Insights and Results

TrainerAgent demonstrates several advanced capabilities that distinguish it from standard automation tools:

  • Hierarchical Training for Data Scarcity: In text classification experiments, when an initial model failed to meet accuracy targets due to a small dataset (30 pairs), the Model Agent autonomously switched to a "hierarchical training mode." It used a larger model (Llama2-7b) to pseudo-label 10,000 additional data points, which were then used to train a smaller, more efficient "albert-tiny" model, improving accuracy from 86% to 92%.
  • The Power of Rejection: TrainerAgent can identify and reject unattainable or unethical requests, ensuring system robustness.
  • Collaborative Intelligence: Breaking the process into specialized roles significantly increased success rates compared to a single-agent approach.
  • Deployment Efficiency: The Server Agent successfully calculated resource needs (e.g., eight 2GB containers for 100 QPS) and automatically generated the necessary deployment scripts.

Limitations and Future Work

Despite its success, TrainerAgent faces several hurdles. It currently relies on pre-established local scripts and cannot yet autonomously execute arbitrary open-source code from platforms like GitHub. While highly automated, it still benefits from human interaction to resolve high-level ambiguities. Future work aims to expand the system's domain expertise to include time-series or audio data and to further refine safeguards against unintended biases in LLM decision-making.

Summary updated

BibTeX
@misc{li2023traineragent,
  author = {Haoyuan Li and Hao Jiang and Tianke Zhang and Zhelun Yu and Aoxiong Yin and Hao Cheng and Siming Fu and Yuhao Zhang and Wanggui He},
  title = {{TrainerAgent: Customizable and Efficient Model Training through LLM-Powered Multi-Agent System}},
  year = {2023},
  eprint = {2311.06622},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2311.06622},
}
Figure