Medical scans such as CT and MRI are 3D volumes, but most efficient vision models still treat them as stacks of 2D pictures, or as three flat projections of the volume. Neither view lets every voxel attend to every other voxel in true 3D at full resolution. Linear attention could fill this gap. It is a variant of the Transformer's attention step that keeps a small running summary of keys and values instead of comparing every pair of tokens, so its cost grows linearly with the number of voxels. In practice it underperforms in two ways. Its attention maps are blurry, and it ignores the physical fact that clinical slices are often several millimetres apart while pixels within a slice are a fraction of a millimetre apart.
We propose a single fix for both problems. Each attention weight is multiplied by a decay that falls off exponentially with the physical distance between two voxels, measured in millimetres separately along each axis. The decay rates are learned per head. Because a separable exponential decay can be applied as a forward and backward running-sum filter along each axis, the whole operator remains exactly linear in voxel count and is genuinely 3D. It needs no slicing, no planar projection, and no pooling. The slice spacing of each scan enters only through the per-step decay factor $\lambda_z = e^{-\alpha_z \Delta z}$. One trained model should therefore handle thin-slice and thick-slice scans at their native resolution without resampling. That robustness across slice spacings is the claim we test.
Core Claim
A locality prior expressed in physical units, and applied inside linear attention, does three things at once. It sharpens the diffuse attention that limits linear models, it removes the need for slice-wise or tri-plane decompositions, and it makes the network robust to changes in slice thickness between training and test scans. The last property is the one no existing efficient 3D segmenter is designed for. Concretely, for voxel $i$ with physical position $p_i \in \mathbb{R}^3$ (in mm), query $q_i$, key $k_i$, value $v_i$, feature map $\phi$, and learned per-head, per-axis rates $\alpha_a \ge 0$, the output is
$$y_i = \frac{\phi(q_i)^\top \sum_j w_{ij}\, \phi(k_j) v_j^\top}{\phi(q_i)^\top \sum_j w_{ij}\, \phi(k_j)}, \qquad w_{ij} = \prod_{a \in \{x,y,z\}} e^{-\alpha_a |p_i^a - p_j^a|}.$$
The weight $w_{ij}$ is a product of two-sided exponentials, one per axis. The per-voxel state $\sum_j w_{ij}\phi(k_j)v_j^\top$ can therefore be computed exactly by running a forward and a backward first-order recursion along $x$, then $y$, then $z$, each with per-step factor $e^{-\alpha_a \Delta_a}$. The cost is $O(N d^2)$ for $N$ voxels and head dimension $d$. Setting $\alpha_a = 0$ for a head recovers ordinary global linear attention. This lets some heads stay global while others become sharply local, and it lets the network learn, for example, to decay slowly in-plane but quickly across thick slices.
Relation to Prior Work
Two groups of work motivate the proposal by exposing the gap. PVT-GDLA builds a linear-time decoder that subtracts two kernelized attention paths and adds sigmoid gates to suppress blur and attention sinks. It reaches 85.32 Dice on Synapse at 6.85G FLOPs, but it runs slice by slice and has no notion of slice spacing. Tri-plane and multi-view designs take a different route. Tri-Plane Mamba scans features along the three orthogonal planes with state space models (recurrent sequence models with input-dependent memory), and Hymavi runs parallel Mamba and attention blocks per view. Both reach linear or near-linear cost by flattening planes into 1D sequences, which places spatial neighbours far apart in scan order. Our operator acts on the 3D grid directly, and its decay is a function of true distance rather than of scan position.
UNETR++ and Light-UNETR also get linear cost in 3D, but they do it by projecting or downsampling keys and values before attention. That trades away spatial detail rather than restructuring the attention itself. The UNETR++ authors also report failures on thin and irregular structures, which is exactly where a sharp local prior should help. CSAM and uC 3DU-Net treat anisotropy explicitly, through pooled cross-slice attention and through 2D U-Nets inside 3D skip connections. These are architectural treatments with fixed resolution assumptions. Neither conditions on spacing as a continuous input.
Three papers supply the method. Elucidating the Design Space of Decay in Linear Attention finds that per-channel (vector) decay beats scalar decay, that a moderate decay range works best, and that rotary position embeddings add little once decay is present. We adopt per-head vector rates and drop rotary embeddings accordingly. The recurrent, fast-weight reading of linear attention in Practical Computational Power of Linear Transformers is what justifies computing the decayed state by recursions. The difference here is that our recursions are bidirectional and non-causal, and there are three of them, one per axis.
One paper constrains the design. Training Tensor Attention Efficiently warns that asymptotic gains can hide large constants. Our recursions carry a $d \times d$ state per voxel, so memory at high-resolution stages is a genuine concern rather than a footnote. We address it with small head dimensions at fine stages, chunked recomputation in the backward pass, and wall-clock measurements, not FLOP counts alone.
Research Program
We will first implement the operator as a Triton kernel and verify it numerically against a dense $O(N^2)$ reference on small volumes. The kernel performs six recursive scans per layer: forward and backward along each of $x$, $y$, $z$. Scan steps take the per-volume voxel spacing read from the image header.
We then place the operator in a hierarchical 3D encoder-decoder that matches the UNETR++ layout. It replaces Efficient Paired Attention at every stage and keeps the same convolutional stem and skip connections. Two optional components get separate tests: a sigmoid output gate in the style of GDLA, and a depthwise-convolution local branch. This lets us tell whether physical decay alone closes the blur gap, or whether it only complements differential attention.
Training mixes scans at native spacing and adds random through-plane subsampling as augmentation. During subsampling, the spacing passed to the decay is updated to match. The analysis component inspects the learned $\alpha_a$ per head and per stage. It checks whether the network learns stronger through-plane decay, and how the effective receptive field changes when the same volume is presented at different slice thicknesses.
Baselines
The naive reference point is the same architecture with all decay rates fixed at zero, which is ordinary global non-negative linear attention in 3D. It is trained identically on the same data, schedule and tuning budget. This baseline isolates whether any locality prior helps. We expect it to show the blurry boundaries documented for non-negative kernels by PVT-GDLA. If it is not clearly worse, the motivation for the proposal fails.
The strongest existing 3D competitor is UNETR++. It reports 87.2% Dice on Synapse, 83.28% mean Dice on BTCV and 92.83% on ACDC, with large FLOP reductions over nnFormer. We will retrain it from the released configuration on identical splits and preprocessing, and use the same number of hyperparameter trials as our model, so that matched-spacing numbers are comparable. Beating it means matching its matched-spacing Dice within run-to-run noise at equal or lower measured GPU memory and latency. It also means exceeding it clearly, which we pre-register as at least 3 Dice points, when test slice spacing differs from training spacing.
The strongest linear-attention competitor is PVT-GDLA, at 85.32 Dice on Synapse and 6.85G FLOPs, run slice by slice as published. The strongest linear-time 3D alternative is Tri-Plane Mamba. Because it depends on a pretrained foundation model, we compare against it under its own data-scarce BTCV regimes rather than in from-scratch training. For anisotropic prostate MRI, the reference is CSAM, which reports 51.0% lesion Dice against 37.0% for 3D nnU-Net. For AMOS22 the reference is Hymavi at 87.33% Dice.
The key ablation keeps the identical decay mechanism but measures distance in voxel index steps rather than millimetres. Rates are still learned, but spacing is never supplied. This ablation separates "locality helps" from "physical units help," and it is the comparison the cross-spacing claim rests on.
Why not just…?
Why not just resample every scan to isotropic spacing and use any efficient 3D attention? Resampling is standard and removes the anisotropy problem by fiat. Upsampling thick-slice scans inflates voxel count by the anisotropy ratio, which pushes models like UNETR++ toward more aggressive downsampling. It also interpolates through-plane detail that was never measured. The experiment settles this directly: we include a resample-to-isotropic arm of UNETR++ and of our zero-decay model, and report Dice alongside memory and latency. If resampling matches us at comparable cost, the spacing-conditioned decay is not worth its complexity, and we will say so.
Why not just add spacing-aware positional encodings to ordinary linear attention? This is the most serious alternative, because it also injects millimetres. In linear attention, though, positional encodings must pass through the feature map. The decay study found that rotary embeddings contribute negligibly once decay is present, which suggests position signals are weak in this setting. We will test an arm that uses rotary embeddings on mm coordinates with zero decay. If it matches our cross-spacing robustness, the decay is unnecessary.
Why not just use the 2.5D or 2D-skip designs that already handle anisotropy? CSAM and uC 3DU-Net work well at the anisotropy they were trained on. CSAM, however, pools away fine cross-slice token interactions, and uC has no long-range attention, with gains vanishing at deep stages. Both are fixed to one resolution regime. The cross-spacing test applies to them as well. If they degrade gracefully when slice thickness changes, our central claim weakens to an efficiency argument.
Why not just bolt GDLA onto flattened 3D tokens? That approach is the obvious extension, and it remains spacing-blind. We run it as an arm, 3D differential linear attention without decay, so that any gains from decay are not credited to differential subtraction or the reverse.
Proposed Experiments
The matched-spacing experiment trains and tests on Synapse with the standard 18/12 split (as used by nnFormer), on BTCV, ACDC and AMOS22. We report Dice, HD95, parameters, measured peak memory and throughput. Results are broken out per organ, with attention to the pancreas, gallbladder and duodenum, the thin and irregular structures where UNETR++ and linear attention are known to struggle.
The decisive experiment tests across slice spacings. We train on scans subsampled to a single through-plane spacing, then test on the same held-out scans at several thinner and thicker spacings obtained by slice subsampling. Labels are subsampled consistently, and predictions are evaluated at the test resolution. We plot Dice against the spacing shift for every arm. The proposal succeeds if the mm-decay model's curve is flat where the index-decay ablation, UNETR++, and the positional-encoding arm drop. A second check uses the anisotropic prostate MRI task against CSAM's 51.0% lesion Dice, and ACDC, whose thick cine slices make anisotropy natural rather than synthetic.
A final efficiency check sweeps input volume size from $96^3$ upward. It measures wall-clock time and memory against the 18.86 versus 2.37 GFLOPs-per-block contrast that Tri-Plane Mamba reports for attention versus Mamba adapters. The check has two purposes: to confirm that linear scaling survives the per-voxel state in practice, and to report honestly the resolution at which the $d \times d$ state becomes the bottleneck.
References
- Gated Differential Linear Attention: A Linear-Time Decoder for High-Fidelity Medical Segmentation
- Tri-Plane Mamba: Efficiently Adapting Segment Anything Model for 3D Medical Images
- Hymavi : A Hybrid Mamba-Attention Network in Multi-View Framework for Volumetric Medical Image Segmentation
- UNETR++: Delving into Efficient and Accurate 3D Medical Image Segmentation
- Harnessing Lightweight Transformer With Contextual Synergic Enhancement for Efficient 3D Medical Image Segmentation
- CSAM: A 2.5D Cross-Slice Attention Module for Anisotropic Volumetric Medical Image Segmentation
- Upping the Game: How 2D U-Net Skip Connections Flip 3D Segmentation
- Elucidating the Design Space of Decay in Linear Attention
- Practical Computational Power of Linear Transformers and Their Recurrent and Self-Referential Extensions
- Training Tensor Attention Efficiently: From Cubic to Almost Linear Time
- nnFormer: Volumetric Medical Image Segmentation via a 3D Transformer