Abstract
Differentiable logic gate networks (DLGNs) learn compact, interpretable Boolean circuits via gradient-based training, but existing variants are restricted to binary logic. Extending DLGNs to Ternary Kleene $K_3$ logic enables principled abstention under uncertainty via an UNKNOWN state. However, the search space for ternary gates explodes to 19,683 per neuron, making traditional softmax-over-gates training intractable. We introduce Polynomial Surrogate Training (PST), representing each ternary neuron as a degree-(2,2) polynomial with just 9 learnable coefficients—a 2,187× parameter reduction. Scaling experiments on CIFAR-10 demonstrate that ternary networks train 2–3× faster than binary counterparts and that the "hardening gap" between soft training and discrete inference vanishes with overparameterization. Furthermore, the UNKNOWN state acts as a Bayes-optimal uncertainty proxy, allowing ternary circuits to outperform binary ones through selective prediction.
Introduction: Beyond Binary Logic
Differentiable Logic Gate Networks (DLGNs) are a promising neuro-symbolic architecture that learns to compose discrete logic gates (e.g., AND, OR, XOR) using gradient descent. The result is a model that functions as a trainable hardware circuit, offering high interpretability and efficiency. However, binary logic is inherently rigid. In safety-critical domains like medical diagnosis or autonomous sensing, a model should ideally have the capacity to abstain from a decision when faced with high uncertainty.
Moving to ternary logic introduces a third state: UNKNOWN. While conceptually simple, the technical hurdle is the "curse of dimensionality." Binary DLGNs choose from 16 possible two-input gates. In ternary logic, this set grows to $3^{3^2} = 19,683$. Maintaining a probability distribution over nearly 20,000 gates per neuron is computationally impossible for standard training methods.
Polynomial Surrogate Training (PST)
To overcome this intractability, we propose Polynomial Surrogate Training (PST). Instead of a categorical search, each ternary neuron learns the coefficients of a low-degree polynomial that serves as a continuous surrogate for discrete logic.
As shown in the architecture overview, PST represents each neuron as a degree-(2, 2) polynomial $p(a,b)$ with 9 learnable coefficients. We prove that any ternary function can be uniquely represented by this polynomial. To ensure the "soft" polynomial eventually converges to a "hard" discrete gate, we employ a data-independent commitment loss. This forces the polynomial outputs toward the discrete set $\{-1, 0, 1\}$ as training progresses, effectively "hardening" the circuit for inference.
Scaling and Performance Results
We evaluated PST by scaling networks from 48K to 512K neurons on the CIFAR-10 dataset. A critical challenge in discrete networks is the "hardening gap"—the drop in accuracy when transitioning from continuous training to discrete circuit inference. Our results indicate that overparameterization is a natural remedy for this issue.
As detailed in the table above, the hardening gap for ternary networks (TLGN) shrinks significantly as model size increases, falling from 14.1 percentage points in the Medium model to just 3.7 in the Huge model. Notably, ternary networks achieve accuracy parity with binary baselines while training 2–3× faster. This efficiency stems from the polynomial parameterization, which avoids the overhead of large softmax distributions.
Uncertainty and Selective Prediction
Beyond efficiency, ternary logic provides a principled way to handle ambiguity. In synthetic tests (e.g., Moons, Spirals), the regions where the model outputs UNKNOWN align closely with high Bayes entropy. This allows for selective prediction: by filtering out low-confidence (UNKNOWN) outputs, ternary circuits can achieve significantly higher accuracy than binary models that are forced to guess on every sample. For instance, on the "Moons" dataset, the ternary circuit achieves 98.1% accuracy at 50% coverage, whereas the binary model remains at 91.8%.
Conclusion
PST establishes a general methodology for many-valued differentiable logic. By reducing the parameterization cost from super-exponential to quadratic ($q^2$ for $q$ logic states), PST opens the door to higher-valued logic systems. Future work will explore extending these architectures to recurrent circuits for runtime verification in safety-critical systems, where the UNKNOWN state can serve as a real-time indicator of insufficient data for safe operation.
Summary updated