Physics-Grounded Adversarial Stain Augmentation with Calibrated Coverage Guarantees

Mingi Hong · 2026

Read Physics-Grounded Adversarial Stain Augmentation with Calibrated Coverage Guarantees by Mingi Hong (2026) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2605-13889.txt.

Introduction

Mingi Hong proposes Calibrated Adversarial Stain Augmentation, performing adversarial augmentation in Macenko stain parameter space with a budget set from multi-center statistics. On Camelyon17-WILDS over 5 seeds, CASA reaches 93.9 percent plus or minus 1.6 percent slide-level accuracy. That beats HED-strong at 88.4 percent plus or minus 7.3 percent, RandStainNA at 85.2 percent plus or minus 6.7 percent, and ERM at 63.9 percent plus or minus 11.3 percent.

Catalog record

CREATORMingi Hong
YEAR2026
COLLECTIONPAPERS
FORMATTXT
FILE SIZE8766
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2605.13889

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

Physics-Grounded Adversarial Stain Augmentation with Calibrated Coverage Guarantees
Mingi Hong

Abstract
Stain variation across hospitals degrades histopathology models at deployment. Existing augmentation methods perturb color spaces with arbitrary hyperparameters, lacking both a principled budget and coverage guarantees for unseen centers. We propose C alibrated A dversarial S tain A ugmentation ( CASA ), which performs adversarial augmentation in the Macenko stain parameter space with a budget calibrated from multi-center statistics via the DKW inequality. On Camelyon17-WILDS (5 seeds), CASA achieves 93.9 % ± 1.6 % 93.9\%\pm 1.6\% slide-level accuracy—outperforming HED-strong ( 88.4 % ± 7.3 % 88.4\%\pm 7.3\% ), RandStainNA ( 85.2 % ± 6.7 % 85.2\%\pm 6.7\% ), and ERM ( 63.9 % ± 11.3 % 63.9\%\pm 11.3\% )—with the highest worst-group accuracy ( 84.9 % ± 0.9 % 84.9\%\pm 0.9\% ) among all 10 compared methods.



\jmlrpages
\midlauthor
\orcid

0009-0009-4121-5765

434, Samseong-ro, Gangnam-gu, Seoul, Republic of Korea

†
†
proceedings:
MIDL: Medical Imaging with Deep Learning
†
†
year:
2026
†
†
workshop:
Short Paper Track

keywords

Histopathology, Domain Generalization, Adversarial Augmentation, Distributionally Robust Optimization

1
Introduction

Hematoxylin and Eosin (H&E) staining varies across hospitals due to differences in reagent concentrations, protocols, and scanners.
This variation causes models trained at one center to degrade at another, limiting clinical deployment
8
.

Existing approaches fall into two categories.

Stain normalization
transforms images to a reference template but introduces artifacts and depends on template selection
4
.

Stain augmentation
increases color diversity during training; Tellez et al. showed that random perturbation in HED space improves generalization
8
, and RandStainNA bridges augmentation with normalization in LAB space
7
.
However, random methods require manual selection of perturbation strength (
\sigma
), and this choice affects OOD performance: we observe an 8 percentage point gap between HED-light (
\sigma{=}0.05
,
80.4\%
) and HED-strong (
\sigma{=}0.2
,
88.4\%
) on Camelyon17-WILDS, with no principled criterion for selecting
\sigma
.

Recent adversarial augmentation methods—AdvST
9
and Zhong et al.
10
—learn worst-case perturbations via PGD but operate in generic color spaces (HSV, contrast) with arbitrary budgets unconnected to the physical staining process.

If instead the model trains on the
hardest
stain variation within a realistic range, it should generalize to any center whose stain falls within that range.
We propose
CASA
, which realizes this idea: (1) adversarial augmentation in the
physics-grounded
Macenko stain parameter space, where perturbations correspond to realistic stain variations; and (2) an adversarial budget
calibrated
from multi-center data with a statistical coverage guarantee.

2
Method

Stain decomposition.

The Beer-Lambert law models H&E image formation: for each pixel
j
,
\mathbf{I}_{j}=I_{0}\exp(-\mathbf{W}\mathbf{h}_{j})
, where
\mathbf{W}\in\mathbb{R}^{3\times 2}
contains unit-norm stain basis vectors (Hematoxylin and Eosin columns) and
\mathbf{h}_{j}\in\mathbb{R}^{2}
contains the corresponding stain concentrations.
We extract
\mathbf{W}
via the Macenko method
4
, building on the color deconvolution framework of Ruifrok and Johnston
6
, and obtain
\mathbf{h}
by least-squares inversion.

Training loop.

Each iteration solves a min-max problem.
The
inner maximization
finds the worst-case stain perturbation
(\bm{\delta}_{W}^{*},\bm{\delta}_{h}^{*})
via
K
-step PGD:

\max_{\|\bm{\delta}_{W}\|\leq\tau_{W},\;\|\bm{\delta}_{h}\|\leq\tau_{H}}\;\mathcal{L}\!\Big(f_{\theta}\!\big(I_{0}e^{-(\mathbf{W}_{\text{ref}}+\bm{\delta}_{W})\,(\mathbf{h}_{0}\odot(1+\bm{\delta}_{h}))}\big),\;y\Big)

(1)

where
\bm{\delta}_{W}
perturbs stain vector directions (projected onto a spherical cap to preserve unit norm) and
\bm{\delta}_{h}
scales concentrations element-wise.
Since
\tau_{H}<1
, the factor
(1+\delta_{h,k})
remains strictly positive for the final perturbation; intermediate PGD iterates are clamped to
\delta_{h,k}\geq-1
to maintain non-negativity throughout.
The reference stain matrix
\mathbf{W}_{\text{ref}}
and initial concentrations
\mathbf{h}_{0}
are precomputed once per batch from the Macenko decomposition.
After
K
steps, the augmented image is reconstructed via the Beer-Lambert inverse and passed to the
outer minimization
, which updates
\theta
by SGD on
\mathcal{L}(f_{\theta}(\tilde{\mathbf{I}}),y)
.
The model trains on the worst-case stain perturbation within the calibrated budget at every iteration.

Calibrated budget.

The budgets
\tau_{W}
and
\tau_{H}
are not hyperparameters—they are estimated from training data.
Given
n
images from the training centers:
(i) extract per-image stain matrices
\mathbf{W}_{i}
and concentrations
\mathbf{h}_{i}
;
(ii) compute the angular deviation
\alpha_{i}=\angle(\mathbf{W}_{i},\bar{\mathbf{W}})
and concentration ratio
r_{i}=q_{99}(\mathbf{h}_{i})\,/\,\overline{q_{99}(\mathbf{h})}
, where
q_{99}
denotes the 99th percentile;
(iii) set
\tau_{W}
and
\tau_{H}
as the
(1{-}\delta{+}\varepsilon_{n})
-empirical quantiles of
\{\alpha_{i}\}
and
\{|r_{i}-1|\}
respectively, where
\varepsilon_{n}
is the DKW correction below.
On Camelyon17-WILDS with
n{=}1{,}000
training images, this yields
\tau_{W}{=}0.353
rad (
20.2^{\circ}
) and
\tau_{H}{=}0.987
.

Coverage guarantee.

The DKW inequality
1
;
5
bounds the deviation of the empirical CDF
F_{n}
from the true CDF
F
:

\Pr\!\left[\sup_{t}|F_{n}(t)-F(t)|>\varepsilon_{n}\right]\leq 2e^{-2n\varepsilon_{n}^{2}}

(2)

Since we apply the bound to both
\tau_{W}
and
\tau_{H}
, a union bound requires each to hold at level
\beta/2
, giving
\varepsilon_{n}=\sqrt{\ln(4/\beta)/(2n)}
.
We take the
(1{-}\delta{+}\varepsilon_{n})
-empirical quantile as each budget, which ensures that the true
(1{-}\delta)
-quantile is covered with probability
\geq 1{-}\beta
.
With
\delta{=}\beta{=}0.05
and
n{=}1{,}000
:
\varepsilon_{n}{=}0.047
, giving a quantile level of
0.997
.
Each stain parameter of a new center thus falls within its budget with
\geq 95\%
confidence.

3
Experiments

Setup.

We evaluate on Camelyon17-WILDS
3
: binary tumor classification across 5 hospitals (train: 0,3,4; val: 1; test: 2; 302K patches).
All methods use DenseNet-121 trained from scratch, SGD (lr
=
0.001, wd
=
0.01), batch size 32, 10 epochs, 5 seeds.
CASA uses
K{=}5
PGD steps.
We report the WILDS official slide-level macro accuracy (
acc_avg
).
Baselines include stain augmentation (HED-strong/light
8
, RandStainNA
7
, Macenko-norm
4
), adversarial methods (AdvST
9
, Zhong et al.
10
), domain adaptation (DANN
2
), and bilevel stain optimization in the same parameter space as CASA.

Results.

Method

acc_avg

acc_wg

CASA (ours)

\mathbf{93.9\pm 1.6}

\mathbf{84.9\pm 0.9}

HED-strong (
\sigma{=}0.2
)

88.4\pm 7.3

76.1\pm 13.5

RandStainNA

85.2\pm 6.7

57.6\pm 21.3

HED-light (
\sigma{=}0.05
)

80.4\pm 6.6

66.1\pm 10.3

Macenko-norm

78.0\pm 14.7

46.0\pm 17.5

Bilevel-Stain

71.4\pm 12.7

43.2\pm 14.5

DANN

69.8\pm 4.1

53.1\pm 5.8

Zhong et al.

64.8\pm 9.8

46.8\pm 9.3

ERM

63.9\pm 11.3

36.1\pm 9.4

AdvST

56.4\pm 7.1

31.7\pm 14.9

CASA ranks first in both accuracy (
93.9\%
) and worst-group stability (
\pm 0.9\%
).
Three findings emerge from tab:main:

(1) Stain-specific
>
generic adversarial.

AdvST (
56.4\%
) perturbs HSV, contrast, and sharpness—it scores below ERM (
63.9\%
).
Zhong et al. (
64.8\%
) operates on feature-level style and only matches ERM.
Adversarial augmentation requires stain-specific parameterization to help rather than hurt.

(2) Adversarial
>
random in the same space.

CASA (
93.9\%
) outperforms HED-strong (
88.4\%
) by
5.5
points with
4{\times}
lower
acc_avg
variance.
Bilevel optimization (
71.4\%
), which minimizes rather than maximizes the inner objective in the same parameter space, scores 22.5 points lower—worst-case perturbations generalize better than “helpful” ones.

(3) Calibrated budget removes hyperparameter sensitivity.

HED-strong (
\sigma{=}0.2
) and HED-light (
\sigma{=}0.05
) differ by 8 points, yet no criterion exists for choosing
\sigma
.
CASA derives its budget from the data; no manual tuning is needed.

4
Conclusion

Two design choices make CASA effective where generic adversarial methods fail: grounding perturbations in the physical stain parameter space, and calibrating the budget from multi-center data instead of tuning it by hand.

Read the complete text