Separating Compression from Phase Change in High-Pressure Diffraction

When a crystal is squeezed inside a diamond anvil cell (two diamond tips pressing a micron-sized sample to millions of atmospheres), its X-ray diffraction pattern changes for two very different reasons. The atoms move closer together, so every diffraction peak drifts smoothly. At some critical pressure the crystal may also rearrange into a new symmetry, so peaks split, vanish, or appear. Scientists care most about the second kind of change, because that is where superconductivity, metallization, and volume collapse show up. Synchrotron beamlines now record thousands of these patterns per hour, which is more than anyone can analyze by hand. Models trained on simulated patterns also break on real data: a Swin Transformer reaching 82.79% top-5 space-group accuracy on simulated patterns falls to 35% on real samples (A new benchmark for machine learning applied to powder X-ray diffraction). We propose an encoder that splits each pattern into two codes. One code is an "identity" code describing which crystal phase is present. The other is a "state" code describing how compressed, strained, broadened, and contaminated the pattern is. The goal is that the identity code changes only when the phase actually changes.

The tool is borrowed from speech synthesis, where an adversary is used to keep speaker identity out of a style code. Applied naively here, that tool fails for a specific reason. In speech, who is talking and how they talk are roughly independent. In a pressure ramp, pressure and phase are strongly linked: the high-pressure phase only exists at high pressure. An adversary that removes all pressure information from the identity code therefore also removes the phase transition. Our central claim is that this confound is the real obstacle at this intersection. It is fixed by making the adversary conditional on phase, so that it removes only the pressure information that varies within a phase. A second ingredient is swap training, which pairs the identity of one pattern with the state of another.

Core Claim

Our claim is that a two-code encoder, trained with a phase-conditional adversary plus swap-consistency, will locate transition pressures on in situ ramps more accurately than three alternatives: synthetic-supervised classifiers, strain augmentation alone, and unconditional adversarial invariance. The advantage should grow as the correlation between pressure and phase in the training data increases. Unconditional adversarial training should get worse as that correlation grows. That prediction is falsifiable and is not shared by any baseline.

Where This Sits

The disentanglement method comes from speech work.

  • Voice conversion and accent conversion systems put a classifier behind a gradient reversal layer. This layer passes features forward unchanged but flips the sign of the gradient going back, so the encoder learns to hide speaker identity from the classifier. Examples are StableVC, Voice-preserving Zero-shot Multiple Accent Conversion, and the prosody/content separation in Disentangling Content and Fine-Grained Prosody Information Via Hybrid ASR Bottleneck Features. We reuse this mechanism. We depart from it by conditioning the adversary, because those works assume the nuisance factor and the identity are independent, and here they are not.
  • FlexiVoice supplies two design constraints. It trains on deliberately conflicting pairs, such as a "happy" instruction with "sad" reference audio, to break entanglement; we adapt this as identity/state swapping. It also reports that continuous similarity rewards get polluted by legitimate style changes and must be replaced by discrete verification. We take that as a warning against continuous contrastive objectives for the identity code, since a continuous distance would penalize physically valid peak drift.
  • The speech literature's known failure mode also constrains us. A strong adversary over-scrubs and harms reconstruction, while a weak one leaks. We therefore report results across the full range of adversary strength rather than at a single tuned value.

Several diffraction papers motivate the problem.

None of these works separates continuous compression from symmetry change in a learned representation.

Research Program

Encoder and decoder. The encoder maps a one-dimensional integrated pattern $x$ to an identity code $z_{id}$ and a state code $z_s$. A decoder reconstructs $x$ from the pair.

Training data. Simulated training ramps are built from SIMPOD/Crystallography Open Database structures. Each structure is compressed along a sampled equation of state with anisotropic axis compressibilities. Simulated nuisances are then added: gasket lines (Re, steel), diamond spikes, a diffuse halo from the pressure medium, broadening from uneven stress, and texture. Known high-pressure phase pairs are spliced in at sampled transition pressures, so every frame has an exact phase label $y$ and state $s$.

Objective. The encoder and decoder minimize

$$\mathcal{L} = \mathcal{L}_{rec}(x, D(z_{id}, z_s)) + \mathcal{L}_{phase}(y \mid z_{id}) + \mathcal{L}_{state}(s \mid z_s) - \beta\, \mathcal{L}_{adv}(s \mid z_{id}, y) + \gamma\, \mathcal{L}_{swap}.$$

The terms are as follows:

  • $\mathcal{L}_{rec}$ is reconstruction error.
  • $\mathcal{L}_{phase}$ is phase classification from the identity code.
  • $\mathcal{L}_{state}$ regresses the state vector $s$ (lattice strain, peak width, background parameters) from $z_s$.
  • $\mathcal{L}_{adv}$ is the loss of an adversary that tries to predict $s$ from $z_{id}$ while being given the true phase $y$. The encoder maximizes this loss through gradient reversal, weighted by $\beta$. Because the adversary already knows the phase, it gains nothing from phase information. The encoder is therefore pushed to remove only within-phase pressure information.
  • $\mathcal{L}_{swap}$, weighted by $\gamma$, renders a pattern from the identity of frame A and the state of frame B. We have the exact simulated target for that combination, so the render is compared against it, and re-encoding the render must recover both $z_{id}(A)$ and $z_s(B)$.

Unlabeled real frames. Real frames enter in two ways: through reconstruction, and through a second conditional adversary that hides experiment or beamline identity from $z_{id}$. This second adversary must also be conditional. Each real experiment usually studies one material, so experiment identity is confounded with phase in the same way pressure is. Here the condition is a pseudo-label: the model's own phase prediction, kept only when it is confident.

Readout. At inference, a transition is declared where $z_{id}$ changes abruptly along a ramp. The transition pressure is read off that change point, and $z_s$ gives a continuous compression curve.

Baselines

Synthetic-supervised classifier (naive reference). A one-dimensional CNN and a Swin-style model are trained only on our simulated ramps without any nuisance augmentation. Transitions are read from changes in their predicted class. The closest reported number is Swin Transformer V2's 35% top-5 accuracy on real samples after 82.79% on simulation (A new benchmark for machine learning applied to powder X-ray diffraction). That figure is for space-group prediction at ambient conditions, not transition detection, so it frames the gap rather than serving as a direct target. Beating this baseline should be easy; failing to would end the project.

Full nuisance augmentation. The same backbones are trained on the full augmented simulation, with strain, gasket lines, halos, and texture, using the same training budget. We expect this to be the strongest competitor, because most of what our model learns could in principle come from augmentation alone.

Hybrid mixing. We add labeled real frames to simulated ones, following Machine Learning Automated Analysis of Enormous Synchrotron X-ray Diffraction Datasets. That paper reports calcite accuracy rising from 64% to 90% or above, and rhenium AUROC from 0.50 to 0.96. This baseline gets the same small labeled real set that we allow ourselves only in a clearly marked "few-label" setting. Our main setting uses none.

Contrastive alignment. An XtalNet-style contrastive encoder (End-to-End Crystal Structure Prediction from Powder X-Ray Diffraction) is retrained on our simulated ramps. Its embedding is used for change-point detection. No result for in situ ramps is reported on Lacuna.

Ablations. These isolate the key ingredient by holding everything else fixed:

  • the unconditional adversary (standard domain-adversarial training);
  • no adversary at all;
  • no swap loss.

Every learned baseline gets the same simulated data, the same backbone size, and the same hyperparameter search budget of 30 trials, with selection on a held-out simulated validation split.

Rietveld reference. Sequential Rietveld fitting by an expert serves as the accuracy reference for transition pressures on real ramps; it is not a competitor on throughput.

What counts as beating the baselines. Lower transition-pressure error than full augmentation on real ramps. Within-phase pressure in $z_{id}$ at chance for a linear probe. No loss of phase accuracy relative to the unconditional and no-adversary ablations.

Why not just…?

Why not just augment simulated data with every artifact and train a classifier? This is the real threat. If the full-augmentation baseline matches our transition error on real ramps, the adversary is not earning its place. In that case we would report the representation diagnostics, such as swap fidelity, as the remaining contribution. Two things argue against it. First, Rincón et al. find a sharp drop from simulation to real data for large models trained on nearly half a million simulated patterns. Second, augmentation only covers artifacts someone thought to simulate. The adversary on experiment identity is our only route to using unlabeled real frames, and the experiment that settles the question is the head-to-head comparison on real ramps.

Why not just represent patterns on a log-d axis, where uniform compression becomes a pure shift, and use a shift-invariant network? For isotropic compression this solves strain invariance by construction. We include it as a baseline. Anisotropic compression breaks the trick: different axes shrink at different rates, which changes peak spacings, not just positions. Examples include the negative area compressibility reported for PdSe2 and the anisotropic collapse in CaMn2Bi2. We stratify results by simulated anisotropy. If log-d matches us when anisotropy is low and loses when it is high, that shows the learned state code is needed exactly where physics says it should be.

Why not just use sequential Rietveld refinement? It remains the reference for accuracy. However, it needs a starting structural model and expert setup, and it cannot keep pace with ramp throughput (Machine Learning Automated Analysis of Enormous Synchrotron X-ray Diffraction Datasets). We position our model as a triage step that flags candidate transition pressures for Rietveld follow-up. We will measure what fraction of expert-identified transitions it flags, and how many false alarms it produces per ramp.

Proposed Experiments

Confound sweep. This is the decisive check. We build simulated training sets in which the correlation between pressure and phase ranges from zero (each phase appears across the full pressure range, which is unphysical but constructible) to the near-total correlation of real ramps. We then evaluate transition-pressure error and phase accuracy on held-out ramps. If our account is right:

  • the unconditional adversary should match ours at zero correlation and degrade steadily as correlation grows;
  • the conditional adversary should stay flat.

If both degrade together, the conditioning idea is wrong.

Leakage probes. We train linear probes to predict pressure from $z_{id}$ within each phase, and phase from $z_s$. We plot reconstruction error against $\beta$ to show where the leakage/over-scrubbing trade-off falls for each method.

Swap fidelity. We measure the error between the swapped render and its exact simulated target.

Real ramps. We evaluate on in situ high-pressure ramps with published transition pressures, such as CaMn2Bi2. The raw frames are not in the file and must be obtained from the authors or collected in new beamtime. We will report error in GPa against the Rietveld-determined transition.

Ambient real data. Ambient phase identification on the labeled subset of opXRD checks that the identity code is not overfit to pressure ramps. No reported ML number exists on Lacuna for opXRD, so all methods are compared there under our protocol.