Learning Discrete Directed Acyclic Graphs via Backpropagation

Andrew J. Wren, Pasquale Minervini, Luca Franceschi, Valentina Zantedeschi

TL;DR

Standard continuous optimization methods for learning Directed Acyclic Graphs (DAGs) rely on continuous relaxations of graph adjacency matrices, departing from the fundamentally discrete nature of graph structures. DAG-DB introduces a framework that avoids continuous relaxations altogether, treating the adjacency matrix as an implicit discrete distribution and training it via discrete backpropagation techniques like Straight-Through Estimation (STE) and Implicit Maximum Likelihood Estimation (I-MLE).

What Problem Does This Paper Address?

Learning the structure of Bayesian networks—represented as Directed Acyclic Graphs (DAGs)—from observational data is a core problem in causal discovery and graphical modeling. Traditionally, this required combinatorial search (e.g., greedy score-based or constraint-based methods), which struggles to scale.

Recent breakthroughs like NOTEARS reframed structure learning as continuous optimization by "relaxing" discrete binary adjacency matrices into real-valued matrices subject to algebraic acyclicity constraints. However, this relaxation abandons the true discrete nature of edges. This paper investigates whether one can instead keep edges fully discrete throughout training by applying gradient-based optimization via discrete backpropagation.

Methods

The proposed framework, DAG-DB (DAGs via Discrete Backpropagation), models graph structure probabilistically without relaxing edges to continuous values:

  • Probabilistic Formulation via Perturb-and-MAP (P&M): The model parameterizes an exponential family distribution over zero-diagonal binary adjacency matrices $Z \in \{0, 1\}^{d \times d}$ using continuous parameters $\Theta$. Binary samples $Z^{(s)}$ are drawn using Perturb-and-MAP sampling: $Z = \text{MAP}(\Theta + \tau\Psi)$, where $\Psi$ is standard logistic noise and $\tau$ is a temperature hyperparameter.
  • Discrete Backpropagation: Because the MAP operation has zero gradient almost everywhere, standard backpropagation fails. DAG-DB investigates gradient estimators to backpropagate from discrete samples $Z$ to continuous parameters $\Theta$:
  • Straight-Through Estimator (STE): Treats thresholding as an identity mapping during the backward pass ($\nabla_\Theta L \approx \frac{1}{\tau S} \sum_s \nabla_{Z^{(s)}} L$).
  • Implicit Maximum Likelihood Estimation (I-MLE): Perturbs the discrete target using Domke’s method to approximate parameter updates.
  • Loss & Regularization: Given a sample $Z$, parent features predict target features via a linear map $f_\Phi(x \diamond Z)$. The loss includes prediction Mean Squared Error (MSE), a binary matrix algebraic DAG penalty $r_{\text{DAG}}(Z) = [\text{tr}(\exp Z) - d]^2$, and an optional $L_1$ sparsity penalty $r_{\text{sp}}(Z)$.
  • Evaluation Maximum DAG Solver: During training, the model can operate on general digraphs. At test time, an approximate maximum directed acyclic subgraph solver (Greedy Feedback Arc Set, or GFAS) converts the predicted digraph into a valid DAG.

Datasets

  • Synthetic Datasets: Random DAGs generated across different node sizes ($d \in \{10, 30, 100\}$) using:
  • Erdös–Rényi graphs (ER1, ER2, ER4, with expected degree $k$).
  • Scale-free Barabási–Albert graphs (SF2, SF4).
  • Data sampled from standard Gaussian equal-variance linear additive noise models (LANM).
  • Real-World Dataset: The Sachs cellular signaling network dataset ($d = 11$ nodes, 17 edges, 853 observational data points), widely used in causal discovery benchmarks.

Key Insights and Ideas

  • Probabilistic relaxation beats continuous relaxation of edge weights: Rather than relaxing binary edges into continuous real numbers, DAG-DB keeps individual graph samples strictly discrete and relaxes the distribution over graphs.
  • Surprising efficacy of STE: Despite being a crude heuristic, the Straight-Through Estimator paired with an explicit edge-count cap (STE_84) performed remarkably well, often matching or outperforming the theoretically grounded I-MLE on synthetic benchmarks.
  • P&M enables non-independent constraints: Standard Bernoulli sampling requires edge independence. In contrast, Perturb-and-MAP easily supports global structural constraints—such as capping the maximum number of allowable edges across the whole graph—directly in the MAP step.
  • Post-hoc acyclicity is sufficient: Enforcing strict DAG constraints at every training iteration via combinatorial solvers is computationally prohibitive. Regularizing with a soft DAG loss during training and applying an acyclic projection (GFAS) only at evaluation yields comparable or better results at a fraction of the compute time.

Key Results

  • Synthetic Benchmarks: DAG-DB variants consistently outperformed classic combinatorial methods (PC-Stable, FGES) on normalized Class Structural Hamming Distance ($\text{nSHD}_c$) and class precision ($\text{prec}_c$). While continuous relaxation baselines (NOTEARS, GOLEM) still achieved lower overall error, DAG-DB proved that discrete backpropagation is a viable, competitive alternative.
  • Sachs Dataset:
  • Unconstrained I-MLE (IMLE_None) scored an $\text{SHD}_c$ of 12.7 (median 13), precision of 0.869, and recall of 0.255, placing it close to state-of-the-art continuous baselines (GOLEM at $\text{SHD}_c = 11$, precision $1.000$; NOTEARS at $\text{SHD}_c = 11$, precision $0.467$).
  • Combinatorial methods FGES and PC achieved $\text{SHD}_c = 11$ with lower precision ($0.750$).

Limitations and Future Work

  • Performance Gap with Continuous Methods: On purely linear synthetic data, continuous relaxation methods (especially GOLEM) still outperform DAG-DB in both accuracy and runtime.
  • Runtime Overhead: Discrete sampling and multiple forward/backward passes increase training times (e.g., ~12 minutes for a single 30-node ER2 graph for I-MLE vs. significantly faster runtimes for NOTEARS/GOLEM).
  • Future Directions: Extending DAG-DB beyond linear structural equation models to non-linear neural mechanisms, discrete/categorical observational data, interventional causal regimes (like SDI), and latent DAG Variational Autoencoders (VAEs).

Summary updated

BibTeX
@inproceedings{wren2022learning,
  author = {Andrew J. Wren and Pasquale Minervini and Luca Franceschi and Valentina Zantedeschi},
  title = {{Learning Discrete Directed Acyclic Graphs via Backpropagation}},
  booktitle = {CML4Impact @ NeurIPS},
  year = {2022},
  url = {https://openreview.net/forum?id=sSI7k-UAW7E},
}
Figure