Gigapixel images such as pathology slides are too large to feed to a neural network whole, so they are cut into thousands of small tiles and summarized by a second network, the aggregator. Cutting destroys spatial context: a tumor region that spans many tiles looks like unrelated fragments. The natural way to recover context is to let each tile exchange information with its neighbors over several rounds. The information then spreads farther with each round, so seeing a wider region requires a deeper aggregator. Generalization theory warns against exactly this. Error bounds for stacked layers grow like a product of per-layer norms, which is exponential in depth. Practitioners have followed the warning without saying so: TransMIL, a Transformer-based aggregator, uses two layers.
This note proposes a spatial aggregator whose depth can grow to match the size of the context it needs, while its generalization bound stays bounded independent of depth. The design has two parts. Tiles exchange information along a fixed neighbor graph built from their slide coordinates, with no attention computed from features. Each round of exchange is added as a residual branch scaled by $L^{-\gamma}$, where $L$ is the depth. With the neighbor graph fixed, graph-diffusion PAC-Bayes theory applies directly. With the branch scaling, the depth-exponential factor disappears. We then test a specific hypothesis. The persistent gap between trained spatial aggregators and the Bayes-optimal classifier on a synthetic benchmark comes partly from how depth and branch scaling are set. It does not come from missing capacity.
Core Claim
Treat each tile as a node. Let $S$ be the normalized adjacency matrix of the tile grid. $S$ is fixed by coordinates and not learned, so its spectral norm satisfies $\|S\|_2 \le 1$. Let $h_l \in \mathbb{R}^{N \times d}$ be the tile features after $l$ rounds, $W_l$ a learned $d \times d$ matrix with $\|W_l\|_2 \le B$, and $\sigma$ a 1-Lipschitz nonlinearity. The aggregator is
$$h_{l+1} = h_l + L^{-\gamma}\, \sigma(S\, h_l\, W_l), \qquad l = 0,\dots,L-1,$$
and the stack ends in a pooling readout. Peeling layers gives a Lipschitz constant, and a PAC-Bayes perturbation sensitivity, controlled by
$$\prod_{l=1}^{L}\left(1 + L^{-\gamma} B\right) \le \exp\!\left(B\, L^{1-\gamma}\right).$$
This bound is independent of $L$ at $\gamma = 1$ and sub-exponential for $\gamma \in (1/2, 1)$. The unscaled case $\gamma = 0$ recovers the familiar $(1+B)^L$ explosion.
At $\gamma = 1$ depth still buys spatial reach. As $L$ grows, the linearized stack approaches $\exp(S W)$, a heat-kernel diffusion that mixes every hop distance. The effective context radius is therefore set by the learned weight norms, and depth acts only as a discretization of the diffusion. Our first contribution is to prove this formally. The target is a PAC-Bayes margin bound for multi-class classification on bags of tiles, with depth entering only through $L^{1-\gamma}$.
Our second contribution is empirical. At $\gamma = 0$ the aggregator's tangent kernel should degenerate as depth grows, meaning bags become indistinguishable to gradient descent. The patch-graph analogue of this collapse is over-smoothing. With $\gamma \in (1/2, 1]$, depth can be matched to the size of the discriminative region without the gap growing.
The pieces come from existing work. Algorithm-Dependent Generalization Bounds for Overparameterized Deep Residual Networks shows that $1/L$ branch scaling gives ResNets polylogarithmic depth dependence. Branch Scaling Manifests as Implicit Architectural Regularization for Improving Generalization in Overparameterized ResNets shows that constant scaling collapses the residual tangent kernel into a "spike kernel" that cannot learn, and that $\gamma \in (1/2,1]$ gives minimax rates. Both analyze flat vectors with no spatial structure. Generalization in Graph Neural Networks: Improved PAC-Bayesian Bounds on Graph Diffusion bounds graph networks through $\|S\|_2$ and the loss Hessian trace. It states explicitly that it cannot handle diffusion operators that depend on the input data, and it still carries per-layer weight-norm products.
Our move is to give up input-dependent attention deliberately. This keeps the Ju et al. assumptions valid on tile grids of about 10,000 nodes, and borrows branch scaling to remove the depth product. Neither line of work combines the two, and neither studies tile bags. Relative to spatial aggregators such as TransMIL, PSA-MIL and ILRA-MIL, the differences are that our graph is fixed rather than learned, depth is a studied variable, and the result carries a finite-sample guarantee. TransMIL's accompanying analysis is only an entropy argument.
Motivation and Constraint
The motivating evidence is Synthetic Data Reveals Generalization Gaps in Correlated Multiple Instance Learning. On its Shifted Mean MIL benchmark, bags contain a contiguous discriminative neighborhood surrounded by noise tiles. Trained aggregators fall 0.04 to 0.15 AUROC below the analytic Bayes ceiling. Growing the training set to 10,000 bags does not close the gap, yet hand-set weights reach the ceiling. The authors therefore locate the failure in optimization and leave its cause open.
The branch-scaling results give a concrete candidate cause: a kernel that is badly conditioned at initialization, whose conditioning worsens with depth. This proposal tests that candidate. We do not assume it is correct. If the gap turns out to be insensitive to $\gamma$ and $L$, that is a clean negative result that narrows the space of explanations Harvey et al. left open.
The main constraint comes from On Generalization Bounds for Neural Networks with Low Rank Layers. Even with a careful vector-valued complexity analysis, that work keeps a $C_1^L$ proof artifact unless the layers are explicitly contractive. Our scaled residual form supplies that contraction by construction, rather than relying on a low-rank assumption.
Research Program
The theory work has three steps. First, derive the perturbation bound for the scaled residual diffusion stack, followed by mean or attention pooling, under a multi-class margin loss. This extends the noise-stability route of Ju et al. so that the per-layer weight norms enter additively, weighted by $L^{-\gamma}$, instead of as a product. Second, characterize the infinite-width tangent kernel of the same stack on a fixed grid graph. We will show that at $\gamma = 0$ the kernel between two bags converges, as $L \to \infty$, to a value that does not depend on where the discriminative region sits. This is the spatial spike kernel. For $\gamma > 1/2$ the kernel keeps a heat-kernel dependence on spatial layout. Third, compute the bound numerically for trained models and compare it with the measured train–test gap across depths, following Ju et al.'s demonstration that Hessian-based quantities track real gaps.
The empirical work builds one aggregator family. Depth runs over $L \in \{1,2,4,8,16,32\}$ and scaling over $\gamma \in \{0, 0.5, 0.75, 1\}$, with an option for 8-neighbor grids over foreground tiles. On every run we log the kernel's effective rank across bags at initialization, the Hessian trace at convergence, the computed bound, and test performance.
Baselines
The naive reference point is mean pooling and attention-based pooling (ABMIL) over the same frozen tile features. On Shifted Mean MIL, Harvey et al. place these among the models 0.04–0.15 AUROC below Bayes. On CAMELYON16 the attention-pooling model CLAM-MB reaches 87.79% AUC, as reported by ILRA-MIL. Beating these shows only that context helps, which is already known. The comparison is included to calibrate the scale of the other results.
The strongest synthetic baseline is Smooth Attention Pooling (smAP). Harvey et al. report it as the best trained model on Shifted Mean MIL, though still statistically below Bayes. It is also the closest existing idea, since it smooths attention over neighbors in a single step. We will rerun it with the benchmark's own generator, the same bag counts, and the same hyperparameter search budget as our model: an equal number of configurations over learning rate and weight decay. Beating smAP means a statistically significant reduction of the Bayes gap, measured over seeds, at the largest neighborhood sizes.
The strongest real-data baselines are ILRA-MIL and TransMIL. ILRA-MIL reports 96.49% AUC on CAMELYON16 and 97.63% on TCGA-NSCLC. TransMIL reports 93.09% on CAMELYON16, 96.03% on NSCLC, and 98.82% on RCC. We will retrain both on the same frozen ResNet-50 features and splits, under matched tuning budgets, rather than quoting their numbers. For PSA-MIL on CAMELYON16, no reported result was found on Lacuna. We will run it ourselves if code is available.
On real data we do not expect large AUC gains. Success means matching ILRA-MIL within its seed variance while also providing a bound that is non-vacuous or close to it. A result showing that deeper models at $\gamma = 1$ do not lose accuracy while $\gamma = 0$ models do would also count.
The key ablation varies $\gamma$ at fixed architecture. This isolates branch scaling as the causal ingredient. A second ablation replaces the fixed neighbor graph $S$ with feature-dependent attention at matched depth. This tests whether fixing the graph costs accuracy in exchange for provability.
Why not just…?
Why not just use a two-layer TransMIL or ILRA-MIL, since shallow models already score well? On real benchmarks they may well be as good as our model, and we say so. Two things are missing, however. Shallow local exchange cannot reach large discriminative regions, and no finite-sample guarantee exists for either model. The synthetic sweep over neighborhood size tests the first point directly. If shallow models match deep scaled ones even at the largest regions, the depth argument fails and the contribution shrinks to the bound alone.
Why not just rely on LayerNorm or BatchNorm, which the branch-scaling paper says implicitly downscale residual branches? This is a real threat. Yu et al. report that $\gamma = 1$ performs comparably to BatchNorm on CIFAR-100. We therefore include a normalized, unscaled variant at every depth. If it matches the $\gamma = 1$ model empirically, the practical recommendation becomes "normalize," and our contribution is the explicit bound, which normalization does not supply because its effective scale depends on the data.
Why not just compute a single closed-form heat diffusion $\exp(tS)$ with a learnable time $t$? Our analysis says the deep $\gamma = 1$ stack approaches this operator when linearized, so it is the most dangerous alternative. It is included as an ablation. The deep stack differs because of per-layer nonlinearities and feature mixing. If the closed form matches it on Shifted Mean MIL and on CAMELYON16, we will report that depth is unnecessary and that learnable-time heat pooling is the simpler method. It inherits the same depth-free bound.
Why not just add more data or use noise-stability training? Harvey et al. show that 10,000 bags do not close the gap. We include Ju et al.'s noise stability optimization as an orthogonal regularizer applied to the unscaled model. On ClinTox it reached 79.31% ROC-AUC against 61.06% for early stopping. Including it tells us whether a flatter loss surface alone accounts for any gain.
Proposed Experiments
The decisive experiment runs on Shifted Mean MIL. We extend its generator so that the radius of the discriminative neighborhood can be varied, then plot the Bayes gap against depth for each $\gamma$. The theory predicts four outcomes. At $\gamma = 0$, the gap first falls and then rises with depth, and the effective rank of the initial kernel falls with it. At $\gamma = 1$, the gap falls and then stays flat. The best depth grows with the region radius. Finally, the gap closes further than smAP's. If the gap is flat across $\gamma$ at every depth, the kernel-degeneration explanation for Harvey et al.'s failure is refuted.
The second check compares the computed bound with the observed train–test gap across depths on CAMELYON16 and TCGA-NSCLC, using fixed features and splits. The bound should stay flat in $L$ at $\gamma = 1$ and grow at $\gamma = 0$, and it should rank models the same way the measured gaps do.
The third check runs on TCGA-BRCA biomarker prediction, where Capturing Cellular Topology in Multi-Gigapixel Pathology Images reports 0.73 HER2 AUC for its graph method. There we test whether the fixed tile grid is enough, or whether graphs built from nuclei still win. The latter outcome would indicate that the neighbor graph itself, and not depth, limits performance.
References
- Algorithm-Dependent Generalization Bounds for Overparameterized Deep Residual Networks
- Branch Scaling Manifests as Implicit Architectural Regularization for Improving Generalization in Overparameterized ResNets
- Generalization in Graph Neural Networks: Improved PAC-Bayesian Bounds on Graph Diffusion
- TransMIL: Transformer based Correlated Multiple Instance Learning for Whole Slide Image Classification
- PSA-MIL: A Probabilistic Spatial Attention-Based Multiple Instance Learning for Whole Slide Image Classification
- Exploring Low-Rank Property in Multiple Instance Learning for Whole Slide Image Classification
- Synthetic Data Reveals Generalization Gaps in Correlated Multiple Instance Learning
- On Generalization Bounds for Neural Networks with Low Rank Layers
- Capturing Cellular Topology in Multi-Gigapixel Pathology Images