Constrained Image Generation Using Binarized Neural Networks with Decision Procedures

Svyatoslav Korneev, Nina Narodytska, Luca Pulina, Armando Tacchella, Nikolaj S. Bjørner, Mooly SagivarXiv 2018 · arXiv

Introduction

In material science, designing porous media—such as the electrodes in lithium-ion batteries—requires a delicate balance between geometric structure and physical performance. Engineers must generate digital models that satisfy strict topological constraints (e.g., a specific number of isolated grains) and process constraints (e.g., a target dispersion coefficient for ion movement). While Generative Adversarial Networks (GANs) excel at visual realism, they often fail to respect hard declarative rules or physical laws. This paper proposes a novel framework that treats image generation as a formal logic problem, ensuring that every generated sample is guaranteed to meet specified constraints.

Methodology: BNNs as Logical Proxies

The core of the approach is the use of Binarized Neural Networks (BNNs) as proxies for complex physical simulations. Traditional Partial Differential Equation (PDE) solvers are computationally expensive and difficult to invert. By training a BNN to approximate these solvers, the authors can translate the network's behavior into a set of reified linear constraints. Because BNNs utilize binary weights and activations, they function essentially as complex logical circuits that formal solvers can reason about.

To handle geometric requirements, the authors encode rules like grain connectivity and compactness into the same logical framework. For instance, connectivity is enforced by treating the image grid as a graph and using Directed Acyclic Graph (DAG) constraints to ensure pixels belonging to a single "grain" are physically connected.

Encoding geometric constraints like connectivity and convexity into logical formulas on an image grid.

Solving for Valid Images

The combined logic—representing both the BNN's physical approximation and the geometric rules—is fed into off-the-shelf decision procedures, specifically CPLEX (an Integer Linear Programming solver) and Z3 (an SMT solver). Instead of "generating" an image in the traditional sense, the solver finds a "satisfying assignment" for the pixel values that makes the entire formula true. This allows for true inverse design: a user can request an image with a specific physical property interval, and the solver will find a valid pixel arrangement that satisfies it.

Key Results and Performance

The system was tested on datasets $D_2$ and $D_3$ (containing two and three grains, respectively). CPLEX generally outperformed Z3, solving most 16x16 image instances within 12–25 seconds. The generated images successfully reflected physical trends; for example, when high dispersion was requested, the solver produced images with smaller, less obstructive grains.

Examples of generated images satisfying various grain counts and physical property intervals across different datasets.

While the BNN proxy introduced a small margin of error compared to ground-truth PDE solvers (a Mean Absolute Error of approximately 10), the trade-off is a massive gain in speed and the absolute guarantee of geometric constraint satisfaction—something standard deep learning models cannot provide.

Limitations and Future Outlook

The primary challenge for this method is scalability. As image resolution increases beyond 16x16, the number of logical variables grows exponentially, leading to significant solver slowdowns. Future work will focus on developing specialized decision procedures for BNN-specific constraints and exploring more "solver-friendly" neural architectures to enable the generation of higher-resolution material models.

Summary updated

Abstract

We consider the problem of binary image generation with given properties. This problem arises in a number of practical applications, including generation of artificial porous medium for an electrode of lithium-ion batteries, for composed materials, etc. A generated image represents a porous medium and, as such, it is subject to two sets of constraints: topological constraints on the structure and process constraints on the physical process over this structure. To perform image generation we need to define a mapping from a porous medium to its physical process parameters. For a given geometry of a porous medium, this mapping can be done by solving a partial differential equation (PDE). However, embedding a PDE solver into the search procedure is computationally expensive. We use a binarized neural network to approximate a PDE solver. This allows us to encode the entire problem as a logical formula. Our main contribution is that, for the first time, we show that this problem can be tackled using decision procedures. Our experiments show that our model is able to produce random constrained images that satisfy both topological and process constraints.
BibTeX
@misc{korneev2018constrained,
  author = {Svyatoslav Korneev and Nina Narodytska and Luca Pulina and Armando Tacchella and Nikolaj S. Bjørner and Mooly Sagiv},
  title = {{Constrained Image Generation Using Binarized Neural Networks with Decision Procedures}},
  year = {2018},
  eprint = {1802.08795},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1802.08795},
}
Figure