Logic Synthesis Meets Machine Learning: Trading Exactness for Generalization

Shubham Rai, Walter Lau Neto, Yukio Miyasaka, Xinpei Zhang, Mingfei Yu, Qingyang Yi, Masahiro Fujita, Guilherme B. Manske, Matheus F. Pontes, Leomar S. da Rosa, Marilton S. de Aguiar, Paulo F. Butzen, Po-Chun Chien, Yu-Shan Huang, Hoa-Ren Wang, Jie-Hong R. Jiang, Jiaqi Gu, Zheng Zhao, Zixuan Jiang, David Z. Pan, Brunno A. Abreu, Isac de Souza Campos, Augusto Andre Souza Berndt, Cristina Meinhardt, Jonata T. Carvalho, Mateus Grellert, Sergio Bampi, Aditya Lohana, Akash Kumar, Wei Zeng, Azadeh Davoodi, Rasit Onur Topaloglu, Yuan Zhou, Jordan Dotzel, Yichi Zhang, Hanyu Wang, Zhiru Zhang, Valerio Tenace, Pierre-Emmanuel Gaillardon, Alan Mishchenko, Satrajit Chatterjee · DOI

Abstract

This paper explores the intersection of hardware logic synthesis and supervised machine learning. By reframing logic synthesis as a learning problem that prioritizes generalization over absolute exactness, researchers demonstrate that circuit size can be reduced by approximately 50% with only a marginal 2% loss in accuracy. The study analyzes various approaches from the IWLS 2020 Programming Contest, highlighting the trade-offs between hardware complexity and predictive performance.

Introduction

In traditional electronic design automation (EDA), logic synthesis is the rigorous process of transforming a mathematical Boolean function into a physical circuit of logic gates. Conventionally, this process is "exact," requiring the circuit to perfectly match the function's output for every possible input within a defined "care set."

However, as modern integrated circuits face increasing constraints on power and area, interest in approximate computing has surged. This research investigates treating logic synthesis as a machine learning (ML) problem: instead of constructing a circuit that is 100% correct on a training set, can we build a significantly smaller circuit that generalizes well to unseen data? The primary challenge is that Boolean functions are discrete and non-smooth—where a single bit flip can drastically alter the output—making them difficult for standard ML models to learn compared to continuous data like images or audio.

Methods and Approaches

The paper evaluates the methodologies of ten teams participating in the IWLS 2020 Programming Contest. The objective was to synthesize an And-Inverter Graph (AIG) with fewer than 5,000 nodes that maximizes accuracy on a hidden test set.

Summary of techniques used by the ten participating teams.

Key techniques employed by the teams included:

  • Decision Trees (DT) and Random Forests (RF): These were the most popular baselines. Their structure maps naturally to hardware multiplexers and logic gates.
  • Neural Networks (NN): Some teams trained NNs and "distilled" them into logic by pruning connections and converting neurons into Look-Up Tables (LUTs).
  • Cartesian Genetic Programming (CGP): An evolutionary approach where circuits are iteratively optimized for both size and accuracy.
  • Function Matching: Several teams identified patterns in training data (e.g., adders or comparators) and instantiated known-good hardware structures directly.
  • Feature Engineering: Techniques like SHAP (SHapley Additive exPlanations) were used to identify critical input bits and prune the search space.

Benchmark Datasets

The authors introduced a benchmark suite of 100 functions across three domains:

  1. Arithmetic: Adders, dividers, multipliers, comparators, and square-rooters of varying bit-widths (up to 256-bit).
  2. Random Logic: Logic "cones" extracted from real-world designs like the PicoJava processor and MCNC benchmarks.
  3. Machine Learning: Binary classification problems derived from MNIST and CIFAR-10 datasets.

Each benchmark provided 6,400 training examples and 6,400 validation examples.

Key Insights: The Pareto Frontier of Logic

A central finding of the study is the quantifiable trade-off between circuit size and exactness. The data revealed a clear Pareto frontier where substantial area savings could be achieved with minimal accuracy loss.

The Pareto frontier illustrating the trade-off between circuit size and test accuracy.
  • The "XOR" Wall: Standard ML models struggle with parity (XOR) functions because they lack "locality" (changing one bit always flips the output). Traditional models fail to generalize here unless specifically designed for XOR patterns.
  • Portfolios Win: No single algorithm was universally superior. Winning teams utilized "portfolios," running multiple algorithms and selecting the best performer for each specific benchmark.
  • Structural Memorization: Some teams found that "memorizing" the training set into a LUT network could lead to decent generalization, suggesting that memorization is not always detrimental in the discrete Boolean domain.

Key Results

  • Top Performance: Team 1 secured the win with an average test accuracy of 88.69%.
  • Extreme Compression: Team 10 achieved 80.25% accuracy using an average of only 140 nodes per circuit, demonstrating remarkable efficiency.
  • Generalization Gap: Most teams maintained a small gap (1-2%) between validation and test accuracy, proving that ML-based synthesis can effectively generalize to unseen Boolean inputs.
  • Arithmetic Difficulty: While adders were relatively simple to learn, deep multipliers and square-rooters remained significant challenges under the node constraints.

Limitations and Future Directions

While promising, several hurdles remain for ML-based logic synthesis. Current benchmarks are relatively small; future work must determine if these techniques scale to functions with thousands of inputs and outputs. Additionally, real-world synthesis involves multi-output circuits with shared logic, a significantly more complex optimization problem. Finally, future metrics should incorporate power consumption and delay alongside area to better reflect practical hardware constraints.

Summary updated

BibTeX
@inproceedings{rai2020logic,
  author = {Shubham Rai and Walter Lau Neto and Yukio Miyasaka and Xinpei Zhang and Mingfei Yu and Qingyang Yi and Masahiro Fujita and Guilherme B. Manske and Matheus F. Pontes and Leomar S. da Rosa and Marilton S. de Aguiar and Paulo F. Butzen and Po-Chun Chien and Yu-Shan Huang and Hoa-Ren Wang and Jie-Hong R. Jiang and Jiaqi Gu and Zheng Zhao and Zixuan Jiang and David Z. Pan and Brunno A. Abreu and Isac de Souza Campos and Augusto Andre Souza Berndt and Cristina Meinhardt and Jonata T. Carvalho and Mateus Grellert and Sergio Bampi and Aditya Lohana and Akash Kumar and Wei Zeng and Azadeh Davoodi and Rasit Onur Topaloglu and Yuan Zhou and Jordan Dotzel and Yichi Zhang and Hanyu Wang and Zhiru Zhang and Valerio Tenace and Pierre-Emmanuel Gaillardon and Alan Mishchenko and Satrajit Chatterjee},
  title = {{Logic Synthesis Meets Machine Learning: Trading Exactness for Generalization}},
  booktitle = {DATE},
  year = {2020},
  doi = {10.23919/date51398.2021.9473972},
}
Figure