Can AI Design a Better nnU-Net? A Hypothesis-Driven Architecture Discovery Loop from Failures to Design Rules
Organizations: Zhejiang University
Abstract
Neural architecture search and LLM-driven evolution often reduce evaluation to a scalar fitness score, discarding failures that could explain why designs succeed or fail. We present a hypothesis-driven architecture discovery loop in which LLM agents diagnose structured error patterns, formulate falsifiable hypotheses, test counterfactual controls under a frozen nnU-Net pipeline, and distill validated mechanisms into executable trigger-to-action rules. Across eight search waves, the loop identifies two principles for 3D medical image segmentation. First, reallocating computation from high-resolution decoders to the mid-encoder preserves thin-anatomy boundaries while reducing cost. Second, support-confined region contrast addresses errors between nested anatomical compartments, with anatomy-dependent triggers selecting when the rule applies. These principles produce LeanNeXt (0.78 MACs and 0.92 training-step time relative to nnU-Net; +1.63 Dice points on four-fold KiTS23 cross-validation) and trigger-routed LeanNeXt+. The latter improves all 15 evaluated CT/MRI settings over nnU-Net and exceeds the 3.3 larger ResEnc-M on 12 of 15 benchmarks at 0.30 its parameter count. Relative to random sampling, one-shot LLM generation, and score-selected agent search, the loop shows how failure analysis can yield reusable design rules across modalities.
Figures & tables
| Paradigm / System | Primary goal | Feedback signal | What agents generate | Experimental role | Final output |
|---|---|---|---|---|---|
| Auto-nnU-Net [ 2 ] | Per-dataset config | Multi-fidelity val. Dice | Hyperparameter/arch. configs | Rank candidates (10–1000 ep.) | Task configuration |
| AgentNAS [ 22 ] | Per-task model | Proxy val. score (30 % ep.) | Seed networks & recipes | Rank top-8 at full budget | Task network + recipe |
| Camyla [ 10 ] | End-to-end paper | Aggregate benchmark score | Candidate architectures | Keep best design per dataset | Per-dataset network |
| Ours | Discover design rules | Profiles + failure patterns | Falsifiable hypotheses | Test prospective predictions | LeanNeXt / LeanNeXt+ |
| nnU-Net [ 20 ] | MedNeXt-M [ 38 ] | ResEnc-1 [ 21 ] | ResEnc-M [ 21 ] | HyReX | LeanNeXt (ours) | LeanNeXt+ (ours) | |
| Cost on the KiTS23 plan | |||||||
| Parameters (M) | 31.20 | 17.55 | 31.76 | 102.35 | 29.66 | 31.04 | 31.04 |
| GMAC ( ) | 477.4 | 243.6 | 426.6 | 717.5 | 586.8 | 373.5 | 373.6 |
| Memory (GB) | 8.51 | 11.14 | 8.46 | 9.73 | 9.56 | 8.02 | 7.77 |
| Step (ms) | 123.3 | 672.3 | 121.7 | 164.6 | 172.7 | 113.1 | 117.1 |
| Design benchmarks (Dice, %) | |||||||
| Design paradigm | Representative / pool | In-budget hits | Cost ( nnU-Net) | KiTS23 Dice | Unseen Pancreas / HepV Dice | Positive transfer |
|---|---|---|---|---|---|---|
| Differentiable 3D NAS | A3DS DiNTS [ 13 ] | 0/1 | 29.2 GB VRAM | (65.28 %) | – | 0/3 design tasks |
| Manual 3D Transformers | SwinUNETR-V2 [ 15 ] / nnFormer [ 58 ] | 0/2 | 13.4 / 5.7 GB VRAM | / | – | 1/3 design tasks |
| Random grammar sampling | 15 random draws (same block library) | 0/15 | 1.75 step, 14/15 larger | med. (best ) | – | 6/15 screens |
| One-shot LLM generation | Single-prompt SP1 / SP2 (Claude Opus 5.5) | 0/2 | 3.46 par., 1.69 step | / (screen) | – | Over-budget only |
| Human uniform scaling | ResEnc-M [ 21 ] / MedNeXt-M [ 38 ] | 0/2 | 3.3 par. / 5.45 step | / | / (ResEnc-M) | 12/15 (ACDC OOM ) |
| Score-driven agent (same LLM) | Waves 1–3 (10 models; top: HyReX) | 0/10 | 1.23 MACs, 1.40 step | med. ( CV) | / ( neg. transfer ) | 9/11 benchmarks |
| Rule | Observation (diagnosis) | Hypothesis & intervention | Prediction before training | 4-fold CV / replication outcome | Verdict |
|---|---|---|---|---|---|
| R1 | Two finest decoder stages: 56.0 % of MACs, 1.6 % of parameters | One conv + additive skip per decoder stage (replacing concat + two convs) | Faster; large organs flat; thin, boundary-dominated organs regress | 0.81 step; KiTS23 ; oesophagus vs. liver | Confirmed; regression seeds R2 |
| R2 | R1’s per-organ loss grows with boundary share ( ) | Reinvest saved MACs in mid-encoder depth (E2, E3) | Boundary-dominated classes recover; gain rises with boundary share | AMOS22, ACDC (8/8 folds); ( ) | Confirmed |
| R3 | Dense kernels are costly at fine stages | ConvNeXtV2 blocks at coarsest stages only | Pays where a kernel spans the feature map | Over R1 R2: KiTS23, AMOS22; without R2: | Confirmed with R2 |
| – | KiTS23 tumour Dice tracks precision ( ); false tumours in cyst-bearing kidneys | Learned global context (anatomy tokens) at every decoder stage | Fewer false-positive tumours and distant components | over nnU-Net, trailing LeanNeXt ( ) | Refuted; points to calibrated cues |
| R4 | Nested-subtype calls flip at inside the 20–40 HU window | Masked region-level contrast statistics fed to two decoder stages | Subtype precision rises on complex masses; constant inputs stay flat | over LeanNeXt ; constants ; false tumour/mL cyst 0.397 0.170 | Confirmed |
| Design (CT & MRI) | Unseen (CT & MRI) | Isolated rule effect ( Dice) | ||||||||||
| Rule | Pre-training trigger | KiTS23 | AMOS22 | ACDC | LiTS | BTCV | Pancreas | BraTS | Architectural action | KiTS23 | AMOS22 | ACDC |
| R1 | Fine-decoder MAC share (%) | 56.0 | 42.8 | 41.7 | 56.0 | 42.8 | 42.8 | 55.4 | Single decoder conv + additive skip | |||
| R2 | Classes with boundary share | 0/3 | 8/15 | 3/3 | 1/2 | 6/13 | 1/2 | 1/3 | Reinvest in encoder depth (4, 3 residual blocks at E2, E3) | |||
| R3 | Coarsest feature-map size | Four ConvNeXtV2 blocks at coarsest stages (0.040 dense MACs) | ||||||||||
| R4 | Multi-compartment topology ( ) | Yes (3) | Yes (15) | Yes (3) | Off | Yes (13) | Off | Yes (3) | Masked region contrast & anatomy-conditioned moments at decoder | – | ||
| Network | Par. | GMAC | Step | Dice |
|---|---|---|---|---|
| Rules R1 R3 | 0.68 | 0.54 | 0.77 | |
| nnU-Net, width 0.70 | 0.49 | 0.54 | 0.96 | |
| nnU-Net, width 0.82 | 0.67 | 0.64 | 1.01 | |
| EffiDec3D-style decoder | 0.54 | 0.56 | 0.68 |
| (a) Stage-by-stage topology, parameters (M), and multiply-adds (GMAC) on KiTS23 | |||||||||||
| nnU-Net (default) | LeanNeXt-S (R1 R3) | LeanNeXt (R1 R2 R3) | |||||||||
| Stage | Map | Ch. | Blocks | Blocks | Blocks | ||||||
| E0 | 128 3 | 32 | 2 conv | 0.03 | 59.8 | 2 conv | 0.03 | 59.8 | 2 conv | 0.03 | 59.8 |
| E1 | 64 3 | 64 | 2 conv | 0.17 | 43.5 | 2 conv | 0.17 | 43.5 | 2 conv | 0.17 | 43.5 |
| E2 | 32 3 | 128 | 2 conv | 0.66 | 21.7 | 2 conv | 0.66 | 21.7 | 4 res | 3.33 | 109.0 |
| E3 | 16 3 | 256 | 2 conv | 2.66 | 10.9 | 2 conv | 2.66 | 10.9 | 3 res | 9.77 | 40.0 |
| Contrast | Dice | Folds up |
|---|---|---|
| Control LeanNeXt | – | |
| LeanNeXt+ control | [ , ] | 4/4 |
| LeanNeXt+ LeanNeXt | – |
| Benchmark | Dice | NSD@1mm | NSD@2mm | |
|---|---|---|---|---|
| Design | KiTS23 | |||
| AMOS22 | ||||
| ACDC | ||||
| Locked | AMOS22 | |||
| ACDC | ||||
| Pancreas |
| Paired contrast (KiTS23) | Dice | 95 % CI | ( ) | Seed 0 | Seed 1 |
|---|---|---|---|---|---|
| LeanNeXt nnU-Net | [ , ] | 8/8 (0.0039) | +1.63 | ||
| LeanNeXt+ LeanNeXt | [ , ] | 7/8 (0.0352) | |||
| LeanNeXt+ nnU-Net | [ , ] | 8/8 (0.0039) | |||
| LeanNeXt+ ResEnc-M | [ , ] | 6/8 (0.1445) | |||
| ResEnc-M nnU-Net | [ , ] | 8/8 (0.0039) |
3D Medical Image Segmentation
3D Medical Image Segmentation identifies organs, lesions, and fine structures in volumetric scans for measurement and clinical planning.
See all 246 papers