Page-Aligned Counterfactual Masks for Cheap Leave-One-Out Attribution

The most trustworthy way to ask "how much did this training example matter?" is leave-one-out retraining: train the model again without the example and see how its predictions change. This costs one full training run per example, so practitioners fall back on approximations. One of the few approximations that is still a real counterfactual is turn-over dropout. Each training example gets a fixed random mask over the weights and only ever updates the masked half. The other half, which never saw the example, then stands in for "the model trained without it." We propose borrowing a lesson from operating-system memory management. That lesson is that scattering small allocations across every physical page is what makes memory hard to reuse and slow to address. Our claim is that random per-weight masks scatter each example's footprint in the same way. Packing that footprint into contiguous, aligned blocks of parameters (the analogue of huge pages) should make counterfactual evaluation cheaper. It should also let a single training run answer removal questions at several granularities: one example, one document, one data source.

The opportunity matters because removal questions now carry real stakes. Royalty and accountability schemes want to know which sources a model depends on (Computational Copyright; Who Gets Credit or Blame?). The methods that scale to large models answer these questions only indirectly, through gradients, curvature estimates, or loss differences between checkpoints. Influence estimates of this kind are known to be fragile in deep networks (Influence Functions in Deep Learning Are Fragile). A built-in counterfactual that is cheap, fast on real hardware, and works at several granularities would be a different kind of tool from these post-hoc estimators.

Core Claim

Turn-over dropout (Efficient Estimation of Influence of a Training Instance) hashes each example's ID to a mask $m(z)$ and compares the loss of sub-network $m(z)$ with that of the flipped sub-network $1-m(z)$. It reports attribution over 10,000 BERT-base instances in 35 seconds. It also has two known costs. The first is quality: per-weight dropout at rates up to 50% degrades the base model. The second is layout: per-example masks over individual weights produce irregular, scattered memory access.

Our claim is that both costs come largely from the granularity of the mask, not from the counterfactual idea itself. We replace per-weight masks with masks over contiguous, aligned parameter slabs, chosen to match how the accelerator stores and multiplies weights. We then confine the masks to a few dedicated bands of slabs, so the bulk of the network trains on all data.

Each band is keyed by a different identifier: one by data-source ID, one by document ID, one by example ID. The counterfactual "remove source $s$" flips only the source band. The counterfactual "remove example $z$" flips only the example band. Each counterfactual evaluation becomes a dense forward pass that skips whole slabs.

What would be new is the move from scattered to packed masks, together with banded, multi-granularity counterfactuals. We will also measure, for the first time, both attribution fidelity and hardware cost against true leave-one-out retraining.

The memory-systems literature supplies the design intuition but not the method. TEMERAIRE shows that packing small allocations densely into some huge pages, while keeping others whole, is what preserves contiguity and cuts translation-cache misses. The paper reports a 26% reduction in fragmentation waste and 6% fewer cycles lost to those misses across Google's fleet. PIM-Malloc shows that scattered, dynamically indexed accesses on constrained hardware are very costly unless they are reorganized hierarchically. vAttention shows that keeping data contiguous lets standard dense kernels run unchanged, and that this beats paging schemes that require custom gather kernels.

None of these papers touches training or attribution. We import their organizing principle (pack each owner's footprint into aligned blocks) and apply it to a different kind of owner, the training example.

Research Program

The first component is the masking scheme. We partition each masked weight matrix into contiguous slabs aligned to the tile sizes of the matrix-multiply kernels. In host memory these are 2MB-aligned chunks, so that stored masks and per-slab state map cleanly onto huge pages.

We reserve a fraction $\rho$ of slabs for counterfactual bands, and divide them among $G$ granularity levels. For example, with $G=3$ the levels are source, document, and example. Within the band for level $g$, each identifier at that level hashes to an on/off pattern over that band's slabs. An example's training mask is the intersection of its patterns across all bands, plus every shared slab.

To estimate the effect of removing unit $u$ at level $g$, we compare the loss of the trained mask with the loss after flipping band $g$ only. This is the same approximation turn-over dropout already makes for its unmasked layers: parameters outside the flipped region were exposed to $u$.

The central scientific question is how $\rho$, slab size, and band count trade off three quantities. These are the base model's quality, the fidelity of each band's counterfactual to true removal, and the interference between bands.

The second component is the implementation. Because every mask is a set of whole slabs, counterfactual forward passes run as smaller dense matrix multiplies, not as elementwise masking. Backward passes can skip gradient computation for slabs an example does not own, and a mask is stored as a short bit vector. We will build this as a PyTorch module with slab-skipping kernels. We will profile wall-clock time, memory traffic, and translation-cache misses with hardware counters, against an elementwise-mask implementation that regenerates masks from seeds.

The third component is analysis. We will relate per-band fidelity to how much signal a band can hold. Our working hypothesis is that coarse units, such as data sources, need few slabs to be faithful, while single examples need more. If this holds, it would say how to budget a fixed $\rho$ across granularities.

Baselines

The naive reference point is an ordinary model with no attribution machinery, evaluated by true leave-one-out retraining. This gives the ground truth and the cost ceiling. It also gives the quality ceiling: any masking scheme is judged by how much accuracy it loses relative to this model, trained on identical data with the same budget.

The most direct competitor is turn-over dropout with per-weight hashed masks, as in Efficient Estimation of Influence of a Training Instance. It is the only existing method that builds a true never-exposed counterfactual into training. Its reported numbers are 35 seconds for 10,000 BERT-base instances, and an out-of-domain review accuracy gain from 77.0% to 78.3% after removing the top 1% of harmful examples. We will rerun it on the same splits with the same total exposure fraction and the same training steps. To beat it, our scheme must match or exceed it on rank correlation with leave-one-out ground truth while losing less base accuracy, or match it on both while running counterfactual evaluation faster.

The strongest post-hoc competitors are UnTrac and UnTrac-Inv (Unlearning Traces the Influential Training Data of Language Models), Z0-Inf (Z0-Inf), and LoGRA (What is Your Data Worth to GPT?). UnTrac is the most relevant for source-level questions because it was evaluated on exactly that task: OPT-125M trained on Pile subsets, BookCorpus, and CCNewsV2. It reports correlation with leave-one-out that is significantly higher than gradient and Hessian baselines. However, no scalar correlation value for UnTrac was found on Lacuna. For Z0-Inf, the file reports higher Spearman correlation than TracIn and LoGRA on Llama 3.1 8B, again with no scalar value found on Lacuna. LoGRA reports up to 6,500x throughput over EKFAC.

We will run all three on the unmasked baseline model, tuning their key settings (step count, learning rate, projection rank) with a tuning budget equal to the one we give $\rho$ and slab size. We will charge them for any extra checkpoints or gradient passes they need.

The ablation that isolates our key ingredient holds everything fixed except mask granularity. It compares per-weight masks against slab masks at identical exposure fraction and band layout. A second ablation compares a single example-level band against multiple bands, to measure cross-band interference.

Why not just…?

Why not just use a hugepage-aware allocator under existing attribution pipelines? That is the literal intersection of the two directions, and we expect it to pay little. TEMERAIRE's fleet-wide gain was 1.2% in instructions per cycle. Attribution workloads are dominated by large, long-lived tensors that PyTorch's caching allocator already handles reasonably. We will report allocator-swap measurements on a LoGRA pipeline as a side result. We do not build the proposal on them, because a few percent of speedup does not change which attribution questions are affordable.

Why not just use UnTrac or Z0-Inf on a normally trained model? This is the real threat. These methods require no change to training, and they reportedly track leave-one-out well. If they match banded masks on source- and example-level fidelity at similar cost, the case for modifying training collapses to cases where post-hoc estimates are unreliable, such as outliers with large gradients. The head-to-head experiments below settle this directly. We will report the outcome either way, including the regime where post-hoc methods win.

Why not just train separate models on data shards? Fully disjoint shards give exact removal but split capacity, so each shard model is weaker. Banded masks are a middle point. As $\rho \to 1$ with disjoint slabs they approach sharded models, and as $\rho \to 0$ they approach an ordinary model. We will include sharded models with matched total parameters and compute as a baseline. If they beat our scheme on the quality–fidelity frontier, the shared-trunk design is not justified.

Why not just keep per-weight masks and implement them efficiently? Seeded mask regeneration may already make elementwise masking cheap. If so, the speed argument for slabs is weak, and the contribution must rest on quality and multi-granularity. The granularity ablation measures both effects separately, so we will know which one carries the result.

Proposed Experiments

At small scale, we follow the turn-over dropout setup: BERT-base on SST-2 and Yahoo! Answers with 10,000 training instances, and a VGG-style network on CIFAR-10 with slabs defined over channel groups. Ground truth comes from actual leave-one-out retraining for a random sample of a few hundred instances. Each instance is retrained with several seeds, so that seed noise sets a ceiling on achievable correlation. We report Spearman and Pearson correlation with this ground truth, base accuracy, and the harmful-example removal test (out-of-domain accuracy after deleting the top 1%).

At language-model scale, we follow UnTrac. We train OPT-125M on a mixture of Pile-CC, Wikipedia, HackerNews, BookCorpus, and CCNewsV2, with the source band keyed by corpus and an example band keyed by document. We then retrain once per held-out source to obtain exact source-level leave-one-out effects on Toxigen, WinoBias, and TruthfulQA. The decisive check is whether the source band recovers the retraining ranking at least as well as UnTrac, which identified Pile-CC and BookCorpus as the main drivers of toxicity. The example band must do so without degrading source-band fidelity. We also report base perplexity relative to an unmasked model.

For hardware, we measure counterfactual-evaluation time, training-step overhead, memory traffic, and translation-cache misses for slab versus per-weight masks on A100-class GPUs and on CPU hosts. We sweep slab size from kernel-tile scale to 2MB.

The result that would confirm the proposal has three parts. Slab masks reach a better point than per-weight masks on the quality–fidelity frontier. One run answers source- and example-level removal questions with fidelity comparable to the best post-hoc method at each level. Counterfactual evaluation runs measurably faster. If post-hoc methods match it everywhere, we will report the scheme as unnecessary for these settings.