Neural Combinatorial Logic Circuit Synthesis from Input-Output Examples

Peter Belcak, Roger WattenhoferarXiv 2022

Abstract: We propose a novel, fully explainable neural approach to synthesis of combinatorial logic circuits from input-output examples. The carrying advantage of our method is that it readily extends to inductive scenarios, where the set of examples is incomplete but still indicative of the desired behaviour. Our method can be employed for a virtually arbitrary choice of atoms - from logic gates to FPGA blocks - as long as they can be formulated in a differentiable fashion, and consistently yields good results for synthesis of practical circuits of increasing size. In particular, we succeed in learning a number of arithmetic, bitwise, and signal-routing operations, and even generalise towards the correct behaviour in inductive scenarios. Our method, attacking a discrete logical synthesis problem with an explainable neural approach, hints at a wider promise for synthesis and reasoning-related tasks.

Introduction

Logic circuit synthesis—the process of designing a circuit that satisfies a specific functional requirement—is a cornerstone of computer science. Traditionally, this is achieved by compiling high-level hardware description languages (like Verilog) into gate-level representations. However, there is a growing interest in programming by example, where a system induces the correct circuit logic simply by observing a list of inputs and their corresponding outputs.

The challenge in this domain is twofold. First, induction requires the system to "guess" the underlying logic (e.g., realizing a pattern is addition) even when the set of examples is incomplete. Second, explainability is paramount; while standard neural networks are often "black boxes," this research aims to bridge the gap between the flexibility of neural learning and the transparency of hardware design, allowing for the extraction of human-readable logic diagrams.

Methodology: Softmax-Choice Wiring

The researchers propose a neural-network-like layout composed of atomic units (the building blocks of the circuit). They experimented with three types of units: And-Inverter Gates (AIG), Look-Up Tables (LUT), and LUT-Adder Blocks (LAB), the latter providing an architectural bias toward arithmetic tasks.

Architecture of the neural circuit synthesis model showing softmax-choice wiring between layers.

The core innovation is the Softmax-Choice Wiring. Instead of hard-coding connections, every unit is allowed to "listen" to the outputs of all units in previous layers. During training, the system uses Softmax attention to decide which connection is most important, transforming a discrete combinatorial problem into a continuous optimization problem solvable by gradient descent.

To ensure the final result is a valid physical circuit, a Sharpening Softmax Loss is applied. This penalty forces connection weights toward binary values (0 or 1). Once the model converges, the connections with the highest weights are "read out" to produce a standard, discrete logic circuit.

Experimental Setup and Datasets

The method was evaluated on a suite of "Elementary Circuits" (EC) tasks, including bitwise operations (NOT, AND, XOR), arithmetic (addition, subtraction, multiplication), and signal control (multiplexers, decoders). These were tested at two widths: EC-2 (2-bit inputs) and EC-4 (4-bit inputs). To test inductive capabilities, the researchers created datasets where 5% or 10% of the possible input-output pairs were removed (denoted as EC-w-95 and EC-w-90).

Key Results

The method consistently yielded high accuracy across various circuit types and demonstrated significant robustness to missing data.

Performance metrics across different unit types and data completeness levels.
  • Performance: 4-bit LUTs achieved the highest scores, reaching a signal accuracy of 0.969 on 2-bit tasks and 0.967 on 4-bit tasks.
  • Induction Success: Even when 10% of the data was missing (EC-4-90), the LUT and LAB models maintained high accuracy, proving they were learning the underlying logic rather than merely memorizing the truth table.
  • Explainability: The sharpening loss successfully allowed for the extraction of discrete, functional logic circuits from the trained neural weights.

Conclusion and Future Work

While the results are promising, several hurdles remain for scaling this approach to real-world hardware. The current "all-to-all" softmax wiring may become computationally overwhelmed as the number of bits increases. Future research will likely focus on heterogeneous networks—mixing different types of units—and navigating the more complex optimization landscapes inherent in larger circuit designs.

Summary updated

BibTeX
@misc{belcak2022neural,
  author = {Peter Belcak and Roger Wattenhofer},
  title = {{Neural Combinatorial Logic Circuit Synthesis from Input-Output Examples}},
  year = {2022},
  eprint = {2210.16606},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2210.16606},
}
Figure