nnFoundationViT-ReportGen-Merlin

Copyright German Cancer Research Center (DKFZ) and contributors. Please make sure that your usage of these models is in compliance with their license.

nnFoundation paper RMR paper Code

nnFoundationViT-ReportGen-Merlin generates radiology reports (findings and impression) for abdominal CT volumes. Frozen nnFoundationViT features are passed through a trainable adapter to Qwen3-VL-2B-Instruct, adapted with LoRA, and trained on the Merlin dataset. The training recipe builds on the findings of Resolution Meets Reduction (RMR) and improves on the report-generation models of the nnFoundation paper; we recommend it for generating reports on new abdominal CT.

For chest CT, use nnFoundationViT-ReportGen-CT-RATE.

Model

Component Details Trained
Vision encoder nnFoundationViT, 192³ input, 24³ = 13,824 patch tokens Frozen
Adapter Normalization and MLP applied to each patch token, no token reduction Fully
Language model Qwen3-VL-2B-Instruct LoRA (r 32, α 64) on attention, MLP, and lm_head

This repository holds only the trained weights (adapter and LoRA, 46M parameters); the encoder and the language model are downloaded from their own repositories.

Usage

Reports are generated with inference_nifti.py from the code repository, for a folder of NIfTI volumes:

git clone https://github.com/MIC-DKFZ/3d_report_generation.git && cd 3d_report_generation
uv sync --locked --python 3.12 --extra totalsegmentator
uv run hf download MIC-DKFZ/nnFoundationViT-ReportGen-Merlin --local-dir models/merlin

uv run torchrun --standalone --nproc_per_node=<number of GPUs> inference_nifti.py \
  --checkpoint_dir models/merlin \
  --input_dir /path/to/abdominal_ct_volumes \
  --mask_dir /path/to/masks \
  --output_dir /path/to/reports

The reports are saved in inference_results.json. See report generation for NIfTI volumes for masks, offline use, and batching.

Expected input

Abdominal CT volumes as NIfTI files (.nii.gz or .nii). The script prepares each volume as in training, so no settings have to be passed: it reorients the volume, crops it to the foreground of its TotalSegmentator total mask (made if missing), resizes the crop to 192³, and applies z-score normalization.

Training

Setting Value
Data Merlin training split and the source validation studies outside the 1,000 held for validation, with the report cleaning and study exclusions of RMR (v2 dataset JSONs)
Epochs 32
Effective batch size 24
Optimizer AdamW, no weight decay
Learning rate Adapter 3e-4, LoRA 3e-4; the adapter first trains alone with a warmup, then all trained parameters warm up again, followed by a cosine decay

The released weights are the checkpoint with the best validation F1, from epoch 24.

Evaluation

Results on the 5,125 reports of the official Merlin test split, with greedy decoding. The clinical scores compare the findings that ModernBERT-Merlin extracts from the generated reports with the reference labels, as macro averages over its 30 findings.

Metric Value
F1 (macro) 0.503
Precision (macro) 0.556
Recall (macro) 0.468
CRG 0.498
BLEU-1 / BLEU-4 0.301 / 0.115
METEOR 0.184
ROUGE-L 0.268
CIDEr 0.023

The generated reports are in test_predictions/inference_results.json; join them with the dataset's reports by image_id to compute other metrics.

Intended use and limitations

  • Intended for research on radiology report generation, not for clinical decision-making or diagnosis. Generated reports can contain findings that are not present and miss findings that are.
  • Trained only on abdominal CT from Merlin, with English reports; other body regions, scanners, and report styles have not been evaluated.
  • Volumes are expected to be cropped to their TotalSegmentator mask. Reports for whole volumes (--allow_missing_masks) are less reliable, since the model saw almost none in training.

Repository contents

File Purpose
model.safetensors the trained adapter and LoRA weights
final_config.yml the training config, including the preprocessing and the encoder revision that inference_nifti.py reads
checkpoint_manifest.json checkpoint metadata
test_predictions/ the generated test-set reports and their metrics
LICENSE CC BY-NC-SA 4.0

Citation

If you use this model, please cite the nnFoundation paper for the vision encoder and RMR for the report-generation recipe:

nnFoundation BibTeX
@misc{harsy2026nnfoundation3dfoundationmodels,
  title         = {nnFoundation: 3D Foundation Models for Radiology},
  author        = {Ulrich Harsy, Constantin and Wald, Tassilo and Gotkowski, Karol and others},
  year          = {2026},
  eprint        = {2609.26924},
  archivePrefix = {arXiv},
  primaryClass  = {cs.CV},
  url           = {https://arxiv.org/abs/2609.26924}
}
RMR BibTeX
@misc{suprijadi2026resolutionmeetsreduction,
  title         = {Resolution Meets Reduction: Efficient Visual Context for 3D Radiology Report Generation},
  author        = {Suprijadi, Jonathan and Stock, Raphael and Langenberg, Moritz
                   and Zimmerer, David and Kahl, Kim-Celine and Denner, Stefan
                   and Kirchhoff, Yannick and Gotkowski, Karol and Rokuss, Maximilian
                   and Traub, Jeremias and Wald, Tassilo and Ulrich, Constantin
                   and Maier-Hein, Klaus},
  year          = {2026},
  eprint        = {2608.08713},
  archivePrefix = {arXiv},
  primaryClass  = {cs.CV},
  url           = {https://arxiv.org/abs/2608.08713}
}

Please also acknowledge Merlin (paper, dataset) and Qwen3-VL.

License

The weights and this model card are licensed under CC BY-NC-SA 4.0, matching the non-commercial terms of the Merlin training data. The vision encoder (nnFoundationViT, CC BY-SA 4.0) and the language model (Qwen3-VL-2B-Instruct, Apache 2.0) are not included and keep their own licenses.

Downloads last month

-

Downloads are not tracked for this model. How to track
Safetensors
Model size
46.2M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for MIC-DKFZ/nnFoundationViT-ReportGen-Merlin

Adapter
(141)
this model

Papers for MIC-DKFZ/nnFoundationViT-ReportGen-Merlin