Distributed Parallel Gradient Stacking(DPGS): Solving Whole Slide Image Stacking Challenge in Multi-Instance Learning

Boyuan Wu, Zefeng Wang, Xianwei Lin, Jiachun Xu, Jikai Yu, Zhou Shicheng, Hongda Chen, Lianxin HuICML 2025

TL;DR

The Distributed Parallel Gradient Stacking (DPGS) framework introduces a novel way to train Multi-Instance Learning (MIL) models on Whole Slide Images (WSIs) by stacking gradients rather than data. This approach bypasses the "non-stackable" data challenge caused by variable-length bags, achieving up to 31× faster training and a 9.3% accuracy boost while reducing communication overhead by over 99%.

The Problem: Non-Stackable WSI Data

In digital pathology, Whole Slide Images (WSIs) are massive—often exceeding 100,000 pixels in each dimension. To process them, researchers use Multi-Instance Learning (MIL), where an image is treated as a "bag" of smaller patches (instances).

The fundamental headache is that every WSI produces a different number of patches. Standard deep learning thrives on "stacking" data into uniform mini-batches (tensors) for GPU efficiency. Because MIL bags have inconsistent lengths, they cannot be easily stacked. Traditionally, this forces researchers into two suboptimal options:

  1. Sequential Processing: Training on one bag at a time. This is painfully slow and leads to unstable, "noisy" gradient updates because the model only sees one example before updating.
  2. Compromised Data: Using "padding" (adding zeros, which wastes computation) or "sampling" (discarding patches, which loses critical diagnostic information).

Methods: DPGS and DMGC

The authors tackle this stacking challenge to enable true parallel training without losing data integrity, proposing two interconnected solutions.

1. Distributed Parallel Gradient Stacking (DPGS)

Instead of trying to force variable-length data into a single tensor, DPGS parallelizes the models. Multiple sub-processes each take a single, variable-length bag and compute its gradient independently. These gradients are then sent to a master process that "stacks" (averages) them.

Comparison between traditional sequential MIL and the proposed DPGS approach.

The beauty of this method is mathematical: averaging the gradients of $P$ individual bags is equivalent to computing the gradient of a mini-batch of size $P$. This allows for "lossless" stacking—the model gets the stability of batch training without the data-wrangling nightmares.

2. Deep Model-Gradient Compression (DMGC)

Distributed training usually suffers from a communication bottleneck, as sending massive model weights and gradients back and forth across a network is slow. DMGC implements dual sparsity: it compresses both the gradients and the model weight deltas. It uses a "Top-K" strategy, only transmitting the most significant updates (e.g., the top 0.1% of changes) and accumulating the rest locally until they become significant. This creates a "virtual batch" effect that further stabilizes training.

Key Insights

  • Gradients as the Universal Currency: The core realization is that while data is messy and variable, gradients are always the exact same shape as the model parameters. By shifting the "stacking" from the input level to the gradient level, the authors bypass the architectural limitations of MIL.
  • The Stability-Speed Tradeoff is a Myth: Usually, faster training (via compression or sampling) hurts accuracy. Here, because gradient stacking provides a more stable estimate of the "true" gradient than single-bag updates, the model actually converges to a better solution faster.
  • Virtual Batching via Accumulation: By holding onto small updates locally (residual accumulation), the system effectively simulates much larger batch sizes than the physical hardware would normally allow. This is particularly beneficial for the non-IID nature of medical images.

Key Results

The framework was evaluated on two major public WSI benchmarks (Camelyon16 and TCGA-Lung) using various feature extraction setups. The performance gains are substantial across the board:

  • Speed: DPGS achieved up to 31× faster training compared to sequential baselines. Even compared to "Padding" methods, it was significantly more efficient because it didn't waste cycles on zero-value instances.
  • Accuracy: The method saw a maximum 9.3% accuracy improvement. For example, on the TCGA-LUNG dataset, ABMIL accuracy jumped from 92.38% to 93.90% while training time plummeted from 636s to just 20s.
  • Efficiency: DMGC reduced communication bandwidth by 99.2% while maintaining convergence. Experiments showed that even with extremely low "Keep Rates" (discarding the vast majority of updates), the model remained stable.
Performance metrics showing accuracy and training time improvements across different datasets and batch sizes.

Limitations and Future Work

While DPGS solves the stacking problem, it still relies on synchronous updates—meaning the master process has to wait for the slowest GPU (the "straggler" problem) before updating the global model. This creates a plateau effect where adding more nodes yields diminishing returns after a certain point.

The authors suggest that future work should explore asynchronous distributed computing to eliminate this waiting time, potentially allowing MIL models to scale seamlessly to petabyte-sized histopathology datasets.

Summary updated

BibTeX
@inproceedings{wu2025distributed,
  author = {Boyuan Wu and ZEFENG WANG and Xianwei Lin and Jiachun Xu and Jikai Yu and Zhou Shicheng and Hongda Chen and Lianxin Hu},
  title = {{Distributed Parallel Gradient Stacking(DPGS): Solving Whole Slide Image Stacking Challenge in Multi-Instance Learning}},
  booktitle = {International Conference on Machine Learning},
  year = {2025},
  url = {https://openreview.net/forum?id=ss5JNmJDkW},
}
Figure