betaFeedback

WorksPhysics and Astronomy

Can end-to-end learning from raw electronic structure explain magnetic anisotropy?

Abstract

Machine-learning models trained directly on electronic spectra can predict spin–orbit-driven properties, yet models with comparable predictive accuracy may learn different electronic dependencies. We examine this problem using magnetic anisotropy in atomic-scale magnets and a validation strategy designed to assess the physical relevance of learned spectral relationships. We compare a bidirectional gated recurrent unit and a one-dimensional convolutional neural network, both trained to predict magnetic anisotropy energy (MAE) from spin- and orbital-resolved scalar-relativistic densities of states (SR-DOS). Despite comparable in-domain (ID) accuracy, the architectures learn only partly overlapping spectral dependencies. Shapley additive explanations identify spectral features shared between the two architectures that can be associated with plausible spin–orbit-coupling pathways consistent with second-order perturbation theory (PT2). Adding PT2-derived MAE contributions to the model inputs has little effect on ID performance but can improve transfer beyond the training domain, with gains differing between architectures. Controlled spectral perturbations further demonstrate that similar attribution patterns do not imply the same functional dependence of the predicted MAE on spectral weight. The contrasting responses provide a functional context for architecture-dependent out-of-domain transfer. End-to-end learning can identify candidate electronic signatures of magnetic anisotropy. Their credible microscopic interpretation, however, rests on convergent evidence from predictive performance, model comparison, physical theory, controlled spectral interventions, and evaluation under distribution shift.

Introduction

Machine-learning (ML) models increasingly use energy-resolved electronic-structure representations to predict materials properties [1, 2, 3, 4]. In particular, neural networks can learn predictive spectral features directly from densities of states (DOS), reducing reliance on handcrafted descriptors [2, 3]. While the end-to-end approach increases model flexibility, it also makes the physical basis of the predictions more difficult to establish.

Feature-importance methods may identify the energy regions contributing most strongly to a prediction, but the resulting attributions remain properties of the fitted model and cannot be assumed to represent model-independent physical observables [5] [6, 7]. This issue is closely related to the Rashomon effect, whereby similarly accurate models may rely on distinct functional dependencies and yield different explanations [8–11]. Although multi-model and Rashomon-set analyses have been applied to descriptor-based materials tasks [12–14], high-dimensional electronic spectra pose an additional challenge. Spectral attribution must be evaluated against both the functional response of the model and the underlying physics.

Magnetic anisotropy energy (MAE) is central to the stability and control of atomic-scale magnets (ASMs), enabling single-atom information storage, spin manipulation, and quantum functionality [15–18]. Its sensitivity to subtle changes in orbital occupation, hybridization, and the energetic alignment of occupied and unoccupied electronic states makes MAE a demanding test case for assessing the credibility of spectral relationships learned by ML models.

Recent computational studies have established transition-metal (TM) dimers anchored at nitrogen-decorated single vacancies (NSVs) in graphene, including MgO-supported configurations, as well-defined computational platform for studying atomic-scale magnetic anisotropy [19, 20]. Extending such investigations to broader chemical, structural, and substrate environments requires costly geometry optimization and noncollinear density functional theory (DFT) calculations including spin–orbit coupling (NCL–SOC). Beyond the computational cost, the resulting high-dimensional electronic-structure data complicate the identification of the microscopic origins of MAE.

For ASMs, second-order perturbation theory (PT2) provides a physical rationale for using scalar-relativistic densities of states (SR-DOS) as inputs to ML models. Within PT2, MAE is related to spin–orbit-mediated couplings between occupied and unoccupied states, subject to symmetry-dependent selection rules [21, 22]. Consequently, SR-DOS contains information relevant to MAE prediction without requiring explicit NCL–SOC calculations at inference time. The perturbative description becomes less reliable when near-degenerate transitions involve energy separations comparable to the SOC strength [23]. Handcrafted descriptors based on selected peaks, integrals, or fitted components [19, 24] may also omit relevant fine structure. Learning directly from SR-DOS preserves the energy-resolved input without imposing a predefined descriptor form.

Here, we introduce a strategy for assessing the physical relevance of learned spectral relationships. To distinguish shared dependencies from those specific to model architecture, we compare a bidirectional gated recurrent unit (BiGRU) with a one-dimensional convolutional neural network (1D-CNN). Both architectures are trained on spin- and orbital-resolved SR-DOS of TM dimers anchored at NSVs in graphene. Single- and multi-task settings are considered, with MAE as the primary target and selected SOC-related quantities as auxiliary targets. SR-DOS and Shapley additive explanations (SHAP) [25, 26] are used to relate spectral features shared between the architectures to SOC pathways expected from PT2. Controlled spectral perturbations then test whether the attributed regions are functionally relevant to the predicted MAE. The architecture-dependent responses are considered alongside differences in out-of-domain (OOD) transfer, evaluated on explicit-substrate systems excluded from training. We also examine whether supplying PT2-derived MAE contributions as additional model inputs improves in-domain (ID) prediction or OOD transfer.

Model comparison tests whether identified dependencies are shared between architectures, PT2 provides a physical reference for their interpretation, spectral interventions test their functional role, and OOD evaluation probes their robustness beyond the training distribution. Together, these analyses provide convergent evidence for assessing whether the learned spectral relationships support a physically grounded microscopic interpretation.

Methods

Machine learning

A bidirectional gated recurrent unit (BiGRU) and a one-dimensional convolutional neural network (1D-CNN) are used to predict magnetic anisotropy energy (MAE), atom-resolved spin–orbit coupling energies (ESOCE_{\mathrm{SOC}}), and orbital-resolved SOC matrix elements (HSOCdH_{\mathrm{SOC}}^{d}) from spin- and orbital-resolved scalar-relativistic density of states (SR-DOS). Calculating the SR-DOS is substantially less expensive than the noncollinear density functional theory (NCL-DFT) calculations including SOC used to obtain the target quantities.

The SR-DOS is represented on a uniform grid of 200 energy points spanning [−3,3][-3, 3] eV relative to the Fermi level (EFE_{\mathrm{F}}) using either five dd-orbital channels or all nine ss-, pp-, and dd-orbital channels for each spin projection and transition-metal (TM) atom. Before being passed to the models, the SR-DOS is reorganized using a Fermi-level split. The occupied and unoccupied halves are ordered by increasing distance from EFE_{\mathrm{F}} and paired at corresponding sequence positions, with their DOS values retained as separate channels. This representation yields a sequence of length T=100T = 100, in which each position contains spectral information from both sides of EFE_{\mathrm{F}}. With the distance from EFE_{\mathrm{F}} included as an additional channel, the input tensor has dimensions T×CT \times C, where C=41C = 41 for the dd-only representation and C=73C = 73 for the spds p d representation. This transformation changes only the structural layout of the SR-DOS grid, facilitating the learning of spectral relationships around EFE_{\mathrm{F}}, while preserving the raw computational spectrum.

BiGRU architecture

The recurrent architecture combines two self-attention modules with a BiGRU encoder. The input first passes through a channel self-attention module that captures interactions among the atom-, spin-, and orbital-resolved DOS channels before sequential encoding. Channel embeddings are averaged over the sequence and projected to queries, keys, and values with a projection dimension of 32. Scaled dot-product attention produces a C×CC \times C channel-mixing matrix that is applied uniformly at every sequence position. The resulting representation is combined with the original input through a residual connection followed by layer normalization.

The attention-weighted sequence is then encoded by a three-layer BiGRU with 100 hidden units per direction and dropout p=0.3p = 0.3 between recurrent layers. The forward and backward hidden states are concatenated, yielding a 200-dimensional representation at each sequence position. Temporal self-attention applies full query, key, and value projections of dimension 200 to the BiGRU states and assigns learned weights to positions along the reordered energy sequence. The BiGRU output is normalized with layer normalization before being passed to the temporal attention module. Mean pooling over the attention-weighted sequence produces a single context vector. Final predictions are generated by two fully connected layers with dimensions 200→50→nout200 \to50 \to n_{\mathrm{out}} and dropout p=0.3p = 0.3, where noutn_{\mathrm{out}} depends on the selected single- or multi-task target configuration. The effects of Fermi-level reordering, recurrent directionality, and attention design are evaluated through an ablation study (Table S1). The tested variants include unidirectional and bidirectional GRUs, representations with and without Fermi-level reordering, and channel, temporal, combined channel–temporal, or no explicit attention. Fermi-level reordering consistently improves MAE prediction in all three target configurations compared with the corresponding bidirectional models without reordering. Bidirectional encoding generally outperforms the unidirectional alternative, although the magnitude of the improvement depends on the predicted quantity. The optimal attention design also depends on the target configuration but combined channel and temporal attention yields the highest MAE R2R^2 in each evaluated setting. This configuration is adopted for all BiGRU analyses.

TargetF.-splitDir.AttentionValidation set RMAE2R^2_{\mathrm{MAE}}Validation set R^2_{\mathrm{ESOC}}^{\mathrm{bot}}Validation set R^2_{\mathrm{ESOC}}^{\mathrm{top}}Test set RMAE2R^2_{\mathrm{MAE}}Test set R^2_{\mathrm{ESOC}}^{\mathrm{bot}}Test set R^2_{\mathrm{ESOC}}^{\mathrm{top}}
MAEnobinone0.7950.753
MAEnouninone0.7830.746
MAEyesbich+temp0.8370.804
MAEyesbichannel0.8180.798
MAEyesbinone0.8150.787
MAEyesbitemporal0.8320.803
MAEyesuninone0.8190.785
MAE + ESOCE_{\mathrm{SOC}}nobinone0.7910.8800.8710.8050.8290.869
MAE + ESOCE_{\mathrm{SOC}}nouninone0.8040.8790.8500.7730.8150.819
MAE + ESOCE_{\mathrm{SOC}}yesbich+temp0.8120.8910.8910.8210.8570.877
MAE + ESOCE_{\mathrm{SOC}}yesbichannel0.8130.9040.8830.8110.8570.881
MAE + ESOCE_{\mathrm{SOC}}yesbinone0.8110.8860.8840.8140.8590.876
MAE + ESOCE_{\mathrm{SOC}}yesbitemporal0.8170.8890.8960.8040.8650.898
MAE + ESOCE_{\mathrm{SOC}}yesuninone0.8060.8860.8800.8060.8480.882
MAE + ESOC+HSOCdE_{\mathrm{SOC}} + H_{\mathrm{SOC}}^dnobinone0.7240.8380.8170.7260.8130.805
MAE + ESOC+HSOCdE_{\mathrm{SOC}} + H_{\mathrm{SOC}}^dnouninone0.7150.8310.7990.7170.8130.818
MAE + ESOC+HSOCdE_{\mathrm{SOC}} + H_{\mathrm{SOC}}^dyesbich+temp0.7750.8620.8570.7960.8400.860
MAE + ESOC+HSOCdE_{\mathrm{SOC}} + H_{\mathrm{SOC}}^dyesbichannel0.7640.8480.8490.7600.8160.832
MAE + ESOC+HSOCdE_{\mathrm{SOC}} + H_{\mathrm{SOC}}^dyesbinone0.7680.8600.8430.7670.8380.840
MAE + ESOC+HSOCdE_{\mathrm{SOC}} + H_{\mathrm{SOC}}^dyesbitemporal0.7540.8590.8680.7650.8300.847
MAE + ESOC+HSOCdE_{\mathrm{SOC}} + H_{\mathrm{SOC}}^dyesuninone0.7730.8500.8380.7710.8300.848

Table S1. Comparison of BiGRU architecture variants using the spdspd orbital representation. In-domain R2R^2 values obtained by eightfold cross-validation are reported for different target settings, input arrangements, recurrent directions, and attention mechanisms. F.-split indicates whether Fermi-level reordering is applied to the input sequence. Dir. denotes a bidirectional (bi) or unidirectional (uni) GRU. Attention specifies channel self-attention (ch), temporal self-attention (temp), their combination (ch+temp), or no explicit attention (none). The ESOCE_{\mathrm{SOC}} scores are reported separately for the bottom and top TM atoms. Bold entries identify the BiGRU configuration used throughout the analyses, which combines Fermi-level reordering, bidirectional encoding, and channel and temporal attention; this selection was based solely on validation-set performance. The same architecture is used for models trained on the dd-orbital representation.

1D-CNN architecture

The convolutional architecture treats the Fermi-reordered SR-DOS as a multichannel signal defined along the distance-from-EFE_{\mathrm{F}} axis. It consists of four successive convolutional blocks, each comprising a one-dimensional (1D) convolution with kernel size 5, padding 2, and 100 output channels, followed by batch normalization, ReLU activation, and dropout p=0.3p = 0.3. The channel width remains fixed throughout the network, and no pooling or strided convolution is applied within the convolutional stack. The sequence length thus remains T=100T = 100, preserving the resolution of the reordered input representation.

The fixed-width convolutional kernels define local receptive fields along the reordered energy axis, enabling the extraction of local spectral motifs from the SR-DOS. Global average pooling over the sequence produces a 100-dimensional representation. Final predictions are generated by two fully connected layers with dimensions 100→100→nout100 \to100 \to n_{\mathrm{out}} and dropout p=0.3p = 0.3, where noutn_{\mathrm{out}} depends on the selected single- or multi-task target configuration.

The final convolutional architecture is selected by comparing plain 1D-CNNs of different depths with 1D variants of VGG, ResNet, and DenseNet (Table S2). The four-block 1D-CNN achieves the highest MAE R2R^2 in the MAE + ESOCE_{\mathrm{SOC}} setting and remains close to the best-performing architectures in the other tasks, prompting its use in all 1D-CNN analyses.

TargetArch.Depth.Validation set RMAE2R^2_{\mathrm{MAE}}Validation set R^2_{\mathrm{ESOC}}^{\mathrm{bot}}Validation set R^2_{\mathrm{ESOC}}^{\mathrm{top}}Test set RMAE2R^2_{\mathrm{MAE}}Test set R^2_{\mathrm{ESOC}}^{\mathrm{bot}}Test set R^2_{\mathrm{ESOC}}^{\mathrm{top}}
MAECNN10.830––0.810––
MAECNN20.835––0.813––
MAECNN30.835––0.813––
MAECNN30.841––0.821––
MAECNN40.843––0.808––
MAECNN60.831––0.800––
MAEResNet20.831––0.805––
MAEResNet40.821––0.800––
MAEResNet80.827––0.799––
MAEDenseNet20.833––0.806––
MAEDenseNet30.834––0.811––
MAEDenseNet40.827––0.788––
MAEVGG20.836––0.804––
MAEVGG30.829––0.803––
MAEVGG40.827––0.825––
MAE + ESOCE_{\mathrm{SOC}}CNN10.8310.8790.8680.8180.8610.875
MAE + ESOCE_{\mathrm{SOC}}CNN20.8350.8930.8750.8300.8620.879
MAE + ESOCE_{\mathrm{SOC}}CNN30.8350.8930.8750.8300.8620.879
MAE + ESOCE_{\mathrm{SOC}}CNN40.8460.8940.8790.8420.8660.886
MAE + ESOCE_{\mathrm{SOC}}CNN60.8410.8890.8790.8360.8650.881
MAE + ESOCE_{\mathrm{SOC}}ResNet20.8380.9000.8800.8240.8680.874
MAE + ESOCE_{\mathrm{SOC}}ResNet40.8280.8920.8840.8250.8480.871
MAE + ESOCE_{\mathrm{SOC}}ResNet80.8190.9020.8870.8170.8700.869
MAE + ESOCE_{\mathrm{SOC}}DenseNet20.8230.8880.8670.8180.8500.858
MAE + ESOCE_{\mathrm{SOC}}DenseNet30.8130.8880.8720.8180.8570.868
MAE + ESOCE_{\mathrm{SOC}}DenseNet40.8240.8890.8770.8250.8660.882
MAE + ESOCE_{\mathrm{SOC}}VGG20.8290.8880.8780.8250.8690.887
MAE + ESOCE_{\mathrm{SOC}}VGG30.8290.8980.8830.8220.8560.877
MAE + ESOCE_{\mathrm{SOC}}VGG40.8200.8910.8890.8130.8550.874
MAE + ESOCE_{\mathrm{SOC}} + HSOCdH_{\mathrm{SOC}}^dCNN10.8010.8600.8410.7810.8380.857
MAE + ESOCE_{\mathrm{SOC}} + HSOCdH_{\mathrm{SOC}}^dCNN20.8160.8670.8490.7950.8410.855
MAE + ESOCE_{\mathrm{SOC}} + HSOCdH_{\mathrm{SOC}}^dCNN30.8160.8670.8490.7950.8410.855
MAE + ESOCE_{\mathrm{SOC}} + HSOCdH_{\mathrm{SOC}}^dCNN40.8170.8770.8600.8040.8580.865
MAE + ESOCE_{\mathrm{SOC}} + HSOCdH_{\mathrm{SOC}}^dCNN60.8200.8720.8530.8030.8560.871
MAE + ESOCE_{\mathrm{SOC}} + HSOCdH_{\mathrm{SOC}}^dResNet20.8170.8740.8510.8010.8450.854
MAE + ESOCE_{\mathrm{SOC}} + HSOCdH_{\mathrm{SOC}}^dResNet40.8120.8670.8520.8050.8530.865
MAE + ESOCE_{\mathrm{SOC}} + HSOCdH_{\mathrm{SOC}}^dResNet80.8150.8830.8570.7910.8490.854
MAE + ESOCE_{\mathrm{SOC}} + HSOCdH_{\mathrm{SOC}}^dDenseNet20.7940.8670.8410.7890.8410.854
MAE + ESOCE_{\mathrm{SOC}} + HSOCdH_{\mathrm{SOC}}^dDenseNet30.7980.8670.8490.7970.8390.850
MAE + ESOCE_{\mathrm{SOC}} + HSOCdH_{\mathrm{SOC}}^dDenseNet40.7990.8860.8590.7930.8500.862
MAE + ESOCE_{\mathrm{SOC}} + HSOCdH_{\mathrm{SOC}}^dVGG20.8120.8750.8540.8060.8550.863
MAE + ESOCE_{\mathrm{SOC}} + HSOCdH_{\mathrm{SOC}}^dVGG30.8060.8790.8550.8100.8520.876
MAE + ESOCE_{\mathrm{SOC}} + HSOCdH_{\mathrm{SOC}}^dVGG40.7870.8690.8520.7910.8480.862

Table S2. Comparison of 1D-CNN architecture variants using the spdspd orbital representation. In-domain R2R^2 values obtained by eightfold cross-validation are reported for different target settings, convolutional backbones, and network depths. Arch. denotes the convolutional backbone, comprising plain CNN, ResNet, DenseNet, and VGG-style architectures. Depth specifies the number of convolutional blocks for the plain CNN, ResNet, and VGG-style architectures and the number of dense blocks for DenseNet. The ESOCE_{\mathrm{SOC}} scores are reported separately for the bottom and top TM atoms. The bold row identifies the four-block plain 1D-CNN used throughout the analyses; this selection was based solely on validation-set performance. The same architecture is used for models trained on the dd-only representation. Fermi-level reordering is applied to all configurations.

Training procedure

Both architectures are trained using the Adam optimiser [27] with an initial learning rate of 10−310^{-3}, reduced by a factor of 0.9 every 100 epochs. The models minimize the mean squared error (MSE) between predicted and target values. Before computing the MSE loss, each target is standardized to zero mean and unit variance (zz-score normalization) using the mean and standard deviation of the corresponding training partition.

In-domain performance is evaluated using eight-fold cross-validation, with the implicit-substrate systems randomly assigned to eight mutually exclusive subsets. In each fold, six subsets are used for training, one for validation, and one as an independent test set. Early stopping is applied by monitoring the validation loss after each epoch. If the loss does not improve for 500 consecutive epochs, training is terminated and the checkpoint with the lowest validation loss is retained. The reported R2R^2 scores and mean absolute errors (MAErr) are evaluated on the held-out test subset in each fold and averaged over the eight folds. Fold-level variability and confidence intervals for the performance metrics are reported in Section S2 of the Supplementary Information. The corresponding training and validation loss curves for all folds and target configurations are provided in Section S3 of the Supplementary Information.

For the SHAP analysis and out-of-domain evaluation, the models are retrained on the complete ID dataset without a held-out subset. Because early stopping cannot be applied without a validation subset, the number of training epochs is fixed to the mean early-stopping epoch obtained from the eight cross-validation folds for the corresponding architecture and target configuration. The resulting training duration ranges from approximately 750 to 1900 epochs. The explicit-substrate dataset is used exclusively for OOD evaluation and does not contribute to model training, hyperparameter selection, or determination of the training duration.

Electronic-structure calculations

Spin-polarized density functional theory (DFT) calculations are performed using the Vienna ab-initio simulation package (VASP) [28–31]. Exchange and correlation are described within the generalized gradient approximation (GGA) [32, 33] using the Perdew-Burke-Ernzerhof (PBE) functional [34, 35], and electron–ion interactions are treated using the projector augmented-wave (PAW) method [36, 37]. A plane-wave cutoff energy of 400 eV is used for both SR and NCL–SOC calculations, following previously established convergence criteria for TM dimers anchored at vacancy defects in graphene [38, 39]. Partial occupancies are treated using Gaussian smearing with a width of 0.02 eV. Electronic minimization is considered converged when the change in total energy falls below 10−610^{-6} eV. Symmetry constraints are disabled in all calculations.

Scalar-relativistic structural relaxations are performed using a 2×2×12 \times2 \times1 kk-point mesh until the residual forces fall below 10−210^{-2} eV Å−1^{-1}, followed by static SR calculations using 6×6×16 \times6 \times1 sampling. The more demanding NCL–SOC calculations are performed using a 3×3×13 \times3 \times1 mesh. Selected high-MAE systems are recalculated at 6×6×16 \times6 \times1, resulting in only minor changes.

The SR–DOS serves as the model input, whereas NCL–DFT calculations including SOC provide the reference targets. The ID training dataset comprises 806 OsPd, OsPt, IrPd, and IrPt dimer configurations on freestanding NSV-graphene and on NSV-graphene retaining the geometry induced by Ir(111), as shown in Figure S2, without explicit substrate atoms [19]. OOD transfer is evaluated on an explicit-substrate dataset comprising ground-state configurations on Cu(111), Ni(111), Ir(111), and MgO(001).

Selected supercells rendered using POET

Figure S2. Selected supercells rendered using POET. a Freestanding OsPd@NSV, b OsPt@NSV@Ir(111).

The self-consistent MAE is obtained from the NCL–SOC total energies corresponding to different magnetization directions and is defined as

MAE=min⁡(Ex,Exy,Ey)−Ez,(1)\mathrm{MAE} = \min(E_x, E_{xy}, E_y) - E_z, \tag*{(1)}

where EαE_\alpha denotes the total energy for magnetization oriented along direction α\alpha [40–43]. The zz axis is perpendicular to the graphene layer and parallel to the TM–TM bond, while xx, yy, and xyxy denote the considered in-plane orientations. Under this convention, positive MAE corresponds to an out-of-plane easy axis, whereas negative values indicate an in-plane easy axis.

PT2-derived contributions to the MAE are calculated from the energy separations of occupied–unoccupied dd-orbital pairs using the orbital selection rules and the procedure described in Ref. [19]. The resulting values are included as an additional input channel in the corresponding physics-informed model variants.

Results

Spectral learning of interdependent spin–orbit-driven properties

Spin- and orbital-resolved SR-DOS for TM dimers anchored at NSVs in graphene serve as model inputs, and the target quantities are obtained from NCL-DFT calculations including SOC. Single- and multi-task models are trained to predict MAE, atom-resolved ESOCE_{\mathrm{SOC}}, and 16 dd-orbital SOC matrix elements (HSOCdH_{\mathrm{SOC}}^{d}), with all outputs in a given multi-task configuration predicted from a shared spectral representation. The BiGRU and 1D-CNN models are evaluated using different learning settings and input orbital channels in ID and OOD regimes (cf. Table 1 and Table 2).

ModelTargetOrbitalsMAE R2R^2MAE MAErrESOCE_{\mathrm{SOC}} R2R^2ESOCE_{\mathrm{SOC}} MAErrHSOCdH_{\mathrm{SOC}}^{d} R2R^2HSOCdH_{\mathrm{SOC}}^{d} MAErr
ID
MAEspds p d0.804 (0.753)8.84––––
dd0.7869.26––––
MAE + ESOCE_{\mathrm{SOC}}spds p d0.821 (0.805)8.260.86710.7––
dd0.8178.320.86711.0––
MAE + ESOCE_{\mathrm{SOC}} + HSOCdH_{\mathrm{SOC}}^{d}spds p d0.796 (0.726)9.140.85012.10.5674.07
dd0.7869.380.84412.30.5724.09
OOD
MAEspds p d0.59115.9––––
dd0.45020.7––––
MAE + ESOCE_{\mathrm{SOC}}spds p d0.77113.70.60822.6––
dd0.53120.00.09630.4––
MAE + ESOCE_{\mathrm{SOC}} + HSOCdH_{\mathrm{SOC}}^{d}spds p d0.43019.30.41323.2−0.7427.68
dd0.52120.60.25033.8−0.9997.78

Table 1. In-domain and out-of-domain performance of the BiGRU models. The ID data include freestanding and implicit-substrate systems, while the OOD set comprise explicit-substrate systems excluded from training. The coefficient of determination (R2R^2) and mean absolute error (MAErr, in meV) are provided for single- and multi-task models using either dd or spds p d orbital representations. Metrics for ESOCE_{\mathrm{SOC}} are averaged over the two TM atoms in each dimer, whereas those for HSOCdH_{\mathrm{SOC}}^{d} are additionally averaged over the 16 orbital-pair elements. Values in parentheses indicate the R2R^2 scores obtained without Fermi-level reordering of the BiGRU input sequence.

ModelTargetOrbitalsMAE R2R^2MAE MAErrESOCE_{\mathrm{SOC}} R2R^2ESOCE_{\mathrm{SOC}} MAErrHSOCdH_{\mathrm{SOC}}^{d} R2R^2HSOCdH_{\mathrm{SOC}}^{d} MAErr
ID
MAEspds p d0.8088.38––––
dd0.8018.69––––
MAE + ESOCE_{\mathrm{SOC}}spds p d0.8427.710.87610.4––
dd0.8218.350.87510.8––
MAE + ESOCE_{\mathrm{SOC}} + HSOCdH_{\mathrm{SOC}}^{d}spds p d0.8048.570.86211.30.6013.85
dd0.7909.090.85311.80.5963.91
OOD
MAEspds p d0.40823.7––––
dd0.47521.3––––
MAE + ESOCE_{\mathrm{SOC}}spds p d0.51019.50.55725.6––
dd0.46120.50.62225.2––
MAE + ESOCE_{\mathrm{SOC}} + HSOCdH_{\mathrm{SOC}}^{d}spds p d0.57820.20.67723.60.0156.11
dd0.47020.10.68024.2−0.0935.96

Table 2. In-domain and out-of-domain performance of the 1D-CNN models. The coefficient of determination (R2R^2) and mean absolute error (MAErr, in meV) are provided for single- and multi-task models using either dd or spds p d orbital representations. Metrics for ESOCE_{\mathrm{SOC}} are averaged over the two TM atoms in each dimer, whereas those for HSOCdH_{\mathrm{SOC}}^{d} are additionally averaged over the 16 orbital-pair elements.

In the ID setting, both architectures achieve comparable predictive performance with a slight overall edge for the 1D-CNN. Predicting MAE jointly with ESOCE_{\mathrm{SOC}} consistently improves MAE accuracy relative to the single-target baseline for both architectures and input representations, consistent with atom-resolved SOC energies providing useful, physically related auxiliary supervision. Moreover, ESOCE_{\mathrm{SOC}} consistently reaches higher R2R^2 values than MAE, indicating that its atom-resolved variation is more readily inferred from SR-DOS than the subtle balance of competing SOC contributions determining MAE. The corresponding parity plots for MAE (Figure 1) and ESOCE_{\mathrm{SOC}} (Figure 2) show predictions clustered around the diagonal, with only a small number of more pronounced outliers.

Comparison of ML-predicted and DFT-computed magnetic anisotropy energy

Figure 1. Comparison of ML-predicted and DFT-computed magnetic anisotropy energy (MAE). (a) Predictions from the BiGRU, (b) predictions from the 1D-CNN. Both models were trained in the MAE + ESOCE_{\mathrm{SOC}} multi-task setting using the full spds p d SR-DOS representation. The gray dashed diagonal indicates perfect agreement with the DFT values. Red stars denote the explicit-substrate systems.

Comparison of ML-predicted and DFT-computed atom-resolved SOC energies

Figure 2. Comparison of ML-predicted and DFT-computed atom-resolved SOC energies (ESOCE_{\mathrm{SOC}}). BiGRU predictions for (a) the bottom and (b) top TM atoms, (c) and (d) corresponding 1D-CNN predictions. Both models were trained in the MAE + ESOCE_{\mathrm{SOC}} multi-task setting using the full spdspd SR-DOS representation. The gray dashed diagonal indicates perfect agreement with the DFT values. Red stars denote the explicit-substrate systems.

Including the orbital-resolved SOC matrix elements as additional targets only modestly reduces MAE and ESOCE_{\mathrm{SOC}} accuracy, yet the individual matrix elements remain considerably harder to infer from SR-DOS. Their R2R^2 values span a broad range, from 0.382 to 0.844 for the BiGRU and from 0.375 to 0.885 for the 1D-CNN, suggesting that the strength of the mapping between the spectral input and specific orbital couplings varies considerably.

Restricting the spectral representation to the dd-orbital DOS leads to only small changes in ID performance, consistent with the dominant role of dd states in the magnetic anisotropy of ASMs and indicating that the dd-orbital DOS provides most of the information used for ID prediction.

The transition to explicit substrates changes the spectral environment presented to the models by introducing substrate-derived states and modifying the hybridization and energetic placement of dimer-related features. OOD transfer consequently tests whether the learned spectral dependencies remain useful under this chemically and electronically distinct environment.

The OOD performance depends more strongly on architecture, orbital representation, and target set1 ting. For MAE, the highest transfer accuracy is achieved by the spdspd BiGRU trained jointly on MAE and ESOCE_{\mathrm{SOC}}. This model also outperforms the feature-engineered gradient-boosting approach evaluated on the same explicit-substrate benchmark [19]. Extending the target set to include HSOCdH_{\mathrm{SOC}}^{d} substantially degrades MAE transfer for the spdspd BiGRU, while producing little change for its dd-only variant. By comparison, the OOD MAE R2R^2 of the 1D-CNN increases for both orbital representations, with the larger improvement obtained for the full spdspd input.

For ESOCE_{\mathrm{SOC}} in the two-target setting, the BiGRU benefits markedly from the full spdspd representation, whereas the dd-only representation yields better transfer for the 1D-CNN. In the full multi-task setting, the 1D-CNN retains substantially higher OOD ESOCE_{\mathrm{SOC}} accuracy than the BiGRU. The orbital-resolved matrix elements themselves do not transfer reliably in either architecture. Their OOD R2R^2 values are strongly negative for the BiGRU and remain close to zero for the 1D-CNN.

Comparable ID accuracy alongside architecture- and target-dependent OOD MAE transfer motivates a comparison of how the two models use the same dd-orbital spectral representation.

Energy-resolved SHAP analysis

To identify the SR-DOS features associated with the learned MAE predictions, we analyze energy-resolved SHAP attributions for the BiGRU and 1D-CNN, as detailed in Section S5 of the Supplementary Information. Spectral regions highlighted by both architectures are treated as candidate MAE-relevant signatures that are less readily attributed to a single architecture-specific strategy. SHAP values are computed relative to a background distribution BB defined by low-anisotropy systems with MAE ∈[−25,25]\in[-25, 25] meV. Positive and negative SHAP values indicate spectral contributions that increase or decrease the predicted MAE relative to BB, whereas the absolute SHAP magnitude quantifies the attributed importance of a given energy region independently of sign.

For both high-positive- and strongly negative-MAE systems, the two architectures consistently assign attribution to Fermi-adjacent dd-state regions, making them the most reproducible spectral signature shared by the models (Figure 3). The detailed attribution pattern, however, depends on both the network architecture and the prediction target. For the top TM atom, the BiGRU gives a stronger response immediately adjacent to EFE_{\mathrm{F}}. Below these features, the 1D-CNN response exceeds that of the BiGRU and extends farther into the occupied region. For the bottom TM atom, Fermi-adjacent attribution also recurs, but the BiGRU tends to favor occupied frontier features, whereas the 1D-CNN assigns relatively greater weight above EFE_{\mathrm{F}} and at deeper occupied energies.

Energy-resolved average absolute SHAP profiles for the top and bottom TM atoms

Figure 3. Energy-resolved average absolute SHAP profiles for the top and bottom TM atoms. (a, b) High-positive-MAE systems (MAE >25> 25 meV), (c, d) strongly negative-MAE systems (MAE <−25< -25 meV). Results were obtained from models trained on the dd-orbital SR-DOS representation using the MAE-only target in (a) and (c), and the MAE + ESOCE_{\mathrm{SOC}} target setting in (b) and (d). The SHAP background distribution is defined by weak-anisotropy systems with −25-25 meV ≤\leq MAE ≤25\leq25 meV.

Adding ESOCE_{\mathrm{SOC}} to the target set largely preserves the SHAP-active energy windows while redistributing their relative weight (Figure 3b,Figure 3d). For the 1D-CNN, a deeper occupied feature on the top TM atom gains importance in both MAE regimes, reaching a magnitude comparable to the Fermi-adjacent peaks for high-positive MAE and becoming the dominant contribution for strongly negative MAE. For the latter case, a bottom-atom peak emerges at a similar energy. For the BiGRU, the main redistribution occurs on the bottom TM atom, where a strong maximum develops deeper in the occupied region.

Figure 4 together with Figure S3–Figure S5 provide atom-, spin-, and orbital-resolved DOS–SHAP views of representative high-positive- and strongly negative-MAE systems. The attributions extend beyond the dominant DOS maxima to peak edges, depleted frontier regions, and low-DOS intervals separating occupied and unoccupied spectral features, showing that the resulting patterns are not determined solely by DOS intensity (see also Figure S6–Figure S11).

Figure 4. Energy-resolved DOS–SHAP overlays. The profiles correspond to the top TM atom of the high-MAE OsPd@NSV dimer with a DFT-computed MAE of 133.0 meV. Columns and rows distinguish the spin channels and individual d orbitals, respectively.

Energy-resolved DOS–SHAP overlays showing DOS, RNN, and CNN profiles for spin channels and individual d orbitals

Figure S3. Energy-resolved DOS–SHAP overlays. The profiles correspond to the bottom TM atom of the high-MAE OsPd@NSV dimer with a DFT-computed MAE of 133.0 meV. Columns and rows distinguish the spin channels and individual dd orbitals, respectively.

Energy-resolved DOS–SHAP overlays

Figure S5. Energy-resolved DOS–SHAP overlays. The profiles correspond to the bottom TM atom of the strongly negative-MAE OsPt@NSV dimer with a DFT-computed MAE of −75.7-75.7 meV. Columns and rows distinguish the spin channels and individual dd orbitals, respectively.

Energy-resolved DOS–SHAP overlays for the bottom and top TM atoms of the OsPt@NSV system

Figure S6. Energy-resolved DOS–SHAP overlays. Results are shown for the bottom and top TM atoms of the highest-MAE OsPt@NSV system with a DFT-computed MAE of 158.2 meV. Rows distinguish the individual dd orbitals. The columns correspond to the spin-up and spin-down channels of the bottom TM atom, followed by the corresponding channels of the top TM atom.

Energy-resolved DOS–SHAP overlays

Figure S11. Energy-resolved DOS–SHAP overlays. Results are shown for the bottom and top TM atoms of a strongly negative-MAE OsPt@NSV dimer with a DFT-computed MAE of −64.8-64.8 meV. Rows distinguish the individual dd orbitals. The columns correspond to the spin-up and spin-down channels of the bottom TM atom, followed by the corresponding channels of the top TM atom.

For the top TM atom of the highest-MAE dimer (Figure 4 and Figure S12), the two architectures highlight overlapping Fermi-adjacent orbital features but weight them differently, with the 1D-CNN retaining attribution farther into the occupied region. In the spin-down channel, the dxyd_{xy} and dx2−y2d_{x^2-y^2} SHAP profiles follow prominent Fermi-adjacent DOS features and extend into their depleted surroundings. A related peak-edge response appears for dz2d_{z^2}, whereas the dxzd_{xz} and dyzd_{yz} channels carry attribution on DOS features flanking EFE_F and within the low-DOS interval separating them. By comparison, the spin-up response is predominantly confined to occupied features, albeit with a similar extension beyond the DOS maxima.

Orbital-resolved comparison of ML attributions and DFT-computed contributions to the magnetic anisotropy energy of the Os atom in OsPd@NSV

Figure S12. Orbital-resolved comparison of ML attributions and DFT-computed contributions to the magnetic anisotropy energy (MAE) of the Os atom in OsPd@NSV. The DFT-computed MAE of the system is 133.0 meV. a, Spin- and orbital-resolved scalar-relativistic density of states (SR-DOS). b, c, SHAP attributions obtained from the 1D-CNN for the spin-up and spin-down channels, respectively. d, e, Corresponding SHAP attributions obtained from the BiGRU. f, Eigenvalue spectra extracted from magnetic-force-theorem (MFT) [3, 4] calculations using POET [5] for magnetization perpendicular (top) and parallel (bottom) to the TM dimer bond. Each spectrum is referenced to its corresponding Fermi level (EFE_\mathrm{F}; red lines), and the energy axes are aligned to account for the difference in EFE_\mathrm{F}. Labels (g)–(n) in f identify states with relevant contributions to the MAE. Their atom- and orbital-resolved decompositions are shown in (g–n), with box dimensions proportional to the corresponding orbital weights.

In a PT2 interpretation, the SHAP-active orbital features on the top TM atom are compatible with several symmetry-allowed SOC pathways [19]. The spin-down dxz/dyzd_{xz}/d_{yz} features are consistent with candidate spin-conserving virtual excitations mediated by L^z\hat{L}_z. The dxy/dx2−y2d_{xy}/d_{x^2-y^2} pair is likewise L^z\hat{L}_z-allowed, although the absence of an occupied counterpart shifts the interpretation of its extended SHAP response from an active virtual-transition channel to the local spectral arrangement of these orbitals. The dz2d_{z^2}-related attribution is consistent with L^x/L^y\hat{L}_x/\hat{L}_y-mediated coupling to dxz/dyzd_{xz}/d_{yz}, while the dxy/dx2−y2d_{xy}/d_{x^2-y^2} response points to additional L^x/L^y\hat{L}_x/\hat{L}_y-allowed transition channels involving dxz/dyzd_{xz}/d_{yz}. Occupied spin-up features indicate spin-flip contributions to the net SOC balance. For the bottom TM atom, the attribution is distributed over orbital pairs compatible with competing spin-conserving L^z\hat{L}_z-allowed and L^x/L^y\hat{L}_x/\hat{L}_y-mediated channels (Figure S3), with no single PT2 pathway clearly isolated by the DOS–SHAP pattern.

For the strongly negative-MAE dimer, the dominant top-atom DOS–SHAP features are compatible with same-spin L^x/L^y\hat{L}_x/\hat{L}_y-mediated coupling between occupied dz2d_{z^2} and dxy/dx2−y2d_{xy}/d_{x^2-y^2} states and unoccupied dxz/dyzd_{xz}/d_{yz} states (Figure S4 and Figure S13) favoring in-plane anisotropy. For the bottom TM atom (Figure S5), as in the high-positive-MAE case, the DOS–SHAP pattern reflects competing L^z\hat{L}_z- and L^x/L^y\hat{L}_x/\hat{L}_y-allowed channels.

Energy-resolved DOS–SHAP overlays

Figure S4. Energy-resolved DOS–SHAP overlays. The profiles correspond to the top TM atom of the strongly negative-MAE OsPt@NSV dimer with a DFT-computed MAE of −75.7 meV. Rows and columns distinguish the spin channels and individual dd orbitals, respectively.

Orbital-resolved comparison of ML attributions and DFT-computed contributions to the magnetic anisotropy energy of the Os atom in OsPt@NSV

Figure S13. Orbital-resolved comparison of ML attributions and DFT-computed contributions to the magnetic anisotropy energy (MAE) of the Os atom in OsPt@NSV. The DFT-computed MAE of the system is −75.7 meV-75.7\ \mathrm{meV}. a, Spin- and orbital-resolved scalar-relativistic density of states (SR-DOS). b, c, SHAP attributions obtained from the 1D-CNN for the spin-up and spin-down channels, respectively. d, e, Corresponding SHAP attributions obtained from the BiGRU. f, Eigenvalue spectra extracted from magnetic-force-theorem (MFT) [3, 4] calculations performed using POET [5] for magnetization perpendicular (top) and parallel (bottom) to the TM–TM bond. Each spectrum is referenced to its corresponding Fermi level (EFE_\mathrm{F}; red lines), and the energy axes are aligned to account for the difference between the two Fermi levels. Labels (g)–(n) in f identify states with relevant contributions to the MAE. Their atom- and orbital-resolved decompositions are shown in g–n, with box areas proportional to the corresponding orbital weights.

These orbital assignments provide a PT2-consistent interpretation of the SHAP-active regions. The DOS–SHAP overlays remain model-attribution patterns, however, and do not constitute a direct decomposition of the SOC contribution to MAE.

Discussion

To test whether SHAP-active spectral regions correspond to functionally important components of the learned mapping, we perform controlled perturbations of the input SR-DOS and recompute the MAE using the trained networks. The perturbed DOS is constructed as

DOSi,σmod(E)=max⁡[DOSi,σ(E)+Hexp⁡(−(E−L)22W2),0],(2)DOS^{\mathrm{mod}}_{i,\sigma}(E) = \max\left[ DOS_{i,\sigma}(E) + H\exp\left(-\frac{(E-L)^2}{2W^2}\right), 0\right], \tag*{(2)}

where LL, HH, and WW denote the center, signed amplitude, and width of the perturbation, respectively, with the values of LL and WW and the maximum value of HH for each perturbation summarized in Table S7. Positive values of HH add spectral weight, whereas negative values attenuate an existing DOS feature. Existing peaks are selectively reduced, and artificial Gaussian peaks are introduced into depleted energy windows. The DOS–SHAP overlays (Figure 4 and Figure S3–Figure S5) are used to select the spin–orbital channels and energy windows for perturbation, including regions with either strong or negligible SHAP attribution. The resulting changes in predicted MAE provide an intervention-based test of the learned spectral dependence.

FigureLLWWHH
Figure 5a−0.200.20−0.30
Figure 5c−0.100.050.30
Figure S14−2.000.25−0.17
Figure S141.000.150.30
Figure S15−0.160.20−0.09
Figure S150.400.050.50
Figure S16−1.450.10−0.10
Figure S161.000.100.30
Figure S18−2.000.25−0.17
Figure S181.000.150.30
Figure S19−0.160.20−0.09
Figure S190.400.050.50
Figure S20−1.450.10−0.10
Figure S201.000.100.30

Table S7. Parameters of the controlled DOS perturbations. The listed parameters define the Gaussian modifications introduced in Eq. (1) of the main text and correspond to the modified DOS profiles shown in the indicated figures. LL and WW denote the center and width of the perturbation, respectively, and are given in eV. HH is the limiting signed amplitude in the units of the DOS. Positive and negative values of HH correspond to the addition and attenuation of spectral weight, respectively.

Modifying a single spin- and orbital-resolved DOS channel while keeping all others fixed breaks correlations and sum rules present in self-consistent DFT solutions, potentially affecting the electron count, spin balance, and inter-orbital hybridization. Consequently, the modified spectra need not correspond to physically realizable electronic structures and generally fall outside the training distribution. The objective is not to generate realistic electronic structures, but to probe the response of the learned mapping to prescribed modifications around representative DOS configurations.

For the high-positive-MAE system, attenuating a DOS peak coinciding with a pronounced SHAP maximum substantially lowers the BiGRU-predicted MAE (Figure 5a,Figure 5b), indicating a positive contribution of this feature to the prediction. Introducing spectral weight into a depleted interval carrying strong SHAP attribution produces an even larger MAE reduction (Figure 5c,Figure 5d), revealing that the BiGRU treats the locally depleted DOS as part of the high-MAE spectral signature. Perturbations of SHAP-inactive regions have negligible effects (Figure S14).

Controlled DOS perturbations evaluated using the BiGRU

Figure 5. Controlled DOS perturbations evaluated using the BiGRU. Results are shown for the bottom TM atom of the high-MAE OsPd@NSV dimer with a DFT-computed MAE of 133.0 meV. (a) Attenuation of an existing DOS peak in a region with strong SHAP attribution, (c) introduction of spectral weight into an initially depleted interval with strong attribution. (b, d) Corresponding MAE predictions as functions of the perturbation amplitude HH.

Controlled DOS perturbations for the high-MAE OsPd@NSV dimer

Figure S14. Controlled DOS perturbations. Results are shown for the top TM atom of the high-MAE OsPd@NSV dimer, with a DFT-computed MAE of 133.0 meV, evaluated using the BiGRU. a, Attenuation of an existing DOS peak; c, introduction of an artificial DOS peak. Both modifications target regions with negligible SHAP attribution. b, d, Corresponding MAE predictions as functions of the perturbation amplitude HH.

The BiGRU response for the strongly negative-MAE system similarly distinguishes SHAP-active from SHAP-inactive regions. Modifying SHAP-active features shifts the predicted MAE toward less negative values and thus toward reduced in-plane anisotropy (Figure S15), whereas analogous perturbations in SHAP-inactive intervals leave the prediction nearly unchanged (Figure S16). The selected interventions in both MAE regimes thus demonstrate that the BiGRU relies predominantly on spectral features identified by the attribution analysis.

Controlled DOS perturbations for the strongly negative-MAE OsPt@NSV dimer

Figure S15. Controlled DOS perturbations. Results are shown for the top TM atom of the strongly negative-MAE OsPt@NSV dimer, with a DFT-computed MAE of −75.7-75.7 meV, evaluated using the BiGRU. a, Attenuation of an occupied DOS feature in a region with strong SHAP attribution; c, introduction of spectral weight into another SHAP-active energy window. b, d, Corresponding MAE predictions as functions of the perturbation amplitude HH.

Four-panel plot showing controlled DOS perturbations and corresponding MAE predictions

Figure S16. Controlled DOS perturbations in SHAP-inactive regions. Results are shown for the strongly negative-MAE OsPt@NSV dimer, with a DFT-computed MAE of −75.7 meV, evaluated using the BiGRU. a, Attenuation of a DOS peak for the bottom TM atom; c, introduction of an artificial DOS peak for the top TM atom. b, d, Corresponding MAE predictions as functions of the perturbation amplitude HH.

The 1D-CNN exhibits a more complex response for the high-positive-MAE system. Attenuating the DOS peak that lowers the BiGRU prediction increases the CNN-predicted MAE (Figure 6a,Figure 6b), indicating opposite local responses of the two learned mappings to the same spectral modification. Magnetic-force-theorem (MFT) [44, 45] analysis performed using POET [20] (Figure S12 and Figure S17) provides a plausible physical context for this divergence. The attenuated dyzd_{yz} feature participates in competing contributions to the MAE, including a negative contribution associated with its magnetization-dependent eigenvalue shift and a positive contribution arising from its interplay with the magnetization-dependent occupation of the dxy/dx2−y2d_{xy}/d_{x^2-y^2} states. The opposite model responses may reflect different sensitivities to these competing components of the same spectral feature. Adding spectral weight to the strongly attributed depleted interval lowers the CNN prediction in agreement with the BiGRU response, although the effect is substantially weaker (Figure 6c,Figure 6d). Reducing a DOS peak carrying little attribution in the BiGRU but substantial attribution in the 1D-CNN lowers the CNN prediction (Figure S18,Figure S18), consistent with the CNN SHAP profile. Unlike the corresponding BiGRU intervention, introducing spectral weight into a window with negligible attribution in the unmodified CNN input produces a pronounced reduction in the CNN-predicted MAE (Figure S18,Figure S18). For the strongly negative-MAE system, the 1D-CNN perturbation responses closely agree with those of the BiGRU and preserve the distinction between SHAP-active and SHAP-inactive regions (Figure S19 and Figure S20).

Controlled DOS perturbations evaluated using the 1D-CNN

Figure 6. Controlled DOS perturbations evaluated using the 1D-CNN. Results are shown for the bottom TM atom of the high-MAE OsPd@NSV dimer with a DFT-computed MAE of 133.0 meV. (a) Attenuation of an existing DOS peak in a region with strong SHAP attribution, (c) introduction of spectral weight into an initially depleted interval with strong attribution. (b, d) Corresponding MAE predictions as functions of the perturbation amplitude HH.

Orbital-resolved SR-DOS and selected spectral perturbations

Figure S17. Orbital-resolved SR-DOS and selected spectral perturbations. a, b, Orbital-resolved SR-DOS of the bottom and top TM atoms, respectively, in the high-MAE OsPd@NSV dimer with a DFT-computed MAE of 133.0 meV. c, d, Corresponding SR-DOS of the bottom and top TM atoms in OsPt@NSV with a DFT-computed MAE of −75.7-75.7 meV. Positive and negative DOS values represent the two spin channels. The vertical dashed line marks the Fermi level, EFE_\mathrm{F}. Colored arrows indicate the orbital channels and energy positions selected for attenuation of existing DOS features or introduction of spectral weight into initially depleted regions. Labels report the resulting changes in the MAE predicted by the BiGRU and 1D-CNN at the maximum perturbation amplitude. Orbital contributions are identified by the color legend below the panels.

Controlled DOS perturbations for the high-MAE OsPd@NSV dimer

Figure S18. Controlled DOS perturbations. Results are shown for the top TM atom of the high-MAE OsPd@NSV dimer, with a DFT-computed MAE of 133.0 meV, evaluated using the 1D-CNN. a, Attenuation of a DOS peak carrying substantial SHAP attribution; c, introduction of spectral weight into an initially depleted interval with negligible attribution. b, d, Corresponding MAE predictions as functions of the perturbation amplitude HH.

Controlled DOS perturbations for the strongly negative-MAE OsPt@NSV dimer

Figure S19. Controlled DOS perturbations. Results are shown for the top TM atom of the strongly negative-MAE OsPt@NSV dimer, with a DFT-computed MAE of −75.7 meV, evaluated using the 1D-CNN. a, Attenuation of an occupied DOS feature in a region with strong SHAP attribution; c, introduction of spectral weight into another SHAP-active energy window. b, d, Corresponding MAE predictions as functions of the perturbation amplitude HH.

Controlled DOS perturbations in SHAP-inactive regions

Figure S20. Controlled DOS perturbations in SHAP-inactive regions. Results are shown for the strongly negative-MAE OsPt@NSV dimer, with a DFT-computed MAE of −75.7 meV, evaluated using the 1D-CNN. a, Attenuation of a DOS peak for the bottom TM atom; c, introduction of an artificial DOS peak for the top TM atom. b, d, Corresponding MAE predictions as functions of the perturbation amplitude HH.

The close agreement between the two architectures for the strongly negative-MAE system contrasts with their more differentiated behaviors for the high-positive-MAE case, particularly upon introduction of a previously absent spectral motif. These system-dependent responses provide model-level context for the differences in OOD transfer and motivate examining whether adding PT2-derived MAE contributions to the model input can improve generalization beyond the implicit-substrate domain.

In the ID regime, adding the PT2-derived input channel alters R2R^2 by no more than 0.03, with the direction of the change depending on both architecture and target setting (Table 3). The BiGRU improves slightly in the MAE-only and MAE + ESOCE_{\mathrm{SOC}} settings but deteriorates when HSOCdH_{\mathrm{SOC}}^{d} is included, whereas the 1D-CNN shows a small benefit only in the full multi-task setting. The limited and non-systematic ID effect indicates that the baseline models already capture most of the predictive information provided by the PT2-derived input.

Model TargetBiGRU w/o PT2BiGRU w/ PT21D-CNN w/o PT21D-CNN w/ PT2
ID
MAE0.8040.8120.8080.807
MAE + ESOCE_{\mathrm{SOC}}0.8210.8280.8420.831
MAE + ESOC+HSOCdE_{\mathrm{SOC}} + H_{\mathrm{SOC}}^{d}0.7960.7700.8040.812
OOD
MAE0.5910.6510.4080.523
MAE + ESOCE_{\mathrm{SOC}}0.7710.6410.5100.597
MAE + ESOC+HSOCdE_{\mathrm{SOC}} + H_{\mathrm{SOC}}^{d}0.4300.6310.5780.600

Table 3. Effect of PT2-derived input channel on ID and OOD MAE performance. R2R^2 values are compared for BiGRU and 1D-CNN models with the additional PT2-derived input (w/ PT2) and the corresponding baselines (w/o PT2). Bold values indicate the higher R2R^2 within each comparison pair.

The effect becomes more pronounced under OOD transfer. The 1D-CNN benefits from the additional PT2-derived input in every target setting, although the magnitude of the improvement varies. The BiGRU response is less uniform, with PT2 improving the MAE-only model and yielding its largest benefit in the full multi-task setting, which additionally includes orbital-resolved SOC targets. By contrast, the intermediate MAE+ESOCE_{\mathrm{SOC}} model shows a substantial deterioration, further ruling out a universal regularization effect. The benefit of the PT2 constraint depends on both architectural bias and the selected combination of prediction targets.

Conclusions

The combined results place clear limits on what can be inferred from a single post hoc explanation. Agreement between the two architectures identifies spectral signatures less readily attributed to a single model bias, whereas the perturbation tests show that overlapping attribution need not imply the same local dependence on spectral weight. The PT2 analysis places these signatures within plausible SOC pathways, while the distinct OOD profiles show that architecture-dependent behavior extends beyond attribution to predictive transfer. Finally, including PT2-derived MAE contributions can improve performance in selected OOD settings but does not provide a universally effective route to generalization.

This work demonstrates that end-to-end learning from raw electronic structure can reveal testable spectral signatures associated with magnetic anisotropy without relying on handcrafted descriptors. Assessing their microscopic significance requires convergent evidence from complementary architectures, physical theory, controlled interventions, and OOD evaluation.

Associated Content

Data Availability Statement

Data supporting the findings of this paper are provided in the Supporting Information. Both the paper and the Supporting Information, as well as all data contained therein are freely available at https://doi.org/10.5281/zenodo.21636936.

The source code, trained models, and datasets underlying the reported analyses are available at https://github.com/RafalTopolnicki/ml-dos2mae.

Supporting Information

Architecture and hyperparameter comparison; uncertainty in performance metrics; training curves; structures of the investigated systems; energy-resolved SHAP analyses; DOS–SHAP overlays; comparison of SHAP attributions with magnetic force theorem (MFT) contributions; and additional results from controlled DOS perturbations.

Author Contributions

R.T. proposed the research concept, designed, implemented, and evaluated the machine-learning models and the associated attribution and perturbation analyses, and contributed to the interpretation of the model predictions. J.N. performed the DFT calculations, prepared the electronic-structure data, and contributed to the analysis and discussion of the results. P.B. formulated the research objectives and scope, supervised and coordinated the study, contributed to the analysis and interpretation of the results, and wrote the manuscript. All authors reviewed and edited the manuscript and approved the final version.

Notes

The authors declare no competing interests.

Acknowledgments

This article has been produced with the financial support of the European Union under the REFRESH – Research Excellence For REgion Sustainability and High-tech Industries project (CZ.10.03.01/00/22_003/0000048) via the Operational Programme Just Transition and under the TECH-SCALE project (CZ.02.01.01/00/22_008/0004587) via the Operational Programme Johannes Amos Comenius.

This work was also supported by the bilateral Czech Science Foundation (GA ČR) / Poland National Science Centre (NCN) project (26-23324K).

R.T. acknowledges support from Dioscuri, a programme initiated by the Max Planck Society, jointly managed with the National Science Centre in Poland, and mutually funded by the Polish Ministry of Science and Higher Education and the German Federal Ministry of Research, Technology and Space.

J.N. acknowledges support from Palacký University Olomouc (project IGA_PrF_2026_002).

The calculations were performed with the support of the Interdisciplinary Centre for Mathematical and Computational Modeling of the University of Warsaw (ICM UW) under computational grant number g105-2705.

Supplementary information:

Architecture and hyperparameter comparison

Table S1 and Table S2 compare the in-domain performance of the tested BiGRU and 1D-CNN configurations using eight-fold cross-validation. Each table reports R2R^2 on both the validation set, which is used for early stopping in each fold and architecture selection, and the held-out test set, which is not used in any model selection decision. The close agreement between validation and test R2R^2 across all configurations indicates that the validation-based selection did not lead to overfitting to the validation set. The reported results use the spdspd orbital representation. The selected configurations are also evaluated using the dd-only representation, for which similar performance trends are observed.

The BiGRU variants differ in Fermi-level reordering, recurrent directionality, and attention design. The evaluated attention mechanisms include channel self-attention, temporal self-attention, their combination, and no explicit attention. The configuration combining Fermi-level reordering, bidirectional encoding, and channel and temporal attention gives the highest MAE R2R^2 in all three target settings, reaching 0.804, 0.821, and 0.796 for the MAE-only, MAE+ESOCE_{\mathrm{SOC}}, and MAE+ESOCE_{\mathrm{SOC}}+HSOCdH^d_{\mathrm{SOC}} settings, respectively. This configuration is used throughout the BiGRU analyses.

The convolutional comparison includes plain 1D-CNN, ResNet, DenseNet, and VGG-style architectures with different numbers of convolutional blocks. Fermi-level reordering is applied to all tested configurations. The four-block plain 1D-CNN gives the highest MAE R2R^2 in the MAE + ESOCE_{\mathrm{SOC}} setting, reaching 0.842, and remains within 0.02 of the best-performing architecture in the other target settings. This configuration provides a consistent convolutional backbone across the single- and multi-task comparisons without introducing residual connections or dense interlayer connectivity and is used throughout the 1D-CNN analyses.

Uncertainty in performance metrics

Table S3–Table S6 report fold-level uncertainty for the selected BiGRU and 1D-CNN models. All metrics are computed independently on the held-out test fold of each of the k=8k = 8 cross-validation splits and are summarised by their mean and standard deviation (σ\sigma) across folds. The 95% confidence interval is obtained from the one-sample tt-distribution with seven degrees of freedom,

TargetOrb.RMAE2R^2_{\mathrm{MAE}}RESOC2R^2_{E_{\mathrm{SOC}}}RHSOCd2R^2_{H_{\mathrm{SOC}}^{d}}
MAEspdspd0.804 (0.055) CI = [0.758, 0.850]––
dd0.786 (0.051) CI = [0.743, 0.829]––
MAE + ESOCE_{\mathrm{SOC}}spdspd0.821 (0.051) CI = [0.779, 0.864]0.867 (0.045) CI = [0.829, 0.905]–
dd0.817 (0.076) CI = [0.754, 0.881]0.867 (0.036) CI = [0.837, 0.898]–
MAE + ESOCE_{\mathrm{SOC}} + HSOCdH_{\mathrm{SOC}}^{d}spdspd0.796 (0.044) CI = [0.759, 0.833]0.850 (0.025) CI = [0.829, 0.871]0.567 (0.041) CI = [0.532, 0.601]
dd0.786 (0.050) CI = [0.744, 0.828]0.844 (0.034) CI = [0.815, 0.872]0.572 (0.054) CI = [0.527, 0.616]

Table S3. In-domain R2R^2 of the BiGRU models. Each cell: mean (std) and 95% CI = mean ± 2.365 std/8\sqrt{8}.

Table S6 | In-domain MAErr (meV) of the 1D-CNN models. Each cell: mean (std) and 95 % CI. MAErr for ESOCE_{\mathrm{SOC}} averaged over the two TM atoms; MAErr for HSOCdH^{d}_{\mathrm{SOC}} averaged over the 16 orbital-pair matrix elements.

TargetOrb.MAErrMAE\mathrm{MAErr}_{\mathrm{MAE}}MAErrESOC\mathrm{MAErr}_{E_{\mathrm{SOC}}}MAErrHSOCd\mathrm{MAErr}_{H^{d}_{\mathrm{SOC}}}
MAEspdspd8.38 (0.86) CI = [7.67, 9.10]––
dd8.69 (0.85) CI = [7.97, 9.40]––
MAE + ESOCE_{\mathrm{SOC}}spdspd7.71 (0.83) CI = [7.02, 8.41]10.43 (1.15) CI = [9.46, 11.39]–
dd8.35 (0.70) CI = [7.77, 8.94]10.78 (1.14) CI = [9.82, 11.73]–
MAE + ESOCE_{\mathrm{SOC}} + HSOCdH^{d}_{\mathrm{SOC}}spdspd8.57 (1.02) CI = [7.72, 9.43]11.35 (1.36) CI = [10.21, 12.49]3.853 (0.250) CI = [3.644, 4.062]
dd9.09 (0.79) CI = [8.43, 9.75]11.83 (1.12) CI = [10.90, 12.77]3.909 (0.269) CI = [3.685, 4.134]

Table S6.

CI95=xˉ±t0.025, k−1σk=xˉ±2.365σk\mathrm{CI}_{95} = \bar{x} \pm t_{0.025,\,k-1}\frac{\sigma}{\sqrt{k}} = \bar{x} \pm2.365\frac{\sigma}{\sqrt{k}}

where xˉ\bar{x} is the fold-mean and k=8k = 8. R2R^2 values for ESOCE_{\mathrm{SOC}} are averages of the per-fold scores for the bottom and top TM atoms; those for HSOCdH_{\mathrm{SOC}}^{d} are additionally averaged over the 16 orbital-pair matrix elements. MAErr for ESOCE_{\mathrm{SOC}} and HSOCH_{\mathrm{SOC}} follows the same averaging convention and is expressed in meV. Note that cross-validation folds are not independent—each sample appears in seven training sets—so the intervals are slightly optimistic.

To assess whether the difference in in-domain MAE R2R^2 between the BiGRU and 1D-CNN is statistically meaningful, we apply a paired tt-test across the eight cross-validation folds. Because both architectures are evaluated on the same held-out test folds, the per-fold scores are paired. In all six target–orbital combinations the difference is not statistically significant at the α=0.05\alpha= 0.05 level (pp ranging from 0.08 to 0.85; the closest case is the MAE + ESOCE_{\mathrm{SOC}} setting with spdspd orbitals, where the 1D-CNN exceeds the BiGRU by 0.021 with p=0.08p = 0.08). We therefore conclude that the two architectures achieve statistically equivalent in-domain predictive accuracy, consistent with the Rashomon effect, and that the differences discussed in the main text reflect architecture-dependent learned representations rather than differences in overall predictive performance.

Table S4 | In-domain MAErr (meV) of the BiGRU models. Each cell: mean (std) and 95 % CI. MAErr for ESOCE_{\mathrm{SOC}} averaged over the two TM atoms; MAErr for HSOCdH_{\mathrm{SOC}}^{d} averaged over the 16 orbital-pair matrix elements.

TargetOrb.MAErrMAE\mathrm{MAErr}_{\mathrm{MAE}}MAErrESOC\mathrm{MAErr}_{E_{\mathrm{SOC}}}MAErrHSOCd\mathrm{MAErr}_{H_{\mathrm{SOC}}^{d}}
MAEs p ds\,p\,d8.84 (1.39) CI = [7.68, 10.00]––
MAEdd9.26 (0.92) CI = [8.50, 10.03]––
MAE + ESOCE_{\mathrm{SOC}}s p ds\,p\,d8.26 (0.86) CI = [7.54, 8.98]10.71 (1.23) CI = [9.69, 11.74]–
MAE + ESOCE_{\mathrm{SOC}}dd8.32 (1.02) CI = [7.46, 9.17]10.95 (1.23) CI = [9.93, 11.98]–
MAE + ESOC+HSOCdE_{\mathrm{SOC}} + H_{\mathrm{SOC}}^{d}s p ds\,p\,d9.14 (0.90) CI = [8.39, 9.89]12.09 (1.29) CI = [11.02, 13.17]4.070 (0.285) CI = [3.832, 4.309]
MAE + ESOC+HSOCdE_{\mathrm{SOC}} + H_{\mathrm{SOC}}^{d}dd9.38 (0.91) CI = [8.62, 10.13]12.33 (1.39) CI = [11.17, 13.49]4.092 (0.307) CI = [3.835, 4.349]

Table S4. Table S4 | In-domain MAErr (meV) of the BiGRU models. Each cell: mean (std) and 95 % CI. MAErr for ESOCE_{\mathrm{SOC}} averaged over the two TM atoms; MAErr for HSOCdH_{\mathrm{SOC}}^{d} averaged over the 16 orbital-pair matrix elements.

Table S5 | In-domain R2R^2 of the 1D-CNN models. Each cell: mean (std) and 95 % CI = mean ±2.365 std/8\pm2.365\,\mathrm{std}/\sqrt{8}.

TargetOrb.RMAE2R^2_{\mathrm{MAE}}RESOC2R^2_{E_{\mathrm{SOC}}}RHSOCd2R^2_{H_{\mathrm{SOC}}^{d}}
MAEs p ds\,p\,d0.808 (0.050) CI = [0.766, 0.850]––
MAEdd0.801 (0.048) CI = [0.761, 0.842]––
MAE + ESOCE_{\mathrm{SOC}}s p ds\,p\,d0.842 (0.029) CI = [0.818, 0.866]0.876 (0.046) CI = [0.837, 0.914]–
MAE + ESOCE_{\mathrm{SOC}}dd0.821 (0.042) CI = [0.786, 0.856]0.875 (0.033) CI = [0.847, 0.903]–
MAE + ESOC+HSOCdE_{\mathrm{SOC}} + H_{\mathrm{SOC}}^{d}s p ds\,p\,d0.804 (0.067) CI = [0.748, 0.860]0.862 (0.046) CI = [0.823, 0.901]0.601 (0.045) CI = [0.564, 0.639]
MAE + ESOC+HSOCdE_{\mathrm{SOC}} + H_{\mathrm{SOC}}^{d}dd0.790 (0.057) CI = [0.743, 0.838]0.853 (0.033) CI = [0.825, 0.880]0.596 (0.043) CI = [0.560, 0.632]

Table S5. Table S5 | In-domain R2R^2 of the 1D-CNN models. Each cell: mean (std) and 95 % CI = mean ±2.365 std/8\pm2.365\,\mathrm{std}/\sqrt{8}.

Training Curves

Figure S1 shows the training and validation loss curves for the BiGRU and 1D-CNN models for all eight cross-validation folds and all three target configurations. Both architectures converge smoothly, with the validation loss closely tracking the training loss throughout, indicating no overfitting. Early stopping with a patience of 500 epochs terminates training when the validation loss no longer improves; the stopping epoch, marked by a cross and a vertical dashed line in each panel, varies across folds and target settings but is consistent within each architecture–target combination. The 1D-CNN generally converges in fewer epochs than the BiGRU, reflecting the lower complexity of the convolutional stack relative to the three-layer recurrent encoder.

Training and validation loss curves for all cross-validation folds

Figure S1. Training and validation loss curves for all cross-validation folds. Each row corresponds to one of the eight folds and each column to one of the three target configurations (MAE, MAE+ESOCE_{\mathrm{SOC}}, and MAE+ESOC+HSOCdE_{\mathrm{SOC}} + H_{\mathrm{SOC}}^{d}). Gray and black curves show the BiGRU training and validation losses, respectively, and light-blue and dark-blue curves show the corresponding 1D-CNN losses. For each model, the cross and vertical dashed line indicate the checkpoint with the lowest validation loss selected by early stopping. Both axes are shown on logarithmic scales.

Structures

Energy-resolved SHAP

SHAP decomposition

SHapley Additive exPlanations (SHAP) [1, 2] decomposes a model prediction into additive feature contributions relative to a background expectation. For a model ff receiving the Fermi-reordered multichannel SR-DOS input X∈RT×C\mathbf{X} \in\mathbb{R}^{T \times C}, the prediction is expressed as

y^=EX′∼B[f(X′)]+∑t=1T∑c=1Cϕt,c,(3)\hat{y} = \mathbb{E}_{\mathbf{X}' \sim\mathcal{B}}[f(\mathbf{X}')] + \sum_{t=1}^{T} \sum_{c=1}^{C} \phi_{t,c}, \tag*{(3)}

where T=100T = 100 is the number of positions along the reordered distance-from-EF_{\mathrm{F}} axis, CC is the number of input channels (including contributions from both TM atoms), ϕt,c\phi_{t,c} is the SHAP value assigned to the DOS intensity at energy index tt and channel cc, and B\mathcal{B} is the background dataset. A positive ϕt,c\phi_{t,c} indicates that the corresponding spectral weight at (t,c)(t,c) shifts the prediction toward a higher value relative to the background expectation, whereas a negative value indicates a suppressive contribution. Because contributions of opposite sign can cancel upon summation, the absolute SHAP magnitude ∣ϕt,c∣\lvert\phi_{t,c}\rvert is used to quantify attributed importance independently of the direction of the contribution.

Background distribution

The background dataset B\mathcal{B} consists of weak-anisotropy systems with MAE ∈[−25,25]\in[-25, 25] meV. The resulting SHAP values describe feature contributions relative to the model response expected for this reference population. For example, a positive ϕt,c\phi_{t,c} assigned to a given energy and orbital channel indicates that the corresponding spectral feature shifts the predicted MAE toward more positive values relative to the background expectation. Attribution patterns are analyzed separately for high-positive-MAE systems (MAE >25> 25 meV) and strongly negative-MAE systems (MAE <−25< -25 meV).

Gradient-based SHAP

SHAP values are computed using the GradientExplainer algorithm [2], which estimates feature attributions for differentiable models using expected gradients. The analysis is performed using models retrained on the complete implicit-substrate dataset, as described in the Training procedure section. Attributions are initially obtained in the standardized target space used during training and are converted to physical units by multiplying them by the standard deviation of the corresponding target scaler. For MAE, the resulting SHAP values are reported in meV.

DOS–SHAP overlays

Additional DOS–SHAP overlays

Energy-resolved DOS–SHAP overlays are presented for additional systems including high-positive-MAE systems, systems near the lower boundary of the high-positive-MAE regime, and strongly negative-MAE systems. Each figure resolves the overlays by TM atom, spin channel, and dd orbital.

Energy-resolved DOS–SHAP overlays for the bottom and top TM atoms of an OsPt@NSV dimer, showing DOS and SHAP curves across individual $d$ orbitals and spin channels

Figure S7. Energy-resolved DOS–SHAP overlays. Results are shown for the bottom and top TM atoms of a high-MAE OsPt@NSV dimer with a DFT-computed MAE of 126.6 meV. Rows distinguish the individual dd orbitals. The columns correspond to the spin-up and spin-down channels of the bottom TM atom, followed by the corresponding channels of the top TM atom.

Energy-resolved DOS–SHAP overlays

Figure S8. Energy-resolved DOS–SHAP overlays. Results are shown for the bottom and top TM atoms of an IrPd@NSV dimer near the lower boundary of the high-positive-MAE regime, with a DFT-computed MAE of 27.4 meV. Rows distinguish the individual dd orbitals. The columns correspond to the spin-up and spin-down channels of the bottom TM atom, followed by the corresponding channels of the top TM atom.

Energy-resolved DOS–SHAP overlays

Figure S9. Energy-resolved DOS–SHAP overlays. Results are shown for the bottom and top TM atoms of an IrPd@NSV dimer near the lower boundary of the high-positive-MAE regime, with a DFT-computed MAE of 28.9 meV. Rows distinguish the individual dd orbitals. The columns correspond to the spin-up and spin-down channels of the bottom TM atom, followed by the corresponding channels of the top TM atom.

Energy-resolved DOS–SHAP overlays

Figure S10. Energy-resolved DOS–SHAP overlays. Results are shown for the bottom and top TM atoms of a strongly negative-MAE IrPt@NSV dimer with a DFT-computed MAE of −56.2-56.2 meV. Rows distinguish the individual dd orbitals. The columns correspond to the spin-up and spin-down channels of the bottom TM atom, followed by the corresponding channels of the top TM atom.

SHAP and MFT comparison

Controlled DOS perturbations

References

  1. [1]Shapley, L. S. A value for n-person games. In Contributions to the Theory of Games (eds. Kuhn, H. W. & Tucker, A. W.) Vol. 2, 307–317 (Princeton University Press, 1953).
  2. [2]Lundberg, S. M. & Lee, S.-I. A unified approach to interpreting model predictions. Adv. Neural Inf. Process. Syst. 30, 4765–74 (2017).arxiv.org/abs/1705.07874
  3. [3]Mackintosh, A. R. & Andersen, O. K. The electronic structure of transition metals. In Electrons at the Fermi Surface (ed. Springford, M.) 149–224 (Cambridge University Press, 1980).
  4. [4]Heine, V. Electronic structure from the point of view of the local atomic environment. Solid State Phys. 35, 1–127 (1980).DOI
  5. [5]Navrátil, J. & Blónski, P. POET: A Software Suite for Mapping the Site-Specific Electronic Origins of Magnetic Anisotropy. J. Phys. Chem. A 130, 4723–4733 (2026).DOI

Paper details

vlnc:W_kr7pmakj
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 0

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Physics and Astronomy

Not recorded for this paper

View statement
Looking for related papers…
Contents