MedAdaptAgent: An Automatic Harness for Adapting Medical Imaging Models to New Sites
Organizations: University of California, San Francisco · University of California, Berkeley
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.
Figures & tables
| family | examples | labels | GPU? | principal requirement |
|---|---|---|---|---|
| input matching | histogram, stain, frequency | 0 | no | compatible input semantics |
| normalization/TTA | BN reset, Tent, SAR, EATA | 0 | mixed | supported trainable statistics |
| frozen probe | linear or per-pixel head | yes | recognized output head | |
| model tuning | head, partial, LoRA, surgical | yes | training compute |
| Policy | Prostate | RIGA | CHAOS | AMOS | BraTS | MMWHS | Fundus | Fundus-ROI | M&Ms-V | M&Ms-F | Mean | Harm |
| Direct deployment | 0.792 | 0.744 | 0.089 | 0.723 | 0.449 | 0.039 | 0.000 | 0.383 | 0.773 | 0.842 | 0.483 | 0 |
| Fixed BN reset, | 0.635 | 0.483 | 0.385 | 0.539 | 0.404 | 0.051 | 0.000 | 0.520 | 0.549 | 0.822 | 0.439 | 6 |
| Fixed Tent, | 0.791 | 0.796 | 0.237 | 0.324 | 0.131 | 0.000 | 0.000 | 0.707 | 0.746 | 0.835 | 0.457 | 6 |
| Fixed SAR, | 0.755 | 0.000 | 0.224 | 0.490 | 0.000 | 0.113 | 0.000 | 0.000 | 0.506 | 0.691 | 0.278 | 7 |
| Fixed EATA, | 0.756 | 0.000 | 0.223 | 0.490 | 0.000 | 0.111 | 0.000 | 0.000 | 0.497 | 0.688 | 0.277 | 7 |
| MedAdaptAgent , | 0.792 | 0.796 | 0.089 | 0.723 | 0.449 | 0.039 | 0.000 | 0.520 | 0.773 | 0.842 | 0.502 | 0 |
| replacement rule | mean AUROC | harmed | worst |
|---|---|---|---|
| highest selection AUROC | 13/52 | ||
| MedAdaptAgent | 9/52 |
| model | source target | model/site diagnosis | direct | delivered | outcome | |
| U-Net | MSD CE TotalSeg NC | mixed; BN | 5 | 0.386 | 0.386 | retain source |
| SwinUNETR | BTCV CE TotalSeg NC | mixed; IN/LN | 5 | 0.669 | 0.705 | LoRA |
| SegResNet | TotalSeg CT MSD CT | intensity; GN | 5 | 0.951 | 0.951 | retain source |
| U-Net | MSD CT AMOS MRI | modality; BN | 5 | 0.000 | 0.120 | Tent |
| SwinUNETR | BTCV CT AMOS MRI | modality; IN/LN | 5 | 0.040 | 0.191 | partial fine-tuning |
| U-Net | MSD CT AMOS MRI | modality; BN | 20 | 0.000 | 0.233 | LoRA |
Appendix figures & tables7 assets
Supplementary material from the paper’s appendix.
Appendix
| policy | mean AUROC | harmed | worst |
|---|---|---|---|
| source (no adaptation) | 0.810 | 0/13 | 0.000 |
| MedAdaptAgent ( , label-free estimate) | 0.809 | 4/13 | |
| BN reset | 0.787 | 6/11 | |
| Tent | 0.779 | 7/11 | |
| fixed head fine-tuning | 0.846 | 6/13 | |
| fixed full fine-tuning | 0.712 | 10/13 |
| selection rule | decision value | replacements | harmful / replaced |
|---|---|---|---|
| retain source | 0.483 | 0/10 | n/a |
| Minimum-entropy selector | 0.460 | 9/10 | 5/9 |
| scalar proxy | 0.460 | 8/10 | 4/8 |
| VLM preference only | 0.496 | 3/10 | 1/3 |
| full proxy consensus | 0.502 | 2/10 | 0/2 |
| configuration | normalization | BN reset | Tent | interpretation |
| ViT-small classifier | LayerNorm | 0.000 | 0.000 | no BN layers |
| Swin-Tiny classifier | LayerNorm | 0.000 | 0.000 | no BN layers |
| SegFormer 2-D | LayerNorm encoder + 1 BN head | method-dependent benefit | ||
| SwinUNETR 3-D ( Hatamizadeh et al., 2022 ) | InstanceNorm + LayerNorm | 0.000 | 0.000 | no BN layers |
| SegResNet 3-D | GroupNorm | 0.000 | 0.000 | no BN layers |
| 3-D U-Net, TotalSeg CE | 17 BatchNorm3d layers | both reduce Dice |
| model and evaluation set | AUROC | vs. target source |
|---|---|---|
| source, in-domain RUMC ( ) | 0.708 | n/a |
| source, target PCNN ( ) | 0.479 | 0.000 |
| BN reset | 0.467 | |
| Tent | 0.508 | |
| head fine-tuning ( ) | 0.477 | n/a |
| partial fine-tuning ( ) | 0.501 | n/a |
| planner | selected adjustment | test Dice | reload agreement |
|---|---|---|---|
| GPT-5.2 | LoRA | 0.230 | 10/10 |
| GPT-5.6 Luna | LoRA | 0.196 | 10/10 |
| Qwen3-VL-4B-Instruct | LoRA | 0.215 | 10/10 |
| Qwen3-VL-8B-Instruct | partial fine-tuning | 0.205 | 10/10 |
| transfer | architecture | dominant shift | source | output | selected action |
|---|---|---|---|---|---|
| AMOS CT MRI multiorgan | U-Net | modality | 0.723 | 0.928 | partial fine-tuning |
| BraTS T1 FLAIR tumor | U-Net | sequence | 0.449 | 0.871 | partial fine-tuning |
| CHAOS CT MRI liver | U-Net | modality | 0.089 | 0.662 | partial fine-tuning |
| REFUGE full-FOV RIM-ONE | U-Net | scale/preproc. | 0.000 | 0.657 | final-layer probe |
| REFUGE ROI RIM-ONE | U-Net | intensity/scale | 0.383 | 0.715 | partial fine-tuning |
| MMWHS CT whole heart | U-Net | contrast | 0.039 | 0.633 | partial fine-tuning |
| transfer | architecture | diagnosed shift | source | output | action |
|---|---|---|---|---|---|
| APTOS DDR | ResNet18 | mixed | 0.827 | 0.830 | head fine-tuning |
| APTOS EyePACS | ResNet18 | mixed | 0.716 | 0.704 | head fine-tuning |
| APTOS Messidor-2 | ResNet18 | mixed | 0.730 | 0.623 | partial fine-tuning |
| BreakHis 40 400 | ResNet18 | resolution | 0.801 | 0.866 | head fine-tuning |
| CAMELYON17 cross-hospital | ResNet18 | intensity | 0.931 | 0.931 | retain source model |
| CAMELYON17 cross-hospital | Swin-Tiny | intensity | 0.981 | 0.997 | source histogram match |
Unsupervised Domain Adaptation
Unsupervised domain adaptation transfers models from labeled source data to unlabeled target domains with different data distributions.
See all 183 papers