arXiv:2610.34884cs.CVOct 2026

Manuscript Offprint

arXiv:2610.34884

MedAdaptAgent: An Automatic Harness for Adapting Medical Imaging Models to New Sites

Hanxue Gu, Zhonghao Liu, Xingrui Gu, Kang Wang, Yang Yang

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Reusing pretrained medical-imaging models offers an alternative to training from scratch. A model trained for the same task may perform poorly at a new hospital because imaging protocols and preprocessing differ. Effective adaptation depends on the model architecture, domain shift, and available labels and compute. Adaptation can improve scores on a small labeled set yet reduce performance on unseen data. We present MedAdaptAgent, an automatic harness that turns a supplied model, target data, and a free-text request into a new-site adaptation workflow. Its LLM-driven Adaptation Planner uses model-site evidence to choose compatible experiments and revise subsequent adjustments. The harness requires evidence of improvement over the pretrained model, then delivers the selected model as a complete, runnable package. Evaluation spans 26 segmentation and classification transfers across architectures and compute settings, with segmentation annotation budgets ranging from zero-shot transfer to few-shot adaptation. With 20 local annotations, mean segmentation Dice rises from 0.483 to 0.774 across 10 transfers, a 60.1% relative gain, with no harmful replacements. Mean classification AUROC rises from 0.810 to 0.837 across 13 transfers, a 3.4% relative gain. Comparing adapted models with the pretrained model reduces harmful classification replacements by 30.8% versus selecting the highest-scoring model on the available labels, using identical candidates. Seven public-model deployments demonstrate adaptation and reproducible package delivery across contrast and modality shifts. A CT-to-MRI study extends the evaluation to four LLM planners, including two open-weight models. We release the code on GitHub.

1 Introduction

Medical image analysis at a new hospital no longer has to begin with training a model from scratch. Public repositories now distribute trained model packages, including MONAI bundles for organ segmentation and TotalSegmentator for whole-body anatomical analysis (MONAI Consortium, 2025a,b; Wasserthal et al., 2023). When one of these models addresses the same or a closely related task, a hospital can start from it rather than first collecting a large annotated cohort. Multi-center benchmarks and medical adaptation studies have documented substantial variation across hospitals, scanners, acquisition protocols, and patient populations (Bandi et al., 2019; Koh et al., 2021; Karani et al., 2021). Source and target data can also differ in modality, annotation convention, image resolution, or preprocessing, changing the inputs, the expected outputs, or both (Yu et al., 2025). Direct deployment can therefore lead to poor performance or complete failure (Karani et al., 2021; Xiong et al., 2026).

When direct deployment fails, adaptation offers an alternative to rebuilding the model from scratch. Applying it requires choosing and configuring a method for the specific model-site pair. Domain adaptation, test-time adaptation, and few-shot repair offer adjustments such as input matching, nor-

Figure

Figure 1: Automatic new-site model adaptation with the MedAdaptAgent harness. A supplied model and target-hospital request enter the Onboarding Analyzer, which inspects the model-site pair and constructs the feasible action space. The LLM-driven Adaptation Planner iterates planning, tool execution, and evidence updates within deterministic compatibility and budget controls. The Evidence Gate authorizes replacement. The harness then packages the pretrained model or an evidence-supported adapted model, and returns a safe-stop report when no tested option satisfies the deployment objective.

malization updates, probing, and fine-tuning (Wang et al., 2021; Niu et al., 2023; Kumar et al., 2022; Lee et al., 2023). Their feasibility and effect depend on the supplied model and deployment setting. A BatchNorm-based method requires compatible normalization layers, while supervised fine-tuning requires labels and training compute; a method that helps one shift may harm another (Zhao et al., 2023; Yu et al., 2025). With only a few annotations, an adapted model may score well on the labeled examples yet perform worse on unseen target data than the pretrained model (Cygert et al., 2024; Xiong et al., 2026). Applying these methods also requires a team to diagnose the mismatch, inspect the model and preprocessing, configure compatible experiments, interpret uncertain results, and package the selected model for inference. For clinical researchers without dedicated ML engineering support, these steps create a substantial barrier to model reuse. Automatic new-site deployment must therefore combine adaptation methods with model analysis, experiment planning, and controlled release.

Most existing automation focuses on model development rather than deployment at a new site. General and medical ML agents begin with task data and an optimization objective, then plan experiments, modify code, and train models (Huang et al., 2024; Feng et al., 2025; Liu et al., 2026). AutoMiSeg automatically assembles a zero-shot segmentation pipeline from foundation models and test-time adaptors (Li et al., 2025). Xiong et al. (2026) study model selection within a precomputed pool of UDA models and validators. These systems automate model construction or candidate selection. New-site deployment starts from a trained model and requires analysis on local data, feasible adjustments under label and compute constraints, comparison with the pretrained model, and a runnable deployment package.

We introduce the MedAdaptAgent harness, an automatic harness for post-training adaptation and new-site deployment, instantiated for segmentation and classification (Figure 1). The system begins with a free-text deployment request, a supplied model, target-site data, and the available annotation and compute budgets. The Onboarding Analyzer translates these inputs into a validated deployment contract and inspects the model and target data. The Adaptation Planner uses this evidence to characterize the model-site gap, construct a compatible action space, and form an experiment policy for the current deployment. It then operates in a closed loop: select an adjustment, execute it, observe the result, and update the next action. This process allows the harness to move among input matching, normalization and test-time adaptation, probing, and fine-tuning as evidence accumulates.

Experiment planning and model release serve different roles in the harness. The Adaptation Planner chooses what to test, while deterministic controls enforce architectural compatibility, resource budgets, candidate identity, and provenance. The Evidence Gate compares each candidate with the pretrained model using the target evidence available to the site. The final output is therefore a deployment package containing the pretrained or an evidence-supported adapted model. When the site specifies an absolute performance requirement and every tested option falls short, the harness returns a safe-stop report with the attempted adjustments and supporting evidence.

We evaluate segmentation and classification transfers across target sites, model architectures, annotation budgets, and GPU availability. Segmentation spans 0, 1, 5, and 20 labeled target cases. With 20 labels and supervised adaptation available, mean Dice rises from 0.483 to 0.774 across 10 transfers, with no harmful replacements. Across 13 classification transfers, mean AUROC rises from 0.810 to 0.837. Evidence-guided planning improves mean Dice from 0.596 for a fixed adjustment sequence to 0.629. Across four classification annotation draws, comparison with the pretrained model reduces harmful replacements by 30.8% relative to choosing the model with the highest score on the small labeled selection set, using identical candidate models. All seven public-model deployments produce packages that reproduce the selected predictions exactly after reload.

Contributions. Our contributions address three barriers to reusing medical-imaging models at new sites. (1) Automating model reuse: we introduce an end-to-end harness that turns a free-text request, an existing model, and target data into a model-specific analysis and adaptation workflow with a runnable deployment package. (2) Adapting the strategy to the deployment: we construct feasible experiments from model capabilities and local resources, then revise the adjustment policy using accumulated evidence. This closed-loop strategy improves on a fixed sequence of the same adjustment tools. (3) Reducing harmful model replacements: we separate candidate search from release and require evidence of improvement over the pretrained model. Controlled comparisons show that this verification reduces the risk of deploying an adapted model that scores well on a small labeled set yet performs worse on unseen target data than the pretrained model.

References (45)