Keeping Low-Rank Adapters Off the Hospital Signal in Few-Shot Medical Imaging

When a hospital wants a pretrained medical image model to recognize a new finding, it usually has a handful of labeled cases, often a dozen or fewer, and these frequently come from whichever scanner or site happened to collect them. A standard fix is low-rank adaptation (LoRA). LoRA freezes the large model and trains small add-on weight matrices inside it, and it now wins most adaptation benchmarks in pathology. But with so few examples, the easiest pattern for those add-on weights to learn may be "which hospital did this image come from" rather than "what disease is shown." We propose to measure whether LoRA does this when site and label are confounded in a tiny training set. We also propose a direct fix. Estimate the directions inside the model that encode acquisition site, using unlabeled images from each site where disease prevalence is not tied to site. Then forbid the adapter from writing anything along those directions.

The idea fits in two sentences. Low-rank adapters trained on a few site-confounded examples probably spend their limited capacity on scanner and site cues. Projecting the adapter's output away from a site subspace learned from unlabeled data should keep the gains of white-box adaptation without the shortcut. What is new is the source of the "nuisance" directions: cheap unlabeled site metadata, not the support set. When site and label are perfectly confounded in the support set, no method that looks only at the support set can separate them.

Where This Sits

Two bodies of evidence pull in opposite directions, and that tension is the motivation. Benchmarking pathology foundation models compares full fine-tuning, partial tuning, linear probing and LoRA across 14 datasets. LoRA had the highest win rates, beating full fine-tuning by 85% and partial fine-tuning by 75% in win rate. The same benchmark found that in 1-shot out-of-domain settings a frozen nearest-neighbor lookup beat gradient-based few-shot methods, so updating weights on tiny data can distort good representations. Separately, Unveiling COVID-19 from Chest X-ray showed that models trained on 447 chest X-rays group images by source dataset and fail across sites. ShorT showed that chest X-ray classifiers encode age and race as shortcuts. Neither line of work asks whether LoRA's low-rank restriction protects against site shortcuts or concentrates on them.

The closest few-shot work is SS-Text+. It is a closed-form adapter on frozen embeddings from medical vision-language models (CONCH, FLAIR, CONVIRT). It handles imbalanced and missing classes by falling back to text prototypes, and it needs no validation set. It never touches the backbone; its authors list white-box fine-tuning as open. It also assumes the frozen features are free of site cues. HAAF does insert adapters into intermediate visual layers for 4-shot pathology anomaly detection, which shows white-box adapters can help at this scale. It does not consider confounded support sets. Our proposal reuses SS-Text+ as the classification head and HAAF-style intermediate adapters. It adds the one thing neither has: a constraint on what the adapter may learn, informed by site.

For the constraint we draw on SilverLining. It removes spatial and spectral shortcuts from images before training and improves cross-hospital chest X-ray AUC from 0.72 to 0.77. It also warns that naive masking creates new confounders. That warning is why we act on internal features rather than pixels.

Core Claim

Our hypothesis concerns a support set of $K$ examples per class whose site composition is correlated with the label. Under that condition, the update learned by an unconstrained LoRA adapter will place a large share of its energy along directions that predict acquisition site. That share should grow as $K$ shrinks and as the confound strengthens. We further hypothesize a fix. If the adapter's output at each layer is restricted to the complement of a site subspace, estimated from unlabeled multi-site data, shortcut reliance will fall. Accuracy on site-balanced and anti-correlated test sets will then exceed both unconstrained LoRA and frozen-feature adapters.

Research Program

The method has one equation. At transformer layer $l$, write $h_l$ for the token representation and $B_l A_l$ for the low-rank adapter. Let $U_l$ be an orthonormal basis of a $k$-dimensional site subspace. The adapted layer computes

$$h_l' = h_l + (I - U_l U_l^\top)\, B_l A_l h_l .$$

The adapter can therefore change the representation only in directions that do not separate sites.

We estimate $U_l$ once per backbone, before any labels are seen. We run the frozen model on an unlabeled pool from each participating site; the pool can be a few hundred images, with the site's natural mix of findings. We then take the top $k$ discriminant directions for site at that layer. Disease labels never enter this step. The estimate stays valid when the support set is perfectly confounded, provided that within each site's unlabeled pool, site is not a proxy for disease. We test that assumption directly. On top of the final embedding, also projected, we fit SS-Text+ in closed form, so the pipeline still needs no validation set.

The program has three parts. The first is a measurement study on unconstrained LoRA. We compute the fraction of each layer's adapter-output energy that falls inside $U_l$, along with a linear probe's accuracy at predicting site from adapted features. Both are measured as functions of shot count, confound strength and LoRA rank. This answers the open question on its own, whatever happens to the method. The second part is the constrained adapter and its sensitivity to $k$. The third part tests where the site estimate breaks: pools that are themselves label-skewed, pools from only a subset of sites, and test sites never seen during estimation.

Baselines

The naive reference is zero-shot classification with the vision-language model's text prompts. It is unaffected by the support set's confound, so it is the floor that any adaptation must clear on anti-correlated test data. Next is frozen nearest-neighbor and prototype lookup, as in the pathology benchmark. That benchmark reports KNN winning at 1-shot out-of-domain, but the file gives no numeric value for it, so we will report our own.

The strongest existing competitor is SS-Text+ on frozen features. It is the best-published method for realistic few-shot medical vision-language adaptation, and because it never updates the backbone it cannot learn new shortcuts. The file reports no per-dataset accuracy for it. The only figure is that standard linear probes drop nearly 5 accuracy points under imbalanced or missing-class settings, a gap SS-Text+ avoids. We will run it on identical embeddings and support sets.

We also include unconstrained LoRA with the same rank, layers and SS-Text+ head; this is the pathology benchmark's winning recipe. We include LoRA with a ShorT-style gradient-reversal site head, which is the standard active debiasing alternative. We include SilverLining-style input preprocessing followed by LoRA; SilverLining's reported cross-hospital AUC of 0.77 on MIMIC-CXR plus CheXpert is the reference number for that pipeline at full data scale.

Two ablations isolate the key ingredient. In the first, a random $k$-dimensional projection replaces the site subspace, which separates "less capacity" from "the right directions removed." In the second, the frozen-feature version projects only the final embedding with $I - U U^\top$ and then applies SS-Text+, with no LoRA at all.

Every method sees the same support sets, the same unlabeled pools (gradient reversal and our estimator are the only ones that use pools or site labels), the same seeds, and a fixed small grid of hyperparameters. Following SS-Text+, all tuning is done once on a separate development task, not on target data. Beating the competitors means higher accuracy and AUC on the worst group and on anti-correlated test sets than both SS-Text+ and unconstrained LoRA, at matched accuracy on the in-distribution test, with confidence intervals across 20 resampled support sets.

Why not just…?

Why not just keep the backbone frozen and use SS-Text+ or KNN? Freezing prevents new shortcuts but cannot add pathology-specific detail the backbone lacks. HAAF attributes failures of frozen vision-language features to a mismatch between the coarse features they encode and fine-grained histology. The pathology benchmark reports LoRA F1 gains up to 0.324 on DigestPath over frozen approaches. Still, this is a real threat when shots are very few, and the 1-shot KNN result says so. Our shot sweep covers 1, 4 and 16, and we will state plainly any regime where frozen methods win.

Why not just project the site subspace out of frozen features, without any adapter? This is the most serious alternative. It is cheaper and reuses our own site estimate, which is why it is an ablation and not an afterthought. If it matches the constrained adapter at every shot count, the right conclusion is that the site subspace, not white-box adaptation, carries the benefit, and we will report it that way. We expect the adapter to win where the frozen features are missing task detail, which is most likely in pathology subtyping, but this is what the experiment decides.

Why not just add an adversarial site head, as in ShorT? Gradient reversal learns the site direction from the labeled support set. When site and label are confounded there, the adversary also removes the disease signal, and adversarial training with a dozen examples is unstable. ShorT's own successes were at full dataset scale. The confounded-support experiment directly compares the two ways of learning the nuisance direction: from support labels, or from unlabeled pools.

Why not just crop to the anatomy or clean the images first? Lung segmentation removed scanner text in the COVID study. SilverLining showed that masking creates new class-correlated blank regions and leaves frequency-domain scanner signatures untouched. We run the preprocessing baseline to measure how much site information survives cleaning, using the site probe on its features.

Proposed Experiments

The primary setting is chest radiography with CONVIRT, using MIMIC-CXR and CheXpert as two sites. SilverLining already documents a cross-hospital shortcut problem on this pair. We build $K$-shot support sets, $K \in \{1, 4, 16\}$, for findings such as cardiomegaly and effusion. The fraction of positives drawn from one hospital ranges from 50% (no confound) to 100% (full confound). We test on site-balanced and site-reversed sets, and draw unlabeled pools from each hospital's remaining images. NIH ChestX-ray14 serves as a held-out third site.

The secondary setting is histology with CONCH. Colorectal tissue sources (CRC-TP, Kather19 and NCT-CRC) act as sites for tissue-type classification, with the same confound construction. BRACS provides a harder breast subtyping transfer test.

Metrics are AUC and accuracy on the worst group and the reversed-site sets, the drop from in-distribution to reversed, and site-probe accuracy on adapted features. We also report the adapter-energy fraction inside $U_l$, which is the diagnostic behind the core claim.

Three checks are decisive. First, unconstrained LoRA's site-energy fraction and reversed-set error should rise together as the confound grows. If they do not, the premise fails, and the measurement study becomes a negative result that is useful to report. Second, the constrained adapter must beat the random-projection ablation at equal $k$; otherwise its benefit is merely reduced capacity. Third, the constrained adapter must beat frozen-feature projection plus SS-Text+ at four or more shots on at least one domain; otherwise white-box adaptation is not justified at this scale. A final stress test estimates $U_l$ from deliberately label-skewed pools, to show how much the method depends on its one assumption.