Deep Scientific Reasoning under Physical Constraints:
Structure-Aware Spectrum Prediction

Yingheng Wang1, Tao Yu2, Shufeng Kong1, Francesco Ricci3,4,
John M. Gregoire5,6, Carla P. Gomes1
1Cornell University 2Griffith University 3UCLouvain 4Matgenix SRL 5Caltech 6Lila Sciences

ICML 2026

Two-stage diagram. Left, structure-aware spectrum decoding: the crystal c is encoded by an edge-aware crystal graph Transformer, and a decoder with source attention over energy bins produces an initial spectrum y-hat-0. Right, constraint-preserving physical reasoning: a velocity field f-theta, conditioned on the crystal embedding and time, iteratively refines y-hat-0 through y-hat-1 to the output y-hat-T, with the integral of the eDOS held constant at every step.

Decode with structure, then refine under conservation. DeepSciReasoner first decodes an initial spectrum from the crystal, letting each spectral bin attend to the atoms that contribute to it. It then transports spectral mass along the spectral axis with a learned velocity field, sharpening band edges and peaks while the total mass stays fixed.

Abstract

Structured scientific spectra encode rich physical information while obeying hard constraints, such as conservation laws and characteristic spectral geometry. Accurate prediction of these spectra is central to materials discovery, yet existing methods often treat them as unconstrained sequences and therefore fail to enforce the underlying physical structure. Taking electronic density of states (eDOS) as the prototypical example, we introduce DeepSciReasoner, a general paradigm for predicting scientific spectra under physical constraints. The framework combines structure-aware spectrum decoding with constraint-preserving physical reasoning, allowing predictions to capture rich spectral structure while respecting the underlying physics. We evaluate DeepSciReasoner on eDOS, phonon density of states (phDOS), X-ray absorption near-edge structure (XANES), and Raman spectra, where it substantially improves prediction accuracy while maintaining physical consistency. These results establish DeepSciReasoner as a reusable blueprint for structured scientific spectrum prediction under hard physical constraints.

Why Physical Reasoning for Spectra?

Machine learning has made rapid progress on scalar crystal properties, but a spectrum is a high-dimensional output over a spectral axis (energy, frequency or wavenumber) whose validity depends on physics. Viewed as a density \(D(E) \ge 0\) on \([a,b]\), with normalized form \(p(E) = D(E) / \int_a^b D(u)\,du\), a valid prediction must be nonnegative and conserve its total mass:

\[ \begin{gathered} p(E) \ge 0 \;\;\text{for all } E \in [a,b], \qquad \int_a^b p(E)\,dE = 1, \\ \text{for eDOS equivalently } \int_a^b D(E)\,dE = N_{\mathrm{states}}. \end{gathered} \]

It must also place that mass correctly: sharp band edges and gaps, and Van Hove singularities in the eDOS, and their analogues in other spectra, such as the white line in XANES and sparse vibrational peaks in Raman and phDOS. Prior eDOS predictors fall short in three ways that recur across structured spectra:

Misaligned band edges

The band gap and the spectrum are predicted separately and reconciled post hoc, which misaligns band edges near the Fermi level and introduces spurious in-gap density.

Peak blurring and mass drift

A pointwise regression loss can be low while peaks shift, Van Hove singularities blur, or the total drifts: spectra that look plausible but are physically inconsistent.

No atom-resolved attribution

The total eDOS is a sum of atom-projected DOS (pDOS), yet prior models collapse the crystal into a single global embedding before decoding.

Our approach. Treat each spectrum as an unnormalized density: decode it with structure-aware atom-to-spectral-axis attention, then refine it by mass-conserving transport, so that spectral geometry is sharpened without breaking conservation. The same recipe transfers from eDOS to phDOS, XANES and Raman without architectural changes.

DeepSciReasoner

A crystal \(c\) is a graph of atoms with interatomic edges (each atom keeps at most \(n_{\max}\) neighbors), and the target is a spectrum \(y \in \mathbb{R}^{l_y}\) on a fixed grid of \(l_y\) spectral bins. The formulation is generic: the only target-specific choices are the spectral axis, its discretization, and optional conditioning (for XANES, the absorbing element). We describe it with eDOS as the running example.

Stage I: structure-aware spectrum decoding

Edge-aware crystal graph Transformer. Each layer attends over an atom's neighbors with keys and values modulated by the edge embedding \(g_{ij}\) of the interatomic distance, followed by a gated residual connection:

\[ \begin{gathered} \alpha_{ij} = \operatorname{softmax}_{j \in \mathcal{N}(i)}\!\Big(\frac{q_i^\top (k_j + g_{ij})}{\sqrt{d}}\Big), \\ \hat h_i = \textstyle\sum_{j \in \mathcal{N}(i)} \alpha_{ij}\, (v_j + g_{ij}). \end{gathered} \]

Spectrum decoding with source attention. Instead of decoding a single pooled embedding with an MLP, a Transformer decoder holds one query per spectral bin, initialized from the bin's index embedding and the global crystal embedding. Self-attention across bins models correlations along the spectral axis, and source attention from each bin to the atom embeddings lets every bin aggregate the atoms that contribute at that energy, mirroring the decomposition of the eDOS into atom-projected contributions. A Softplus head keeps the output nonnegative.

The crystal graph Transformer (CrystalFormer) encodes the atoms; for each of the 128 energy levels, an energy-level embedding plus the crystal embedding passes through self-attention across levels, source attention to the atom embeddings, and LayerNorm, feed-forward and residual layers, giving the initial eDOS prediction y0 to y127 with a Van Hove singularity.
Structure-aware spectrum decoding. The edge-aware crystal graph Transformer encodes the structure, and a decoder with hierarchical attention predicts the eDOS, where each energy bin selectively aggregates atom-projected contributions.

Stage I is trained with a shape-and-mass objective. With \(\tilde y\) and \(\tilde{\hat y}\) the sum-normalized target and prediction, a KL divergence supervises where spectral mass lies, and a second term supervises the predicted total \(\hat Z = \sum_i \hat y_i\):

\[ \mathcal{L} = D_{\mathrm{KL}}\big(\tilde y \,\|\, \tilde{\hat y}\big) + \lambda \,\big\|\hat Z - Z\big\|_2^2 . \]

For eDOS and phDOS the total (the number of states or modes) has an analytic form and can be supplied directly; for XANES and Raman it is learned through this term.

Stage II: mass-conserving iterative refinement

The Stage I prediction can still blur band edges, leave noise in the gap, or misplace mass. Stage II corrects it directly in probability space. The normalized prediction \(p_0\) is evolved toward the target \(p_T\) by pure transport along the spectral axis, governed by the continuity equation with a learned velocity field \(f_\theta\):

\[ \begin{gathered} \partial_t p(x,t) + \partial_x \big(p(x,t)\, f_\theta(x,t)\big) = 0, \\ \frac{d}{dt}\int_a^b p(x,t)\,dx = -\big[\,p f_\theta\,\big]_a^b = 0 . \end{gathered} \]

With no flux through the boundaries, mass can move but can never be created or destroyed. As a physically principled reference flow, we use the 2-Wasserstein displacement interpolation between \(p_0\) and \(p_T\). In one dimension it moves every quantile \(s\) on a straight line at constant speed:

\[ \begin{gathered} x_t(s) = (1-t)\,F_0^{-1}(s) + t\,F_T^{-1}(s), \\ f_t\big(x_t(s)\big) = F_T^{-1}(s) - F_0^{-1}(s), \end{gathered} \]

where \(F_0\) and \(F_T\) are the CDFs of \(p_0\) and \(p_T\). This pair exactly satisfies the continuity equation.

Training (simulation-free). Regress the velocity network onto the reference field:

\[ \mathcal{L}(\theta) = \mathbb{E}_{(x,t)}\, \big\| f_\theta(x,t; C) - f_t(x) \big\|^2 . \]

There is no differentiation through the optimal-transport construction or the PDE solver. Conditioning on the crystal embedding \(C\) amortizes one velocity network across all crystals.

Inference (CDF upwind scheme). Transport the CDF \(F\) instead of the density, with forward Euler in time and a first-order upwind difference in space:

\[ F_i^{k+1} = F_i^{k} - \Delta t\, f_\theta(x_i, t_k)\, D_x^{\mathrm{up}} F_i^{k} . \]

The density is recovered by finite differences. The monotone scheme keeps the CDF ordered, so the refined spectrum stays nonnegative and conserves its mass.

Inference pipeline (Algorithm 1 in the paper)

function INFER(G):
    {h_i}, h_x ← Enc(G);  ŷ₀ ← Dec({h_i}, h_x)       # Stage I: structure-aware decoding
    p ← ŷ₀ / Σ_i ŷ₀,i;  F_i ← Σ_{m≤i} p_m Δx         # normalize; initial CDF
    for k = 0, …, N_t − 2:                           # Stage II: mass-conserving refinement
        v_i ← f_θ(x_i, kΔt; h_x)                     # velocity on the spectral grid
        F_i ← F_i − Δt · v_i · D_x^up F_i            # upwind CDF update
        p_i ← (F_i − F_{i−1}) / Δx;  renormalize p   # recover the density
    return p                                         # optionally rescaled by the predicted total Ẑ

\(D_x^{\mathrm{up}}\) is the backward difference where \(v_i \ge 0\) and the forward difference where \(v_i < 0\), and a CFL-like condition \(\max_i |v_i|\,\Delta t / \Delta x \le 1\) keeps the CDF monotone. Derivations and proofs of the end-to-end validity guarantee are in the paper's appendix.

Results

We compare against two families of baselines: structure encoders that map a learned crystal representation to the target (E3NN, GATGNN, CrystalFormer, and MEGNet and M3GNet on the generalization benchmarks), and crystal-to-sequence models that decode the spectrum as a sequence over its bins (Mat2Spec, DOSTransformer). Spectra are compared with the DFT ground truth by \(R^2\), MAE, MSE and Wasserstein distance (WD). Unlike prior work, the eDOS benchmarks keep the full spectrum, including the band gap between the valence-band maximum and the conduction-band minimum, which makes them more challenging.

Electronic density of states

MethodCalTechTRI
\(R^2\) ↑MAE ↓MSE ↓WD ↓\(R^2\) ↑MAE ↓MSE ↓WD ↓
E3NN0.748±0.0022.421±0.00327.351±0.6290.261±0.0050.669±0.0042.945±0.00536.535±0.5320.445±0.004
GATGNN0.772±0.0012.272±0.01624.831±0.5850.230±0.0040.702±0.0042.724±0.00433.811±0.4200.370±0.003
CrystalFormer0.765±0.0062.344±0.01626.138±0.4770.248±0.0120.695±0.0102.869±0.08234.584±0.5810.399±0.017
Mat2Spec0.743±0.0022.226±0.01027.955±0.1370.228±0.0130.677±0.0022.719±0.07236.628±0.1050.395±0.009
DOSTransformer0.771±0.0022.023±0.03224.675±0.3540.212±0.0400.716±0.0032.455±0.08032.208±0.2880.375±0.014
DeepSciReasoner0.815±0.0071.983±0.02119.612±0.2250.191±0.0170.761±0.0092.357±0.04627.162±0.5630.305±0.011

Full-spectrum eDOS prediction (Table 1 of the paper; mean ± one standard deviation). CalTech uses 128 bins over [−4, 4] eV and TRI 256 bins over [−5, 5] eV, both derived from the Materials Project. Bold marks the best mean and underline the second best. DeepSciReasoner is best on every metric of both datasets; on CalTech it reduces MSE by 20.5% relative to the strongest baseline.

Beyond eDOS: XANES, Raman and phonon DOS

MethodXANES-fullXANES-ORamanphDOS
\(R^2\) ↑WD ↓\(R^2\) ↑WD ↓\(R^2\) ↑WD ↓\(R^2\) ↑MAE ↓MSE ↓WD ↓
E3NN0.650±0.0120.108±0.0030.381±0.0110.099±0.0040.096±0.0050.451±0.0190.506±0.0150.082±0.0030.026±0.0010.103±0.004
GATGNN0.648±0.0050.104±0.0010.293±0.0130.108±0.0020.115±0.0050.526±0.0080.270±0.0250.106±0.0020.038±0.0030.155±0.008
MEGNet0.657±0.0080.107±0.0020.347±0.0200.102±0.0060.045±0.0040.449±0.0240.538±0.0140.080±0.0030.024±0.0010.094±0.004
M3GNet0.648±0.0100.107±0.0020.386±0.0120.096±0.0050.083±0.0030.426±0.0210.543±0.0120.075±0.0030.023±0.0010.075±0.003
DSR0.764±0.0090.098±0.0030.474±0.0100.093±0.0030.264±0.0020.423±0.0170.636±0.0130.062±0.0040.021±0.0020.061±0.002

Generalization to other structured spectra (Table 2 of the paper; mean ± one standard deviation), with the architecture essentially unchanged. XANES-full covers K-edge spectra of all absorbing elements (the decoder is also conditioned on the absorber), and XANES-O is the oxygen K-edge subset with one spectrum per material. DSR = DeepSciReasoner. It improves XANES-full \(R^2\) from 0.657 to 0.764 and Raman \(R^2\) from 0.115 to 0.264 over the strongest baseline, and is best on all four phDOS metrics.

Sharper gaps: valence-band gap identification

Whether a predicted eDOS is sharp enough to be useful shows in a practical screening task: identifying rare near-Fermi-level valence-band (VB) gaps, regions of suppressed states that are easily washed out by smoothing or regression noise. Only a small fraction of materials have them, so the task is highly imbalanced.

MethodCalTechTRI
Prec. ↑Recall ↑F1 ↑MCC ↑Prec. ↑Recall ↑F1 ↑MCC ↑
E3NN0.672±0.0350.366±0.0130.474±0.0030.479±0.0110.647±0.0520.314±0.0710.423±0.0280.442±0.012
GATGNN0.699±0.0330.430±0.0080.532±0.0030.532±0.0090.671±0.0490.362±0.0530.476±0.0210.489±0.008
CrystalFormer0.654±0.0230.443±0.0310.532±0.0220.542±0.0130.616±0.0370.371±0.0090.465±0.0240.472±0.031
Mat2Spec0.726±0.0180.551±0.0070.629±0.0040.611±0.0190.601±0.0240.429±0.0160.509±0.0170.508±0.014
DOSTransformer0.684±0.0270.532±0.0090.594±0.0140.584±0.0510.573±0.0730.329±0.0200.416±0.0520.422±0.066
DeepSciReasoner0.753±0.0210.637±0.0140.704±0.0110.679±0.0220.803±0.0350.571±0.0640.648±0.0470.645±0.063

VB-gap identification (Table 3 of the paper). Structure encoders struggle with their indirect mapping from a global representation, and crystal-to-sequence models improve precision but remain recall-limited. DeepSciReasoner raises F1 from 0.629 to 0.704 on CalTech and from 0.509 to 0.648 on TRI.

Data efficiency

Trained on 25%, 50% and 75% of the CalTech training set, DeepSciReasoner is the best method at every data regime and on every metric, with a clear margin already at 25%. The gap widens rather than narrows as data grows, so the method keeps converting additional supervision into spectral fidelity. The TRI dataset shows the same trends (see the paper's appendix).

Four panels of R squared, MAE, MSE and WD against training set size (25%, 50%, 75%) on CalTech for E3NN, GATGNN, Mat2Spec, DOSTransformer and DeepSciReasoner; DeepSciReasoner is best at every size, with R squared rising from about 0.74 to 0.81.
Data scaling on CalTech: \(R^2\), MAE, MSE and WD against training set size.

Both stages matter

VariantCalTechTRI
\(R^2\) ↑MAE ↓MSE ↓WD ↓\(R^2\) ↑MAE ↓MSE ↓WD ↓
DeepSciReasoner0.815±0.0071.983±0.02119.612±0.2250.191±0.0170.761±0.0092.357±0.04627.162±0.5630.305±0.011
w/o refinement (NR)0.807±0.0032.061±0.02020.990±0.3730.207±0.0050.742±0.0052.420±0.01829.387±0.6410.329±0.004
w/o both (NDNR)0.779±0.0012.259±0.00324.726±0.1740.223±0.0070.708±0.0032.701±0.00533.196±0.1360.372±0.003

Ablation (Table 4 of the paper). Removing the mass-conserving refinement (NR) degrades every metric on both datasets; also removing structure-aware decoding (NDNR) costs much more, e.g. a further 17.8% in MSE on CalTech and 13.1% in WD on TRI. Refinement gives moderate but consistent gains in spectral geometry, while structure-aware decoding drives most of the global accuracy.

Qualitative examples

Eight eDOS panels (four CalTech, four TRI test materials) comparing the DFT ground truth with DeepSciReasoner, E3NN, GATGNN, Mat2Spec and DOSTransformer; DeepSciReasoner follows the band edges and sharp peaks most closely, while baselines smear edges or shift and add peaks.
Against the baselines. Predicted eDOS on CalTech (top) and TRI (bottom) test materials. DeepSciReasoner better reproduces the band edges and gap region, and places the dominant Van Hove singularities at the right energies, while baselines smear edges, shift peaks or add spurious ones.
Eight eDOS panels (four CalTech, four TRI test materials) comparing DeepSciReasoner's prediction with the DFT ground truth; the curves nearly overlap, including band gaps and sharp peaks.
DeepSciReasoner against DFT. More test materials with only our prediction and the ground truth, including gapped materials with steep band onsets.

Code and Data

The repository contains Stage I and Stage II training, test-set evaluation, and launch scripts for every benchmark in the paper. The six benchmarks are released on Hugging Face as prepared crystal graphs with spectrum targets and fixed 80/10/10 splits.

BenchmarkSpectrumSpectral gridSamplesSource
edos_caltecheDOS (CalTech)128 bins, [−4, 4] eV37,565Kong et al., 2022 (Materials Project)
edos_trieDOS (TRI)256 bins, [−5, 5] eV14,140Mueller et al., 2024 (Materials Project)
phdosPhonon DOS51 bins, [0, 1000] cm⁻¹1,524Chen et al., 2021 (DFPT)
xanes_fullK-edge XANES, all absorbers128 bins, [−5, 40] eV rel. to E₀49,895Materials Project XAS (Mathew et al., 2018)
xanes_oK-edge XANES, oxygen128 bins, [−5, 40] eV rel. to E₀5,094Oxygen subset of xanes_full
ramanRaman128 bins, [0, 1500] cm⁻¹2,283Bagheri & Komsa, 2023 (DFPT)

Samples are materials, except for xanes_full, where they are (material, absorbing element) pairs. Curation details are in the paper's appendix and on the dataset card, which also lists the licenses of the source data and the works to cite.

git clone https://github.com/yingheng-wang/DeepSciReasoner && cd DeepSciReasoner
CONDA_CHANNEL_PRIORITY=flexible conda env create -f environment.yml && conda activate dsr

bash scripts/download_data.sh edos_caltech          # no argument: all six benchmarks
for seed in 1 4; do
  bash scripts/train_stage1.sh edos_caltech $seed   # Stage I: structure-aware decoding
  bash scripts/train_stage2.sh edos_caltech $seed   # Stage II: refinement on the frozen Stage I model
done
bash scripts/test.sh edos_caltech 1 4               # test-set metrics of the two-seed ensemble

BibTeX

@inproceedings{wang2026deepscireasoner,
  title     = {Deep Scientific Reasoning under Physical Constraints: Structure-Aware Spectrum Prediction},
  author    = {Wang, Yingheng and Yu, Tao and Kong, Shufeng and Ricci, Francesco and Gregoire, John M. and Gomes, Carla P.},
  booktitle = {Proceedings of the 43rd International Conference on Machine Learning},
  series    = {Proceedings of Machine Learning Research},
  volume    = {306},
  year      = {2026}
}