Differentiable Stellar Atmospheres with Physics-Informed Neural Networks Jiadong Li*, Mingjie Jian*, Yuan-Sen Ting*, Gregory M. Green Abstract We present Kurucz-a1 , a physics-informed neural network (PINN) that emulates 1D stellar atmosphere models under Local Thermodynamic Equilibrium (LTE), addressing a critical bottleneck in differentiable stellar spectroscopy. By incorporating hydrostatic equilibrium as a physical constraint during training, Kurucz-a1 creates a differentiable atmospheric structure solver that maintains physical consistency while achieving computational efficiency. Kurucz-a1 can achieve superior hydrostatic equilibrium and more consistent with the solar observed spectra compared to ATLAS-12 itself, demonstrating the advantages of modern optimization techniques. Combined with modern differentiable radiative transfer codes, this approach enables data-driven optimization of universal physical parameters across diverse stellar populations—a capability essential for next-generation stellar astrophysics. † † affiliationnotice: Equal contribution 1 Introduction Understanding stellar properties requires detailed modeling of observed spectra using stellar atmosphere models. Since stellar interiors are opaque to radiation, observable absorption features originate primarily from the photosphere ( Gray 2008 ) , the layer where light begins to escape from the atmosphere. Stellar spectral modeling typically involves two central steps: constructing an atmospheric model and generating synthetic spectra. The first step determines the atmospheric structure—temperature, pressure, and electron density as functions of optical depth (measured in Rosseland mean opacity units)—by iteratively solving radiative transfer, radiative and hydrostatic equilibrium equations under assumptions of one-dimensional stratification and local thermodynamic equilibrium (LTE) ( Hubeny & Mihalas 2015 ) . Traditional approaches rely on pre-computed grids such as ATLAS ( Castelli & Kurucz 2003 ) , MARCS ( Gustafsson et al. 2008 ) , and PHOENIX ( Allard 2016 ) . The second step uses this fixed atmospheric structure for spectral synthesis ( Kurucz & Avrett 1981 ; Sneden et al. 2012 ; Gerber et al. 2023 ; Piskunov & Valenti 2017 , e.g.) , performing radiative transfer calculations to generate synthetic spectra. However, the output spectra are influenced by numerous poorly constrained parameters. Atomic transition parameters, such as oscillator strengths for individual lines, often require laboratory measurements or theoretical calculations that may be inaccurate ( Asplund 2005 ; Laverick et al. 2018 ) . Furthermore, atmospheric modeling relies on opacity calculations ( Magic et al. 2013 ; Colgan et al. 2016 ) , convection treatments ( Asplund et al. 2000a ; Asplund et al. 2000b ; Neilson & Lester 2013 ; Pasetto et al. 2014 ) , and assumptions about atmospheric structure ( Asplund et al. 2005 ) , which introduce systematic uncertainties into spectral modeling. Large-scale spectroscopic surveys such as the Sloan Digital Sky Survey ( York 2000 ) and LAMOST ( Zhao et al. 2012 ) provide extensive datasets that could enable optimization of these model parameters. While individual stars have different fundamental properties (effective temperature, surface gravity, metallicity), the underlying atomic physics remains universal. In principle, a differentiable end-to-end modeling framework could optimize these universal parameters by fitting large stellar samples while marginalizing over star-by-star properties—effectively using the diversity of stellar observations to constrain the physics that governs all stars. Figure 1: Kurucz-a1 neural network architecture with dual-encoder design. Stellar parameters ( T_{\text{eff}} , \log g , [Fe/H], [ \alpha /Fe]) and optical depth points are encoded separately, then concatenated and processed through fully connected layers (FC) to predict atmospheric parameters ( \rho_{x} , T , P , \kappa , X_{\text{NE}} , ACCRAD) at each depth point. Ideally, creating differentiable stellar spectroscopy codes would involve rewriting existing models in modern frameworks like PyTorch or JAX . However, most stellar atmosphere codes predate the widespread adoption of automatic differentiation. Many of these codes ( Castelli & Kurucz 2003 , e.g.) are written in legacy languages, such as Fortran 77 , and have limited documentation. This presents a barrier to modernization, even with current automated coding tools. Fortunately, the two modeling components—atmospheric structure model and radiative transfer—can be addressed separately. Modern frameworks such as Korg ( Wheeler et al. 2024 ) have successfully modernized radiative transfer solvers in differentiable languages. However, the atmospheric structure solver remains the key bottleneck for end-to-end differentiable modeling. In this study, we address this bottleneck by developing a physics-informed neural network (PINN) emulator for stellar atmospheric structure calculations. While this approach does not directly solve the differential equations in a differentiable framework, it creates a differentiable component that, when combined with modern radiative transfer solvers, enables the end-to-end optimization framework described above. 2 Motivation for PINN Emulating stellar atmospheric structure presents challenges even in discretized form. Consider the ATLAS codes ( Kurucz 1970 ; Kurucz & Avrett 1981 ; Kurucz 1996 ; Kurucz 2014 ) —cornerstone tools in stellar astrophysics developed by Robert Kurucz 1 1 1 Robert Kurucz, who dedicated his life to developing these transformative codes, passed away in 2025. Together with Fiorella Castelli, they built the foundation on which much of contemporary stellar spectroscopy still relies. This work aims to preserve and further modernize their shared legacy. . The ATLAS-12 atmospheric structure solver produces high-dimensional vector fields as functions of Rosseland optical depth: six atmospheric parameters (temperature, pressure, density, electron number density, opacity, and radiative acceleration) across 80 depth points, yielding 480-dimensional outputs. The input space is equally complex. While fundamental stellar parameters ( T_{\text{eff}} , \log g , [Fe/H], [ \alpha /Fe]) provide the primary constraints, individual elemental abundances can affect atmospheric structure ( LeBlanc et al. 2009 ; Ting et al. 2016 ) . This creates a challenging high-dimensional input-output mapping problem where traditional neural network architectures lack appropriate inductive biases for the complex physical relationships governing stellar atmospheres. Figure 2: Relative error distributions for atmospheric parameters predicted by Kurucz-a1 compared to ATLAS-12 models. The four panels show column mass density (RHOX), temperature (T), pressure (P), and Rosseland opacity (ABROSS) versus optical depth. The validation dataset spans Galactic stellar populations (see appendix). However, stellar atmospheric structure is governed by well-established physical laws—primarily hydrostatic equilibrium and radiative transfer equations. These constraints provide the essential inductive bias that standard architectures cannot capture. Physics-Informed Neural Networks (PINNs) ( E & Yu 2017 ; Raissi et al. 2018 ; Raissi et al. 2019 ) offer an optimal solution by integrating these physical constraints directly into the learning process through composite loss functions that enforce both data fidelity and physics compliance. 3 Method Kurucz-a1 employs a dual-encoder architecture (Figure 1 ) that separates global stellar parameters from local depth information. This design reflects the underlying physics where global stellar properties establish the overall atmospheric structure, while local conditions vary systematically with atmospheric depth. Figure 3: Hydrostatic equilibrium diagnostic for a representative red-giant branch star ( T_{\mathrm{eff}}=4500 K, \log g=2.5 , [\mathrm{Fe}/\mathrm{H}]=0 , [ \alpha /Fe] = 0). Deviations from the diagonal indicate violations of dP/d\tau=g/\kappa . Kurucz-a1 (dashed) demonstrates superior agreement compared to the MLP baseline (dot-dashed), nearly matching ATLAS-12 (solid). The stellar parameter encoder processes four fundamental quantities—effective temperature ( T_{\text{eff}} ), surface gravity ( \log g ), metallicity ([Fe/H]), and \alpha -enhancement ([ \alpha /Fe])—through a multi-layer perceptron to produce 512-dimensional embeddings. The depth encoder transforms the 80 Rosseland optical depth points ( \tau_{\text{Ross}} ) into 512-dimensional representations at each atmospheric layer, allowing the network to learn appropriate representations for the atmospheric depth coordinate. The stellar parameter embedding is broadcast and concatenated with each depth embedding to form 1024-dimensional combined embeddings at all 80 depth points. These are processed through a 3-layer MLP emulator (with hidden dimensions [1024, 512, 256]) to predict six atmospheric parameters at each depth: column mass density ( \rho_{x} ), temperature ( T ), gas pressure ( P ), electron number density ( X_{\text{NE}} ), Rosseland mean opacity ( \kappa_{\text{Ross}} ), and radiative acceleration (ACCRAD). We use GeLU activations ( Hendrycks & Gimpel 2016 ) . Figure 4: Distribution of hydrostatic equilibrium loss values across the validation dataset. Kurucz-a1 (purple) achieves a tight distribution comparable to ATLAS-12 (gray), while the MLP baseline (red) shows higher and more scattered values. Values near zero indicate perfect adherence to the hydrostatic equilibrium constraint. The total loss function combines data reproduction and physics enforcement: \mathcal{L}_{\text{total}}=(1-\alpha)\cdot\mathcal{L}_{\text{data}}+\alpha\cdot\mathcal{L}_{\text{physics}} (1) with \alpha=0.03 by grid search, where \mathcal{L}_{\text{data}} is the MSE loss of the predicted outputs. The physics loss enforces hydrostatic equilibrium: \mathcal{L}_{\text{physics}}=\frac{1}{N_{b}\cdot N_{d}}\sum_{i,j}\left(\frac{dP}{d\tau}-\frac{g}{\kappa}\right)^{2}_{i,j} (2) where \frac{dP}{d\tau} is computed via automatic differentiation, enforcing the constraint that governs atmospheric stability: \frac{dP}{d\tau}=\frac{g}{\kappa} (3) Figure 5: Solar spectrum synthesis validation. Top : Observed solar spectrum (green dashed) compared to synthetic spectra from Kurucz-a1 (blue) and ATLAS-12 (orange). Middle : Direct comparison between Kurucz-a1 and ATLAS-12 synthetic spectra, showing minimal differences. Bottom : Residuals relative to observed spectrum demonstrate that Kurucz-a1 achieves better agreement than ATLAS-12 due to superior hydrostatic equilibrium adherence. 4 Results We evaluate Kurucz-a1 ’s performance to demonstrate that physics-informed constraints are essential for robust stellar atmosphere emulation. The validation encompasses 10,427 stellar models spanning T_{\text{eff}}=2500 –50,000 K, \log g=-1 –5.5, [Fe/H] =-4 – +1.46 , and [ \alpha /Fe] =-0.2 – +0.62 (see Appendix for training data details). Figure 2 shows the relative error distributions across optical depth for all atmospheric parameters. Kurucz-a1 achieves median errors below 0.12% for temperature, 1.1% for pressure and density, and 1.5% for opacity across the full range of stellar parameters tested. These errors are well within acceptable bounds for stellar atmosphere modeling. For context, even state-of-the-art grids like MARCS and ATLAS exhibit temperature differences of 10 K to 80 K in their upper layers ( \tau_{\text{Ross}}\leq 10^{-2} ), which is considered the current frontier of uncertainty stemming from different input physics ( Gustafsson et al. 2008 ) . Comparisons for the APOGEE survey show the MARCS and ATLAS9 grids agree to within <1\% for temperature ( Heiter et al. 2015 ) and 2-3% for pressure ( Mészáros et al. 2012 ) . Since our model’s median temperature error is well below these accepted inter-model discrepancies, it demonstrates a high degree of fidelity. However, accurate stellar atmosphere modeling requires more than point-wise precision—the physical consistency of atmospheric profiles is crucial ( Magic et al. 2013 ) . Radiative transfer calculations depend critically on pressure and temperature gradients, not just their absolute values ( Hayek et al. 2010 ) . Figure 3 demonstrates the advantage of Kurucz-a1 in maintaining hydrostatic equilibrium. Kurucz-a1 achieves hydrostatic equilibrium comparable to ATLAS-12 itself, while outperforming the MLP baseline that lacks physics constraints. This validates the vital role of physics-informed loss terms. Notably, Kurucz-a1 , on average, achieves even better hydrostatic equilibrium than ATLAS-12, likely due to ATLAS-12’s discrete numerical scheme and optimization methods that predate modern gradient-based techniques. The small deviations from precise equilibrium in ATLAS-12 ( \sim 0.1% level) reflect limitations of finite-difference discretization. Finally, we validated Kurucz-a1 ’s practical utility by synthesizing solar spectra using PySME ( Wehrhahn et al. 2023 ; Piskunov & Valenti 2017 ) and comparing with observations (Figure 5 ). The synthetic spectra generated using Kurucz-a1 closely match both ATLAS-12 models and observations from the Melchior database ( Royer 2024 ) , confirming that the emulated atmospheric output is indistinguishable from reference models. Kurucz-a1 even outperforms ATLAS-12 in some spectral line wings, likely due to better hydrostatic equilibrium adherence. 5 Broader Impact Kurucz-a1 , available open-source at https://github.com/jiadonglee/kurucz-a1 , provides a practical tool and methodological template for the astronomical community, achieving a mean inference time of 0.37\pm 0.06 millisecond per model on an Apple M1 Pro chip. For stars hotter than \sim 4500K, where molecular transitions are minimal, radiative transfer codes typically execute within seconds to minutes. Consequently, stellar spectral analysis commonly employs sparse grids of pre-computed atmospheric models, running only spectral synthesis code like Korg ( Wheeler et al. 2024 ) and PySME ( Piskunov & Valenti 2017 ; Wehrhahn et al. 2023 ) to synthesize lines for comparison with observations. However, as demonstrated by Ting et al. 2016 , these sparse atmospheric grids introduce systematic errors in stellar line analysis. While solving stellar atmospheric structure with codes like ATLAS requires computational overhead (minutes to hours per model), current sparse grid approaches also limit analysis to few parameters, grouping elemental abundances into broad categories like [Fe/H] and [ \alpha /Fe]. Kurucz-a1 provides a low-cost replacement for stellar atmosphere synthesis models. It generates atmospheric output within seconds, making it practical to eliminate the interpolation errors inherent in sparse grids while maintaining computational efficiency. This framework also eases data storage and transfer requirements when additional abundance dimensions are included. The current implementation uses four stellar parameters consistent with existing atmospheric grids. Future work will extend the PINN framework to higher-dimensional parameter spaces, enabling incorporation of additional abundance dimensions (alpha-elements, CNO, helium) essential for modeling diverse stellar populations, as well as incorporating additional physics such as equation of state and energy balance. Beyond practical applications, this work addresses a fundamental bottleneck in achieving end-to-end differentiable stellar spectroscopy. Combined with modern differentiable radiative transfer codes, this approach opens pathways to data-driven calibration of atomic physics parameters that current stellar models must assume. 6