CircuitBuilder: From Polynomials to Circuits via Reinforcement Learning

Weikun Zhang, Rohan Pandey, Bhaumik Mehta, Kaijie Jin, Naomi Morato, Archit Ganapule, Michael Ruofan Zeng, Jarod Alper

TL;DR

This paper tackles the challenging problem of automatically discovering efficient arithmetic circuits for computing polynomials, framing it as a reinforcement learning task. The authors compare two RL approaches, PPO+MCTS and SAC, finding that SAC excels on simpler problems while PPO+MCTS shows better scalability to more complex scenarios, suggesting this is a promising domain for studying self-improving AI.

What Problem Does This Paper Address?

The paper addresses the "arithmetic circuit problem," which is about finding the most efficient sequence of addition and multiplication gates to compute a given polynomial. This problem is deeply connected to fundamental questions in theoretical computer science, specifically the VP vs. VNP conjecture, which is the algebraic analogue of the P vs. NP problem. Finding minimal circuits is also seen as a stepping stone towards automating mathematical proof generation. The core challenge lies in the enormous search space of possible circuits; even for a modest number of operations, the number of potential circuits explodes combinatorially, making exhaustive search infeasible. Historically, efficient circuit constructions have relied on human ingenuity (e.g., Horner's method for univariate polynomials). This work explores whether reinforcement learning agents can autonomously discover such efficient structures.

Methods

The authors frame the arithmetic circuit problem as a single-player Markov Decision Process (MDP). An RL agent starts with basic inputs (variables and constants) and learns to select operations (addition or multiplication) to build a circuit that computes a target polynomial. They compare two distinct RL approaches:

  • CircuitBuilder (PPO+MCTS): This approach combines Proximal Policy Optimization (PPO) with Monte Carlo Tree Search (MCTS). PPO is used for stable policy updates, while MCTS helps guide exploration in the vast search space by building a search tree and evaluating potential moves. The neural network provides both a policy (action probabilities) and a value estimate (predicted outcome).
  • Soft Actor-Critic (SAC): This is an off-policy actor-critic method designed to handle sparse rewards, which are common in tasks like circuit discovery. SAC incorporates an entropy bonus to encourage exploration and uses twin Q-networks to mitigate overestimation bias.

Both methods utilize a GNN encoder to process the circuit's graph structure and a Transformer decoder to output policy logits and value estimates. They also employ a curriculum learning strategy, starting with simpler polynomials and gradually increasing complexity as the agent's success rate improves.

Datasets

The paper doesn't introduce new datasets in the traditional sense. Instead, they generate "game-boards" which are directed acyclic graphs (DAGs) enumerating all reachable polynomials within a certain complexity (number of gates) and number of variables. These game-boards serve as the environment for training and evaluation. They specifically generate boards for:

  • C4-main: Two-variable polynomials.
  • C4-pretrain: Single-variable polynomials.

These boards are designed such that many nodes (polynomials) have multiple optimal circuits, forcing the agent to learn meaningful decision-making rather than memorizing a single path.

Key Insights and Ideas

  • RL as a powerful tool for symbolic discovery: The paper demonstrates that RL agents can learn to construct non-trivial arithmetic circuits, suggesting its potential for automating complex symbolic reasoning tasks beyond just games.
  • PPO+MCTS vs. SAC trade-offs: SAC shows superior performance on simpler, two-variable problems, indicating its effectiveness in leveraging learned experience. However, PPO+MCTS, with its explicit planning component via MCTS, scales more gracefully to three variables, highlighting the importance of search strategies for higher-dimensional problems.
  • The challenge of scaling: The significant performance drop when moving from two to three variables underscores the exponential growth of the search space and the difficulty of finding optimal circuits as complexity increases.
  • Curriculum learning is crucial: The use of curriculum learning, starting with simpler problems and gradually increasing difficulty, is essential for enabling the agents to learn effectively in this sparse reward environment.

Key Results

  • Two-variable targets (n=2): PPO+MCTS achieved around 35% success rate on complexity 5 and 6 targets by iteration 200. SAC performed better, reaching ~57.8% success on complexity 5 and ~46.3% on complexity 6.
  • Three-variable targets (n=3): Performance dropped significantly for both methods. PPO+MCTS showed steady improvement to ~27.3% success on complexity 5, but struggled with complexity 6, indicating training instability. SAC achieved only ~10.7% success on complexity 5 and ~9.4% on complexity 6, with negative average rewards.
  • Policy Sharpening: For PPO+MCTS on two variables, the policy entropy decreased over training, indicating policy sharpening without collapse. For SAC, the entropy also decreased, suggesting more concentrated exploration.

Limitations and Future Work

  • Scalability to higher dimensions: The primary limitation is the difficulty in scaling to more variables and higher complexities. The authors acknowledge that future improvements must focus on better exploration, stronger representations, and more efficient training strategies for higher-dimensional polynomial spaces.
  • Exploration strategies: Investigating stronger exploration strategies for harder instances and incorporating curriculum learning across multiple complexity levels are suggested.
  • Representation learning: Improving polynomial and circuit representations is seen as key to enabling agents to generalize more effectively as the search space grows.
  • Current scope: The experiments are limited to relatively small circuits (up to six gates) and three variables. The authors emphasize that this stage is about understanding learning dynamics on small problems before scaling up.
  • Future directions: The paper suggests extending training to higher complexity targets (C ≥ 7) and exploring richer polynomial families.

Summary updated

BibTeX
@inproceedings{zhang2026circuitbuilder,
  author = {Weikun Zhang and Rohan Pandey and Bhaumik Mehta and Kaijie Jin and Naomi Morato and Archit Ganapule and Michael Ruofan Zeng and Jarod Alper},
  title = {{CircuitBuilder: From Polynomials to Circuits via Reinforcement Learning}},
  booktitle = {RSI @ ICLR},
  year = {2026},
  url = {https://openreview.net/forum?id=JNsTWIukjQ},
}
Figure