PhaseMatcher: Autoregressive Phase-Set Identification with Spectral Decomposition
Organizations: Institute of Physics, Chinese Academy of Sciences · University of the Chinese Academy of Sciences · Xi’an Jiaotong University · Beijing University of Posts and Telecommunications
Abstract
Recovering complete phase sets from powder X-ray diffraction (PXRD) is challenging when weak-phase peaks overlap stronger signals. A natural strategy is to identify phases iteratively, removing the contribution of each identified phase from the observed pattern before predicting the next. However, even after a phase is correctly identified, misestimating its contribution can distort the residual and cause subsequent errors. We introduce PhaseMatcher, an autoregressive framework for complete phase-set identification with physics-guided spectral decomposition. After each phase prediction, PhaseMatcher re-estimates the contributions of all selected phases and the residual from the original observation and all selected reference patterns, accounting for physically plausible variation between reference patterns and the corresponding phase contributions in the observation. The resulting residual guides subsequent phase identification, while a separate stopping module determines when the phase set is complete. On synthetic mixtures and controlled mixtures constructed from measured single-phase patterns, PhaseMatcher improves complete-set identification over the evaluated baselines. On PhaseMix-135K, it also estimates contributions and residuals more accurately than scalar subtraction.
Figures & tables
| Method | Exact-set@1 (%) | Phase recall (%) | Count acc. (%) | Exact-set@10 (%) |
|---|---|---|---|---|
| (a) PhaseMix-135K | ||||
| PhaseDifformer | 4.06 | 34.90 | 44.33 | - |
| Iterative database matching | 13.85 | 49.98 | 24.39 | 15.86 |
| XDecomposer | 14.63 | 51.10 | 34.95 | 18.52 |
| PhaseMatcher, scalar Greedy | 67.98 | 88.22 | 87.59 | - |
| PhaseMatcher, scalar Beam | 69.57 | 88.47 | 86.07 | 88.79 |
| Exact-set@1 / Phase recall (%) | 1 phase | 2 phases | 3 phases | 4 phases |
|---|---|---|---|---|
| (a) PhaseMix-135K | ||||
| PhaseDifformer | 24.18 / 72.43 | 7.77 / 47.18 | 0.28 / 31.08 | 0.01 / 22.26 |
| Iterative database matching | 54.21 / 81.22 | 26.44 / 60.43 | 8.19 / 47.92 | 1.70 / 38.49 |
| XDecomposer | 72.17 / 74.67 | 29.21 / 59.21 | 5.23 / 49.47 | 0.00 / 42.37 |
| PhaseMatcher, scalar Greedy | 93.80 / 93.96 | 84.09 / 91.70 | 69.28 / 88.50 | 52.50 / 84.84 |
| PhaseMatcher, scalar Beam | 95.72 / 95.79 | 86.64 / 93.06 | 71.75 / 89.31 | 52.88 / 83.72 |
| Method | Cosine similarity | MAE ( ) |
|---|---|---|
| PhaseDifformer | 0.4683 | 64.6040 |
| XDecomposer | 0.6319 | 32.8429 |
| PhaseMatcher, scalar Greedy | 0.8807 | 32.4846 |
| PhaseMatcher, scalar Beam | 0.8701 | 32.5473 |
| PhaseMatcher, Greedy | 0.9735 | 3.4209 |
| PhaseMatcher, Beam | 0.9765 | 3.0280 |
Appendix figures & tables53 assets
Supplementary material from the paper’s appendix.
Appendix
| Quantity | PhaseMix-135K | RRUFF mixtures | Convention |
|---|---|---|---|
| Reference IDs | 135,258 | 740 | Full candidate library at inference |
| Training mixtures | 12,135,258 | 100,000 | Observation realizations 0, 1, 2 |
| Validation mixtures | 100,000 | 7,400 | Observation realization 3 |
| Test mixtures | 100,000 | 7,400 | Observation realization 4 |
| Test | 10,000 | 740 | One selected ID |
| Test | 20,000 | 1,480 | Two distinct IDs |
| Level | Parameter | Distribution / setting | Operation |
| Reference | Gaussian FWHM | Clean theoretical profile rendering | |
| Phase | Wavelength in perturbation formulas | Å | Scherrer broadening and thermal attenuation |
| Phase | Crystallite size | nm | Gaussian broadening; Scherrer width at |
| Phase | Isotropic strain | Bragg-law coordinate warp | |
| Phase | Thermal root-mean-square displacement | Å | Angle-dependent intensity attenuation |
| Phase | Relative-intensity envelope | Six anchors from | Linear interpolation of multiplicative modulation |
| Array | Shape | Type | Meaning |
|---|---|---|---|
| Clean patterns.npy | float32 | Candidate reference spectra | |
| Perturbed patterns.npy | float16 | Five observation profiles per ID | |
| entry.npy | Unicode | Record IDs in reference-row order | |
| axis_two_theta.npy | float32 | Angular grid in degrees | |
| _ids.npy | int32 | Selected library-row IDs | |
| _weights.npy | float32 | Mixture weights |
| Field | Batched shape | Meaning / use |
|---|---|---|
| mixture | Max-normalized observation | |
| phase_ids | True IDs in decreasing-weight order; padding | |
| phase_weights | Mixture weights; padding 0 | |
| counts | True phase count | |
| targets | phase IDs, a termination marker, then padding | |
| reference_patterns | Clean references for the true history |
| Module | Configuration |
|---|---|
| Spectrum encoder: convolutions | Four stride-two layers; kernels 15, 11, 7, 5; channels 256, 512, 512, 512; projection to width 512 |
| Spectrum encoder: Transformer | Learned positional embeddings; 3 layers; 8 heads; feed-forward width 2,048; dropout 0.05 |
| Single-phase classifier | Learned attention pooling; normalized feature and classifier rows; learned logit scale; class matrix |
| Phase Head / STOP Head | 6 / 2 Transformer decoder layers; width 512; 8 heads; feed-forward width 2,048; dropout 0.05 |
| Decomposition encoders | Separate observation and reference pyramids; input channels and ; channels 24, 48, 96, 192 |
| Local correlation | One cosine-similarity table per observation–reference pair: 8 angular regions and offsets to bins; output |
| Term | Definition | |
|---|---|---|
| Component intensity | 1 | Weighted pointwise SmoothL1 between and ; transition parameter 0.02; point weight . Padding masks exclude absent references. |
| Component shape | 0.1 | Mean cosine distance between and over valid references with nonzero target norm. |
| Total selected-phase intensity | 2 | Weighted SmoothL1 between and , with transition parameter 0.02 and point weight . |
| Source allocation | 1 | Kullback–Leibler divergence from target fractions to predicted fractions. Point weight ; bins with have zero weight. |
| Integrated selected-phase intensity | 0.1 | Mean . |
| Residual shape | 0.2 | Cosine distance between max-normalized and . |
| Setting | Single-phase pretraining | Multiphase joint training | Joint training with STOP |
|---|---|---|---|
| Trainable modules | Spectrum encoder and classifier | Encoder, phase table, Phase Head, decomposition | Stage-two modules and STOP Head |
| Initialization | New model | Single-phase encoder and class matrix; new Phase Head and decomposition parameters | Final stage-two weights |
| Objective | Phase cross-entropy | ||
| Optimizer | AdamW | AdamW | Fresh AdamW |
| Initial learning rate | in both parameter groups | in both parameter groups | |
| Weight decay | 0.01 |
| Setting | PhaseMix-135K | RRUFF mixtures |
|---|---|---|
| Phase-stage updates / batch size | 120,000 / 128 | 1,750 / 128 |
| STOP-stage updates / batch size | 40,000 / 224 | 1,250 / 128 |
| Checkpoint for STOP / evaluation | Final phase / final STOP | Final phase / final STOP |
| Input: observations , ordered true-ID sequences of length , true contributions, and stage . | |
| 1 | Sample one candidate set containing all batch-positive IDs and negative proposals. |
|---|---|
| 2 | Initialize phase-loss list , STOP-loss list , weighted decomposition sum , and prefix count . |
| 3 | For : |
| 4 | Select samples ; let contain the first IDs of (the empty sequence when ). |
| 5 | If , set each residual query . |
| 6 | If : compute and set . |
| Input: normalized observation , full reference library, maximum count , and width (1 for Greedy; 10 for Beam). | |
| State: an ordered history , its residual query , and cumulative action log probability . | |
| 1 | Initialize active paths and completed paths . |
| 2 | While is nonempty: |
| 3 | Initialize next active candidates . |
| 4 | For each : |
| 5 | Compute phase logits from and the STOP logit from . |
| Setting | PhaseMix-135K | RRUFF mixtures |
|---|---|---|
| Optimizer updates | 106,000 | 13,380 (30 epochs) |
| Global batch size | 1,024 | 224 |
| Peak learning rate | ||
| Warmup updates | 2,120 | 429 |
| Encoder | Frozen | Fine-tuned |
| Selected update | 106,000 | 13,380 |
| Dataset | Retrieval | Threshold | Exact-set@1 | Phase recall | Count acc. |
|---|---|---|---|---|---|
| PhaseMix-135K | Reranked | 0.800 | 11.015 | 46.180 | 46.392 |
| Cosine | 0.800 | 13.904 | 53.340 | 46.179 | |
| Cosine | 0.850 | 14.572 | 51.850 | 38.569 | |
| Cosine | 0.870 | 14.680 | 51.101 | 34.952 | |
| Reranked | 0.870 | 11.652 | 44.232 | 35.092 | |
| RRUFF | Cosine | 0.800 | 14.608 | 59.303 | 44.986 |
| Dataset | Retrieval, threshold | Exact-set@1 | Phase recall | Count acc. | Exact-set@10 |
|---|---|---|---|---|---|
| PhaseMix-135K | Reranked, 0.800 | 10.87 | 46.16 | 46.22 | 14.15 |
| Cosine, 0.870 (selected) | 14.63 | 51.10 | 34.95 | 18.52 | |
| RRUFF | Cosine, 0.800 | 14.49 | 59.54 | 44.47 | 17.36 |
| Cosine, 0.868 (selected) | 15.46 | 56.52 | 35.27 | 18.11 | |
| Reranked, 0.800 | 12.07 | 52.73 | 45.00 | 16.86 |
| Phase count | Paper component Top-1 | Our component Top-1 | Phase recall | Exact-set@1 |
|---|---|---|---|---|
| 2 | 78.41 | 66.79 | 34.32 | |
| 3 | 61.17 | 53.66 | 1.26 | |
| 4 | 51.96 | 46.54 | 0.03 |
| Module | Updates | Peak LR | Val. interval | Selected step |
|---|---|---|---|---|
| Unguided predictor | 213,000 | 2,000 | 142,000 / 78,000 | |
| Guided predictor | 213,000 | 2,000 | 78,000 / 98,000 | |
| Confidence estimator | 7,100 | 500 | 7,100 / 7,100 |
| Item | Setting |
|---|---|
| Observation generation | Seeds: 20260826 for PhaseMix-135K and 20260909 for RRUFF. PhaseMix-135K shares mixture identities and weights across baselines; differing observation seeds produce different noise realizations. |
| Gaussian representation | Filter-first NNLS targets; FWHM on PhaseMix-135K and on RRUFF, shared by target fitting and inference rendering. |
| Normalization | Observed dense-spectrum maximum, rather than a ground-truth coefficient scale. Remaining coefficients are rendered before forming subsequent peak-height conditions. |
| Peak augmentation | Position standard deviation follows the paper, rather than the released configuration’s ; relative-height standard deviation is 0.1. |
| Confidence objective | Noise error plus candidate BCE over all five candidates; the released configuration uses zero diffusion weight and its top-candidate path. |
| Diffusion and clipping | The denoising diffusion probabilistic model (DDPM) uses all 1,000 indices for training and sampling, . Generated coefficients are nonnegative, without a peak-height upper bound. |
| Dataset | Protocol | Exact-set@1 (%) | Phase recall (%) | Count acc. (%) |
|---|---|---|---|---|
| PhaseMix-135K | Peak height | 4.84 | 29.09 | 38.21 |
| Coefficient (main) | 4.06 | 34.90 | 44.33 | |
| RRUFF mixtures | Peak height | 8.27 | 42.51 | 27.46 |
| Coefficient (main) | 2.12 | 47.04 | 37.51 |
| Phase count | 1 | 2 | 3 | 4 |
|---|---|---|---|---|
| Count accuracy (%) | 98.78 | 90.41 | 64.50 | 43.65 |
| Exact-set@10 (%) | 100.00 | 94.80 | 81.04 | 63.99 |
| Cosine / MAE ( ) | 1 phase | 2 phases | 3 phases | 4 phases |
|---|---|---|---|---|
| PhaseDifformer | 0.5464 / 31.47 | 0.5061 / 49.37 | 0.4548 / 65.94 | 0.4400 / 79.50 |
| XDecomposer ( ) | 0.9270 / 10.66 | 0.7428 / 24.98 | 0.6239 / 32.27 | 0.5597 / 39.50 |
| XDecomposer ( ) | 0.9342 / 13.74 | 0.7323 / 27.56 | 0.6062 / 33.99 | 0.5253 / 39.40 |
| PhaseMatcher, scalar Greedy | 0.9233 / 49.99 | 0.9052 / 36.06 | 0.8828 / 30.62 | 0.8561 / 27.72 |
| PhaseMatcher, scalar Beam | 0.9239 / 50.20 | 0.9050 / 36.11 | 0.8754 / 30.64 | 0.8352 / 27.78 |
| PhaseMatcher, Greedy | 0.9969 / 2.63 | 0.9848 / 3.20 | 0.9740 / 3.73 | 0.9616 / 3.50 |
| Dataset | Test mixtures | Cosine similarity | MAE ( ) |
|---|---|---|---|
| PhaseMix-135K | 100,000 | 0.4683 | 64.6040 |
| RRUFF mixtures | 7,400 | 0.4189 | 125.7769 |
| Method | Phases | Contribution | Residual | ||
|---|---|---|---|---|---|
| Cosine | MAE | Cosine | MAE | ||
| Automatic Greedy, at termination | |||||
| Scalar | 1 | 0.9233 | 49.9854 | 0.3770 | 50.8714 |
| Scalar | 2 | 0.9052 | 36.0601 | 0.3724 | 67.4130 |
| Scalar | 3 | 0.8828 | 30.6208 | 0.3719 | 79.6533 |
| Scalar | 4 | 0.8561 | 27.7196 | 0.3714 | 89.0785 |
| History | Update | Cosine similarity | MAE ( ) |
|---|---|---|---|
| Incomplete | Scalar | 0.6634 | 65.6803 |
| Incomplete | PhaseMatcher | 0.9928 | 5.1114 |
| Complete | Scalar | 0.3508 | 75.8484 |
| Complete | PhaseMatcher | 0.9770 | 3.8705 |
| Samples | Scalar | PhaseMatcher | ||||
| Cosine | MAE ( ) | Cosine | MAE ( ) | |||
| 1 | 1 | 10,000 | 0.3514 | 50.1147 | 0.9870 | 2.0867 |
| 2 | 1 | 20,000 | 0.6855 | 51.0897 | 0.9962 | 3.3403 |
| 2 | 2 | 20,000 | 0.3487 | 66.0129 | 0.9806 | 3.1298 |
| 3 | 1 | 30,000 | 0.8002 | 51.5527 | 0.9982 | 4.1955 |
| 3 | 2 | 30,000 | 0.5347 | 71.7535 | 0.9902 | 4.7662 |
| Contribution | Residual | |||
|---|---|---|---|---|
| Update | Cosine | MAE | Cosine | MAE |
| Sequential scalar | 0.9202 | 40.5222 | 0.5336 | 65.0384 |
| Joint scalar | 0.8909 | 51.3037 | 0.5330 | 64.7952 |
| Joint scalar, proportional clipping | 0.9222 | 39.9904 | 0.5330 | 64.7952 |
| PhaseMatcher | 0.9983 | 3.6447 | 0.9874 | 4.2546 |
| Update | Step 1 | Step 2 | Step 3 | Step 4 |
|---|---|---|---|---|
| Sequential scalar | 51.6661 | 74.1393 | 82.7750 | 84.8074 |
| Joint scalar | 51.6661 | 73.5152 | 82.2667 | 84.9592 |
| PhaseMatcher | 4.8220 | 5.8917 | 6.1350 | 4.3864 |
| Model | Search | Exact-set (%) | Phase recall (%) | Contribution | ||
|---|---|---|---|---|---|---|
| @1 | @10 | Cosine | MAE ( ) | |||
| Without physics guidance | Greedy | 76.79 | - | 91.37 | 0.9725 | 3.7602 |
| Full model | Greedy | 77.15 | - | 91.50 | 0.9735 | 3.4209 |
| Without physics guidance | Beam-10 | 81.36 | 94.49 | 93.31 | 0.9738 | 3.4133 |
| Full model | Beam-10 | 81.98 | 94.73 | 93.59 | 0.9765 | 3.0280 |
| Contribution | Residual | ||||
|---|---|---|---|---|---|
| History | Physics guidance | Cosine | MAE | Cosine | MAE |
| Incomplete | Without | 0.9988 | 5.3124 | 0.9895 | 6.5233 |
| Incomplete | With | 0.9989 | 4.4417 | 0.9928 | 5.1121 |
| Complete | Without | 0.9964 | 3.1938 | 0.9734 | 4.0841 |
| Complete | With | 0.9966 | 2.8534 | 0.9770 | 3.8709 |
| Contribution | Residual | ||||
| Step | Cosine | MAE | Cosine | MAE | |
| 1 | 1 | 1.0000 / 1.0000 | 2.7705 / 2.4017 | 0.9836 / 0.9870 | 2.4554 / 2.0867 |
| 2 | 1 | 0.9997 / 0.9998 | 4.3979 / 3.5523 | 0.9950 / 0.9962 | 4.1862 / 3.3406 |
| 2 | 2 | 0.9977 / 0.9977 | 3.2255 / 2.8268 | 0.9750 / 0.9806 | 3.6667 / 3.1297 |
| 3 | 1 | 0.9995 / 0.9997 | 5.4680 / 4.3406 | 0.9975 / 0.9982 | 5.3233 / 4.1959 |
| 3 | 2 | 0.9988 / 0.9987 | 4.5791 / 3.9769 | 0.9861 / 0.9902 | 6.0940 / 4.7667 |
| Group | Database | PhaseDifformer | XDecomposer | Scalar | PM | ||
|---|---|---|---|---|---|---|---|
| (a) Weakest-phase intensity share | |||||||
| 2 | 2,688 | 0.26 | 2.42 | 4.32 | 62.39 | 75.37 | |
| – | 2,353 | 2.85 | 8.50 | 18.49 | 85.81 | 88.65 | |
| – | 4,098 | 17.86 | 11.01 | 26.96 | 87.92 | 90.04 | |
| 10,861 | 41.26 | 7.71 | 38.54 | 87.63 | 89.55 | ||
| 3 | 10,614 | 0.10 | 0.05 | 0.63 | 51.74 | 69.52 | |
| Phase count | 1 | 2 | 3 | 4 |
|---|---|---|---|---|
| Time (s/mixture) | 0.0250 | 0.0401 | 0.0551 | 0.0685 |