- Rating
- 2
- Confidence
- 4
- Informativeness
- 2
- Presentation
- 2
- Soundness
- 2
Read review
Paper summary
This paper introduces StainFlash, a framework for efficient, high-resolution H&E-to-IHC virtual staining. It combines a deep compression autoencoder with a linear-attention flow-matching network, a timestep-aware pathology encoder, and a fusion module incorporating global and patch-level features from two pathology foundation models. Experiments across multiple datasets and biomarkers report favorable image quality and reduced inference latency relative to evaluated diffusion and flow-matching baselines, supported by ablations, external validation, and downstream HER2 classification.
Critical strengths
- StainFlash achieves substantially lower inference latency than the evaluated diffusion and flow-matching baselines, with increasingly pronounced advantages at higher resolutions.
- Combining global and patch-level representations from pathology foundation models provides a sensible way to incorporate both holistic tissue information and local morphological cues
- The evaluation extends beyond standard image-quality metrics to include CONCH-based metrics, downstream HER2 classification, a small-scale blinded pathologist assessment, and failure-case analysis. These complementary assessments help characterize both the method’s utility and its limitations.
Critical weaknesses
- Based on the measurements in Table 2, the reduction in memory usage primarily comes from the 32x DC-AE, whereas linear attention mainly contributes to inference acceleration. However, when elaborating on “To address both inference latency and memory constraints,” the Introduction does not clearly connect each bottleneck to the corresponding design choice.
- The third paragraph of the Introduction lists numerous references and directly concludes that “these methods suffer from high inference latency and may even fail to produce results due to memory constraints.” The discussion remains at the level of categorizing methods and lacks sufficient technical reasoning to explain why the architectural characteristics of existing virtual staining approaches lead to severe computational bottlenecks at high resolutions.
- In Equation (1) in the Preliminaries, z0 denotes noise, z1 denotes the image latent, and . However, the descriptions “larger timesteps (early stage)” and “smaller timesteps (late stage),” together with the decreasing inference timesteps described for Figure S2, appear inconsistent with the noise-to-data direction defined in Equation (1). The authors should clarify the mapping between these timestep conventions and the corresponding velocity sign.
- The variations in the norms of the modulation coefficients in Equation (3) alone do not convincingly support the interpretation that early stages reconstruct structures while later stages refine details. Stage-specific intervention experiments are needed to validate this interpretation.
- The ablation study in Table 4 lacks an appropriate backbone baseline, making it difficult to determine how much of the improvement comes from the proposed method and how much comes from the stronger pretrained backbone.
- Table 2 shows that most of the acceleration comes from 32× compression. Linear attention provides an additional latency reduction of approximately 13%, with almost no change in memory usage. Its benefits at higher resolutions are not sufficiently established: supplementary Table S3 compares the full StainFlash model with competing methods but does not isolate the contribution of linear attention. A linear-attention ablation at these higher resolutions would strengthen the evidence.
- The downstream task trains a ResNet-50 classifier on virtual IHC images and evaluates it on real IHC images to assess the pathological utility of the generated images. However, favorable classification performance does not directly establish that the generated images accurately reproduce true protein expression at the cellular level.
- The paper’s methodological novelty is limited. The DC-AE and linear attention are largely inherited from the existing backbone, while KIIF employs relatively conventional fusion mechanisms.
Questions for authors
- Can the authors clarify the mapping between training time, scheduler time, and sampling direction, and explain how this affects the interpretation of Figure S2?
- Table 4 shows that removing either foundation model degrades performance. How do the authors distinguish complementary pathological information from the benefits of additional tokens and conditioning capacity?
6 comments
Response to Reviewer i4yM
W3 / Q1: "In Equation (1) in the Preliminaries, z0 denotes noise, z1 denotes the image latent [...] However, the descriptions “larger timesteps (early stage)” and “smaller timesteps (late stage),” together with the decreasing inference timesteps described for Figure S2, appear inconsistent with the noise-to-data direction defined in Equation (1). The authors should clarify the mapping between these timestep conventions and the corresponding velocity sign." "Can the authors clarify the mapping between training time, scheduler time, and sampling direction, and explain how this affects the interpretation of Figure S2?"
A3: We apologize for the confusion. This is a notational inconsistency in the text, not a modeling issue. The mapping is:
- Training time t ∈ [0, 1] (Eq. 1) is the data weight: t = 0 is pure noise and t = 1 is data. The target velocity is v = dz_t/dt = z₁ − z₀ (data minus noise).
- Scheduler time T = 1000·(1 − t) ∈ [0, 1000] is the input to the time embedders: T = 1000 is pure noise and T = 0 is data. The original method section wrote T = t×1000, which was incorrect.
- Sampling integrates from noise to data: t increases from 0 to 1, so T decreases from 1000 to 0. Each Euler step is z ← z + Δt·u(z, c, t) with Δt = (T_k − T_{k+1})/1000 > 0. The only sign flip is dz/dT = −v/1000.
Consequently, the interpretation of Fig. S2 is unchanged: large T corresponds to the early, high-noise stage of sampling. The decrease of ‖α‖ with decreasing T means that the modulation weakens as sampling approaches the data. The revision defines this mapping in the Preliminaries (Sec. 3.0.1), refers the pathology encoder to the scheduler timestep T, and states the direction of T in the caption of Fig. S2. No reported value is affected.
W4: "The variations in the norms of the modulation coefficients in Equation (3) alone do not convincingly support the interpretation that early stages reconstruct structures while later stages refine details. Stage-specific intervention experiments are needed to validate this interpretation."
A4: We agree that the norm analysis alone is insufficient, and we tested the interpretation in two ways (Sec. D.10, Fig. S4).
Stage-specific intervention (RegH2I test set). We split the 20 sampling steps into early (1–6), middle (7–13), and late (14–20) segments. We then zero the Eq. (3) modulation in one segment at a time. Besides DISTS, we measure two consistency scores with the real IHC. Structure is the Pearson correlation of 32×32-downsampled grayscale images, which captures tissue layout. Texture is the Pearson correlation of Sobel gradient maps at scale 128, which captures nuclear/membrane detail.
| Modulation zeroed in | Structure r ↑ | Texture r ↑ | DISTS ↓ |
|---|---|---|---|
| None (StainFlash) | 0.82 | 0.32 | 0.173 |
| Early (steps 1–6) | 0.67 | 0.30 | 0.181 |
| Middle (steps 7–13) | 0.75 | 0.25 | 0.176 |
| Late (steps 14–20) | 0.80 | 0.18 | 0.178 |
Early zeroing mainly damages layout (structure −0.15, texture −0.02). Late zeroing mainly damages detail (structure −0.02, texture −0.14). Middle zeroing is intermediate on both. Texture loss is small under early zeroing for two reasons: the Sobel score is largely insensitive to low-frequency layout errors, and the middle and late steps remain modulated and can still refine detail.
Trajectory illustration (row 3 of Fig. 2, single image; Fig. S4). We record all 20 intermediate states and compute the same two scores at every step. The flow-matching schedule spends more steps at high noise. At step 14 (T ≈ 617), the structure correlation has already reached 0.53 (65% of its final 0.81), while the texture correlation is still near zero. Over the final steps, the structure gains decelerate (+0.043, +0.024, +0.010), whereas texture keeps rising (0.12 → 0.33 over the last five steps; +0.026 at the last step).
Both analyses are consistent with the interpretation suggested by the norm analysis: strong early modulation injects structural priors, and late steps refine nuclear and membrane details. The trajectory result comes from a single image, so we regard the intervention on the full test set as the primary evidence.
Response to Reviewer i4yM
W5: "The ablation study in Table 4 lacks an appropriate backbone baseline, making it difficult to determine how much of the improvement comes from the proposed method and how much comes from the stronger pretrained backbone."
A5: First, all Table 4 variants share the same SANA-0.6B initialization and training settings. The table therefore isolates our modules with the backbone held fixed. Second, Table S12 reports the backbone's own contribution (DISTS / FID / KID): training from scratch gives 0.188 / 44.66 / 0.0185, and freezing the pretrained weights gives 0.183 / 37.32 / 0.0099, vs. 0.173 / 31.66 / 0.0033 for full fine-tuning. Two comparisons with existing results bound the role of the backbone from both sides:
- Without any SANA pretraining, StainFlash still outperforms PixCell on DISTS (0.188 vs. 0.220) and FID (44.66 vs. 47.77), but not on KID (0.0185 vs. 0.0138). PixCell is a flow-matching model of comparable size (608 M), pretrained on large-scale pathology data and conditioned on UNI2-h.
- With the pretrained backbone and the pathology encoder but without KIIF (w/o Implicit: 0.188 / 36.39 / 0.0098), StainFlash falls behind Peng et al. (0.174 / 33.92 / 0.0058) on all three metrics.
Pretraining alone therefore does not account for the gains. We note that we did not train a bare-backbone configuration (pretrained SANA with plain H&E latent concatenation); w/o Implicit is the closest available proxy. This is now stated in Sec. D.8.
W6: "Table 2 shows that most of the acceleration comes from 32× compression. Linear attention provides an additional latency reduction of approximately 13%, with almost no change in memory usage. Its benefits at higher resolutions are not sufficiently established: supplementary Table S3 compares the full StainFlash model with competing methods but does not isolate the contribution of linear attention. A linear-attention ablation at these higher resolutions would strengthen the evidence."
A6: We ran the isolated ablation: only the attention type is switched from linear back to softmax, with all other configurations and the sampling pipeline unchanged. We measured end-to-end latency and peak memory as in Table 2 (80-GB GPU) at 1024², 2048², and 4096²; at 1024², the softmax variant is StainFlash-32-SM in Table 2. The image-token count grows 4× per doubling of the side length, so the softmax attention cost grows 16× while the linear attention cost grows 4×. The measured latencies (softmax vs. linear) are 1.325 vs. 1.149 s (1024²), 6.83 vs. 4.18 s (2048²), and 49.9 vs. 15.9 s (4096²). The saving of linear attention thus widens from 13% to 39% and then 68%, i.e., its benefit compounds with resolution. As the reviewer notes, the memory difference is limited (about 10% even at 4096²). As explained in A1, memory is addressed mainly by the 32× DC-AE. This table has been added to Sec. D.3 (Table S5).
Linear vs. softmax attention across resolutions
| Resolution | Image tokens | Softmax latency | Linear latency | Linear saving | Softmax memory | Linear memory |
|---|---|---|---|---|---|---|
| 1024² | 1,024 | 1.325 s | 1.149 s | 13.3% | 8.782 G | 8.781 G |
| 2048² | 4,096 | 6.83 s | 4.18 s | 38.8% | 9.17 G | 8.84 G |
| 4096² | 16,384 | 49.9 s | 15.9 s | 68.2% | 10.07 G | 9.05 G |
Image tokens: number of image-latent tokens after the 32× DC-AE, (H/32)².
Response to Reviewer i4yM
We thank Reviewer i4yM for the exceptionally detailed technical review. We answer each point with the requested analyses or concrete revisions.
W1: "Based on the measurements in Table 2, the reduction in memory usage primarily comes from the 32x DC-AE, whereas linear attention mainly contributes to inference acceleration. However, when elaborating on “To address both inference latency and memory constraints,” the Introduction does not clearly connect each bottleneck to the corresponding design choice."
A1: Agreed. The revised introduction (Sec. 1, second paragraph) now pairs each bottleneck with the design choice that targets it: the image-token count drives memory and is reduced by the 32× DC-AE, and the O(N²) attention paid at every block of every denoising step drives latency and is reduced by linear attention. The measurements in Table 2 refine this mapping:
Thus, DC-AE addresses memory and the constant factor of latency, whereas linear attention addresses how latency grows with resolution. This refinement has been added to the introduction.
W2: "The third paragraph of the Introduction lists numerous references and directly concludes that “these methods suffer from high inference latency and may even fail to produce results due to memory constraints.” The discussion remains at the level of categorizing methods and lacks sufficient technical reasoning to explain why the architectural characteristics of existing virtual staining approaches lead to severe computational bottlenecks at high resolutions."
A2: We accept this criticism. The revised paragraph (Sec. 1) now explains the architectural cause from the token budget. Diffusion/flow-matching virtual-staining models run 20–200 denoising steps (the baselines' defaults; Sec. 4). In every step, each attention layer processes N = (H/f)² spatial positions, where f is the total downsampling before attention. Self-attention costs O(N²) per layer, so doubling the image side multiplies its cost by 16. This is why pixel-space methods are typically restricted to 256² (Sec. 2). Latent-space models (f = 8 for StainFuser; effectively 16 for PixCell) reduce N, but the quadratic growth remains. The measured latencies from 1024² to 2048² to 4096² (Tables 2 and S3) confirm this reasoning:
DC-AE reduces N, and linear attention removes the quadratic dependence on N. These measurements are now cited in the paragraph.