Enhanced Diagnostic Performance via Large-Resolution Inference Optimization for Pathology Foundation Models

Mengxuan Hu, Zihan Guan, John Kang, Sheng Li, Zhongliang Zhou

Abstract

Despite their prominent performance on tasks such as ROI classification and segmentation, many pathology foundation models remain constrained by a specific input size e.g. 224 x 224, creating substantial inefficiencies when applied to whole-slide images (WSIs), which span thousands of resolutions. A naive strategy is to either enlarge inputs or downsample the WSIs. However, enlarging inputs results in prohibitive GPU memory consumption, while downsampling alters the microns-per-pixel resolution and obscures critical morphological details. To overcome these limitations, we propose an space- and time- efficient inference strategy that sparsifies attention using spatially aware neighboring blocks and filters out non-informative tokens through global attention scores. This design substantially reduces GPU memory and runtime during high-resolution WSI inference while preserving and even improving the downstream performance, enabling inference at higher resolutions under the same GPU budget. The experimental results show that our method can achieves up to an 7.67% improvement in the ROI classification and compatible results in segmentation.

Introduction: The High-Resolution Bottleneck

Pathology foundation models, such as UNI-2 and Virchow, have revolutionized computational pathology. However, these models are typically pre-trained on small image patches (e.g., 224x224 pixels). Applying them to Whole-Slide Images (WSIs)—which contain billions of pixels—presents a significant challenge.

Practitioners currently face a trade-off: downsampling images to fit model inputs, which destroys the "microns-per-pixel" (mpp) resolution necessary for cellular-level diagnosis, or enlarging inputs, which leads to a quadratic explosion in GPU memory usage. For instance, a standard 80GB A100 GPU reaches its limit at a resolution of approximately 1400x1400, far below the requirements for comprehensive WSI analysis.

Proposed Methodology

To address these constraints, we introduce a two-stage optimization strategy designed to enable high-resolution inference without excessive computational overhead.

Overview of the two-stage optimization strategy: Sparse Attention (Stage 1) and Token Pruning (Stage 2).

1. Memory-Efficiency via Sparse Attention

Standard Vision Transformers (ViTs) utilize "all-to-all" attention, where every token attends to every other token. We replace this with a hybrid sparse attention mechanism:

  • Local Windowed Attention: Tokens attend only to their immediate spatial neighbors, capturing high-fidelity local features like cell morphology.
  • Global Attention: Designated tokens (e.g., the [CLS] token) maintain global connectivity, preserving long-range context across the entire high-resolution input.

2. Time-Efficiency via Dynamic Token Pruning

Pathology slides often contain vast regions of non-informative background. Our method ranks tokens based on importance scores derived from global attention weights. After initial layers process the full input, the model discards the least informative tokens (typically 60%), significantly reducing the sequence length for subsequent layers.

Experimental Results

The proposed method was evaluated using the UNI-2 backbone on the PANDA (prostate cancer classification) and SegPath (cell segmentation) datasets.

Comparison of Linear Probing Accuracy and GPU Memory Consumption between Vanilla and Optimized models across resolutions.

Efficiency and Performance Gains

As shown in the results, the optimized strategy significantly extends the resolution ceiling. While the "vanilla" model fails beyond 1400x1400 resolution on an 80GB A100, our method enables inference at resolutions up to 3430x3430.

At a resolution of 1400, the optimized method reduced GPU memory consumption from 78.73 GB to just 9.12 GB and decreased runtime from ~24.8 seconds to ~8.3 seconds. Crucially, this efficiency does not come at the cost of accuracy. By enabling higher-resolution processing, we achieved a 7.67% improvement in linear probing accuracy for cancer classification.

Conclusion

This research demonstrates that resolution is a primary performance multiplier in pathology. By mirroring the biological reality—where local microenvironments provide the most relevant diagnostic signals—sparse attention and token pruning allow models to process larger contexts more efficiently. Future work will focus on refining these techniques for complex segmentation tasks and exploring their application in pathology-specific Vision-Language Models (VLMs).

Summary updated

BibTeX
@misc{hu2026enhanced,
  author = {Mengxuan Hu and Zihan Guan and John Kang and Sheng Li and Zhongliang Zhou},
  title = {{Enhanced Diagnostic Performance via Large-Resolution Inference Optimization for Pathology Foundation Models}},
  year = {2026},
  eprint = {2601.12150},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2601.12150},
}
Figure