[Paper Review] Medical diffusion on a budget: Textual Inversion for medical image generation
The authors show that pre-trained Stable Diffusion models can be adapted to multiple medical imaging modalities by training small textual embeddings (via textual inversion) with only 100 examples on a consumer GPU, enabling realistic medical image generation, data augmentation, and flexible disease manipulation.
Diffusion models for text-to-image generation, known for their efficiency, accessibility, and quality, have gained popularity. While inference with these systems on consumer-grade GPUs is increasingly feasible, training from scratch requires large captioned datasets and significant computational resources. In medical image generation, the limited availability of large, publicly accessible datasets with text reports poses challenges due to legal and ethical concerns. This work shows that adapting pre-trained Stable Diffusion models to medical imaging modalities is achievable by training text embeddings using Textual Inversion. In this study, we experimented with small medical datasets (100 samples each from three modalities) and trained within hours to generate diagnostically accurate images, as judged by an expert radiologist. Experiments with Textual Inversion training and inference parameters reveal the necessity of larger embeddings and more examples in the medical domain. Classification experiments show an increase in diagnostic accuracy (AUC) for detecting prostate cancer on MRI, from 0.78 to 0.80. Further experiments demonstrate embedding flexibility through disease interpolation, combining pathologies, and inpainting for precise disease appearance control. The trained embeddings are compact (less than 1 MB), enabling easy data sharing with reduced privacy concerns.
Motivation & Objective
- Demonstrate that a diffusion model trained on natural images can be adapted to multiple medical imaging modalities via textual inversion.
- Evaluate how embedding size, training cases, and inference settings affect generation quality in the medical domain.
- Show practical applications: synthetic data augmentation for classification, disease progression interpolation, and inpainting for controlled disease appearance.
- Highlight the privacy-friendly, small-size embeddings suitable for sharing medical data.
Proposed method
- Use Stable Diffusion v2.0 with a frozen architecture and train a new token embedding for each medical concept via textual inversion.
- Train embeddings with a constant learning rate (0.005) for 50,000 steps on 100 cases per class, batch size 1.
- Prompts during training use only the embedding name (no templates), and evaluation uses Fréchet Inception Distance (FID) across 100 generated vs 100 real samples per setting.
- Assess inference parameters (sampling steps, CFG scale) and embedding vector sizes (8–64) to determine optimal generation quality.
- Demonstrate composable diffusion by combining multiple embeddings in prompts to generate images with multiple pathologies or varying disease progression.
- Show inpainting by masking regions and conditioning the diffusion model on disease embeddings to place pathology at specific locations.

Experimental results
Research questions
- RQ1Can textual inversion adapt a pre-trained natural-image diffusion model to diverse medical imaging modalities with as few as 100 training cases?
- RQ2How do embedding size, number of training cases, and inference settings affect generation quality for medical images?
- RQ3Can embeddings support compositional prompts, disease progression interpolation, and targeted inpainting in medical images?
- RQ4Do synthetic data generated from embeddings improve downstream medical classification in low-data regimes?
Key findings
- Embeddings trained with 100 cases per class and vector size 64 yield superior generation realism compared to smaller sizes or fewer cases.
- Increasing the number of training cases improves embedding quality more than modest changes to steps or CFG scale.
- Using synthetic data augmented the prostate cancer classifier trained on multi-modal MRI from AUC 0.78 to 0.80 (2% absolute gain) when adding 2000 synthetic cases.
- Embeddings are capable of interpolating between healthy and diseased states and enabling composition of multiple pathologies in a single image.
- Inpainting can precisely place disease appearance in specified image regions, enabling control over disease location and extent.
- The trained embeddings are small (under 1 MB) and can be shared with reduced privacy concerns.

Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.