Exact Adaptive Permutation Tests on Encrypted Genotypes

Genome-wide association studies (GWAS) test each of hundreds of thousands of genetic variants for a link to a disease. When a study is small, the variants are rare, or the trait is oddly distributed, the textbook formulas for p-values become unreliable. The trustworthy fallback is a permutation test, which shuffles the case/control labels many times and asks how often chance alone produces an association as strong as the real one. Two lines of work have progressed separately. One made permutation testing cheap in plaintext by spending shuffles only on variants whose significance is actually in doubt. The other made GWAS possible on homomorphically encrypted genotypes, meaning data that stay encrypted while a cloud server does arithmetic on them. In the encrypted setting, only fixed parametric formulas have been computed. No work in the file computes permutation p-values on encrypted genomes. The obvious attempt also breaks, because the adaptive shortcut needs "if this variant is settled, stop" decisions, and an encrypted server cannot branch on data it cannot read.

This proposal resolves that conflict with a simple split. The server does all per-shuffle work under encryption and returns only an encrypted count per variant: how many shuffles beat the observed statistic. The key holder decrypts just these counts once per round and makes the stopping decisions in plaintext. The counts are integers, and that makes the method work. Comparing two integer-valued statistics has a guaranteed gap of at least one unit, so a cheap polynomial approximation of the comparison can be made exact. The decrypted counts therefore equal the plaintext counts bit for bit. The result is intended to give the same discoveries as an insecure adaptive permutation analysis, with the raw genotypes never visible and the per-shuffle null statistics never decrypted. It would also flag the variants whose status stays unresolved, a direct, cheap measure of how unstable the list of hits is.

Core Claim

Under homomorphic encryption the dominant cost of a permutation test is the encrypted comparison. Each shuffled statistic must be tested against the observed one with a polynomial approximation of a step function, and that consumes multiplicative depth, the number of sequential encrypted multiplications a circuit can afford before its noise must be reset. Because this cost is paid once per variant per shuffle, the savings from adaptive allocation carry over almost one-for-one to encrypted runtime. The encrypted setting in fact rewards adaptivity more than plaintext does, since each skipped shuffle saves far more wall-clock time.

The specific claims are these. First, round-wise decryption of exceedance counts is enough to run the adaptive bandit procedure of Adaptive Monte Carlo Multiple Testing via Multi-Armed Bandits (AMT) on encrypted data. Second, integrality of the test statistic allows exact counting with a low-depth comparison polynomial. Third, the data layout and a repacking step between rounds keep the savings from being erased by SIMD granularity, the fact that one ciphertext holds thousands of values that are processed together.

Why the Obvious Combinations Fail

The closest encrypted work, Secure large-scale genome-wide association studies using homomorphic encryption, computes chi-square and a degree-1 Taylor approximation of logistic regression under the CKKS scheme. It packs many variants into each ciphertext and reports statistics matching cleartext R with $R^2 = 1.00$ on an age-related macular degeneration (AMD) cohort. It supplies our encryption substrate and packing strategy. It computes only asymptotic statistics, which are exactly the quantities that permutation testing exists to replace.

AMT supplies the statistical engine. It keeps without-replacement confidence bounds on each variant's p-value and samples only variants near the Benjamini–Hochberg discovery threshold, the standard cutoff for controlling the false discovery rate. On a Parkinson's GWAS it reported "3,000x fewer MC samples" and a drop from "2 months to 1.1 hours". AMT is plaintext and branches at every step, and the file identifies this branching as incompatible with homomorphic evaluation.

Two shortcuts are ruled out on privacy grounds. Hardware enclaves, as in SAFETY, would permit branching, but they place trust in hardware that is exposed to side channels and limited in memory. Decrypting every shuffled statistic and comparing in plaintext would also permit branching, but it leaks heavily. The values $g_j^\top P_b y$ for many known shuffles $P_b$ are bilinear measurements of the genotype vector $g_j$ and the phenotype vector $y$. Enough of them let an observer reconstruct the pairing the encryption was meant to hide.

Our design sits between these options. Only an aggregated count per active variant per round is ever decrypted.

Research Program

The statistic and the exactness trick. For a biallelic variant $j$ with genotype counts $g_{ij} \in \{0,1,2\}$ and binary phenotype $y_i$, the trend-test score is proportional to $|g_j^\top y - c_j|$, where $c_j = \bar y \sum_i g_{ij}$. The variances in its denominator do not change under label shuffling, so the permutation test only needs to compare numerators. Shuffle $b$ counts as an exceedance when

$$D_{jb} = |g_j^\top P_b y - c_j| - |g_j^\top y - c_j| \ge 0,$$

where $P_b$ is the $b$-th public random shuffle. We scale both terms by the case count so that everything is an integer. $D_{jb}$ is then an integer bounded by roughly $2n$, with $n$ the sample size. The event "$D_{jb} \ge 0$" is the same as "$D_{jb} + \tfrac12 > 0$", and the shifted quantity always has magnitude at least $\tfrac12$. Any sign approximation accurate on the interval $[\tfrac12, 2n+1]$ therefore returns the exact indicator.

The depth of such approximations grows with the logarithm of the ratio between the input range and the required gap. In this setting that ratio is only about $4n$, which keeps the comparison shallow enough to avoid bootstrapping, the costly noise-reset step, in most configurations. Summing the indicators over the shuffles of a round, inside the ciphertext slots, gives an encrypted exceedance count that is exactly correct.

Layout. We use sample-major packing: one ciphertext per individual, whose slots hold that person's genotypes across a block of variants. With this layout a shuffle requires no homomorphic slot movement. Computing $g^\top P_b y$ reduces to the server pairing individual $i$'s genotype ciphertext with the encrypted phenotype of individual $P_b(i)$ and summing, which is pure index bookkeeping. Each shuffle costs $n$ multiplications per variant block, followed by one vectorized comparison across all variants in the block.

Under the default threat model the phenotypes are encrypted. We also cost a weaker model in which the phenotype is plaintext at the server, which replaces ciphertext–ciphertext multiplications with cheaper plaintext–ciphertext ones.

Rounds and repacking. Each round draws a batch of shuffles from a public seed, and the server returns encrypted counts for the active variants. The key holder decrypts the counts, updates the AMT bounds and threshold, and publishes the new active set. Because many variants share a ciphertext, dropping a variant saves nothing until its entire block is inactive. After the first rounds, when AMT's active set collapses, the server therefore compacts active variants into dense ciphertexts using masked rotations. We will measure when compaction pays for itself. The trade-off is a one-time rotation cost per individual against savings that scale with the remaining shuffles.

Leakage accounting. The key holder sees prefix counts and stopping times, which is more than the final p-values alone reveal. We quantify this extra leakage empirically instead of assuming it is harmless. The same membership-inference concern that the file raises for summary statistics applies here.

Instability as a byproduct. When AMT exhausts its budget, the variants still unresolved are exactly those whose discovery status depends on Monte Carlo noise near the threshold. We will test whether this set predicts which hits flip across half-sample subsamples. Half-samples are cheap in our layout: we just omit individuals from the sum. This is the file's feature-selection instability question, as documented in Feature Selection: An Ever Evolving Frontier in Data Mining, posed for the GWAS hit list.

We are deliberately not attempting encrypted Lasso stability selection. The file documents that iterative solvers exhaust multiplicative depth, so that path is out of scope.

Baselines

Plaintext full Monte Carlo permutation testing is the naive reference. It applies a uniform shuffle budget to every variant with no encryption, and defines the correct discovery set. It will be run on identical data with identical shuffle seeds.

Plaintext AMT from Adaptive Monte Carlo Multiple Testing via Multi-Armed Bandits is the strongest existing method for the statistical question, reporting "3,000x fewer MC samples than the full approach" on the Parkinson's GWAS. It is the ceiling on sample efficiency. Our encrypted system counts as successful if it reproduces AMT's discovery set exactly, with the same seeds, and its total shuffle count stays within a small factor of AMT's. That factor comes only from round batching, since AMT updates after every draw.

Encrypted parametric GWAS as in Secure large-scale genome-wide association studies using homomorphic encryption is the strongest existing encrypted competitor. It reports $R^2 = 1.00$ against cleartext statistics on AMD and a projected "5.6 hours on a single server" for 100,000 individuals and 500,000 SNPs. We reimplement its chi-square path on the same hardware and parameter set. We beat it where its asymptotic p-values miscalibrate, in rare-variant and small-sample regimes, and we report its large runtime advantage honestly where they do not.

Static encrypted permutation, with a fixed shuffle budget for every variant, is the ablation that isolates adaptivity. It uses the same comparison circuit, layout, and total compute ceiling. We need a large wall-clock ratio against it at matched discovery accuracy.

Two further ablations isolate the remaining ingredients. The first replaces the integer-gap sign polynomial with a generic approximation of the same depth and counts miscounted exceedances. The second disables repacking.

No reported result exists on Lacuna for encrypted permutation testing of any kind.

Why not just…?

Why not just use encrypted parametric tests, since they already work? For common variants in cohorts the size of AMD, the asymptotic chi-square is probably well calibrated, and there our method would be pure overhead. This is a real threat to relevance, not to correctness. We will settle it by measuring calibration of the encrypted parametric p-values against plaintext full permutations across variant frequency and sample size. The method will be claimed only for the regime where the two disagree on discoveries. If that regime turns out negligible in realistic designs, the contribution shrinks to a niche tool, and we will say so.

Why not just use a permutation-free studentized test such as the Random-Lifter statistic or cross-MMD under encryption? Studentized Tests of Independence: Random-Lifter approach and A permutation-free kernel two-sample test replace shuffling with a statistic that is asymptotically standard normal, which suits a fixed encrypted circuit. They still rest on large-sample asymptotics, which are exactly what fail in the regime where permutations are needed. The Random-Lifter paper itself notes a small-sample power loss from injected noise, and its kernel computation costs $O(n^2)$, which becomes a very large number of encrypted pairwise operations at biobank scale. For a single variant tested against a binary trait they add little over the parametric test. We include them as a calibration comparison on a small simulated subset only.

Why not just run plaintext permutations inside a hardware enclave? It would be faster, and SAFETY shows enclave hybrids working for counts-based tests. The trade is trust: enclaves are exposed to side channels and limited in memory. Our claim concerns what is achievable with no trusted hardware, and we will report the speed gap against an enclave estimate openly.

Why not just decrypt the shuffled statistics and compare in plaintext? This removes the comparison polynomial, but it releases $B$ bilinear measurements per variant. We will run a reconstruction attack on 1000 Genomes–derived data to show how much genotype–phenotype pairing these values expose, compared with releasing counts alone.

Proposed Experiments

The main testbeds follow the file. We use synthetic cohorts generated from 1000 Genomes allele frequencies, as in SAFETY, for controlled regimes, with simulated phenotypes that plant rare-variant and small-sample associations where asymptotic p-values are known to break. We also use the Parkinson's case-control design (267 cases, 271 controls, 448,001 SNPs) from the AMT paper, reproduced with real data if access permits and otherwise simulated at matching dimensions. For scaling we use the AMD dimensions from the encrypted GWAS paper.

The metrics are exact agreement of the discovery set with plaintext AMT under shared seeds, total shuffles, encrypted wall-clock time, ciphertext traffic, and circuit depth. We also measure membership-inference advantage from the decrypted round counts compared with final p-values alone.

Three checks are decisive. First, zero miscounted exceedances across all runs with the integer-gap comparison, against a measurable miscount rate for the generic approximation. Second, an encrypted runtime reduction over static encrypted permutation that tracks AMT's plaintext sample reduction to within the batching factor. Third, a documented regime in which encrypted parametric p-values change the discovery set while our method matches plaintext permutations. A secondary check tests whether the unresolved-at-budget set predicts discovery flips across half-samples better than distance from the threshold computed on the full sample.