Source-linked AI summary
Compositional neural networks for multimodal X-ray and neutron scattering inversion
Valentin Munteanu, Alexander Hinderhofer, Dmitry Lapkin, Vladimir Starostin, Frank Schreiber
TL;DR
Scattering inversion is often ambiguous, and combining separately trained estimators for complementary measurements remains challenging. This paper composes prior-amortized flow-matching posterior estimators at inference time; its examples span single-observation inference and multi-measurement co-refinement.
Problem
Scattering data without phase information can leave distinct structures compatible with observations, while separately trained amortized estimators are not generally directly composable across measurement models.
Source: INTRODUCTION · p. 2Method
The framework combines separately trained prior-amortized flow-matching posterior estimators at inference time using shared and observation-specific local parameter blocks.
Source: INTRODUCTION · pp. 4–5Results
Examples span single-curve XRR, TOF-NR, structured polymer brushes, PNR, and co-refinement; in multi-contrast NR, a single-observation-trained model is reused across three curves.
Source: Compositional co-refinement of… · p. 16, DISCUSSION · p. 21Takeaways & Limitations
The shared–local composition rule offers a modular route to co-refining observations that constrain common structure while retaining measurement-specific parameters.
Source: DISCUSSION · p. 20Accuracy depends on training ranges, parameter dimensionality, prior bounds, score and covariance estimates, and compatible shared parameters, priors, and probability paths.
Source: DISCUSSION · p. 21
Abstract
from arXiv · showhide
X-ray and neutron scattering are indispensable for structural characterization across condensed-matter physics and materials science. Yet, because scattering experiments generally record intensities without phase information, distinct structures can yield similar scattering patterns, rendering the corresponding inverse problems non-unique. This ambiguity can be reduced by combining complementary measurements, but their integration into machine-learning frameworks remains challenging. Here we introduce a modular framework for probabilistic multi-measurement analysis based on prior-amortized flow matching. Single-observation posterior estimators are trained separately for individual observation types or physical probes and combined only at inference time through a compositional sampler. This late fusion approach allows pretrained single-observation models to be reused without dedicated joint retraining. As a case in point, we consider reflectometry, which provides depth-resolved, nanometer-scale information about thin films and interfaces. Our single-observation demonstrations span X-ray, time-of-flight neutron and polarized neutron reflectometry. In separate co-refinement studies, task-matched estimators enable homogeneous composition across multiple neutron contrasts and heterogeneous multimodal composition of X-ray and neutron measurements. Together, these results establish compositional flow matching as a modular approach to uncertainty-aware inversion and co-refinement, with potential applicability to other scattering problems in which multiple observations constrain a common physical structure while retaining measurement-specific parameters.
INTRODUCTION
Scattering inversion is often non-unique, while separately trained posterior estimators are not generally directly composable across measurement models. The paper introduces prior-amortized flow matching and a shared–local composition rule for combining such estimators at inference time.
INTRODUCTION
- Combining complementary measurements can reduce ambiguity in scattering inversion, but existing amortized estimators lack a modular way to combine separately trained models with shared and local parameters.A single best-fitting structure can conceal alternative solutions compatible with the data.Source: INTRODUCTION · pp. 2–3
Bayesian compositional inference with shared and local parameters
- Prior-amortized flow matching estimates posteriors conditioned on measured data, user-supplied prior bounds, and, where relevant, known acquisition quantities.Its learned vector field can be converted to a posterior score, enabling separately trained estimators to be composed during sampling.Source: INTRODUCTION · p. 4, Bayesian compositional inference with… · p. 6
- Composition assumes conditionally independent measurement likelihoods and compatible factorized priors with a common shared-parameter marginal.It combines observations, while physically labeled PNR channels are handled together as one multichannel observation.Source: Bayesian compositional inference with… · pp. 6, 8, 9
- The full-covariance composition rule pools shared-parameter scores by marginal precision and adjusts local scores according to their correlations with shared parameters.It corrects the repeated shared-prior contribution; the rule is exact for Gaussian individual posteriors and a Gaussian shared prior.Source: Bayesian compositional inference with… · pp. 7–8
- The sampler supports homogeneous composition of a reused model and heterogeneous composition of separately trained models, without a dedicated joint estimator for each supported measurement combination.Compatible model coordinates are mapped into shared and local blocks at inference time.Source: INTRODUCTION · p. 5, Bayesian compositional inference with… · p. 8
- The inference workflow can refine raw flow-matching samples with ensemble MCMC targeting the explicit likelihood and selected prior bounds.The main-text figures generally show this refined FMPE-MCMC posterior; raw FMPE results are reported in the Supplementary Information.Source: Bayesian compositional inference with… · p. 9
Single-curve XRR posterior inference for organic thin films
A prior-amortized model was applied to experimental XRR data from a PTCDI-C3 film using sample-specific prior bounds. Its refined posterior reproduces the measured curve and yields physically plausible samples.
Single-curve XRR posterior inference for organic thin films
- The PTCDI-C3 XRR example tests a single-observation model on an organic thin film using sample-specific prior bounds.The model includes a q-shift offset and intensity scale factor alongside structural parameters.Source: Single-curve XRR posterior inference… · p. 11
- The FMPE-MCMC posterior-predictive ensemble closely reproduces the experimental PTCDI-C3 curve and reconstructs corresponding SLD profiles.The figure presents the experimental curve, posterior-predictive simulations, and reconstructed profiles.Source: Single-curve XRR posterior inference… · p. 11
- Raw FMPE samples are already physically plausible, while MCMC refinement targets the explicit likelihood and reduces residual amortization errors.Source: Single-curve XRR posterior inference… · p. 11
NR with time-of-flight data and structured brush parameterizations
The neutron examples extend posterior inference to time-of-flight data and a structured polymer-brush model. Their refined posteriors reproduce experimental curves and provide depth-dependent structural profiles.
NR with time-of-flight data and structured brush parameterizations
- The polymer-brush example uses a physically structured parameterization to reconstruct brush height and solvent volume-fraction profiles.Its continuous brush profile is represented by a small number of interpretable parameters and discretized for reflectivity calculation.Source: NR with time-of-flight data and… · pp. 12–13
- The TOF-NR example tests a two-layer slab model on experimental data with non-uniform q-spacing and pointwise resolution information.The amortized network uses a scalar resolution-smearing coefficient, while MCMC refinement uses the experimental pointwise resolution values.Source: NR with time-of-flight data and… · p. 12
- FMPE-MCMC posterior predictions accompany the experimental TOF-NR and brush curves, with reconstructed SLD and solvent volume-fraction profiles, respectively.The examples show the method applied to both experimental TOF data and a structured model class.Source: NR with time-of-flight data and… · pp. 13–14
Full spin-resolved PNR
The section demonstrates posterior inference and co-refinement across full spin-resolved PNR, multiple neutron contrasts, and multimodal XRR/PNR. Across these settings, compositional sampling combines observations while representing shared structure and measurement-specific parameters.
Full spin-resolved PNR
- Full spin-resolved PNR supplies four coupled reflectivity channels jointly, allowing the estimator to learn correlations among nuclear, magnetic, and angular parameters.The simplified two-layer model includes layer thicknesses, nuclear and magnetic SLDs, and magnetization angles.Source: Full spin-resolved PNR · p. 15
Compositional co-refinement of multiple-contrast NR data
- A single-observation model composes three neutron-contrast posteriors at inference time, enforcing one structure while retaining contrast-specific solvent and instrumental parameters.This reuse avoids training a separate network for each possible number or combination of contrasts.Source: Compositional co-refinement of… · p. 16, Figure 3 · p. 17
Full spin-resolved PNR
- In simplified full spin-resolved PNR, the posterior concentrates around the synthetic generating parameters while representing coupled nuclear, magnetic, and angular uncertainty.The proof of concept omits interfacial roughness and is not a complete treatment of experimental full-PNR analysis with additional instrumental effects.Source: Full spin-resolved PNR · p. 15, Figure 3 · p. 17
Multimodal co-refinement of XRR and PNR data
- The multimodal workflow is also shown for a Pt/Co structure in supplementary co-refinement.The supplementary example uses the same workflow for a second heavy-metal/ferromagnet structure.Source: Multimodal co-refinement of XRR and… · p. 18
- The Pt/Fe XRR/PNR co-refinement jointly constrains shared structural parameters while preserving probe-specific information.The main inference fixes SLD parameters to theoretical values, following the corresponding classical analysis.Source: Multimodal co-refinement of XRR and… · p. 18, Figure 4 · p. 19
DISCUSSION
The discussion presents prior-amortized flow matching and inference-time composition as a reusable route to probabilistic reflectometry inversion and co-refinement. It highlights demonstrations across measurement settings, while noting accuracy and computational constraints.
Bayesian reflectometry and prior amortization
- FMPE models are trained across broad parameter and prior-bound ranges, with conditioning variables specifying experiment-specific bounds and optional known experimental variables.The parameters may include physical and instrumental quantities; NR models use a linear smearing coefficient as an optional known variable.Source: DISCUSSION · p. 20, Bayesian reflectometry and prior… · p. 23
DISCUSSION
- A full-covariance composition rule combines compatible estimators over shared parameters and observation-specific local parameter blocks.Shared parameters can describe sample geometry, while local parameters capture contrast conditions, instrumental effects, or probe-specific scattering properties.Source: DISCUSSION · p. 20
- The framework applies to single-curve XRR, time-of-flight NR, polymer brushes, PNR, and multi-measurement co-refinement.Amortized samples identify plausible parameter regions; MCMC refinement reduces residual approximation errors and incorporates experimental likelihood details that training may not fully represent.Source: DISCUSSION · p. 21
- Amortized posterior samples are approximate, and accuracy depends on training ranges, parameter dimensionality, and supplied prior bounds.The discussion also notes ODE sampling cost and dependence of compositional accuracy on score estimates, covariance approximations, and compatible estimator definitions.Source: DISCUSSION · p. 21
- The shared–local construction is proposed as transferable to other multi-measurement scattering problems where observations constrain a common structure but retain measurement-specific parameters.The examples establish a flexible framework for probabilistic reflectometry inversion and modular co-refinement.Source: DISCUSSION · pp. 21–22
Flow matching posterior estimation
- Flow matching transports base-distribution samples toward the target posterior, using conditional probability paths to train the vector field without a generally intractable marginal regression objective.For the Gaussian path used here, the vector field also determines a posterior score that can support composition during sampling.Source: DISCUSSION · p. 20, Flow matching posterior estimation · pp. 23–24
Neural network architecture
The reflectometry estimator embeds the observation and processes that representation with a residual MLP to predict a conditional vector field. Its inputs accommodate different reflectivity-channel structures and conditioning variables.
Neural network architecture
- The architecture maps reflectometry observations to an embedding, then uses a residual MLP to output the conditional vector field.The MLP has eight residual blocks of width 1024, with GELU activations and layer normalization.Source: Neural network architecture · pp. 25–26
- Standard XRR and NR use one reflectivity channel, non–spin-flip PNR uses two, and full spin-resolved PNR uses four.The corresponding q values are supplied as an additional input channel.Source: Neural network architecture · pp. 25–26
- FiLM layers inject time, the current parameter state, prior bounds, and optional auxiliary variables into each residual block.For neutron reflectometry, the auxiliary variable includes the linear smearing coefficient dq/q.Source: Neural network architecture · p. 26
Compositional sampling for multiple observations
The method composes separately trained posterior estimators at inference time, adapting tall-data and full-covariance Gauss composition to reflectometry’s shared and observation-specific parameters. It corrects repeated shared-prior contributions while retaining correlations between shared and local parameters.
- The framework adapts tall-data construction and full-covariance Gauss composition to flow-matching posterior estimators and reflectometry’s shared/local parameter structure.It combines single-observation models at inference time for multiple measurements of the same sample.Source: Compositional sampling for multiple… · p. 27
- Shared parameters can include layer thicknesses and roughnesses, while contrast-dependent SLDs, scale factors, backgrounds, and probe-specific quantities can remain local.Source: Compositional sampling for multiple… · p. 27
- The joint posterior assumes observations are conditionally independent given global parameters, and corrects the shared prior because each single-observation posterior includes it.Local priors are not repeated across factors and require no corresponding correction.Source: Compositional sampling for multiple… · p. 28
- Full-covariance composition retains shared–local posterior correlations that a diagonal approximation would discard.The local parameters of an observation are adjusted along their posterior-correlation directions when composition shifts shared parameters.Source: Compositional sampling for multiple… · pp. 29, 31
- The shared-block update weights each observation by its marginal precision after accounting for uncertainty in its local parameters.This Schur-complement contribution represents the information each measurement carries about the shared parameters.Source: Compositional sampling for multiple… · p. 31
- The framework supports homogeneous composition with one trained model and heterogeneous composition with different models, provided shared parameters use the same physical quantities, prior bounds, and probability paths.The homogeneous case fits multi-contrast neutron reflectometry; the heterogeneous case accommodates different probes and local parameterizations.Source: Compositional sampling for multiple… · p. 32
MCMC refinement
The authors optionally refine amortized posterior samples with likelihood-based ensemble MCMC. This combines neural inference with posterior sampling initialized from multiple plausible parameter-space regions.
- An optional second-stage refinement targets the posterior defined by the explicit forward-model likelihood and selected prior bounds.Source: MCMC refinement · p. 32
- An ensemble affine-invariant MCMC sampler is initialized with samples from the neural posterior model.The sampler is GPU-parallel and adapted from PANPE.Source: MCMC refinement · p. 32
- Amortized posterior samples provide multiple plausible starting points, which is useful for non-Gaussian, correlated, or multimodal posteriors.This contrasts with initialization from one best-fit solution and small local perturbations.Source: MCMC refinement · p. 32
Training data generation
Training data are generated on the fly from sampled parameters and reflectometry simulations, with physical constraints and acquisition-specific treatments. The full spin-resolved PNR example is restricted to a simplified roughness-free parameterization.
- Training samples enforce physical constraints, including roughnesses no greater than half adjacent-layer thicknesses and total layer thickness no greater than 1500 Å.For absorbing XRR, the imaginary electronic SLD is limited to 0.2 times its real part.Source: Training data generation · p. 33
- NR training uses both uniform and random q-point spacing to improve robustness to non-uniform sampling, while XRR uses uniform spacing.Curves are simulated with the Abelès transfer-matrix formalism; non-slab parameterizations are first converted to equivalent slabs.Source: Training data generation · p. 33
- Full spin-resolved PNR is limited to a simplified parameterization without roughness because microslicing would be computationally expensive for large-scale training.Additional effects including magnetic-domain roughness, Zeeman effects, and helical magnetic structures are outside the work’s scope.Source: Training data generation · p. 33
- NR simulations include resolution smearing and sampled instrumental effects, including q-shift, scale, background, and Gaussian noise.For non–spin-flip PNR, a channel-mixing coefficient can model leakage; NR simulation is more expensive than XRR in time and memory.Source: Training data generation · pp. 33–34
Model training and inference settings
The models use prior-amortized flow matching with a normal base distribution, two-sided conditioning, and linear probability paths. Training runs for 500,000 iterations, and posterior samples are generated by integrating the learned ODE.
- All networks use a prior-amortized flow-matching objective with a normal base distribution, two-sided conditioning, and linear probability paths.Source: Model training and inference settings · p. 34
- Training uses AdamW for 500,000 iterations and takes approximately one day on a single NVIDIA A100 GPU for the model sizes used.The learning rate anneals from 1.0 × 10^-3 to 1.0 × 10^-6 after a 500-step warm-up.Source: Model training and inference settings · p. 34
- Posterior samples are generated by integrating the learned ODE with the adaptive Dormand–Prince solver implemented in torchdiffeq.Source: Model training and inference settings · p. 34
Polymer-brush parameterization
The polymer brush is represented by a physically structured profile whose shape and composition are parameterized, discretized, and supplemented with an interfacial reactive layer.
Polymer-brush parameterization
- The brush profile is parameterized by interfacial polymer fraction ϕ0, brush height L, and exponent n; n = 2 gives an ideal parabolic profile.Other exponent values allow deviations from that ideal form.Source: Polymer-brush parameterization · p. 34
- The continuous profile is discretized into 10 equal-thickness slices, each assigned an effective SLD by linear mixing of polymer and solvent.The solvent volume fraction in slice i is 1 − ϕi.Source: Polymer-brush parameterization · p. 35
- A thin reactive layer with thickness drl and SLD ρrl is included between the fronting medium and the brush.Roughness between adjacent brush slices smooths the discretized profile, following anaklasis.Source: Polymer-brush parameterization · p. 35
DATA AVAILABILITY
The analyzed experimental datasets are available from public archives or accompanying software packages, while the synthetic PNR data are generated from the study’s forward model.
DATA AVAILABILITY
- The TOF-NR data are available from the Institut Laue–Langevin archive; polymer-brush and XRR/PNR co-refinement data accompany anaklasis, and multiple-contrast NR data accompany refnx.Synthetic full spin-resolved PNR data were generated using the Methods forward model and parameter settings.Source: DATA AVAILABILITY · p. 35
Supplementary Information
The supplementary information provides additional experimental reflectometry examples, posterior and predictive visualizations, model-training ranges, and an SLD reference.
Supplementary Information
- TOF-NR and polymer-brush NR examples pair experimental data with posterior-predictive simulations from parameter samples, and a corner plot compares raw FMPE and FMPE-MCMC inferred posteriors.Source: Figure 10 · p. 47, Supplementary Information · pp. 47, 49, Figure 11 · p. 48
- The three-contrast NR example presents D2O, H2O, and a third solvent contrast with posterior-predictive curves and parameter posterior visualizations.The posterior parameter set includes polymer SLD without solvent, solvent volume fraction, layer thicknesses, and curve-specific scale factors and backgrounds.Source: Figure 16 · p. 53, Supplementary Information · pp. 54–55, Figure 17 · p. 54
- The Pt/Fe and Pt/Co co-refinement examples show XRR and PNR posterior predictions and parameter posteriors, including alternatives with SLDs not fixed.The figures identify layer thicknesses, roughnesses, scale factors, backgrounds, and PNR mixing coefficient; the alternative inferences include electronic, nuclear, and magnetic SLDs.Source: Figure 18 · p. 55, Supplementary Information · pp. 56, 59, Figure 19 · p. 56
- The paper reports training ranges for XRR and NR models with standard slab parameterization, solvent-parameterized NR, absorption-parameterized XRR, and non-spin-flip and full spin-resolved PNR models.Source: Table 1 · p. 61, Table 2 · p. 61, Table 3 · p. 61