Structured Neural Networks for Density Estimation

Asic Q Chen, Ruian Shi, Xiang Gao, Ricardo Baptista, Rahul G KrishnanSPIGM @ ICML 2023

TL;DR

This paper introduces Structured Neural Networks (StrNNs), a novel approach to inject prior knowledge about conditional independence structures (like those in Bayesian networks) directly into neural networks. By strategically masking network weights, StrNNs enable more data-efficient and accurate density estimation and causal inference, especially in low-data regimes, by ensuring that learned relationships respect known independencies.

What Problem Does This Paper Address?

Traditional neural networks often treat all input features as potentially interacting, which can lead to inefficient learning and overfitting, particularly when data is scarce. However, in many real-world scenarios, we possess prior knowledge about which variables are conditionally independent of others (e.g., from domain expertise or causal graphs). The challenge is to effectively incorporate this structural knowledge into neural networks to improve their performance, generalization, and interpretability. Existing methods like Masked Autoencoders (MADE) primarily enforce autoregressive dependencies, which is a specific type of structure, but they struggle to incorporate more general conditional independence constraints. This paper aims to bridge this gap by proposing a flexible framework to inject arbitrary conditional independence structures into neural networks.

Methods

The core innovation is the Structured Neural Network (StrNN). StrNNs achieve structural encoding through weight masking. The key idea is to design binary masks for the weights of a neural network such that the resulting network's connectivity reflects a desired adjacency matrix representing conditional independencies. This process involves binary matrix factorization, which is generally NP-hard. To address this, the authors propose:

  • A novel relationship between neural network architectures and binary matrix factorization: They show that the sparsity pattern of the product of masks for each layer should match the target adjacency matrix.
  • Practical algorithms for mask generation: They develop a greedy algorithm that efficiently approximates the factorization, prioritizing maximizing connections while respecting the structure. They also explore an integer programming approach for optimal solutions on smaller problems.
  • Integration into existing flow models: StrNNs are integrated into autoregressive flows (StrAF) and continuous normalizing flows (StrCNF) to create structured generative models.

Datasets

The paper evaluates its methods on a variety of synthetic and real-world datasets:

  • Synthetic Binary Data: Generated from known Bayesian networks with different sparsity patterns ("Binary every_other", "Binary random_sparse").
  • Synthetic Gaussian Data: Generated from known structure equations with different sparsity patterns ("Gaussian prev_2", "Gaussian random_sparse").
  • MNIST Image Data: Binarized MNIST dataset, treated as high-dimensional data where local pixel dependencies are modeled.
  • Synthetic Data for Autoregressive Flow Evaluation: A 15-dimensional multi-modal, non-linear dataset with sparse conditional dependencies.
  • Synthetic Data for Causal Inference: 5- and 10-variable linear additive Structural Equation Models (SEMs) with sparse adjacency matrices.

Key Insights and Ideas

  • Structure is crucial for data efficiency: Injecting known conditional independence structures significantly improves density estimation performance, especially when training data is limited. This suggests that neural networks can learn more effectively by being guided by prior structural knowledge.
  • Weight masking is a powerful tool for structural encoding: By strategically zeroing out weights, StrNNs can enforce specific dependencies and independencies, directly shaping the network's functional behavior.
  • Binary matrix factorization is key to designing structured networks: The problem of creating structured neural networks can be framed as factoring an adjacency matrix into layer-wise masks, which is a challenging but solvable problem with approximate algorithms.
  • StrNNs enhance generative models and causal inference: Integrating StrNNs into normalizing flows (StrAF, StrCNF) leads to better density estimation and more accurate causal effect predictions (interventions and counterfactuals) compared to models that don't explicitly incorporate graphical structures.

Key Results

  • Density Estimation: StrNN consistently outperforms the fully autoregressive MADE baseline on both synthetic binary and Gaussian data, particularly in low-data regimes. For example, on binary synthetic data, StrNN shows a significant advantage as sample size decreases.
  • Normalizing Flows: StrAF and StrCNF achieve competitive or superior performance in density estimation compared to baselines like ARF, GNF, FFJORD, and Weilbach et al.'s model. For instance, StrCNF outperforms other continuous flow models.
  • Causal Inference: StrAF demonstrates superior performance in estimating interventions and counterfactuals compared to CAREFL, a causal autoregressive flow model. This is shown through lower total mean squared error (MSE) on both 5- and 10-variable SEMs.
  • Mask Factorization: The proposed greedy algorithm for mask factorization is computationally efficient and provides results comparable to exact integer programming methods, making it suitable for large-scale problems.

Limitations and Future Work

  • Access to true adjacency structure: The current work assumes access to the true conditional independence structure. Future work could explore learning this structure directly from data, integrating with causal discovery algorithms.
  • StrNN optimization objectives: The paper proposes objectives for mask factorization but suggests that exploring other objectives could further improve performance and generalization. Investigating the impact of different factorization objectives on model performance is an open area.
  • Computational cost of exact factorization: While the greedy algorithm is efficient, the exact integer programming solution for mask factorization is computationally expensive for high-dimensional data.
  • Exploring new applications: The authors suggest that StrNNs could be applied to other domains where structural knowledge is available, such as reinforcement learning or time series analysis.
  • Leveraging sparsity for faster training: Investigating how sparsity imposed by StrNN can lead to faster training and potentially connect to ideas like the Lottery Ticket Hypothesis is a promising direction.

Summary updated

BibTeX
@inproceedings{chen2023structured,
  author = {Asic Q Chen and Ruian Shi and Xiang Gao and Ricardo Baptista and Rahul G Krishnan},
  title = {{Structured Neural Networks for Density Estimation}},
  booktitle = {SPIGM @ ICML},
  year = {2023},
  url = {https://openreview.net/forum?id=GaUt5aVc2N},
}
Figure