How to Turn an Attention Neural Network into an Interpretable Hard-Logic Predicate Circuit: Truth-Table Predicate Extraction and State-Machine Merging under Ship-of-Theseus Replacement

Yuchen Li, Zongqi Fan, Xintong Li, Nguyen H. Tran, Ken-Tye YongarXiv 2026

TL;DR

Researchers have developed a method to transform complex attention-based neural networks into "hard-logic" circuits composed of simple Boolean gates (AND, OR, NOT). This conversion allows for microsecond-level inference on low-power hardware like FPGAs while making the model's internal decision-making process readable as a set of logical rules.

What Problem Does This Paper Address?

Modern neural networks, particularly Transformers, are "black boxes." Their intelligence is spread across millions of "soft" floating-point weights, making it nearly impossible to understand exactly why a model made a specific decision. Furthermore, running these models requires massive computational power, specialized GPUs, and high energy consumption, which limits their use in miniaturized or edge devices.

The authors address the challenge of interpretability and hardware efficiency. They ask: Can we replace a whole trained network with a circuit where every unit is a simple 0/1 predicate (a logical rule) that runs in its place without needing multipliers or floating-point arithmetic?

Methods

The authors introduce a framework to convert pretrained models (like BERT and DistilGPT2) into logic circuits using several novel techniques:

  • Reverse Ship-of-Theseus Replacement: Named after the philosophical thought experiment, this method replaces neural blocks one at a time, starting from the output layer and moving toward the input. After each block is "hardened" into logic, the remaining "soft" parts of the network are retrained to adapt to the new, frozen logical components.
  • Truth-Table Predicatisation: Every mapping between layers is converted into a minimized truth table. For wide feature transitions, they use noise-tolerant minimization to create implication rules.
  • Attention as Logic: They treat the attention mechanism—usually a complex product of activations—as a lookup table. By mapping queries and keys to short discrete codes, the "attention" becomes a simple logical selection process.
  • Imitating the Teacher Where It Is Right: The circuit is fitted only on training examples that the original "teacher" model classified correctly. This prevents the smaller, simpler circuit from wasting its limited capacity trying to learn the teacher's mistakes.
Figure 1. The method. (a) Blocks are hardened from the top down (reverse Ship of Theseus), and after each stage the soft blocks below re-adapt to the frozen circuit, so that every stage is a complete classifier. (b) In one block, tokens carry discrete states (1), and the heads of a query token select keys (2) by integer scores (order selection) or by a learned rule (rule selection). Predicates on the selected keys, merged when equal on all data (3), form a truth table on the rows that the data reach (4, grey: don’t care), and its minimised OR of ANDs (5) gives every token its next state (6). (c) The predicates of the readout token that hold add their integer votes. (d) The largest sum gives the class, which is traced through the rules for the tweet of Section 4.5 (DistilGPT2, order selection, emoji drawn as one token).

Datasets

The method was evaluated on the TweetEval-emotion benchmark, a four-class classification task (anger, joy, optimism, sadness). The authors used:

  • DistilGPT2: A 6-block decoder model.
  • BERT-base: A 12-block encoder model.

Key Insights and Ideas

  • Low-Dimensional Manifolds: The core reason this works is that trained networks don't actually use their full high-dimensional space; their internal representations occupy low-dimensional "manifolds." This allows a relatively small set of logical rules to capture the essential behavior of the network.
  • Logic is Faster than Math: By converting weights into fixed gates and wires, the model no longer needs to move weights from memory to a processor. The "model" is the hardware itself.
  • Human-Readable Rules: Instead of looking at a weight of 0.042, an auditor can read a rule like: “If the 'cry' token is selected by head 8 and the 'sadness' emoji is selected by head 10, then the state is 'sadness'.” This makes the model's logic auditable and transparent.

Key Results

The converted circuits achieved impressive speedups with a manageable loss in accuracy:

  • Speed: The circuits classify a tweet in 1–5 microseconds on an FPGA. This is 200 to 1,000 times faster than the original network running on a high-end GPU (RTX 5090) at batch size 1.
  • Power: The logic runs on palm-sized boards drawing only 7.5–15 Watts, compared to the hundreds of watts required by desktop GPUs.
  • Accuracy: There is a "logic tax" of roughly 8.5 to 8.6 percentage points in accuracy compared to the original FP8 teacher model. For example, the DistilGPT2 circuit reached 66.5% accuracy vs. the teacher's 74.7%.
  • Size: The circuits are significantly smaller. The BERT-base circuit is roughly 30 times smaller than its FP8 counterpart.
Table 1. Complete circuits, fitted on the training tweets that the teacher classifies correctly. Test gold accuracy, agreement with the teacher on test, and size. Circuits: mean ± s.d. over 3 seeds, sizes of seed 0. The bag of words is fitted on the same tweets with the teacher’s labels.
Table 3. Latency and power for one tweet. Circuits: order selection, seed 0, estimated (E) from synthesis and a stated performance and power model, latency of the logic as the mean over the test tweets at 250–450 MHz. Card and module power: typical / maximum, sourced (S) from the vendor; for the ZCU104, whose board power is not published, the dynamic power of the logic (E). GPUs: the teacher at batch 1, measured (M), mean latency, in eager PyTorch the better of FP16 and FP32 with board power over both, with CUDA graphs FP16 (best tweet in parentheses), board power without the host. Gold accuracy (seed 0): DistilGPT2 circuit 0.662, teacher 0.747; BERT circuit 0.694, teacher 0.780.

Limitations and Future Work

  • Accuracy Gap: While the speedup is massive, the ~8% drop in accuracy might be too high for some mission-critical applications.
  • Task Scope: The current study focuses on classification. The authors note that applying this to generative tasks (like full text generation in LLMs) is a subject for future work.
  • Manual Tokenization: Currently, tokenization is handled separately; the authors suggest that building the tokenizer directly into the logic circuit would further reduce system-wide latency.

Summary updated

BibTeX
@misc{li2026how,
  author = {Yuchen Li and Zongqi Fan and Xintong Li and Nguyen H. Tran and Ken-Tye Yong},
  title = {{How to Turn an Attention Neural Network into an Interpretable Hard-Logic Predicate Circuit: Truth-Table Predicate Extraction and State-Machine Merging under Ship-of-Theseus Replacement}},
  year = {2026},
  eprint = {2611.24381},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.24381},
}
Figure