Learning Neurosymbolic Generative Models via Program Synthesis

Halley Young, Osbert Bastani, Mayur Naik

Introduction

Standard deep generative models, such as Generative Adversarial Networks (GANs) and Variational Autoencoders (VAEs), have demonstrated remarkable success in capturing local textures and styles. However, they frequently struggle with "global structure"—the rigid, repeating patterns and long-range dependencies characteristic of man-made environments, such as the grid of windows on a skyscraper. These models often suffer from "counting" and "alignment" errors, where structural elements are haphazardly placed or vary inconsistently in size.

To address this, we introduce PS-GM (Program-Synthesis Guided Generative Models), a neurosymbolic approach. PS-GM bridges the gap between the perceptual strengths of deep learning and the structural precision of program synthesis. By generating a symbolic "skeleton" through code and using deep learning to fill in the perceptual details, the model achieves significantly more coherent image generation and completion.

Methodology

PS-GM decomposes the image generation process into two distinct components: a symbolic Sketch ($s$) and perceptual Components ($c$).

The Neurosymbolic Bridge

The "Sketch" is a symbolic program—specifically nested for-loops—that defines the skeletal structure of the image. This program acts as a mathematical prior, ensuring that repeating elements are perfectly aligned and spaced. The "Components" are the raw sub-images (e.g., a single window) that fill the "holes" defined by the sketch.

Figure 1: The PS-GM framework uses nested for-loops to define the spatial structure (sketch) of an image, which is then populated with perceptual components.

Generation and Completion Pipelines

  • Generation: The model samples a latent vector to produce a program $P$. This program is executed to create a low-fidelity "structure rendering." A deep model, such as a Variational Encoder-Decoder (VED) or CycleGAN, then translates this rendering into a high-resolution, realistic image.
  • Completion: When faced with a partial image, the system synthesizes a program describing the visible portion. It then extrapolates this program to cover missing areas, allowing the deep model to fill in pixels based on a consistent, mathematically derived structure rather than local "hallucination."

Datasets and Evaluation

The model was evaluated on two primary benchmarks:

  1. Synthetic MNIST-Grid: A 9x9 grid of colored MNIST digits designed to test the model's ability to learn both rigid structure and statistical correlations (e.g., specific digits paired with specific colors).
  2. Building Facades: A real-world dataset of 1,855 images of building fronts. This dataset is a classic benchmark for testing structural patterns like windows, doors, and balconies.

Key Results

PS-GM significantly outperformed state-of-the-art baselines in both quantitative and qualitative metrics. On the synthetic MNIST-Grid dataset, PS-GM achieved a Frechet Inception Distance (FID) of 85.51, a massive improvement over the 258.68 achieved by the SpatialGAN baseline.

Figure 5: An example of the structured, high-fidelity output targeted by PS-GM in the Building Facades dataset.

Qualitatively, PS-GM excels in image completion tasks. While standard models often produce blurry or misaligned patches when filling large gaps, PS-GM produces sharp, perfectly aligned repeating patterns that maintain the original architecture's global consistency. Furthermore, the model proved highly data-efficient; because the structural "rules" are baked into the program grammar, it does not require massive datasets to learn the concept of a grid.

Conclusion and Future Work

By integrating program synthesis into the generative pipeline, PS-GM provides a robust solution to the structural failures of pure neural models. While current limitations include the need for domain-specific grammars and the use of greedy synthesis heuristics, the success of this neurosymbolic approach points toward a future where generative models can reliably handle both the messy complexity of pixels and the rigid logic of symbolic structure.

Summary updated

BibTeX
@inproceedings{young2019learning,
  author = {Halley Young and Osbert Bastani and Mayur Naik},
  title = {{Learning Neurosymbolic Generative Models via Program Synthesis}},
  booktitle = {International Conference on Machine Learning},
  year = {2019},
}
Figure