M3Builder: A Multi-agent System for Automated Machine Learning in Medical Imaging

Jinghao Feng, Qiaoyu Zheng, Chaoyi Wu, Ziheng Zhao, Ya Zhang, Yanfeng Wang, Weidi Xie

Introduction

Developing specialized artificial intelligence models for medical imaging is a high-stakes, labor-intensive process. It requires a rare intersection of clinical expertise, data engineering, and deep learning proficiency. While "Agentic AI" has promised to automate coding tasks, the medical domain remains a "final frontier" due to complex 3D data formats, diverse imaging modalities (CT, MRI, X-ray), and a lack of standardized tools.

M3Builder is a novel framework designed to bridge this gap. By orchestrating a team of specialized AI agents, M3Builder can take a plain-English request—such as "build a model to segment lungs from Chest X-rays"—and autonomously handle the entire pipeline from data preprocessing to final model training.

The Challenge of Medical AI Engineering

The "coding gap" in medicine is a major bottleneck. Clinicians identify critical problems but often lack the software engineering skills to build custom AI tools. Conversely, general-purpose AI agents often fail in medical contexts due to:

  1. Data Complexity: Medical data (e.g., 3D NIfTI files) is significantly more complex than standard 2D images.
  2. Tool Scarcity: There is a lack of "off-the-shelf" tools for automated medical machine learning (ML).
  3. Workflow Fragility: Domain-specific bugs, such as tensor shape mismatches in 3D volumes, frequently crash training pipelines, and general agents struggle to self-correct these issues.

The M3Builder Framework

The core innovation of M3Builder is its Multi-Agent Collaboration Framework, which employs a "divide-and-conquer" strategy using four distinct roles:

  • Task Manager: Coordinates the process by analyzing user requests, selecting datasets, and creating execution plans.
  • Data Engineer: Manages data screening, metadata extraction, and dataset splitting.
  • Module Architect: Acts as the lead developer, writing dataloaders and selecting model architectures (e.g., 2D vs. 3D) based on the task.
  • Model Trainer: Optimizes the model by configuring hyperparameters and performing iterative auto-debugging based on compiler and runtime errors.
The M3Builder Agent Network Workflow and Workspace illustrates the collaborative interaction between specialized agents and the structured ML environment.

These agents operate within a specialized Medical Imaging ML Workspace that provides "Data Cards" for standardized metadata, a custom toolset for handling large medical files, and code templates based on industry standards like nnU-Net.

M3Bench: A Comprehensive Evaluation

To evaluate the system, the authors introduced M3Bench, a benchmark consisting of 14 datasets covering four primary tasks: organ segmentation, anomaly detection, disease diagnosis, and report generation. The benchmark spans five anatomical regions and three modalities (CT, MRI, and X-ray).

Results and Performance

M3Builder demonstrates remarkable efficacy. When powered by Claude-3.7-Sonnet, the system achieved a 94.29% success rate across all 14 tasks. This performance significantly outpaces other state-of-the-art LLMs and general-purpose coding assistants.

Performance comparison of various LLMs across the M3Bench tasks, highlighting the superior reasoning capabilities of Claude-3.7-Sonnet.

Key findings from the evaluation include:

  • Superiority over SOTA: M3Builder (82.14% average success in specific runs) outperformed existing systems like Aider (35.71%) and Copilot Edits (39.29%).
  • The Importance of Auto-Debugging: Ablation studies revealed that without the iterative debugging loop, success rates dropped sharply. The "Model Trainer's" ability to resolve issues like CUDA "out of memory" errors by adjusting batch sizes is critical for viability.
  • Standardization: By utilizing robust templates like nnU-Net, the agents focus on configuration and integration rather than error-prone scratch-coding.

Discussion and Future Directions

While M3Builder represents a significant leap forward, some limitations remain. Currently, the agents are "visually blind," relying on text descriptions and metadata rather than direct image analysis. Future work aims to incorporate multimodal Vision-Language Models (VLMs) to allow agents to verify data quality visually. Additionally, the authors plan to expand the system's scope to include electronic health records (EHR) and genomic data, moving toward a more holistic automated clinical AI engineer.

Summary updated

BibTeX
@inproceedings{feng2025m,
  author = {Jinghao Feng and Qiaoyu Zheng and Chaoyi Wu and Ziheng Zhao and Ya Zhang and Yanfeng Wang and Weidi Xie},
  title = {{M3Builder: A Multi-agent System for Automated Machine Learning in Medical Imaging}},
  booktitle = {Agentic AI/CREATE/Clinical MLLMs @ MICCAI},
  year = {2025},
  doi = {10.1007/978-3-032-06004-4\_12},
}
Figure