MedNeXt-B Expert-Initialised Patch-wise MoE (V3) — BraTS 2023 GLI (5-fold CV)
3D segmentation of brain tumor regions (NCR, edema, enhancing tumor) on multi-modal MRI (T1, T1ce, T2, FLAIR), trained on the BraTS 2023 GLI challenge dataset using nnU-Net v2. This is the MoE patch-wise V3 — the winning arm of the paper "The Gate Does Not Choose": a MedNeXt-B with one residual sparse MoE layer in the decoder (after dec_block_0): 4 experts, each a full MedNeXt block initialised from one 300-epoch expert checkpoint (Baseline, DistMap, Kervadec, BlobLoss β = 0.5), routed per patch by a noisy top-2 gate (2Conv-GAP) on a 3×3×3 grid with halos. No external experts, no cached probabilities : everything lives in one network (~10.6 M parameters, +0.1 % over the baseline), end-to-end trained for 300 epochs per fold.
This repository ships the 5 cross-validation folds of the model. Use the same fold-of-the-patient at inference, or ensemble all 5 folds (BraTS-style soft voting).
Official BraTS-2023 results (lesion-wise protocol S1, paired against the same-fold baseline)
| Fold | Δ lesion-wise Dice | p (paired) | Δ lesion-wise HD95 | n |
|---|---|---|---|---|
| fold 0 | +0.0041 | 3.1e-04 | -0.97 mm | 239 |
| fold 1 | +0.0082 | 1.8e-12 | -3.07 mm | 239 |
| fold 2 | +0.0045 | 5.2e-07 | -1.22 mm | 239 |
| fold 3 | +0.0092 | 2.6e-09 | -2.78 mm | 239 |
| fold 4 | +0.0025 | 1.0e-12 | +1.62 mm | 239 |
Mean Δ over the 5 folds : +0.0057 — positive on 5/5 folds, above the pre-declared smallest effect of interest (SESOI = 0.003) on 4/5. The best of 24 training-free consensus operators reaches only +0.0013 in the same study (gate margin +0.0044 ≈ 1.5× SESOI). Measured routing: part_max 0.507–0.583 and H_patch_net 0.892–0.995 with 0 dead expert — the gain is real but the gate stays near-uniform, hence the title.
Per-fold validation Dice (best EMA, foreground-mean)
| Fold | Best EMA Dice | Trained epochs | n_tensors |
|---|---|---|---|
| fold 0 | 0.9396 | 300 | 273 |
| fold 1 | 0.9396 | 300 | 273 |
| fold 2 | 0.9417 | 300 | 273 |
| fold 3 | 0.9398 | 300 | 273 |
| fold 4 | 0.9396 | 300 | 273 |
Files
fold_{0..4}/model.safetensors— network weights including the 4 experts and the patch gate (weights-only, no optimizer state)fold_{0..4}/dist_head.safetensors— auxiliary SDT head. Honest note : V3 is trained withlambda_dist = 0.0, so this head is instantiated but not driven by the loss ; it ships for completeness and is not needed for inference.fold_{0..4}/metadata.json— trainer name, best EMA Dice, mirroring axes, λ_distfold_{0..4}/plans.json— nnU-Net architecture plan (patch size 128³, BS 2, MedNeXt-B)
Usage
import torch
from safetensors.torch import load_file
from huggingface_hub import hf_hub_download
# Pick a fold (0–4), or load all 5 for ensembling
fold = 0
weights_path = hf_hub_download(repo_id="guillaume-cassez/mednext-moe-v3-brats2023gli", filename=f"fold_{fold}/model.safetensors")
plans_path = hf_hub_download(repo_id="guillaume-cassez/mednext-moe-v3-brats2023gli", filename=f"fold_{fold}/plans.json")
state_dict = load_file(weights_path)
# Build the MedNeXt model with nnU-Net v2 (see https://github.com/MIC-DKFZ/nnUNet)
# and load the state_dict :
# model.load_state_dict(state_dict)
The state dict is not a stock MedNeXt-B : it carries the expert branches and the gate. To rebuild the network you need the custom trainer shipped in the companion Zenodo deposit (code/nnUNetTrainerMedNeXtMoEPatchV3.py + code/moe_patch3d.py), on top of nnU-Net v2 (https://github.com/MIC-DKFZ/nnUNet) and MedNeXt (https://github.com/MIC-DKFZ/MedNeXt). Preprocessing: the same nnUNetPlans_96GB_mednext plan (plans.json).
Training details
- Architecture : MedNeXt-B + one residual
PatchMoE3Dlayer in the decoder — 4 MedNeXt-block experts (init : Baseline, DistMap, Kervadec, BlobLoss checkpoints), top-2 noisy gate (Shazeer noise, 40-epoch anneal), 3×3×3 patch grid with halos, switch balance loss (w = 0.001), exp_r = 2 - Framework : nnU-Net v2, custom trainer
nnUNetTrainerMedNeXtMoEPatchV3 - Input : 4-modality MRI (T1, T1ce, T2, FLAIR), patch 128³, BS 2, BF16
- Hardware : RTX PRO 6000 Blackwell (96 GB)
- Schedule : 300 epochs per fold, seed 42
- Cross-validation : 5-fold stratified by patient ID (239–240 validation patients per fold)
Companion artefacts
- 📄 Companion paper (v0.13, 2026-09-22) : The Gate Does Not Choose: An Expert-Initialised Mixture-of-Experts Outperforms Training-Free Consensus under the Official BraTS-2023 Metrics — Guillaume Cassez, Stanislas Larnier · CC-BY-4.0 · official BraTS-2023 lesion-wise metrics, 5-fold cross-validation, n = 1 196 patients. Concept DOI (always resolves to the latest version) : 10.5281/zenodo.22776410
- 🌐 Paper page : https://guillaume-cassez.fr/imagerie-medicale/brats/consensus-vs-moe/
- 🏥 Medical imaging hub : https://guillaume-cassez.fr/imagerie-medicale/
- 🧠 Interactive 3D viewer : https://guillaume-cassez.fr/imagerie-medicale/brats/2023-distance-map/viewer/ — 1 196 patients, four experts and the consensus operators side by side with ground truth (WebGL, nothing to install)
- 📊 Per-patient metrics : https://guillaume-cassez.fr/imagerie-medicale/brats/2023-distance-map/ranking/
- 💻 Code : the trainer, evaluation pipeline and per-patient CSVs ship inside the Zenodo deposit above (
code/anddata/folders of the paper bundle). Paper 1's standalone repository : https://github.com/guillaume-cassez/brats-moe-distmap-fusion-1 - 🤝 Sister models (same programme, same folds, same evaluation code path) :
Related publications (same research programme, BraTS 2023 GLI)
Open-access Zenodo preprints, all evaluated under the official BraTS-2023 lesion-wise metrics:
- Two Models That Agree Beat the Best of Them Alone: Parameter-Free Connected-Component Consensus That Beats the Baseline under the Official BraTS-2023 Metrics (v10) — 10.5281/zenodo.19695263 · paper page
- Precision Pays: A Fixed-Weight Boundary Loss Anchors the Precision End of a Recall–Precision Axis and Wins as the Consensus Veto under the Official BraTS-2023 Metrics (v2.6) — 10.5281/zenodo.22906446 · paper page
- The Gate Does Not Choose: An Expert-Initialised Mixture-of-Experts Outperforms Training-Free Consensus under the Official BraTS-2023 Metrics (v0.13) — 10.5281/zenodo.22776410 · paper page
License
Weights: MIT. The companion paper is CC-BY-4.0.