What the Exchange Screening Schedule Reveals: Leakage and Oblivious Fock Builds for Hybrid DFT

Hybrid density functional theory (DFT) is a quantum-mechanical method that computes the electronic properties of molecules and crystals. It mixes in a fraction of "exact" Hartree-Fock exchange to fix the systematic errors of cheaper approximations, and it is now the default for band gaps, battery cathodes and topological materials. It is also expensive. Codes that represent electrons with orbitals centered on atoms keep it affordable through screening: they skip every block of electron-repulsion integrals whose estimated magnitude falls below a threshold. Which blocks survive depends almost entirely on which atoms sit close to which other atoms. The memory access pattern of a screened hybrid calculation is therefore close to a readable copy of the structure being simulated.

This matters as proprietary materials discovery moves onto rented cloud hardware and trusted enclaves, which are processors that encrypt memory contents but cannot hide which addresses are touched. We propose two things. The first is to measure how much of a secret structure an observer can rebuild from the screening trace alone, such as a dopant arrangement, a lithium-vacancy ordering or an adsorption site. The second is to build a Fock-matrix construction that hides this trace at modest cost. Our main observation is that a screened exchange build is a database join between the list of surviving integral blocks and the table of density-matrix blocks. Recent work on oblivious and differentially oblivious joins has shown how to execute such joins without paying for the worst case. A physical packing bound on how many atoms can sit within the screening radius gives a per-atom padding budget, so the cost of hiding grows linearly with system size rather than quadratically.

Core Claim

The claim has two parts, and either can fail on its own. The first part is that the trace of fetched integral and density-matrix blocks in an atom-centered-basis hybrid calculation (HSE06 or PBE0 with Cauchy-Schwarz screening) leaks the secret degrees of freedom of a structure with high accuracy. This is the scientific-computing analogue of what Hashemi et al. showed for embedding-table lookups in recommender systems, where two observed purchases re-identify 98% of users. The second part is that the leak can be removed with bounded overhead by recasting the exchange build as an oblivious join. Here "oblivious" means the sequence of memory addresses does not depend on secret data.

Write the exchange contribution as $K_{\mu\nu} = \sum_{\lambda\sigma} (\mu\lambda|\nu\sigma) P_{\lambda\sigma}$. Here $(\mu\lambda|\nu\sigma)$ are the two-electron integrals over basis functions $\mu,\lambda,\nu,\sigma$, and $P$ is the density matrix. Screening keeps only the quartets that pass the threshold, so the build is a join of the survivor list with $P$ on the key $(\lambda,\sigma)$, with output size $R$ equal to the number of surviving quartets. Chu et al. give differentially oblivious joins whose runtime is $O(R + N\log N)$ and whose padded output is $R + O((\mu_{\max}+\log N)\log N)$. Fully oblivious joins, by contrast, must pad to the worst case. A differentially oblivious join is one whose access pattern changes only slightly, in the differential-privacy sense, when the input changes slightly.

The physics supplies the missing ingredient: a public, geometry-independent cap on the join multiplicity. If the minimum interatomic distance $d_{\min}$ and the screening radius $r_c$ are public, a sphere-packing argument bounds the number of neighbors of any atom. It counts the non-overlapping spheres of radius $d_{\min}/2$ that fit inside a sphere of radius $r_c + d_{\min}/2$:

$$k_{\max} \le \left(1 + \frac{2 r_c}{d_{\min}}\right)^3 .$$

We pad each atom's neighbor list to $k_{\max}$, or more tightly to the public lattice-site envelope when the lattice is known and only occupancy is secret. The cost then becomes a constant factor $k_{\max}/\bar{k}$ over the insecure build, where $\bar{k}$ is the actual mean neighbor count. This avoids the quadratic blowup of padding every pair. The differentially oblivious variant pads only to $R$ plus calibrated one-sided noise, adding dummy blocks and never dropping real ones. Because padding adds dummies with zero weight, the numerical result is bit-for-bit or near-identical to the insecure code. Accuracy is not traded for privacy. Only time is.

Research Program

The program starts with an attack. We instrument an atom-centered-basis hybrid code of the kind benchmarked by Ji et al.. That study compared VASP, FHI-aims, Quantum ESPRESSO and ABACUS. FHI-aims and ABACUS use atom-centered orbitals and screened exchange, while VASP and Quantum ESPRESSO use plane waves. We record the block-level address trace of the exchange build at page and cache-line granularity, which matches the model of an enclave adversary.

From this trace we train inversion attacks of increasing strength. The simplest uses survivor counts per atom. A stronger one reconstructs the neighbor graph from co-access. The strongest uses learned inversion that also exploits basis-shell sizes, which reveal species. Attack success is measured as recovery of the secret degrees of freedom: cation occupancy in alloy supercells, lithium/vacancy and Mn(III)/Mn(IV) ordering in spinels, and adsorption site and height for hydrogen on graphene.

We also audit channels other than the integral blocks. These include the number of self-consistent iterations, convergence-dependent early exits, and incremental Fock-build screening that is weighted by the density change between iterations. That last channel is secret-dependent even when the geometry is fixed.

The defense has three tiers, and each removes a specific channel. The site-envelope tier applies when the lattice is public and only occupancy is secret. It pads every atom's shell list to the largest species basis and runs the build over all site pairs within $r_c$. The packing-bound tier applies when the geometry itself is secret. It pads per-atom lists to $k_{\max}$ and executes the join with sorting-network-based oblivious joins in the style of Krastnikov et al. and Hu and Wu. It also applies a one-time oblivious shuffle of atom labels, borrowed from PermuteRam, so that per-atom work cannot be linked to positions. The differentially oblivious tier replaces the deterministic pad with the noisy pad of Chu et al., giving a privacy budget $\epsilon$ that trades leakage for speed.

In all tiers we fix the iteration count to a public cap and disable data-dependent incremental screening. Because the padded schedule depends only on public quantities, it is known ahead of time. That makes it eligible for offline swap planning in the manner of MAGE. MAGE showed that out-of-core oblivious workloads can run within 15% of their in-memory speed, and we use this when the padded integral store exceeds enclave memory.

Baselines

The naive reference point is the insecure screened hybrid build running in the same enclave. It gives the lower bound on time and the upper bound on leakage, and every overhead we report is relative to it. No reported result was found on Lacuna for the wall time of an enclave-resident screened HSE Fock build. We will therefore measure it ourselves on identical hardware, with identical basis sets, thresholds and k-point meshes.

The strongest existing secure option is the fully oblivious version: drop screening and evaluate every quartet in a fixed order. This is the "worst-case curse" that Chu et al. describe for joins. It leaks nothing beyond system size, and its cost is the price our padding must beat. We count our method as beating it if the packing-bound tier is at least an order of magnitude faster on the 216-atom supercells, at identical numerical output.

A second strong competitor is to leave the code unchanged and place the density matrix and integral store behind a generic tree-based ORAM. ORAM, or oblivious RAM, is a memory layer that reshuffles data so every access looks random. For a privacy-relaxed generic version we use the Root ORAM of Wagh et al., which reports a 2–10× bandwidth reduction over standard tree ORAM. For context on what generic oblivious maps achieve, BOLT reports roughly 5,200 queries per second for CPU oblivious maps against 174,000–219,000 on its secure-memory accelerator. BOLT also reports that its throughput degrades as payloads grow from 8 to 256 bytes, and density-matrix blocks are far larger than that. Our method beats this baseline if its end-to-end SCF time is lower at equal leakage, with the comparison made under the same memory budget.

Two ablations isolate the key ingredient. In the first, the join is replaced by padding every atom to the global worst case $N$ rather than $k_{\max}$. This tests whether the physical bound is what makes the method affordable. In the second, the label shuffle is removed. This tests whether residual per-atom linkability survives padding.

Why not just…?

Why not just use plane-wave hybrids, whose exchange step is already data-independent? In plane-wave codes the exact exchange is evaluated by Fourier transforms over all orbital pairs on a grid that is fixed by the cell and the energy cutoff. Its access pattern is essentially oblivious already. This is a real threat for small cells, and we will not argue it away. The experiment that settles it is a crossover plot: matched-accuracy wall time against supercell size, from the 20-solid set up to 216-atom supercells. It compares plane-wave HSE, made out-of-core with MAGE-style planning where needed, against our padded atom-centered build. If plane waves win at every size we test, the honest conclusion is that practitioners who need confidentiality should switch bases, and we will report that.

Why not just use the on-site hybrid PBE0r, whose exchange is block-diagonal per atom? Eckhoff et al. show that PBE0r matches global and screened hybrids on lithium manganese oxides at roughly GGA cost. It reports a formation-energy error of 0.28 eV per formula unit, against 1.35 eV for PBE. Its access pattern depends only on the atom list and species, so with composition public it is nearly oblivious for free. We will run it as a baseline on the spinel set. Its limit is scope. On-site exchange does not capture the inter-site exchange that sets band inversion in Cd3As2 (Weng et al.) or compositional bowing in InGaAs (Luisier et al.). We will report where its band gaps diverge from HSE on those systems.

Why not just fall back to cheap semi-local DFT or DFT+U inside the enclave? These methods are cheaper and also have simpler memory patterns. However, Casolo et al. show that GGA predicts the wrong spin state for hydrogen on graphene. They also show that GGA+U restores the spin but turns an attractive sticking potential into a purely repulsive one. Eckhoff et al. show that PBE predicts insulating cathodes to be metallic. For the systems where hybrids are needed at all, this alternative changes the answer rather than protecting it.

Why not just hash or permute block addresses without formal guarantees? Hashemi et al. invert hashed sparse indices with up to 0.94 top-10 accuracy. Our attack suite includes a hashed-address variant to show directly whether hashing survives co-access analysis on structure traces.

Proposed Experiments

The decisive check is the attack. The test systems are the 32- and 216-atom InGaAs supercells of Luisier et al., the 13 lithium manganese oxide systems of Eckhoff et al., and the hydrogen-on-graphene approach path of Casolo et al.. On each we measure the following from the insecure trace: cation-occupancy recovery rate, lithium/vacancy ordering accuracy, and adsorption-site and height error. If recovery is near chance, the security half of the project collapses. We would then report a negative result, that screening traces are not an important leak, and stop.

If recovery is high, we rerun every attack against each defense tier. We expect recovery at chance for the deterministic tiers. For the differentially oblivious tier we expect recovery bounded as a function of $\epsilon$, and we report the empirical trade-off curve.

Fidelity is checked on the 20 binary solids of Ji et al.. The secure build must reproduce the insecure lattice constants and HSE band gaps far inside the roughly 0.1 eV band-gap spread that Ji et al. report between codes. Our target is agreement to the SCF convergence tolerance, which is the expected outcome since padding adds only dummy blocks.

Cost is reported as wall time and memory traffic relative to the insecure build, per tier, across system size. It is compared with the unscreened, ORAM-wrapped, PBE0r and plane-wave baselines under a common memory budget. We also measure the empirical ratio $k_{\max}/\bar{k}$ on dense solids, which should be close to 1, and on slabs with vacuum, which should be large. This tells us when the differentially oblivious tier is needed.