TL;DR
Imagine trying to evolve a computer program using Darwinian selection: if you build programs out of trees, they quickly bloat to astronomical sizes, grinding your algorithm to a halt. This paper mathematically proves for the first time that switching from trees to directed acyclic graphs—via Cartesian Genetic Programming (CGP)—yields an exponential speedup on an established benchmark. By naturally reusing subprograms, CGP compresses exponentially large trees into compact linear chains and finds optimal programs in polylogarithmic time.
What Problem Does This Paper Address?
Genetic Programming (GP) automates code discovery by mutating and selecting candidate programs. Traditionally, GP represents programs as syntax trees (Tree-based GP, or TGP). While intuitive, trees have a glaring structural flaw: a computed value at a node can only be passed to a single parent. If a program needs the same intermediate result twice, TGP has to evolve two identical subtrees, leading to massive, bloated programs.
Cartesian Genetic Programming (CGP) fixes this by representing programs as directed acyclic graphs (DAGs) encoded as fixed-length vectors of integers. Because graph nodes can feed their outputs to multiple downstream nodes, CGP can effortlessly reuse subprograms.
Despite CGP's strong empirical track record over the last twenty years—spanning neural architecture search, cryptography, and logic synthesis—almost nothing was known about its rigorous mathematical runtime guarantees. How efficiently does CGP actually navigate its weird search space of bounded, mixed-type integers? And can we prove when and why graphs beat trees?
Methods
The authors apply mathematical runtime analysis (measuring the expected number of fitness evaluations to find an optimal solution) to the standard (1+1) CGP algorithm. In each step, a parent program is mutated to create one offspring, which replaces the parent if its output is at least as good.
They study two standard CGP mutation operators:
- Probabilistic mutation: Independently mutates each integer in the vector with probability $p$.
- Single Active Gene Mutation (SAM): Repeatedly mutates random genes until it hits an active node—one that actually connects to the final output.
Analyzing CGP's evolutionary trajectory is tricky because mutating the output pointer can suddenly deactivate previously built structures, leaving them vulnerable to random destruction. Instead of tracking fragile structural progress, the authors track fitness progress. They prove a novel "transfer lemma" (allowing upper-bound proofs on parameter-free SAM to carry over to probabilistic mutation) and use case-by-case mathematical induction to show that CGP consistently finds specific genome locations where a short sequence of mutations multiplies the program's output by a substantial factor.
Datasets
Rather than training on static datasets, theoretical GP evaluates algorithms on synthetic optimization benchmarks. Here, the authors analyze the classic $\text{MAX-depth-}D\text{-}\{\times, +\}\text{-}\{t\}$ problem:
- Goal: Evolve a valid program that produces the largest possible numerical output using only addition ($+$), multiplication ($\times$), a single input constant $t \ge 1$, and bounded depth $D$.
- Log-scaled variant: Because the optimal output grows doubly exponentially—reaching $\max\{2t, t^2\}^{2^{D-1}}$—standard floating-point numbers quickly overflow during empirical testing. To test CGP up to depth $D=30$, the authors introduce an isomorphic log-scaled benchmark ($\text{MAX-depth-}D\text{-}\{\log^\times, \log^+\}\text{-}\{\log t\}$) that preserves fitness rankings without numerical overflow.
Key Insights and Ideas
- Subprogram reuse unlocks exponential compression: To square a number $D$ times, TGP must build a complete binary tree of $n = 2^{D+1} - 1$ nodes. CGP just wires $D$ multiplication nodes in a sequential chain, feeding each node's output into both inputs of the next node. A tree of size $n$ collapses into a vector of length $\Theta(\log n)$.
- Navigating deceptive landscapes via inactive nodes: CGP's fitness landscape on MAX isn't smooth; some suboptimal programs require multiple simultaneous connection changes to improve. However, CGP exploits inactive nodes (disconnected from the output) to quietly wire up better sub-expressions in the background without hurting current fitness, then links them in for massive fitness jumps.
- First analysis of graph-encoding integer vectors: While most evolutionary theory focuses on simple bit-strings, this work pioneers techniques for bounded integer vectors mixing categorical variables (lookup table functions) and ordinal variables (node wiring).
Key Results
- Proven Exponential Speedup: On MAX, mutation-only (1+1) TGP requires $\mathcal{O}(n \log n)$ to $\mathcal{O}(n^2)$ expected iterations—which is exponential in depth $D$ since $n = 2^{D+1}-1$. The authors prove that (1+1) CGP solves the exact same problem in polylogarithmic time in $n$: at most $\mathcal{O}(D^9) = \mathcal{O}(\log^9 n)$ expected iterations for $t \in [1, 2)$, improving to $\mathcal{O}(D^8) = \mathcal{O}(\log^8 n)$ for $t \ge 2$.
- Empirical Speedup: In head-to-head runs for $D \le 10$, TGP's runtime explodes past tens of thousands of iterations, while CGP finishes almost instantaneously.
- Faster in Practice: On the log-scaled benchmark up to $D=30$, log-log regression shows CGP's empirical average runtime scales between $\Omega(D^3)$ and $\mathcal{O}(D^4)$, with parameter-free SAM outperforming probabilistic mutation.
Limitations and Future Work
The authors note that their theoretical upper bounds ($\mathcal{O}(D^8)$ and $\mathcal{O}(D^9)$) are not tight compared to the empirical $\mathcal{O}(D^3)$–$\mathcal{O}(D^4)$ scaling observed in experiments. While more than sufficient to prove the exponential gap between trees and graphs, the gap stems from worst-case assumptions in their multi-step case analysis. Streamlining this tedious case analysis and tightening the polynomial bounds remain promising avenues for future theoretical work on graph-based program synthesis.
Summary updated