NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Architect of the Bits World: Masked Autoregressive Modeling for Circuit Generation Guided by Truth Table

Haoyuan Wu, Haisheng Zheng, Shoubo Hu, Zhuolun He, Bei Yu · Submission to ICLR 2026 · Rejected

TL;DR

Synthesizing digital logic circuits directly from truth tables is notoriously difficult due to combinatorial explosion and local optima in search-based methods. This paper proposes a hybrid approach: CircuitAR, a masked autoregressive generative model that predicts preliminary circuit graphs from truth tables, which are then pruned and refined to exact functional correctness via Differentiable Architecture Search (DAS). This strategy reduces search space by over 78% and optimization steps by 45% while handling circuits an order of magnitude larger than prior generative baselines.

What Problem Does This Paper Address?

In electronic design automation (EDA), logic synthesis translates high-level functional specifications (often expressed as truth tables) into optimized, interconnected logic gates (like NAND gates) minimizing circuit area and delay. Traditional tools (e.g., ABC, Yosys) rely on hand-crafted heuristics that frequently get trapped in suboptimal designs.

Recent techniques have turned to Differentiable Architecture Search (DAS) (such as CircuitNN and T-Net), using gradient descent to search continuous relaxations of circuit topologies. However, DAS suffers from quadratic computational complexity ($O(N^2)$ in the number of gates), extreme sensitivity to architectural hyperparameters (network depth and layer width), and susceptibility to local minima. Meanwhile, prior pure generative models (like diffusion or autoregressive next-token generators) struggle to enforce strict logical equivalence and typically hit a hard ceiling on circuits with only 20–30 gates.

Methods

The authors introduce a two-phase generative-and-refinement framework:

Truth Table ──► CircuitAR ──► Valid DAG ──► Guided DAS ──► Exact Circuit
               (Masked AR)    (Cycle Removal) (CircuitNN)   (100% Match)
  1. CircuitVQ (Circuit Tokenizer):
  2. Encoder: A Graphormer-based autoencoder encodes circuit directed acyclic graphs (DAGs) into continuous latent vectors.
  3. Quantizer: Vector quantization projects node embeddings onto a discrete codebook of size 8,192 using $\ell_2$-normalized cosine similarity.
  4. Decoder: A Transformer decodes the quantized codes back into the circuit adjacency matrix via binary cross-entropy reconstruction loss.
  5. CircuitAR (Masked Autoregressive Modeling):
  6. Adapted from bidirectional Transformer architectures (Llama variants ranging from 300M to 2B parameters).
  7. Takes target truth tables as cross-attention context and learns to predict randomly masked node tokens using a cosine scheduling strategy.
  8. Employs parallel iterative decoding at test time, progressively unmasking the most confident tokens over $T$ steps.
  9. Graph Cleaning & DAG Search:
  10. Generative outputs can contain invalid cycles. A greedy DFS-based cycle removal algorithm systematically drops the lowest-probability edges to output a valid DAG.
  11. DAS Guided Refinement:
  12. The valid DAG and its edge probabilities define the initial layer widths, depth, and connection weights (logits) of a relaxed CircuitNN.
  13. DAS optimizes the network until the functional loss drops to $< 10^{-12}$, guaranteeing 100% Boolean equivalence to the truth table.

Datasets

  • Pre-training Data: Around 400,000 sub-circuits (averaging ~200 gates each) extracted from public benchmarks: ISCAS’85, IWLS’05, and EPFL Combinational Benchmarks. Sub-circuits were extracted using transitive fan-in/fan-out exploration, capped at $\le 15$ primary inputs/outputs (PI/PO) to avoid exponential truth-table explosion, and augmented with node shuffling and idle (dummy) NAND gates.
  • Evaluation Benchmarks:
  • Standard circuits from the IWLS 2022 programming contest, spanning five functional categories: random logic, basic functions (e.g., majority gates), Espresso benchmarks, arithmetic circuits, and LogicNets.
  • An extended evaluation suite of 100 diverse extracted sub-circuits.
  • A dedicated conditional benchmark of 1,000 circuits used to analyze model scaling via Bits Distance (BitsD) (the mean absolute error between an untrained initialized circuit and the truth table).

Key Insights and Ideas

  • Generative Priors Bridge the Search Gap: Rather than forcing a generative model to be 100% logically exact (which fails on discrete NP-hard tasks) or letting DAS search from scratch (which is prohibitively expensive), the generative model acts as a warm-start structural prior.
  • Model Scaling Laws in Circuit Space: CircuitAR demonstrates clear power-law scaling. Increasing model size from 300M to 2B parameters consistently reduces Bits Distance (from 0.5317 down to 0.4362).
  • Emergent Structural Efficiency: At the 2B scale, an emergent phase shift occurs: CircuitAR designs deeper circuits with fewer total NAND gates, showing a learned capability for topological optimization rather than naive shallow expansion.
  • Order-of-Magnitude Scale Leap: Prior generative circuit models (e.g., ShortCircuit, SeaDAG) capped out at ~20–30 nodes. By combining masked autoregression with DAS refinement, this framework scales directly to ~100-node circuits without sub-circuit decomposition.

Key Results

  • Search Acceleration: Guided DAS via CircuitAR-2B achieved a 45.37% average reduction in optimization steps compared to vanilla CircuitNN (outperforming T-Net’s 13.19% reduction) while ensuring 100% functional accuracy.
  • Search Space Reduction: CircuitAR compressed the required DAS search space by 78.56% compared to CircuitNN.
  • Gate Count & Physical Metrics:
  • Reduced final NAND gate usage by 9.54% on average compared to CircuitNN.
  • In standard 45-nm technology mapping (using ABC and NanGate-45nm), CircuitAR-2B yielded lower silicon area ($50.11\,\mu\text{m}^2$ vs. $59.45\,\mu\text{m}^2$) and reduced delay ($100.02\,\text{ps}$ vs. $104.67\,\text{ps}$) compared to T-Net.

Limitations and Future Work

  • Truth Table Scalability: Representing Boolean behavior via raw truth tables restricts circuits to $\le 15$ inputs/outputs before table size explodes exponentially ($2^{15}$ bits). Extending this approach to larger pin-counts will require alternative representations (e.g., symbolic formulas, AIGs, or partial simulation traces).
  • Circuit Size Limits: Although ~100 gates is a $10\times$ increase over previous generative approaches, real-world chip blocks comprise millions of gates; integrating automatic hierarchical circuit partitioning and stitching remains essential for production use.
  • Metric Correlation: Bits Distance serves well as an empirical proxy for DAS convergence speed, but does not yet exhibit a strictly linear correlation with post-mapping physical metrics (area and delay).

Summary updated

BibTeX
@misc{wu2025architect,
  author = {Haoyuan Wu and Haisheng Zheng and Shoubo Hu and Zhuolun He and Bei Yu},
  title = {{Architect of the Bits World: Masked Autoregressive Modeling for Circuit Generation Guided by Truth Table}},
  year = {2025},
  eprint = {2502.12751},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2502.12751},
}
Figure