Papers
Topics
Authors
Recent
Search
2000 character limit reached

Neural SEMs: Neural Networks in Latent Modeling

Updated 4 May 2026
  • Neural SEMs are latent variable models that combine classical structural equation modeling with neural network components for flexible, nonlinear data analysis.
  • They reformulate traditional SEMs into computation graphs, enabling end-to-end optimization through automatic differentiation and robust regularization techniques.
  • Neural SEMs support scalable applications across fields like social sciences, genomics, and econometrics by integrating custom loss functions and modern optimization methods.

Neural Structural Equation Models (Neural SEMs) are a class of latent-variable models that generalize classical structural equation models by incorporating neural network components into one or more linear mappings, enabling flexible modeling of nonlinear dependencies and high-dimensional data while leveraging advances in automatic differentiation and optimization in modern deep learning frameworks. Neural SEMs unify statistical modeling of latent structures, regularized estimation, and nonparametric function approximation within a computation graph formalism, supporting both traditional covariance-based objectives and sample-level loss functions (Kesteren et al., 2019, Liao et al., 2020).

1. Mathematical Foundations and Computation Graph Representation

Classical SEMs formalize relationships between observed variables yRpy \in \mathbb{R}^p and latent variables ηRm\eta \in \mathbb{R}^m through a measurement model y=Λη+ϵy = \Lambda \eta + \epsilon and structural (latent) model η=B0η+ζ\eta = B_0 \eta + \zeta, with B=IB0B = I - B_0 invertible. The implied covariance is Σ(θ)=ΛB1ΨBTΛ+Θ\Sigma(\theta) = \Lambda B^{-1} \Psi B^{-T} \Lambda^\top + \Theta, where Θ,Ψ\Theta, \Psi are residual and latent covariances (Kesteren et al., 2019).

SEMs can be reformulated as directed acyclic computation graphs: parameter tensors are reshaped into structural matrices, followed by matrix operations (inverse, multiplication, logdet, trace) culminating in a scalar loss such as maximum likelihood,

FML(θ)=logdetΣ(θ)+tr(SΣ(θ)1)F_{ML}(\theta) = \log \det \Sigma(\theta) + \operatorname{tr}(S \Sigma(\theta)^{-1})

or alternatives (GLS, LAD). Differentiable objectives and constraints are encoded as graph edges, enabling end-to-end optimization by automatic differentiation.

2. Neural Parameterizations and Nonlinear Extensions

Neural SEMs generalize linear mappings by inserting neural network modules at either the measurement or structural stages. The structural model can be rendered nonlinear:

η=fθ(η)+ζ\eta = f_\theta(\eta) + \zeta

with fθf_\theta a multi-layer perceptron (MLP) using non-linearities such as ReLU or tanh. Measurement models ηRm\eta \in \mathbb{R}^m0 can similarly employ a neural mapping ηRm\eta \in \mathbb{R}^m1. Losses may transition from covariance-based to sample-level:

ηRm\eta \in \mathbb{R}^m2

Neural modules are seamlessly integrated as DAG nodes, with their gradients computed by reverse-mode autodiff (Kesteren et al., 2019).

3. Optimization Algorithms and Theoretical Guarantees

For large-scale or high-dimensional SEMs, stochastic optimization with modern optimizers (e.g., Adam) is effective. Implementation in deep learning frameworks (PyTorch, TensorFlow) declaratively specifies parameters, model structure, and loss computation. Key methodology details include:

  • Parameter initialization: loadings ηRm\eta \in \mathbb{R}^m3, structural ηRm\eta \in \mathbb{R}^m4, and covariance factors are initialized with standard schemes (e.g., Xavier, He).
  • Constraints: positive-definiteness of covariance matrices is enforced via factorization ηRm\eta \in \mathbb{R}^m5.
  • Optimizer settings: learning rates typically in ηRm\eta \in \mathbb{R}^m6 to ηRm\eta \in \mathbb{R}^m7; Adam parameters ηRm\eta \in \mathbb{R}^m8 recommended.

Adversarial formulations recast generalized SEMs as min-max games, e.g., solving ηRm\eta \in \mathbb{R}^m9 via an objective

y=Λη+ϵy = \Lambda \eta + \epsilon0

with both y=Λη+ϵy = \Lambda \eta + \epsilon1 and y=Λη+ϵy = \Lambda \eta + \epsilon2 parameterized by wide ReLU NNs. Stochastic adversarial SGD updates both players without sample splitting, and wide-network theory (NTK) provides finite-sample convergence rates of order y=Λη+ϵy = \Lambda \eta + \epsilon3 for two-layer networks, or y=Λη+ϵy = \Lambda \eta + \epsilon4 for multilayer networks, with y=Λη+ϵy = \Lambda \eta + \epsilon5 steps and width y=Λη+ϵy = \Lambda \eta + \epsilon6 (Liao et al., 2020).

4. Regularization, Loss Customization, and Model Selection

Penalized estimation is central for high-dimensional Neural SEMs. Regularization terms y=Λη+ϵy = \Lambda \eta + \epsilon7 are merged into the scalar loss,

y=Λη+ϵy = \Lambda \eta + \epsilon8

Available penalties include:

Penalty type Functional Form Implementation Example
LASSO (L1) y=Λη+ϵy = \Lambda \eta + \epsilon9 torch.sum(torch.abs(B0))
Ridge (L2) η=B0η+ζ\eta = B_0 \eta + \zeta0 torch.sum(B0**2)
Elastic Net η=B0η+ζ\eta = B_0 \eta + \zeta1 sum of L1 and L2
Spike-and-slab η=B0η+ζ\eta = B_0 \eta + \zeta2 as in Ročková & George (2018)

Alternative fit indices, such as LAD (least-absolute-deviation), can be incorporated by replacing the ML loss with η=B0η+ζ\eta = B_0 \eta + \zeta3, further enhancing robustness.

5. Software Realizations and Practical Implementation

The tensorsem R package operationalizes Neural SEMs with a TensorFlow backend. It parses lavaan-style model syntax for latent and manifest structures, builds a computation graph, and exposes fit functions for ML, GLS, LAD, and regularized objectives. Positive-definiteness of covariances is enforced via η=B0η+ζ\eta = B_0 \eta + \zeta4 parameterizations.

Key workflow in tensorsem:

η=B0η+ζ\eta = B_0 \eta + \zeta6

Penalty terms and neural modules can be added via function arguments. PyTorch and TensorFlow pseudocode for custom Neural SEMs follows the same computation graph and optimizer design (Kesteren et al., 2019).

6. Theoretical and Practical Considerations

Identification is maintained by fixing one loading per factor or latent variance; ill-posedness is managed by regularization and careful parameter initialization. For covariance-based loss, full-sample gradients are typical, while mini-batch or FIML approaches are feasible for large-η=B0η+ζ\eta = B_0 \eta + \zeta5 scenarios. Standard errors for ML fits are available by inverting the Hessian; for nonsmooth or nonconvex penalties, bootstrap is required but may be unreliable.

Adversarial neural estimation frameworks provide, for the first time, provable finite-sample consistency and convergence for nonparametric SEM estimation. Rates depend on network width, smoothness of the true operator, and optimization hyperparameters. In overparameterized regimes, stochastic optimization and implicit regularization (small learning rates, dropout) further support high-dimensional consistency (Liao et al., 2020).

7. Scope and Applications

Neural SEMs enable the extension of traditional latent variable modeling to settings involving high-dimensional measurements, nonlinear dependencies, multi-source experimental data, and ill-posed inverse problems (e.g., nonparametric instrumental variables, dynamic panels). The computation graph formulation is sufficiently general to permit rapid prototyping of new loss functions, regularization strategies, and model architectures without bespoke algorithmic reformulation. This supports integration of social-scientific latent modeling, genomics, and econometric causal inference within the same computational and theoretical toolkit (Kesteren et al., 2019, Liao et al., 2020).

Definition Search Book Streamline Icon: https://streamlinehq.com
References (2)

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Neural Structural Equation Models (Neural SEMs).