course · part III of III

Computational XAS III: learning and autonomy

Simulations are slow and beamtime is scarce. Machine learning attacks both: validated surrogates emulate calculations within a training domain, inverse models propose structure with uncertainty, and autonomous loops decide what to measure next.

I
Spectra at scale
libraries feed the models
II
Surrogates and inversion
forward fast, backward honest
III
Autonomy
measure where it matters
chapter I

Spectra at scale

One careful simulation answers one question. A library of them becomes training data.

01

From one spectrum to a library

Workflow engines run the theory ladder over thousands of structures and store each spectrum with its absorbing site and provenance. The result is training data, but only for the chemistry and approximations the library actually contains.

The library is the quiet decision in every ML-for-XAS paper: which structures it contains, which rung of the ladder computed them, and which broadening was applied decide what the model can and cannot learn. Experimental deployment adds a sim-to-real gap: calibration, resolution, preprocessing, mixtures, and model inadequacy must be represented or validated separately.

Fig. 1 | From one spectrum to a library. Workflow engines run the theory ladder over thousands of structures, storing each spectrum with its absorbing site and provenance.
public spectral libraries

Computed collections supply controlled training data; measured archives test whether a model survives the sim-to-real gap.

  • computed · crystals

    500,000+ site-resolved K-edge XANES spectra for inorganic materials, computed with FEFF.

  • computed · molecules

    Downloadable structure–spectrum pairs for molecular transition-metal and specialized XAS problems.

  • computed · ML-ready

    Features, spectra, site identifiers, and data splits for eight transition-metal K-edges (Ti–Cu).

  • measured · references

    Experimental spectra with sample, beamline, edge, and measurement-mode context.

Before combining sources, match the absorber, edge, site, structural domain, energy convention, broadening, and preprocessing, and split by chemistry or structure rather than by individual spectrum.

chapter II

Surrogates and inversion

A validated forward model can be reused inside an inverse inference, but inversion is not simply the same neural network run backward. Bayes' rule makes the added assumptions explicit:

likelihood · the forward prediction plus an explicit error modelprior · the domain assumptions before this spectrum
02

Learn the forward map

A surrogate can predict a spectrum in milliseconds within its validated domain. In the simulated Ti coordination series below, pre-edge intensity falls as coordination rises.

surrogate prediction · simulated Ti K-edge
pre-edgeenergy →
pre-edge height
0.46

A surrogate can learn such a map from a simulated library, then answer far faster than the underlying calculation. In the modeled Ti series, lower symmetry and stronger p–d mixing enhance dipole intensity, while centrosymmetric octahedral coordination suppresses it. Coordination is a proxy here, not a universal cause or calibration axis.

Fig. 2 | A surrogate in action. The trained model answers in milliseconds what the forward calculation answers in hours, inside the chemistry it was shown.
in the literature
03

When the surrogate is wrong

Drag the query past the edge of the training set. The model keeps returning an ordinary-looking prediction while the truth walks away, and nothing in that number announces the change.

surrogate vs reality, beyond the training set
truthsurrogate
training rangeextrapolation
surrogate says
0.30
truth
0.30
in-domain · lower risk

Inside the training range the surrogate tracks the reference closely. In-domain status lowers extrapolation risk, but validation error and model bias still matter.

Fig. 3 | Silent failure outside the library. Inside the training range the surrogate tracks the truth; extrapolate and it fails without any warning signal.
04

Invert with uncertainty

The inverse question runs backward: given a measured spectrum, what coordination values are plausible? The estimator below propagates measurement noise through a calibration slope. A complete uncertainty budget must separately test model error, domain shift, preprocessing sensitivity, and non-uniqueness.

calibration curve · pre-edge height vs coordination
measured height ± noiseinferred CNCN →
inferred coordination
4.8 ± 0.1

Inversion is estimation, not lookup. The noise band on the measurement projects through the calibration slope into an uncertainty band on the answer. This band covers measurement noise only; model error, domain shift, preprocessing, and structural non-uniqueness need separate estimates.

Fig. 4 | The inverse estimate. A posterior over structure given spectrum; the width of the distribution is part of the answer, not a nuisance.
in the literature
chapter III

Autonomy

If a model can predict the spectrum and quantify its own uncertainty, it can also decide where to measure next:

The acquisition function can reward uncertainty reduction, scientifically valuable features, task-specific information, or a cost-aware combination. Maximum predictive variance is one useful strategy, not the only one.

05

Spend the beamtime where it matters

A fixed budget of measurement points is placed uniformly or by predictive variance. With fewer points, the value of informed placement becomes increasingly visible.

reconstruction from 28 measured points
truthreconstructed
energy →
uniform error
3.3%
adaptive error
2.8%

Same point budget, different placement. The adaptive policy uses only its sparse pilot measurements, then bisects intervals with large measured slopes or slope changes. The hidden truth is used afterward only to score the simulated benchmark.

Fig. 5 | Adaptive acquisition. The acquisition function proposes the next measurement where expected information is highest, closing the loop around the beamline.
in the literature

An autonomous experiment couples an instrument, an uncertainty-aware model, and an acquisition policy that selects the next point from the evidence collected so far.

06

Close the evidence chain with measured spectra

The companion experiment begins with revision-pinned Fe K-edge XDI reference spectra and adds acquisition noise. Compare how the measured line shapes survive the acquisition and processing chain.

compact capstone · FeO versus Fe₂O₃
  1. 1Run both samples in transmission and state what changes in the measured edge and white line before looking at χ(k).
  2. 2Increase detector noise and identify which conclusions remain stable in μ(E), k³χ(k), and |χ(R)|.
  3. 3Record the operational E₀, background treatment, k window, and detection mode as part of the result, not as invisible setup.
  4. 4Write the weakest chemical claim supported by the comparison, then name the forward calculation or reference measurement that could falsify it.
open the Fe K-edge experiment →
where to go next

Production work adds sample and detector artifacts (self-absorption, dead time, glitches, beam damage), polarization and orientation, mixtures and structural ensembles, plus solver-specific input preparation and convergence. Every transformation should be recorded, and every conclusion tested for sensitivity to those choices.