Demographic Encoding is Not Exposure: Fairness and Privacy in Chest X-ray Foundation Models
Organizations: Department of Computer Science and Engineering, Shiraz University, Shiraz, Iran. · College of Engineering & Computer Science, VinUniversity, Hanoi, Vietnam.
Abstract
Medical foundation models encode patient demographics and can reveal whether a patient was in the training set, and these properties are often treated as one problem. We tested whether they are aligned by measuring demographic encoding, diagnostic fairness gaps and membership-inference vulnerability on the same models. We trained 200 linear or multilayer-perceptron (MLP) heads on frozen BiomedCLIP, DINOv2 and RAD-DINO embeddings, with three seeds, and audited them on CheXpert and NIH ChestX-ray14. Demographic encoding explained almost no variance in patient vulnerability, and all 72 CheXpert associations were statistically equivalent to zero. Erasing linearly decodable demographics left leakage unchanged but reduced age-related underdiagnosis gaps. Leakage depended instead on head capacity and training length. On RAD-DINO, a linear head reached a membership-inference area under the curve (AUC) of 0.694, compared with 0.907 for a 30-epoch MLP, at similar test performance. Fairness and privacy should therefore be audited separately, and linear heads or shorter training reduce leakage with little or no loss of utility. The code is available on GitHub for public use.
Figures & tables
| Dataset | Patients | Images | Audit records | Labels | Attributes | Encoders |
|---|---|---|---|---|---|---|
| CheXpert-small | 15,000 | 44,622 | 31,601 | 14 | sex, race, age | BiomedCLIP, DINOv2, RAD-DINO |
| NIH ChestX-ray14 | 15,000 | 54,521 | 38,316 | 15 | sex, age | BiomedCLIP, RAD-DINO |
| Setting | Value | |
|---|---|---|
| Heads | Architecture | Linear, or MLP with GELU (512 hidden units; 8 and 64 in the sweep) |
| Number of models | 200 (each patient in 100 models) | |
| Optimizer, weight decay | AdamW [ 26 ] , | |
| Learning rate | (linear), (MLP) | |
| Schedule | Cosine annealing to zero | |
| Batch size , epochs | 2048, 30 (5 in the sweep) |
| Dataset | Encoder / head | Test AUROC | MIA AUC | TPR@ FPR (%) | Patient AUC p99 | Patients AUC 0.9 (%) |
|---|---|---|---|---|---|---|
| CheXpert | BiomedCLIP / Linear | 0.733 0.003 | 0.568 0.000 | 0.47 0.04 | 0.725 0.001 | 0.0 0.0 |
| BiomedCLIP / MLP | 0.731 0.004 | 0.698 0.001 | 1.62 0.06 | 0.939 0.003 | 2.9 0.0 | |
| DINOv2 / Linear | 0.714 0.003 | 0.653 0.000 | 1.37 0.05 | 0.869 0.005 | 0.6 0.0 | |
| DINOv2 / MLP | 0.715 0.005 | 0.827 0.001 | 5.34 0.09 | 0.993 0.001 | 28.3 0.1 | |
| RAD-DINO / Linear | 0.772 0.006 | 0.694 0.001 | 2.88 0.12 | 0.918 0.004 | 1.4 0.1 | |
| RAD-DINO / MLP | 0.766 0.005 | 0.907 0.000 | 12.43 0.22 | 1.000 0.000 | 59.6 0.4 |
| Encoder | Head | Test AUROC | MIA AUC | TPR@ FPR (%) | Patients AUC 0.9 (%) |
|---|---|---|---|---|---|
| CheXpert / BiomedCLIP | Linear | 0.736 | 0.568 | 0.51 | 0.0 |
| MLP-8, 30 ep | 0.632 | 0.503 | 0.11 | 0.0 | |
| MLP-64, 30 ep | 0.724 | 0.550 | 0.24 | 0.0 | |
| MLP-512, 5 ep | 0.725 | 0.555 | 0.35 | 0.0 | |
| MLP-512, 30 ep | 0.734 | 0.698 | 1.67 | 2.9 | |
| CheXpert / RAD-DINO | Linear | 0.779 | 0.694 | 3.02 | 1.4 |
| Dataset | Head regime / attribute | Runs | Partial range | Widest 95% CI | -equiv. | max (CI upper) | -equiv. |
|---|---|---|---|---|---|---|---|
| CheXpert | Linear / Sex | 9 | [-0.012, +0.020] | [-0.029, +0.039] | 9/9 | 0.0009 | 9/9 |
| Linear / Race | 9 | [-0.027, +0.016] | [-0.049, +0.037] | 9/9 | 0.0013 | 9/9 | |
| Linear / Age group | 9 | [-0.032, +0.013] | [-0.051, +0.034] | 9/9 | 0.0016 | 9/9 | |
| MLP-512, 30 ep / Sex | 9 | [+0.001, +0.027] | [-0.016, +0.048] | 9/9 | 0.0014 | 9/9 | |
| MLP-512, 30 ep / Race | 9 | [-0.005, +0.035] | [-0.027, +0.056] | 9/9 | 0.0018 | 9/9 | |
| MLP-512, 30 ep / Age group | 9 | [-0.008, +0.028] | [-0.028, +0.047] | 9/9 | 0.0011 | 9/9 |
| Linear probe | MLP probe | ||||||
|---|---|---|---|---|---|---|---|
| Encoder | Embedding | Age | Race | Sex | Age | Race | Sex |
| BiomedCLIP | Original | 0.746 | 0.704 | 0.893 | 0.820 | 0.683 | 0.914 |
| LEACE | 0.442 | 0.512 | 0.564 | 0.561 | 0.591 | 0.794 | |
| RAD-DINO | Original | 0.872 | 0.802 | 0.998 | 0.853 | 0.804 | 0.998 |
| LEACE | 0.511 | 0.541 | 0.683 | 0.692 | 0.666 | 0.994 | |
Medical Imaging Foundation Models
Medical imaging foundation models learn reusable representations for tasks across clinical images, modalities, and institutions.
See all 264 papers