A Stratified Heritability Cube: Precomputed Statistics for Searching Non-Additive and Context-Dependent Genetic Variance

Heritability is the share of variation in a trait, such as height or blood pressure, that is due to inherited genes. Two places where the "missing" part of heritability might be hiding are non-additive effects, where genes interact, and context dependence, where heritability differs by age, sex or social environment. Searching either one with variance-component methods means running thousands of related estimates. Variance-component methods compare how similar people's genomes are with how similar their traits are, instead of testing one variant at a time. The thousands of estimates come from crossing many traits, many subgroups of people, and many genetic similarity matrices: additive, dominance, and interaction matrices for each pair of chromosomes. Today each estimate is computed from scratch with a pass over a biobank-sized genotype matrix. Database research has a mature answer to repeated, overlapping queries of this kind: precompute and store a carefully chosen set of intermediate summaries, and answer later queries from those summaries alone.

The core observation of this proposal is that the moment-based heritability estimator used at biobank scale can be computed exactly from small summaries indexed by pairs of "cells." A cell is a fine demographic group, for example a single age band crossed with sex and income. Every estimator term is a sum over pairs of people, so any subgroup that is a union of cells can be assembled from stored cell-pair sums without touching genotypes again. Storing every summary for every combination of similarity matrices is impossible, so deciding which summaries to build is a materialization problem with a budget. We propose to build this "heritability cube," to choose its contents by planning against a query workload, and to use it to run the first phenome-wide, stratified scan of inter-chromosomal epistatic variance on UK Biobank.

Core Claim

Haseman–Elston regression is the non-iterative moment estimator that Phenome-wide heritability analysis of the UK Biobank used to profile 551 traits. It needs only two kinds of quantities for a subgroup $S$ of people:

  • trace terms $T_{ab}(S)=\sum_{i,j\in S}K_a[i,j]K_b[i,j]$, one for each pair of similarity matrices $K_a, K_b$ (the "kernels");
  • phenotype terms $Q_a(S)=\sum_{i,j\in S}y_iy_jK_a[i,j]$ for a trait vector $y$.

Both are sums over pairs of individuals. If the cohort is split into cells $c_1,\dots,c_C$, each term breaks down as

$$T_{ab}(S)=\sum_{c,d\subseteq S} T_{ab}(c,d),\qquad Q_a(S)=\sum_{c,d\subseteq S} Q_a(c,d),$$

where $T_{ab}(c,d)$ and $Q_a(c,d)$ are the same sums restricted to individuals in cells $c$ and $d$. Each stored cell-pair entry is a single number. With $C$ cells there are $C(C+1)/2$ of them per kernel pair, which is a few thousand numbers instead of an $n\times n$ matrix.

Removing covariates from the trait (fixed effects such as principal components) adds terms of the same form. These are sums of low-dimensional covariate-weighted kernel blocks. The projected trace term needs triple-indexed sums over cells, which costs $O(C^3p^2)$ storage for $p$ covariates. We will implement both this exact version and the common shortcut of residualizing the phenotype first, and report how much the two disagree.

Interaction kernels make this worth doing for missing heritability. The kernel for interactions between chromosome $i$ and chromosome $j$ is the elementwise product $K_i\odot K_j$ of the two chromosomes' additive kernels. Its trace terms are therefore elementwise sums of four chromosome kernels. Restricting to inter-chromosomal pairs ($i\neq j$) has a further benefit. Linkage disequilibrium, the correlation between nearby variants, is a known source of false interaction signals. It is essentially absent between chromosomes, so using only $i\neq j$ removes the dominant confounder listed in the file's open problems by construction.

A full model has 22 additive kernels, a dominance kernel and 231 inter-chromosomal kernels. That gives tens of thousands of kernel pairs, each costing a sweep over roughly $n^2/2 \approx 6\times10^9$ person-pairs at $n=108{,}158$. Building everything at fine cell resolution is out of reach, and building nothing forces a genotype pass per query. The scientific question, how much variance lies in interactions and context rather than additive effects, thus becomes a question of choosing a budgeted set of precomputed summaries.

Relation to Prior Work

The genetics work in the file motivates the problem without solving it.

  • Phenome-wide heritability analysis of the UK Biobank computes its similarity matrix in blocks so that the full matrix never sits in memory. It found heritability falling with age in 33 of 50 physical measures. However, it handles one additive kernel per run and stores nothing across strata or traits. We reuse its estimator unchanged and change only what gets stored.
  • GiMat shows that interaction signals can depend on context, such as the order and timing of diagnoses. It tests specific gene pairs with dense kernels, not genome-wide variance.
  • Epistasis regulates genetic control of cardiac hypertrophy shows that interacting loci for left ventricular mass were invisible in single-variant scans. This is evidence that filtering by marginal significance misses real interactions.

These three papers find specific interactions. We estimate the aggregate variance that interactions explain, a complementary quantity that does not depend on which variants were tested.

Other work constrains the design.

  • MaSk-LMM compresses the genotype matrix with random projections and obtains large speedups for additive mixed models. Its guarantees cover additive structure only, so we do not apply sketching to the interaction kernels themselves. We do allow random-probe trace estimation as a competing option.
  • GenEpi needs at least 256 GB of RAM because it materializes every pairwise encoding. This shows that storing interaction intermediates without a cost model fails.

The systems work supplies the method.

- Cache-Based Multi-Query Optimization chooses cached subexpressions under a memory budget by solving a multiple-choice knapsack, a budgeted selection where each item has a value and a size.

  • Helix decides what to store across iterations of a workflow by weighing the cost of recomputing an item against the cost of loading it.
  • Dynamic Tensor Rematerialization evicts stored tensors online using a recompute-cost-per-byte score.

We adapt the knapsack formulation and the recompute-versus-load reasoning to a new kind of object: algebraically decomposable statistics, where choosing coarser cells trades storage for the range of subgroups that can still be answered. That trade-off has no counterpart in those systems. HYPPO exploits equivalences between interchangeable pipeline steps. Ours is a simpler but exact algebraic equivalence: a subgroup query equals a sum over cells.

Research Program

We will build three components.

Cube builder. A GPU tile engine streams sample-by-sample blocks of the 22 chromosome kernels, computed from standardized genotypes. For each tile it accumulates the cell-pair statistics for every scheduled kernel pair before discarding the tile. The cost is one genotype pass per tile row, shared across all scheduled pairs.

Workload-aware planner. The candidate items are triples of a kernel pair, a cell resolution (coarse, medium or fine demographic grid), and a representation. A representation is either exact cell-pair sums or random-probe products of the form $K(z\odot 1_c)$, where $z$ is a random probe vector masked to cell $c$. Random probes trade exactness for size. Each item gets three numbers:

  • a build cost measured on a small calibration tile;
  • a storage size;
  • a value equal to the expected genotype-pass time it saves, given a query distribution over traits, strata and kernel sets.

The query distribution is fitted from logged analyst sessions or specified up front. A dynamic-programming knapsack in the style of Cache-Based Multi-Query Optimization selects items under a storage and build-time budget. Queries the cube cannot answer fall back to an on-demand genotype pass. The result of that pass is offered back to the cube under an eviction score in the style of Dynamic Tensor Rematerialization.

Scientific scan. The scan estimates additive, dominance and inter-chromosomal epistatic variance, together with how each varies by age, sex and socioeconomic strata, across the UK Biobank phenome.

Baselines

Naive reference: per-query moment estimation. This baseline runs the block-based Haseman–Elston method of Phenome-wide heritability analysis of the UK Biobank independently for each (trait, stratum, kernel set) query, with a full genotype pass each time. It represents current practice and is the natural point of comparison. That paper reports heritability estimates for 100,000 subjects in under 30 seconds on a standard CPU for the additive single-kernel case. We expect the naive approach to remain competitive there, and we will say so if it does. We will reimplement it on the same GPU tile engine so that the comparison isolates storage policy rather than implementation quality. The cube beats it if total wall-clock time for the workload, including the cube build, is lower at matched estimate accuracy.

Strongest existing method: random-probe trace estimation with sketched genotypes. This is the approach of MaSk-LMM, applied per query to the traces. It is the strongest competitor because it already gives 10x to 30x speedups for additive models, and MaSk-LMM reports about 88 minutes on 500,000 synthetic samples versus 15 hours for Regenie. It gets the same GPU, the same budget of genotype passes, and a tuned number of probes. The cube beats it if it achieves lower error in the epistatic and stratified variance estimates at equal total compute. No reported result was found on Lacuna for stochastic-trace estimation of inter-chromosomal epistatic variance, so we will produce that number ourselves.

Storing full similarity matrices on disk. This baseline materializes all 22 per-chromosome kernels, roughly 47 GB each in single precision at this $n$. Each query is computed from these stored matrices by elementwise sweeps.

Cache everything, and LRU. We include an exhaustive cube and a least-recently-used cache as reference points. Helix reports that materializing everything used 30x more storage than its selective plan.

Ablations. Three ablations isolate the key ingredients:

  • a workload-agnostic planner that uses uniform query probabilities, which isolates the value of planning against a workload;
  • a planner restricted to a single cell resolution, which isolates the resolution trade-off;
  • a planner that only uses exact sums, with no probe representation.

Why not just…?

Why not just store each chromosome's similarity matrix once and reuse it? This handles reuse across traits but not the cost of each query. Every stratified or interaction query still sweeps $O(|S|^2)$ entries, often across four matrices for epistatic trace terms. That repeats about $6\times10^9$ operations per kernel pair, per query. The disk-matrix baseline measures this directly. If its total workload time comes within 2x of the cube's, the cube's added complexity is not justified and we will report that.

Why not just use random-probe or sketching estimators for everything? This is the real threat. If probe products masked to each cell are stored, probe estimators are themselves subgroup-decomposable and much smaller than exact sums. That is why the planner includes them as an option rather than treating them as a rival. The open question is variance. Small strata and the small epistatic variance components are where probe noise is largest, and MaSk-LMM's guarantees are for additive structure only. The matched-compute comparison will show where exact sums are worth their size. If probes win everywhere, the contribution reduces to subgroup-decomposable probe caching, which we would still report.

Why not just restrict to candidate genes or significant hits? Candidate filtering answers a different question, which specific pairs interact, and it misses loci with no marginal signal. Epistasis regulates genetic control of cardiac hypertrophy found exactly such loci. Genome-wide variance components need no filtering. Their cost is the reason the cube exists.

Proposed Experiments

The primary data is the UK Biobank interim subsample used by Phenome-wide heritability analysis of the UK Biobank: 108,158 individuals and 486,175 SNPs.

Correctness. Cube-answered estimates must match a direct computation to numerical precision. They must reproduce that paper's reported height estimate, $h^2_{SNP}\approx0.685$. They must also reproduce its finding that 33 of 50 physical measures decline in heritability with age, by an average of 3.5% per decade.

Planner evaluation workloads. We will generate three query workloads:

  • phenome-wide additive scans across 551 traits with trait-specific missingness, so that each trait has its own subgroup $S$;
  • stratified scans across age, sex and socioeconomic grids;
  • full models with additive, dominance and 231 inter-chromosomal kernels.

For each workload and storage budget we report total time to complete the workload, build time, storage used, and relative error against exact estimates.

Recovery of known components. We simulate traits from the real genotypes with planted epistatic variance between chromosome pairs and planted heterogeneity by age band. We then measure how well each method recovers the planted components at equal compute.

Decisive checks. Three outcomes would settle the main questions:

  • whether the cube's advantage grows with the number of kernels and strata while vanishing in the single-kernel case;
  • whether the workload-aware planner beats the uniform-probability planner when the realized workload differs from the one it was planned for (robustness to a misspecified workload);
  • whether the scientific scan shows inter-chromosomal epistatic variance, averaged across traits, that remains distinguishable from zero after correcting for population structure. A null result here would itself bound how much missing heritability inter-chromosomal interactions can explain.