Chip designers who send their layouts to untrusted overseas factories cannot easily check what comes back. A factory might add a hardware Trojan: a small block of malicious logic, often under 0.2% of the gates, that stays quiet during testing. The best current checks are graph neural networks, meaning classifiers that read the circuit as a graph of gates and wires. These checks look at the circuit once, return a score, and need a hand-tuned threshold. An attacker can also fool them by adding logic that changes nothing functionally.
We propose to treat auditing as a running bet. The auditor repeatedly looks at the same netlist (the gate-level wiring list) through a freshly randomized "view": a random subgraph sample, a random logic-resynthesis script, or random feature masking. Each view is scored against clean reference circuits processed the same way. The auditor multiplies up evidence that the netlist looks abnormal, as a gambler compounds winnings. Under the hypothesis that the circuit is clean, this running product is a test martingale: a sequence whose expected next value never exceeds its current value. A classical inequality then caps the chance that it ever crosses $1/\alpha$ at $\alpha$, no matter when the auditor stops. The idea has two parts. Randomized views deny the attacker a fixed input to optimize against. The martingale turns many weak, noisy looks into a stopping rule with an explicit false-alarm bound and no threshold tuning. A central part of the project is measuring whether that bound actually holds on real benchmark circuits, since its assumptions are only approximately met.
Core Claim
Consider a hardware Trojan detector that only sees fixed inputs. It can be beaten by a netlist built for that input: PoisonedGNN inserts toggle-coverage-compliant inverter/XOR cascades and reaches up to 100% attack success rate against GNN-based IP-piracy and Trojan classifiers. Our claim is that the same detector becomes much harder to evade when it is queried on many independently randomized views of the netlist. The evidence should be combined by betting (multiplying per-view evidence scores), not by averaging beliefs.
The contrast with averaging comes from the belief-dynamics literature. Debate or Vote proves that multi-agent debate without an external anchor is a zero-drift martingale, so exchanging opinions does not move the group toward the truth. It reports that on Qwen2.5-7B, majority voting (0.7691 average accuracy) beats two-round decentralized debate (0.7377). We take the constructive side of that result. Drift toward the truth has to come from evidence that is informative under the alternative, and a betting martingale is the construction whose growth rate is exactly that expected information. The second part of the claim is empirical rather than mathematical: whether the false-alarm cap and the time-to-detection behave as theory predicts on TrustHub circuits.
Research Program
Randomized views. A view is a random transformation that preserves circuit function, followed by a detector. We draw from three families. The first is GraphSAINT-style subgraph samples, reusing the sampler of TrojanSAINT. The second is random logic-resynthesis scripts, which restructure gates without changing what the circuit computes. The third is random masking of node features. The detector is TrojanSAINT's node-level GNN, trained once. For each view, we score the test netlist and also a held-out set of clean netlists passed through the same view. This turns the score into a conformal p-value $p_t$: the rank of the test score among the clean scores. We then convert $p_t$ to an evidence value $e_t$ that has expectation at most 1 under the clean hypothesis. The audit statistic is
$$K_t = \prod_{i=1}^{t} \big(1 + \lambda_i (e_i - 1)\big),$$
where $\lambda_i \in [0,1]$ is a betting fraction chosen using only views $1,\dots,i-1$. The audit flags the netlist when $K_t \ge 1/\alpha$, with $\alpha$ the target false-alarm rate. Ville's inequality (the maximal inequality for nonnegative supermartingales) gives $P(\sup_t K_t \ge 1/\alpha) \le \alpha$ whenever each $e_i$ is conditionally valid given the past.
Where the theory is fragile. Conditional validity is the weak point, and we test it rather than assume it. All views share the same test netlist, so the $e_i$ are dependent. Fresh calibration circuits for each view do not make them exactly conditionally valid. We therefore run two statistics side by side. The first is the betting product above, which is powerful but only approximately valid. The second is the average of the $e_i$, which is an exact e-value under arbitrary dependence but grows slowly. Measuring the gap between the product's nominal and realized false-alarm rates on real circuits is the concrete empirical-validation contribution. It parallels how Trust Models and Con-Man Agents found that trust-update proofs failed under unmodeled adversary behavior, and how Social Learning under Randomized Collaborations checked its martingale rates only on a synthetic 10-node network.
Localization. We run one martingale per circuit region (the neighbourhood of each candidate gate) and control the number of false region flags with an e-value analogue of false-discovery-rate control. This gives Trojan localization that can be compared directly with TrojanSAINT's node labels.
Adaptive attacker. We reimplement PoisonedGNN's trigger insertion. We then add an attacker who knows the view distribution and optimizes expected evasion across it. This follows the logic-locking benchmarking lesson in Benchmarking at the Frontier of Hardware Security that defenses need a red team rather than best-effort attacks.
This work differs from the closest hardware work, HaTCh, which appears near sequential-probability-ratio testing on hardware. HaTCh's sequential evidence comes from functional observation. Ours is structural and learned, randomized over views, and aimed at poisoning robustness. It also differs from Verifiable ASICs, which gives exact proofs but only for wide, shallow arithmetic circuits. We give statistical guarantees for arbitrary control logic.
Baselines
Naive reference. Ship the netlist after standard functional tests and coverage checks. PoisonedGNN shows its triggers keep 100% toggle and statement coverage, so this reference should detect nothing adversarial. We report it only to anchor the scale.
Strongest existing detector. This is TrojanSAINT run once on the original netlist, with its threshold tuned on the same calibration circuits we give our method. It reports 78% TPR and 85% TNR on average in practical validation, and 98% TPR and 96% TNR in leave-one-out, on 17 TrustHub benchmarks (TrojanSAINT). We give it the same trained weights, the same training and calibration split, and the same total inference compute as our audit's median stopping time. Beating it means two things. On clean inputs we must match its TPR at our nominal false-alarm rate. Under PoisonedGNN-style poisoning, where static GNN classifiers are driven to misclassify all Trojan-infected test samples (20% trigger size, 25% poisoning intensity on GNN4TJ), we must keep TPR substantially above its collapsed level.
Resynthesize-then-detect. Canonicalize the netlist with one fixed logic-optimization pass, which should strip functionally neutral cascades, then run TrojanSAINT once. This is the most dangerous simple competitor, and no reported result on Lacuna was found for it. It gets identical compute. Beating it requires an advantage against the adaptive attacker who builds triggers that survive that one fixed pass.
Fixed-sample aggregation. Draw the same number of random views up front and combine their p-values by Bonferroni correction, and separately by majority vote over per-view decisions. This tests whether the sequential betting adds anything beyond randomization.
Ablations. Two ablations isolate the two ingredients. The same-view ablation repeats one fixed view, so any gain must come from randomization. The belief-averaging ablation replaces the product with iterative averaging of per-view posterior beliefs, the zero-drift analogue of debate.
Why not just…?
Why not just resynthesize the netlist and rerun the existing detector? This is a genuine threat. Functionally neutral inverter pairs are exactly what logic optimization deletes, so against the published PoisonedGNN trigger, resynthesize-then-detect may match us. Our bet is that a fixed canonicalization becomes a new fixed target: an attacker who knows the script can place triggers that survive it. A random draw from many scripts is harder to anticipate. The adaptive-attacker experiment settles this. If a single canonicalization matches randomized views even against that attacker, the contribution shrinks to the calibration and stopping rule, and we would say so.
Why not just draw many views and use a fixed-sample test? At a fixed budget, a fixed-sample test may be about as powerful. The martingale's advantage is stopping early on obvious cases and continuing on hard ones, with the same guarantee. We report views-to-decision curves. If the fixed-sample test at the martingale's median budget matches its power, the sequential part is only a cost saving, not an accuracy gain.
Why not just ensemble several detectors and take a majority vote? Majority voting helps when errors are independent, as in the LLM setting of Debate or Vote. A foundry attack is systematic, though, and detectors trained on similar netlist distributions will likely fail together. The majority-vote baseline over randomized views measures this directly. We also report the correlation of per-view errors on poisoned circuits.
Why not just harden the GNN with randomized smoothing or adversarial training? PoisonedGNN reports that randomized smoothing hurts clean accuracy while leaving attack success high. Our views differ from smoothing in two ways: they are function-preserving circuit transformations rather than generic graph noise, and they are combined with a calibrated stopping rule. Smoothing is included as an extra row at matched compute.
Proposed Experiments
We use the 17 TrustHub gate-level benchmarks from TrojanSAINT for detection and localization, and the GNN4TJ AES/PIC/RS232 designs for poisoning. Clean calibration circuits come from Trojan-free TrustHub and GNN4TJ variants, held out by base design.
The first decisive check is validity. Across held-out clean netlists and $\alpha \in \{0.01, 0.05, 0.1\}$, we measure how often the betting product ever crosses $1/\alpha$. We compare that to $\alpha$, and to the exact-but-weaker averaged statistic, including under leave-one-design-out shift, where calibration most likely breaks.
The second check is power and cost. For each method we report TPR at matched false-alarm rate, node-level localization TPR and TNR, and views-to-decision.
The third check is robustness. Here we sweep PoisonedGNN trigger size and poisoning intensity, then the adaptive attacker, and compare every baseline.
The fourth check is the ablations. The same-view martingale should gain little over the one-shot detector, and belief averaging should show no drift toward the truth. If both hold while the full method stays robust, randomization plus betting is the working ingredient. If validity fails badly under design shift, that failure is itself the finding: a documented case where a martingale guarantee does not transfer to real netlists, with the averaged e-value as the honest fallback.
References
- $\tt{PoisonedGNN}$: Backdoor Attack on Graph Neural Networks-Based Hardware Security Systems
- Debate or Vote: Which Yields Better Decisions in Multi-Agent Large Language Models?
- TrojanSAINT: Gate-Level Netlist Sampling-Based Inductive Learning for Hardware Trojan Detection
- Trust Models and Con-Man Agents: From Mathematical to Empirical Analysis
- Social Learning under Randomized Collaborations
- Benchmarking at the Frontier of Hardware Security: Lessons from Logic Locking
- HaTCh: Hardware Trojan Catcher
- Verifiable ASICs