Manuscript Offprint
arXiv:2609.10149Sound Debloating of Redundant Checks in Zero-Knowledge Machine-Learning Circuits
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.
Zhantong Xue
Hong Kong University of Science and Technology
Hong Kong, China
Pingchuan Ma
Zhejiang University of Technology
Hangzhou, China
Yuguang Zhou
Hong Kong University of Science and Technology
Hong Kong, China
Zhaoyu Wang
Hong Kong University of Science and Technology
Hong Kong, China
Huaijin Wang
Shandong University
Jinan, China
Shuai Wang
Hong Kong University of Science and Technology
Hong Kong, China
Abstract
Zero-knowledge (ZK) proof systems for neural-network inference compile the model into a system of arithmetic constraints. Many of these constraints are redundant checks: range proofs, sign lookups, and bit decompositions who are globally entailed by the rest of the circuit through chains of reasoning that span distant gadgets. Removing them shrinks the circuit and accelerates proving, but the removal must be carefully justified: an unsoundly debloated circuit becomes forgeable, accepting witnesses the original would have rejected and so allowing a prover to claim, for example, that a neural network produced an output it never actually computed. Such soundness vulnerabilities are not hypothetical: under-constrained circuits in deployed ZK systems have enabled attackers to forge transactions and bypass verification entirely.
We present an automated framework that removes redundant checks while provably preserving soundness. For each candidate removal, our tool first checks whether the rest of the circuit, on its own, can still rule out every value the removed check was excluding. Using whole-circuit abstract interpretation, the analysis searches for such alternative justifications and records them in a provenance graph; a check is then removed only when an alternative path through the graph still derives the facts that it is checking. This ensures that the debloated circuit opens no new forging strategy to an adversary. We evaluate circuits spanning MLP, CNN, RNN, and transformer architectures generated by two production frameworks (ezkl and zkml), with up to 25.3 million constraints. Our tool removes up to 48.7% of constraints and reduces prover time by up to 72.8%, without weakening security.
CCS Concepts
• Security and privacy → Cryptography; • Theory of computation → Program analysis.
1 Introduction
Zero-knowledge (ZK) proof systems [27] let a prover convince a verifier that a computation was performed correctly without revealing its inputs. The computation is encoded as a constraint system , a quantifier-free conjunction of polynomial equations over a finite field; the prover's secret witness is a satisfying assignment, . A fast-growing application is zero-knowledge machine learning: a framework compiles inference of a trained network into such a constraint system, so that a witness satisfies exactly when it encodes a correct inference. A proof of knowledge of such a witness therefore certifies the inference while revealing neither the input nor the model weights [52], enabling on-chain AI verification and privacy-preserving model serving.
Prover cost scales with the number of constraints. Even small models compile to circuits with tens to hundreds of thousands of constraints, and proving a single inference can take minutes to hours [32, 61]. Recent benchmarks report proving overhead of 10,000× or more over plain inference, with hundreds of gigabytes of RAM consumed for moderate-sized models [46]. Shrinking the constraint system is thus a natural target for reducing this cost.
A major cause of this overhead, accounting for up to 48.7% of constraints in our evaluation ($6), is the large number and diversity of well-formedness checks that ZK machine learning (ML) frameworks emit on intermediate variables, including range checks on activation outputs, sign lookups for value decompositions, remainder bounds in integer division gadgets, and bit-decomposition validity proofs [12, 61]. Like assertions in program verification, checks compute no value; they only restrict the admissible assignments, guarding against a malicious prover supplying an out-of-range witness. A gadget is a reusable subcircuit implementing a single operation, such as an activation or division. Yet composition makes many of these checks redundant: each gadget is compiled as a self-contained template carrying every check needed for any input it might receive in isolation. When the framework wires gadgets together, an
This is the authors' version for ACM CCS 2026, with additional appendices. Conference version: Zhantong Xue, Pingchuan Ma, Zhaoyu Wang, Yuguang Zhou, Huaijin Wang, and Shuai Wang. 2026. Sound Debloating of Redundant Checks in Zero-Knowledge Machine-Learning Circuits. In Proceedings of the 2026 ACM SIGSAC Conference on Computer and Communications Security (CCS'26), November 15–19, 2026, The Hague, Netherlands. ACM. Forthcoming. Assigned DOI: https://doi.org/10.1145/3830454.3846774. © 2026 the authors. This manuscript is licensed under CC BY 4.0. Corresponding author.

Figure 1: Threat model: unsound debloating enables a forged proof being accepted by the verifier.
upstream check often constrains a shared variable to a range that already implies a downstream check on the same variable.
For example, the constraint emitted by a ReLU gadget bounds its output to , while the constraint from the next layer's range check independently bounds the same to with ; the upstream constraint still asserts a valid bound, but that bound is already implied by the tighter downstream one. Such compositional redundancies pervade ML circuits because the same gadget templates are instantiated hundreds of times across layers (§3). This raises a natural question:
Can we automatically identify and remove (i.e., debloat¹) these redundant checks to reduce proving cost, without compromising security?
Debloating & ZK ML security. Answering this requires defining what makes debloating safe. We borrow “sound” from ZK proof systems, where it forbids any prover from convincing the verifier of a false statement: a debloated constraint set is sound when every witness it accepts is also accepted by the original ( implies ); equivalently, every removed check is entailed by the survivors, i.e., a logical consequence of them (), leaving the model set unchanged. Unsound debloating enlarges the accepted-witness set, producing exactly the under-constrained circuits behind real-world ZK exploits [6, 47]. As Fig. 1 illustrates, this lets a malicious prover supply a forged witness for the model on input , producing a proof that the verifier still accepts and claiming inferences never produced. Such attacks evade detection, since is the only artifact the verifier ever sees. Soundness is therefore critical for any optimisation that modifies the constraint set.
Challenges. We observe that soundly eliminating redundant checks is challenging for ZK ML frameworks. First, redundancy is inherently global: a check that looks necessary in a local gadget may be implied by constraints several layers away, with the implication flowing in either direction across the circuit, so no per-gadget or single-direction analysis suffices. Second, redundancy does not compose. Two checks may each be individually redundant yet unsound to remove together, because each derivation of redundancy uses the other removed check as a premise; we call this circularity the premise-asymmetry problem (§3.3). Third, exact reasoning is intractable: each redundancy query is an entailment in nonlinear field arithmetic (the analogue of QF_NIA), already
co-NP-hard for a single constraint (§3.3), and the largest sound removal is harder still.
Our solution. This semantic redundancy, checks that are active and unique yet entailed by the rest of the circuit, is invisible to existing optimizers, which decide removals from the syntactic or algebraic form of constraints alone (§2.3); on our benchmarks they remove at most 0.4% (§6.4). We give, to our knowledge, the first sound and scalable method for this class. The technical core is a provenance-tracked proof search. We pair abstract interpretation [15], a tractable analysis that derives sound facts (abstract properties such as range bounds and known bit patterns) about each variable, with a provenance graph, a proof log recording, for every derived fact, the constraints and premises that derived it. A check is removed only when every fact it enforces remains derivable from the remaining constraints, decided by a proof search over the graph; cycle detection in the search rules out the circular mutual derivations that premise asymmetry would otherwise allow. The successful search itself certifies the soundness of each removal covered by the entailment rules. In our evaluation (§6), the tool eliminates 25.5% of constraints on average (up to 48.7%) and reduces proving time by 33.4% on average (up to 72.8%).
Contributions. In sum, we make the following contributions:
-
We identify the well-formedness checks emitted by ZK machine learning frameworks as a systematic source of semantic redundancy untapped by existing optimizers, and formalize the three challenges that make its sound removal non-trivial.
-
We propose an abstract interpretation framework that derives statically checkable facts about each variable and tracks the provenance of each fact back to the constraints that proved it. The construction is sound: for each removed constraint, no malicious prover gains additional power from the removal.
-
We implement the approach in a tool and evaluate it on circuits spanning MLP, CNN, RNN, and transformer architectures from two production frameworks. The tool eliminates 25.5% of constraints on average (up to 48.7%), reduces proving time by 33.4% on average (up to 72.8%), and scales to circuits with up to 25.3 million constraints.
2 Background
2.1 Constraints in ZK Proof Systems
A zero-knowledge proof convinces a verifier that a prover knows a witness satisfying some computation, without revealing the witness [27]. Modern proof systems make this checkable by compiling the computation into a constraint system : a finite conjunction of algebraic equations over a prime field . In logical terms, is a quantifier-free formula, a witness is a model of it (), and the proof certifies satisfiability without disclosing the model. (The protocol's cryptographic soundness is orthogonal to this paper: our subject is which models itself admits.) Both prover time and memory scale with the number of constraints, so reducing constraint count is a primary lever for accelerating ZK systems.
Two representations dominate practice, and our tool supports both. Both constrain assignments over a variable set , differing in the shape of an individual constraint.
¹Analogous to software debloating, which removes unused code from binaries.
R1CS [11] states each constraint as a quadratic identity: a product of two linear forms over equals a third, so every constraint has degree at most two. It is the native format for Groth16 [28] and front-ends such as Circom [10] and ZoKrates [19].
PLONKish, introduced by PLONK [24] and adopted by halo2 [20], instead lays the variables out in a table whose columns are partitioned into private advice columns (holding witness variables) and public fixed columns (compile-time constants, including the selectors that switch individual constraints on and off per row). It has three constraint forms: a gate requires a polynomial over the variables of a row to vanish on every row where its selector is active; a lookup requires a tuple of variables to appear in a predefined table; and a copy constraint equates two cells. Lookups and custom gates make table-driven nonlinearities cheap, which is why general-purpose ZK machine learning frameworks [12, 61] target PLONKish.
2.2 ZK Machine Learning Frameworks
Standard ML frameworks such as PyTorch [51] and TensorFlow [2] execute a model's forward pass over IEEE floating-point tensors and emit whatever output the computation produces. ZK ML reframes that same forward pass as a verifiable relation: the prover convinces a verifier that an input-weight-output triple satisfies over , typically with the weights kept private [52]. We study two general-purpose ZK ML frameworks of this kind: ezkl [61] and zkm1 [12]. Each ingests a trained model (ezkl: ONNX; zkm1: TFLite) and compiles every layer or operator as a gadget (1): each use emits a fresh constraint set, and the circuit is the union of these per-gadget sets, adjacent gadgets sharing the variables that carry values between them.
Two restrictions distinguish ZK ML from standard ML toolchains: (1) the constraints live in a prime field with no IEEE floats, so the toolchain quantizes: a real value is represented by the integer for a scale exponent , integers enter through their canonical signed representatives, and every fixed-point operation is re-expressed over ; and (2) soundness requires every inference step to be constrained: any operation left unconstrained lets a malicious prover assign its witness arbitrarily. These restrictions also change the target of analysis: rather than the real-valued network of DNN verification (), our object is the field-arithmetic system the compiler emits, and the question shifts from input-output properties to entailment among its constraints.
ZK ML frameworks therefore scaffold the model with three classes of checking constraints: compiler-emitted invariants pinning each witness variable to the bounded range where field arithmetic agrees with the intended fixed-point semantics (otherwise wrapped-around field values satisfy the same equations, admitting unintended models). Range checks prove that a witness value lies in a specified interval, bounding activations to their declared bit-width and constraining the auxiliary digits introduced by other gadgets. Value decomposition realizes integer division by a constant for fixed-point rescaling: the compiler introduces auxiliary witness variables with and range-checked into , since has no native integer division. Lookup-table nonlinearities realize ReLU, Sigmoid, Softmax, and similar functions by
Table 1: Capability comparison of prior tools.
| Compilers | Distilling | CirC | Clap | Halo2-Analyzer | |
|---|---|---|---|---|---|
| Algebraic optimization | ✓ | ✓ | ✓ | ✓ | ✗ |
| Syntactic optimization | ✓ | ✓ | ✓ | ✓ | ✓ |
| Semantic optimization | ✗ | ✗ | ✗ | ✗ | ✗ |
| Logical entailment | ✗ | ✗ | ✗ | ✗ | ✗ |
precomputing input-output pairs across the quantized domain and asserting that each pair appears in the table.
ezkl and zkm1 differ in how these checks are emitted. ezkl factors them through shared infrastructure: every range proof goes through a single range-check service, rescaling decomposes each value into base- digits (default ) whose ranges are checked via that same service, and activation lookups consult their tables directly, with input bounds inherited from the upstream decomposition. zkm1 inlines them into each gadget: range-check lookups are emitted at every call site, rescaling uses a single division gadget without digit decomposition, and every activation lookup is preceded by a separate input-range lookup. ezkl's scaffolding is thus factored across the circuit; zkm1's is replicated per gadget.
2.3 Constraint Optimization in ZK Systems
Several prior tools reduce or analyze the constraint count of ZK circuits. Table 1 compares them along the dimensions that determine whether they detect the redundancies our work targets.
Compiler optimizations. Mainstream ZK compilers (Circom [10] (02), ZoKrates [19], Noir [7], and Leo [13]) apply standard syntactic and algebraic simplifications, including constant folding, common subexpression elimination, and Gaussian elimination over linear constraints. Nonlinear constraints are untouched, and none of these passes reasons about the values variables may take.
Distilling constraints. Albert et al. [3] extend Circom by deriving new linear consequences from nonlinear R1CS triples via Gaussian elimination over their quadratic-monomial coefficients, then substituting and deleting. This analysis is purely algebraic.
CirC. CirC [48] shares an IR across R1CS, SMT, and ILP back-ends and applies standard IR-level optimizations during lowering: constant folding, common-subexpression elimination, and linearity reduction. It has no awareness of entailment redundancies.
Clap. Clap [62] targets PLONKish circuits with structural rewrites (linear inlining, gate consolidation, and custom-gate synthesis) under formal soundness guarantees. The rewrites operate on circuit syntax, so a check that is semantically entailed by other gadgets remains invisible to them.
Halo2 analyzer. The Halo2 analyzer [60] applies abstract interpretation to PLONKish circuits to flag unused gates, unused columns, and assigned-but-unconstrained cells. This analysis only detects structural dead weight.
In sum, each prior pass decides removals from the syntactic or algebraic form of constraints considered in isolation; none asks what the remaining constraints entail. §6.4 confirms the gap empirically: on our benchmarks these tools remove at most 0.4%, while entailment-based debloating removes up to 48.7%.
3 Problem and Motivation
This section fixes the sound debloating problem formally ( ), grounds it in a concrete zero-knowledge ML fragment ( ), and uses that fragment to surface three challenges any sound debloater must address ( ).
3.1 Problem Formulation
Let be a constraint system over variables .
Definition 1 (Satisfaction). A witness satisfies a constraint , written , if holds under the assignment . We write if for every .
Definition 2 (Entailment). A set of constraints (the premises) entails a constraint , written , if every witness satisfying also satisfies . We extend entailment to sets on the right: for a set of constraints, iff for every .
We define redundancy and sound debloating using entailment.
Definition 3 (Redundancy). A constraint is redundant with respect to if .
Definition 4 (Safe debloating). A subset is a safe debloating of if . This is sound since every witness that satisfies the debloated system also satisfies the original . This property is stringent: an unsound removal admits a witness with but , potentially allowing a malicious prover to forge a witness that the verifier accepts but that does not correspond to a legitimate computation.
The ideal target is a maximum safe debloating:
Computing exactly is intractable ( ), so we instead compute a large feasible in polynomial time ( ).
3.2 Motivating Example
Fig. 2(a) shows a multi-layer fragment produced by a typical ZK machine learning framework (we take ezl in this example). Each gadget emits its own soundness checks without consulting its neighbours, producing the constraints listed in the right column:
: fully-connected gate enforcing .
: ReLU lookup asserting .
: decomposition gate .
: digit lookups asserting .
: sign lookup asserting .
: next-layer range check asserting .
In isolation every constraint is essential, but in the full circuit redundancies emerge:
-
Range-check subsumption. Assume that . asserts , but the downstream already enforces , making redundant (dashed arrow in the figure).
-
Bound-induced collapse. Assume the sign and low-digit checks remain, and another surviving constraint bounds to . When , the downstream bound gives , while and force because is a multiple of . Thus is redundant; can be removed only if another surviving fact pins .

(a) Multi-layer fragment with constraints per gadget.
Derivations of
Derivations of
(b) Premise asymmetry: removing both lookups breaks all joint paths.
Figure 2: Illustrative redundancy patterns in ZK ML circuits.
Identifying and safely removing such redundancies is the goal of this work, but doing so raises three challenges.
3.3 Design Challenges
Challenge A: Non-local subsumption. The ReLU lookup asserts but is fully subsumed by the downstream range check with ; the bound-induced collapse is similarly non-local. Certifying either redundancy requires bounding z from constraints spread across the whole circuit.
Bounding variables from surrounding constraints is the canonical problem of deep neural network (DNN) verification [33, 58, 76]. Yet mature DNN techniques (linear bound propagation, SMT/MILP) assume a layered DAG seeded at a designated input region or output property, which a compiled ZK constraint system lacks. The bound on z, for instance, flows backward from to , and elsewhere bounds flow forward across one equality and backward across the next. This rules out any analysis tied to a fixed traversal direction. We adopt abstract interpretation in a worklist form ( ), whose fixpoint propagates facts in any direction over the flat constraint set without a designated starting point.
Challenge B: Premise asymmetry. Consider Fig. 2(b): a gate and two lookups , . The fact has two derivations: directly from , or jointly from since and force ; 's derivations are symmetric. Each lookup is individually redundant, yet removing both leaves only , which admits the unexpected witness
: each joint derivation required the very lookup just deleted. Such mutual dependencies recur in ZK machine learning circuits, e.g., paired bounds in division gadgets, cross-layer range checks.
Formally, each 's redundancy is established against , which still contains its partner. Safe debloating requires entailment from the strictly smaller (Def. 4), in which every removed constraint is gone simultaneously. We call this gap premise asymmetry: a constraint redundant given its peers may stop being so once those peers are also removed. Safe composition therefore requires a data structure that tracks alternate derivations of each fact, plus a search procedure that rejects circular derivations among them. We build a provenance graph (§4.2) recording which constraints proved which fact, exposing alternate derivations to the removal loop.
Challenge C: Intractable exact methods. The decision is co-NP-hard already for a single constraint (3-UNSAT reduces via a degree-3 polynomial encoding over ); SMT-based analyses do not scale to constraint systems of this size [49], while the circuits we evaluate reach tens of millions. The optimisation compounds the hardness: it ranges over candidates, and Challenge B shows subset validity does not decompose into singleton checks, placing the exact problem in .
We therefore forgo exact methods for a polynomial-time, sound-by-construction over-approximation. Three practical limits shape its design. One at a time: with subsets to enumerate, we grow greedily, accepting each addition only if safely removable given prior commits; the cumulative mask is also the snapshot Challenge B's proof search consults, so one-at-a-time is what makes cycle-aware checking possible. Shared work: rerunning the analysis after each tentative removal would multiply its cost by , not scalable (§6); we instead compute the derivations once and reuse them via the provenance graph. Targeted obligations: since checking even single-constraint redundancy is hard, a heuristic entailment filter (§4.3) flags constraints whose enforced property the fixpoint already entails and names the facts the proof search must re-derive.
§4 instantiated these three responses as a single pipeline.
4 Approach
For the check classes handled by our entailment rules, removing a constraint from is safe iff the facts enforces are still derivable from ; our pipeline turns that derivability test into a tractable computation in three phases:
Abstract interpretation proves which facts hold of each variable, computing a fixpoint over three abstract domains (intervals, known bits, constants). The provenance graph records, for each fact in , which constraints proved it from which premise facts. Provenance-guided debloating then verifies, for each candidate , that the facts enforces remain derivable in after is masked out; if so, is removed, yielding the removal set . In Appendix E we give an end-to-end example of the three phases on a five-constraint circuit distilled from §3.2.
4.1 Abstract Interpretation over Constraints
Abstract domain. Each variable is tracked by an abstract value drawn from a reduced product of three lattice domains:
(1) Constant: either a known field element or (unknown).
(2) Interval: a range bounding all possible values of when interpreted as a signed integer.
(3) Known bits: a bitmask and a value pattern , recording that for every bit position where , the -th bit of equals .
The three components cross-propagate: a refinement in one domain sharpens the others via standard reduced-product rules [15, 16], as in LLVM's KnownBits analysis [64].
Transfer functions. Each constraint type defines a transfer function that refines the abstract values of its variables. Transfer functions handle arithmetic gates (addition, multiplication, scaling, and their inverses), lookup tables (intersecting a variable's abstract value with the table's range), and bit decompositions (linking interval bounds to individual bit facts). Propagation is non-directional: may tighten any of , or from the other two.
We show three representative rules in inference-rule form; the remainder follow the same template. Premises above the line are the abstract-state facts consulted; the conclusion below the line is the contributed refinement. denotes the current state; abbreviate ; is the abstract-interval order (sharper bounds are smaller); and is the smallest interval containing (interval multiplication).
Symmetric variants are elided: BITIFY also propagates backward, and QUADRATIC GATE solves backward for or : rearranging divides by the other operand, giving and symmetrically for . The backward rule fires only when the divisor's range is sign-determined (in particular, excludes zero), which makes the interval division well defined; otherwise it contributes nothing.
Soundness under field wrap-around. Witnesses live in , not . We interpret a field element as its canonical signed representative in the window . A transfer rule is allowed to contribute an integer fact only when the concrete operation it abstracts is unique in this signed interpretation: for addition and scaling, the operand ranges and the resulting range must stay inside ; for multiplication, the full interval product must stay inside ; and for backward rules such as solving a quadratic gate for one operand, the divisor/range side conditions used by the rule must also keep the inferred range inside . Lookup and bit-decomposition rules are treated as integer facts only for table entries or bit widths whose represented values lie inside the same signed window. We enforce this discipline by widening any out-of-window conclusion to :
Thus, any modular wrap-around that would make the integer reading ambiguous causes the analysis to keep no refinement from that rule. With the wrap-around guard, the analysis performs a refinement only when integer and modular arithmetic agree on it, so every kept fact holds for every witness (wrap-around or not).
Fixpoint computation. Variables start at , except those pinned to circuit constants (e.g., fixed-column entries or hard-coded values), which start at the corresponding constant. A standard worklist re-applies each constraint's transfer function whenever one of its variables is refined.
Soundness, termination, and complexity. Each transfer function is locally sound: for every constraint and every witness , applying to any abstract state that over-approximates yields a state that still over-approximates . We verify this condition per constraint type and take it as a precondition on the rules. Local soundness, monotonicity (), and the bounded height of the lattice (every interval lies in by WRAPGUARD) are the standard ingredients of the worklist fixpoint construction [15, 16]: chaotic iteration (a worklist with arbitrary dequeue order) reaches a fixpoint that over-approximates every . With constraints, the maximum constraint arity, and the height of the interval lattice over , the construction runs in time.
4.2 Provenance Graph
The fixpoint proves facts but discards how they were derived; the premise asymmetry of Challenge B shows why that history matters. To handle it without re-running the fixpoint after every candidate removal, we record the derivation structure as a provenance graph [17, 18]: a bipartite AND/OR graph whose fact nodes (OR) hold proven facts and whose constraint nodes (AND) record which constraints, with which premise facts, established them.
To track derivations at the granularity downstream entailment needs, we project each variable's reduced-product value into up to three atomic facts, one per abstract domain: a lower bound, an upper bound, and a known-bits pattern. Each atom is separately provable, so a constraint can take credit for the specific atom it contributes and provenance tracks each atom on its own.
For a state and a fact over variable , we write to mean that every concrete value in satisfies . We use to distinguish abstract from semantic entailment ( ).
Definition 5 (Provenance graph). The provenance graph of constraint system C at fixpoint is a directed bipartite graph with parts F (fact nodes, the OR side) and N (constraint nodes, the AND side):
-
is the set of fact nodes, one per pair with and . Each node asserts the corresponding atom of : a lower bound , an upper bound , or a known-bits pattern (a bitmask plus value pinning specific bit positions of ), using the values records. This per-domain projection lets each entailment check consume only what it needs: bound checks read , bit-level checks read bits.
-
contains one constraint node per triple such that constraint derives target fact from premise set .
Algorithm 1. Provenance graph construction.
Input: Constraints , fixpoint
Output: Provenance graph
1:
2:
3: for each do
4: for each variable referenced by do
5: reset
6: replay
7: for each with do
8:
9:
10: (Def. 5)
11: return
A constraint may contribute several nodes (one per derivable fact). A node with is an axiom node: derives from its semantics alone, independent of any other proven fact. Axiom nodes (e.g., a lookup with column range contributing the bound facts of ) cannot participate in dependency cycles, providing cycle-free proof paths the debloater can rely on. Constraint nodes with are joint nodes, deriving their target from the conjunction of premise facts.
- contains, for each , a premise edge from each to , and a derivation edge from to its target .
Construction. Each constraint node records what the fixpoint does not track: which fact the constraint alone contributes, and which premises that contribution consults. Alg. 1 computes this in one outer loop over ; no fixpoint iteration is needed. For each , it replays 's transfer function with reset to and other variables held at ; for the monotone, single-constraint transfer functions implemented by our analyzer, this replay exposes the refinements that can contribute to at the fixpoint. We do not require this replay to be complete for all possible semantic consequences of ; facts not exposed by an implemented transfer rule are simply unavailable to the debloater. MINPREMISES (below) then trims to the facts the replay actually consulted.
Minimal premises. The replay above held every other-variable fact at , but most were not actually consulted. Recording the maximal set would inflate the graph and, worse, manufacture spurious dependencies that the debloater would later have to mask around. MINPREMISES (Alg. 2) trims them via a drop-to-top rule: candidates are individual facts about variables that references, and the procedure tentatively drops each in turn (widening the affected variable toward via state( ) from Alg. 2), replays transfer , and discards a candidate if the target still emerges. Soundness follows from §4.1's monotonicity: a fact whose absence the target survives was not consulted. Visit order is arbitrary; different orders yield different irreducible sets, but proof search needs some proof, not a minimum-cardinality one.
Complexity. Write and d for the maximum number of variables referenced by any single constraint.
THEOREM 4.1 (CONSTRUCTION COMPLEXITY). Alg. 1 runs in time and produces a graph with fact nodes, constraint nodes, and edges.
Algorithm 2. MINPREMISES via drop-to-top.
Notation. For a fact set , let state() denote the abstract state assigning and each other variable the narrowest abstract value consistent with the facts .
Input: Constraint , target fact , fixpoint
Output: Irreducible such that
1:
2: for each (arbitrary order) do
3: widen by dropping
4: if then
5: unused
6: return
Usually, a constraint has a limited number of variables, so is a small constant, thus the construction is near-linear in . The proof sketch appears in Appendix D.
4.3 Provenance-Guided Debloating
Debloating selects constraints whose removal preserves the witness set. An entailment filter proposes candidates; a removal loop removes them one at a time, using AND/OR proof search on to certify each removal. We describe these components in order, then argue soundness.
Entailment filter. A constraint is a candidate, written , when the fixpoint already implies its enforced property: . We define by cases on the constraint shape; two are representative, and the remainder follow the same template.
-
LOOKUP where is a single-column range table containing exactly the integers in – holds when .
-
GATE – holds when for all and .
Here abbreviates the joint atom check, and denotes a singleton interval ( and coincide at ). For lookup tables that are not of this form, the range rule does not apply. Analogous cases handle bit decompositions, R1CS products, and equals-zero constraints. The filter is sound but incomplete: a redundant constraint whose shape does not match any implemented case is simply retained.
Provability under a mask. A subset is a mask, modeling constraint nodes that the deboater has tentatively disabled; masks arise because removals are applied incrementally and provability must be re-checked after each. Provability under has AND/OR semantics: a fact is provable iff some unmasked constraint node targeting is itself provable (OR), and a constraint node is provable iff every premise is provable (AND). We take the least fixed point of these clauses: a fact is provable only when a finite, acyclic derivation rooted at axiom nodes witnesses it; cyclic derivations do not establish provability.
Proof search. The removal loop needs to decide, for a fact and a mask , whether is provable in under . We compute this by AND/OR depth-first search (Alg. 3). PROVEOR() succeeds when some unmasked constraint node targeting succeeds; a constraint node succeeds when every premise of does. The visiting set returns FALSE on revisits to a node still on the search stack, refusing to derive a fact from a circular proof and
Algorithm 3. AND/OR proof search under a mask.
Input: Graph , target , mask
Output: TRUE iff is provable in under
Driver:
1: visiting, proven, disproven
2: return PROVEOR()
function PROVEOR():
3: if proven return TRUE memo
4: if disproven return FALSE memo
5: if visiting return FALSE cycle
6: visiting visiting ; FALSE
7: for each with do
8: if PROVEAND() then TRUE; break
9: visiting visiting
10: if then proven proven else
disproven disproven
11: return
function PROVEAND():
12: if return FALSE
13: if visiting return FALSE cycle
14: visiting visiting ; TRUE
15: for each do
16: if then FALSE; break
17: visiting visiting ; return
Algorithm 4. Removal loop for provenance-grounded debloating.
Input: Candidates , provenance graph , ordering on
Output: Removal set
1: ;
2: for each in order do
3: 's constraint nodes
4: tentatively mask
5: if PROVEOR() succeeds for every then
6: remove; mask stays
7: else
8: revert tentative mask
9: return
thereby ruling out the premise-asymmetry cycles of Challenge B (§3.3). The proven and disproven memos record each fact node's result on return, so subsequent references within the same query short-circuit. Each node and edge is thus traversed at most once per query, giving time.
Removal loop. For each candidate , its proof obligations are the fact nodes the filter consulted when admitting . The two filter rules above instantiate as follows: a lookup entailed by contributes the and nodes of ; a gate entailed by for all contributes the and nodes of every (which together pin to ). If every fact in remains provable under the cumulative mask of prior removals, the loop removes and adds its constraint nodes to the mask (Alg. 4).
Ordering and intractability. Finding the largest removal set is at least as hard as the minimum equivalent subformula problem, which is coNP-hard [41]: the maximum removal set corresponds to a smallest equivalent subset of , and deciding whether such a subset of a given size exists is intractable. We therefore use a greedy ordering (§5) that visits low-uniqueness candidates first, removing constraints with many alternative proofs before those that are the sole proof source for some fact. The ordering affects only the size of the removal set, not its soundness: every removal is individually verified by proof search.
Complexity. Let denote the number of candidates emitted by the filter and the average size of the subgraph reachable from a target fact in . Each removal attempt runs proof searches, each bounded by under memoized cycle-aware traversal (Alg. 3). With bounded by the constant constraint arity, one attempt costs , and the entire loop runs in time. In the worst case , giving ; in circuits where is small, the loop is near-linear.
For removals justified by the implemented transfer and entailment rules, soundness proceeds in two steps. Theorem 4.2 shows that any fact the search declares provable under a mask holds for every witness of the unmasked constraints. Combined with a per-rule entailment-soundness precondition on the filter, Theorem 4.3 then concludes that those removed constraints are redundant.
Provability soundness. Let and let be the mask induced by removing .
THEOREM 4.2 (PROVABILITY SOUNDNESS). If a fact is provable in under mask , then every witness assigns a value satisfying fact .
Debloating soundness. Iterating Alg. 4's removals in order produces a provenance-grounded removal set:
Definition 6 (Provenance-grounded removal). A subset is provenance-grounded if there exists an ordering of its elements such that each is entailed (so its obligations are defined) and, writing , every fact in is provable in under mask for every .
Each entailment rule is engineered to satisfy an entailment soundness property: for every entailed constraint and every witness that satisfies every fact in at its proven abstract value, also satisfies . The theorem below is therefore conditional on the rule schemas covered by the implementation and on their local soundness obligations; unsupported constraint shapes are conservatively retained rather than certified by this argument.
THEOREM 4.3 (DEBLOATING SOUNDNESS). If is provenance-grounded then is a safe debloating (Def. 4): , equivalently every satisfies iff it satisfies .
Proof sketches for both theorems appear in Appendix D.
Security implication. Theorem 4.3 guarantees that the debloated circuit admits exactly the same set of valid witnesses as the original for the certified removal set , whose members are discharged by the implemented entailment rules. In the adversarial setting of a zero-knowledge proof system, this means a malicious prover who could not forge a valid witness before debloating still cannot do so afterward: the soundness guarantee of the proof system is preserved for the certified removals under the modeled constraint semantics.
Remark on stale proofs. need only be provable under the mask at step , not under the final mask. A later removal may
invalidate 's original proof without invalidating its removal. The removal loop therefore needs no bookkeeping for prior proofs: checking each obligation once against the cumulative mask suffices.
5 Implementation
We implement the approach of §4 in Rust in roughly 30k lines. This section reports the engineering details in our implementation.
Loaders and emitters. The tool supports two constraint formats.
-
R1CS. The loader consumes Circom source via an ANTLR4 [50]-generated parser to produce a flat constraint vector. The emitter re-generates Circom source so that existing tool-chains can prove and verify the debloated circuit unchanged.
-
PLONKish. halo2 circuits are built programmatically inside Rust rather than from a source file, so there is nothing to parse. The loader instead observes halo2's mock prover during a single synthesis pass and records every gate, lookup, and copy constraint into a JSON description that preserves the circuit structure. The emitter rebuilds the JSON back into a halo2 circuit, so the existing prover and verifier run unchanged.
Notably, when loading, we assume that model weights (encoded in PLONKish's advice columns) are not known to our tool. We therefore do not leverage any weight-specific optimizations.
Greedy removal ordering. Alg. 4's ordering is realized as a uniqueness score: for each candidate , we count the fact nodes for which is the sole unmasked source in the provenance graph. Candidates are visited in ascending score order, so constraints with score 0 (those whose facts have alternative proofs) are tried first, while high-score constraints that prop up many facts uniquely are deferred to the end. This is the standard greedy surrogate for set cover, computed once from the initial graph.
Dead elimination. After debloating, some constraints may reference only auxiliary variables that are disconnected from the circuit's designated boundary variables (e.g., public and private inputs/outputs). We apply a conservative cleanup pass only to such unreachable auxiliary structure: a backward-reachability pass starts from these boundary variables, marks the constraints that can affect them as live, and treats the deletion of the rest as preserving the observable relation. A subsequent column-pruning pass identifies advice and fixed columns that no surviving constraint references and marks them for removal.
Mechanized soundness proof. We mechanize the soundness argument for certified removals in Rocq [65]. The development defines the modeled constraint semantics and abstract domains, proves local soundness for the implemented transfer and entailment rules, and independently checks the analyzer-emitted certificate for each removal set , establishing the safe-debloating property (Def. 4): every witness of the debloated circuit satisfies the removed checks, so both circuits accept the same witnesses. This certification covers the constraint kinds discharged by our implementation; unsupported shapes are retained unless a covered rule certifies their removal.
6 Evaluation
We evaluate our approach along three dimensions:
Table 2: RQ1: Constraint reduction and proof-system impact on named benchmarks. |C| is the number of loaded constraints; Red% is the fraction removed by debloating; are baseline prove/verify time; is the proof size; are the relative changes in prove/verify time, and proof size after debloating.
| Model | zkml | ezkl | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |C| | Red% | |C| | Red% | |||||||||||||
| MNIST-MLP | 6.30K | 22.30% | 569 s | -16.80% | 13.70 s | -25.30% | 8.10 MB | -2.70% | 416.50K | 3.20% | 174 s | -20.70% | 2.33 s | 0.00% | 7.90 KB | -31.60% |
| LeNet-5 | 338.10K | 31.70% | 994 s | -41.20% | 9.82 s | -59.10% | 3.00 MB | -40.00% | 2.20M | 15.90% | 298 s | -32.00% | 2.33 s | +0.10% | 15.20 KB | -42.30% |
| MobileNet-v2 | — | — | — | — | — | — | — | — | 25.30M | 22.80% | 9545 s | -4.10% | 0.93 s | -0.50% | 275.00 KB | -3.60% |
| PTB-RNN | 28.10K | 43.10% | 4.14 s | -36.70% | 32.00 ms | -25.20% | 58.20 KB | -36.90% | 3.80M | 12.90% | 1561 s | -62.90% | 2.37 s | -1.30% | 93.80 KB | -74.20% |
| PTB-GRU | 78.80K | 44.70% | 12.60 s | -42.70% | 94.80 ms | -44.90% | 178.20 KB | -43.80% | 12.80M | 12.10% | 4.50 h | -1.10% | 1.06 s | -6.60% | 462.40 KB | -1.20% |
| PTB-LSTM | 76.10K | 48.70% | 29.90 s | -43.70% | 0.16 s | -48.10% | 260.20 KB | -45.60% | 16.20M | 11.50% | 7.60 h | -20.10% | 1.16 s | +3.40% | 730.50 KB | -1.00% |
| BERT-tiny | 57.20K | 37.40% | 9.21 s | -39.40% | 71.00 ms | -39.20% | 137.00 KB | -40.90% | 10.20M | 24.90% | 4783 s | -72.80% | 0.97 s | -10.70% | 138.10 KB | -72.90% |
-
RQ1 (Effectiveness). How much does debloating reduce the number of constraints, and does that reduction translate into prover, verifier, and proof-size savings?
-
RQ2 (Scalability). How does analysis time and constraint reduction scale as circuit size grows?
-
RQ3 (Comparison). How does our tool compare to existing constraint-reduction tools and to exact SMT-based entailment checking?
6.1 Experimental Setup
Hardware. All experiments run on a server equipped with an AMD EPYC 9754 and 768 GiB of DDR5 RAM with Ubuntu 24 LTS.
Corpus. Our corpus covers seven architectures: MNIST-MLP (fully connected) and LeNet-5 (convolutional) for digit recognition [38]; MobileNet-v2 (depthwise-separable convolutions) [54]; PTB-RNN (Elman) [21], PTB-GRU [14], and PTB-LSTM [31] on Penn Treebank; and BERT-tiny (a single-layer transformer encoder) [66].
Each architecture is compiled through two PLONKish pipelines: ezkl [61], which compiles ONNX models, and zkml [12], which composes hand-crafted PLONKish gadgets. Six of the seven architectures run through both pipelines; MobileNet-v2 runs through ezkl only, as zkml does not support depthwise-separable convolutions. Running the same architecture through two pipelines separates architecture-dependent redundancy (a property of the neural network model) from pipeline-dependent redundancy (a property of the circuit generation framework). Each model uses the published architecture dimensions where memory permits; when the zkml prover's footprint exceeds the server's 768 GiB capacity, we use the largest scale that completes successfully (hidden=50 for zkml/PTB-*, for zkml/BERT-tiny). Circuit complexity at these sizes ranges from ~6k constraints to ~25M constraints.
Proving and verifying. For end-to-end proof-system measurements in RQ1, we use Axiom's halo2 implementation [5] as it provides better memory efficiency, and record CPU time for both proving and verifying.
Scaling. For RQ2, we parameterize each architecture family by a size multiplier that varies the principal dimension (hidden width for recurrent/transformer models, channel count for CNNs, layer width for FC networks), producing circuits that span the same structural patterns at increasing scale. For each configuration we record our approach's analysis wall time and the
resulting constraint reduction rate. The largest instance reaches ~38M constraints at 32X.
Comparison baselines. For RQ3, we compare against five existing tools and one exact method. Circom v2.2.3 with full optimization (02) [10], Distilling Constraints [3], and CirC [48] target R1CS constraint systems; since our tool also supports R1CS, the comparison is direct. Circom O2 and Distilling consume Circom source; CirC compiles ZoKrates [19] programs to R1CS, so we re-implement each circuit as a semantically equivalent ZoKrates program. Clap [62] and the Halo2 analyzer (korrekt) [60] consume PLONKish circuits instead, so the comparison uses the zkml compilation of the same architectures: a converter reproduces each circuit's gates and lookups in Clap's eDSL and runs Clap unmodified; korrekt requires Rust circuit sources rather than extracted circuits, so we faithfully reimplement its three structural analyses on the same circuits. Finally, we run the exact method our analysis approximates: deciding each redundancy query with cvc5 [8] on a faithful QF_NIA encoding. The encoding asserts gate polynomials as equations, expands lookups into per-row disjunctions, and encodes copy constraints as equalities. Each circuit receives a 24-hour budget; queries the solver cannot decide conservatively keep the constraint.
The R1CS tools additionally need an R1CS corpus. To the best of our knowledge, no mature R1CS framework exists for neural-network inference circuits. The commonly cited circomlib-ml [59] on Github is toy-level and under-constrained: its gadgets omit checks needed for soundness. Thus, we prepare five circuits (MLP, LeNet, RNN, GRU, LSTM) by augmenting circomlib-ml's templates with checks modeled after zkml's constraint patterns, producing sound circuits with realistic redundancy structure. MobileNet and BERT are excluded because neither can be encoded using gadgets provided by circomlib-ml. The sizes of those circuits are intentionally small to allow all baselines to complete within a reasonable time.
The No-Graph ablation removes each candidate, re-runs abstract interpretation to fixpoint, and restores the candidate if entailment fails. Each of the filter candidates triggers a fresh fixpoint: overall, versus graph construction and an commit loop (§4). Its 4-hour budget per circuit is roughly our full approach's actual time on RQ3 circuits.
6.2 RQ1: Effectiveness
Table 2 reports constraint reduction, proving and verification time, and proof size for each architecture-pipeline pair.
Constraint reduction. Debloating removes constraints on every benchmark in our corpus. On ezkl, reduction ranges from 3.20% to 24.90% (median 12.90%); on zkm1, from 22.30% to 48.70% (median 40.25%). The consistently higher reduction on zkm1 is expected: zkm1's hand-crafted gadgets compose range checks and lookup constraints at the constraint level, producing inter-constraint entailment opportunities that abstract interpretation can exploit. ezkl's gadgets, by contrast, fuse multiple operations into shared layouts where each soundness check is emitted once and reused across many rows, leaving fewer constraint-level redundancies for the deboater to detect. Within each pipeline, recurrent and transformer architectures (PTB-*, BERT-tiny) yield higher reduction than feed-forward ones (MNIST-MLP), consistent with unrolled timesteps repeating identical gadget patterns whose intermediate checks accumulate redundancy.
Proving time. Prove-time savings appear on every benchmark, but the magnitude varies widely: 16.80–43.70% on zkm1 and 1.10–72.80% on ezkl. Several properties of PLONKish explain the spread.
The prover commits one polynomial per advice column, of length where (logrows) is the smallest power of two fitting the circuit; each distinct lookup argument adds further committed polynomials. The prover therefore pays per advice column and per distinct lookup type, not per constraint, so prove-time savings arise only when removals (i) prune an entire advice column, or (ii) eliminate a distinct lookup argument. Witness-generation also contributes to timing, scaling roughly with the number of cells in the table (advice columns rows used).
On zkm1, debloating predominantly removes lookup invocations (33–50% fewer across the six benchmarks), while gate and advice-column counts remain nearly unchanged. Because zkm1 emits a fresh lookup argument per gadget call site, trimming invocations directly collapses the number of distinct lookup arguments. Prove-time tracks lookup reduction closely (17–44%, mean 36.75%).
On ezkl, the dominant effect is column pruning. ezkl shares lookup arguments across many call sites of the same non-linearity, so distinct-lookup elimination is a smaller, secondary effect. On BERT-tiny and PTB-RNN, debloating prunes 38% and 62% of advice columns and collapses 29% and 17% of the distinct lookup arguments, yielding 72.80% and 62.90% prove-time reductions. On the remaining ezkl models, fewer columns are eliminated and speedups are 1–32%.
Verifier time and proof size. Verifier time is small in absolute terms and varies with system-level factors; we observe +3.40% to –59.10% changes across benchmarks. Proof-size reductions range from 1–74% on ezkl and 3–46% on zkm1, generally tracking the degree of column or lookup removal discussed above.
Answer to RQ1. Debloating finds and removes redundant constraints on all 13 pipeline-model pairs. The deboater reduces constraint counts by up to 48.70%, effectively saving prove time and proof size.
Table 3: RQ3: Comparison with existing constraint-reduction tools on five architectures.
| Circuit | |C| | O2 | Distil. | CirC | Clap | korrekt | No Graph | Ours |
|---|---|---|---|---|---|---|---|---|
| MLP | 5,463 | 0% | 0% | 0% | 0% | 0% | timeout | 22.9% |
| LeNet | 60.2K | 0% | 0% | 0.1% | 0% | 0% | timeout | 29.6% |
| RNN | 19.7K | 0.2% | 0.2% | 0.4% | 0% | 0% | timeout | 15.9% |
| GRU | 10.8K | 0% | 0% | 0.2% | 0% | 0% | timeout | 42.8% |
| LSTM | 10.8K | 0% | 0% | 0.3% | 0% | 0% | 51.6% | 51.6% |
6.3 RQ2: Scalability
Fig. 3 plots analysis time and constraint reduction as each architecture scales from to .
Analysis time. §4 establishes that the abstract interpretation and provenance construction phases are near-linear in constraint count , while the commit loop is with worst case . Empirically, fitting between the and endpoints yields exponents on ezkl and on zkm1. The higher exponents on zkm1 are consistent with deeper provenance chains in the dense fully-connected layers (increasing the per-query cost ) and larger arity per dot-product constraint (increasing the ). In absolute terms, the smallest circuit (zkml/FC-MLP, 476 constraints) completes in 0.10 s, and the largest circuit (ezkl/MobileNet, 38.40M constraints) completes in 2.90 h. This indicates that our tool maintains efficiency as circuits scale, and since debloating is a one-time, offline transformation, even multi-hour analyses amortize over arbitrarily many subsequent proof generations.
Reduction stability. On zkm1, reduction percentages are remarkably stable across scale: RNN, GRU, and LSTM vary by less than 0.30 percentage points from to (25.20%, 25.00%, and 27.30%, respectively). FC-MLP and Transformer show similarly narrow ranges (27.30–27.60% and 19.80–21.40%). LeNet-CNN increases slightly from 29.20% to 31.70%. On ezkl, MobileNet (21.90–23.10%) and Transformer (28.00–36.40%) are similarly stable or improving; FC-MLP and the recurrent families show a modest decline (8–10 percentage points) at high multipliers.
The difference traces to how each pipeline scales. zkm1 composes self-contained gadgets, so scaling the principal dimension replicates identical gadget instances and their internal redundancy in each step. On ezkl, the absolute number of trimmed constraints also grows with scale, but the total constraint count grows faster for some families (FC-MLP, RNN, GRU, LSTM), diluting the percentage. For MobileNet and Transformer, total and trimmed constraints scale at similar rates, keeping the ratio stable or improving.
Answer to RQ2. Analysis time scales efficiently with constraint count, and reduction percentages stay stable across scale on both pipelines.
6.4 RQ3: Comparison
Table 3 reports the constraint reduction achieved by each tool on the five RQ3 architectures. is the R1CS constraint count (baseline). “O2” is Circom O2; “Distilling” is Albert et al.'s approach; “CirC” is CirC's IR optimizations; “Clap” and “korrekt” run on the zkm1 compilation of the same architectures; and “No Graph” is our deboater

Figure 3: RQ2: Analysis time and constraint reduction as circuit size scales from 1× to 32×. Top row: ezkl; bottom row: zkml. In each panel, the upper chart plots constraints, parameters, and time relative to the 1× baseline (log scale); the lower chart plots reduction percentage (linear scale). The dashed vertical line marks the parameter sizes of RQ1 models.
with the provenance graph disabled, falling back to per-candidate re-verification (§6.1). The final column is our full debloater.
Circom O2 and Distilling. Circom O2 and Distilling achieve no reduction on four of the five circuits. The sole exception is PTB-RNN, where both remove 0.2% of constraints, which is a negligible improvement. This is expected: both tools target algebraic simplifications (constant folding, linear-combination merging) that do not reason about cross-constraint entailment.
CirC. We render each circuit in ZoKrates and compile through CirC with and without IR optimizations, including constant folding, variable scalarization, and oblivious array elimination. CirC achieves at most 0.4% reduction: these ML circuits lack the program features (oblivious arrays, hashing, RAM) targeted by its passes.
Clap and Halo2-Analyzer (korrekt). Both tools remove nothing on any circuit (Table 3). The zeros are structural, not incidental. Korrekt flags gates that are statically dead: polynomials that abstractly evaluate to zero on every active row via zero constants, zero scale factors, or known-zero fixed cells. We verified that every gate expression in these circuits abstract-evaluates to non-constant, because zkml activates each gate template exactly on the rows it uses and embeds only non-zero weights. Clap's range-check elimination drops a check only when a syntactically identical check on the same signal appears elsewhere; after equality merging, every lookup in these circuits enforces a distinct expression, leaving nothing to drop. Both tools ask whether a check is ever active or duplicated; neither asks whether an active, unique check is entailed, which is where the redundancy resides (22.3–48.7% on the same circuits, Table 2).
Exact SMT (QF_NIA). At the scale of Table 3, the exact method is out of reach. We therefore run it on scaled-down instances of the five RQ3 architectures (8–680 neurons; 116–7.2K constraints). Within the 24-hour budget, only the smallest instance, MLP (116 constraints), terminates, and it takes 11.4 hours to do so. Its removal set exactly matches the one our tool computes in 0.06 s. The other
four exceed the budget. Exact entailment is thus the right specification but not a scalable algorithm: our provenance-guided approximation reaches the same answer five orders of magnitude faster.
No-Graph ablation. On LSTM, No-Graph reaches the same 51.6% reduction (in 42 min) as our full debloater; on the other four circuits, it exhausts the 4-hour budget, each candidate triggering a fixpoint recomputation over the entire constraint set. LSTM is the outlier for a structural reason: its number of constraints entering analysis (total minus equality constraints) is the smallest in the corpus (966 versus 1,140–13,014 for the others), so each per-candidate fixpoint is correspondingly cheap. Our provenance graph replaces every fix-point with an on-graph proof search over the candidate's premises, finishing all five circuits in 4 s (LSTM) to 11 min (LeNet). At larger scale in RQ1 (tens of millions of constraints), the same cost may take days; the graph is what makes that scale tractable.
Our tool. Our tool reduces constraints by 15.90% (RNN) to 51.60% (LSTM), the only substantial reductions within budget across all five circuits. GRU and LSTM compose multiple checked gates over shared hidden-state signals per timestep, creating denser entailment opportunities than simpler recurrent and feed-forward circuits.
Answer to RQ3. Syntactic tools achieve at most 0.40% reduction (Circom O2, Distilling, CirC) or none at all (Clap, korrekt); exact SMT terminates only on a 116-constraint instance, confirming our result after 11.4 hours. Our tool alone removes redundant checks at substantial rates, achieving 15.90–51.60% reduction.
7 Discussion
Incompleteness. Exact maximum debloating is intractable at our target scale (Challenge C, §3.3). Our sound but incomplete analysis uses interval, known-bits, and constant domains, template-based entailment rules, and greedy removal. These polynomial-time approximations may miss redundant checks, but every removal remains justified by provenance-guided proof search over the surviving constraints. Missed removals affect optimization, not soundness; our evaluation demonstrates substantial reductions on circuits with tens of millions of constraints.
Scope. Our tool targets cross-constraint entailment among soundness checks, which is the dominant redundancy class in ML inference circuits. Algebraic simplifications (constant folding, linear-combination merging, common subexpression elimination) lie outside this scope; tools in §2.3 already cover them. The two classes touch disjoint constraints, so the passes can compose.
Generality on Non-ML Domains. In principle, our method is general: it consumes only R1CS and PLONKish constraint systems over , the generic formats that ZK frameworks emit regardless of the source domain. Only the density of redundancy is ML-specific, since gadget-templated compilation replicates the range, sign, and decomposition checks that drive our gains. The same checks recur beyond ML, although our evidence covers only ML circuits: signature-verification [1] and bignum arithmetic circuits [35] range-check limb decompositions in the same way, so they are natural next targets. The achievable reduction there is likely smaller, since field arithmetic and Merkle-path hashing, rather than such checks, account for most of their constraints. Porting stays within the framework: a new domain needs abstract domains and transfer functions matched to its invariants, which we leave to future work.
Scalability on Complex ML Models. Modern ZK ML workloads increasingly target transformers and large language models. These compile from the same operators as our benchmarks and therefore emit the same checks, so we expect the method to extend to them. Consistent with this, BERT-tiny yields 24.90–37.40% reduction (§6.2), stable as the circuit scales 32× (§6.3). We presume the trend continues beyond this scale, though end-to-end evaluation is currently precluded by prover memory. It is a bottleneck for ZK ML at large rather than for our analysis, with GPT-2 alone requiring roughly 1 TB of RAM [12].
8 Related Work
ZK machine learning and acceleration. A broad literature authors circuits for specific model families with custom gadgets and protocol choices: zkCNN [43], vCNN [39], and pvCNN [71] for CNNs; zkLLM [63] for language models; and works on decision-tree predictions [77], proofs of training [25], and R1CS gadgets for NN primitives [22]. A complementary line reduces proving cost without post-processing the constraints: folding schemes [36, 37] amortize repeated structure; lookup arguments [4, 23, 29, 55] offload nonlinearities to tables; GKR-based protocols [68, 72] prove layered computations via sumcheck; and hardware work [40, 44] lowers prover cost directly. These choices are made at authoring time or per-operation; our debloater is a post-pass that removes constraints already redundant by composition, and is therefore orthogonal.
DNN verification. Neural-network verifiers use abstract interpretation and bound propagation to prove input-output properties: [26] introduced abstract interpretation for certification; Reuplex [33] and Marabou [34] combine Simplex with ReLU case splitting; ERAN [57, 58] uses zonotope and polyhedral abstractions;
and -CROWN [70, 73, 76] combines linear bounds with branch-and-bound; and DeepSRGR [74] tightens neuron bounds via LP. We share the use of abstract domains, but our object is the compiled ZK constraint system over , with lookups, copy constraints, and decompositions that have no direct NN analogue, and our question is constraint entailment: whether follows from , not whether a network satisfies an input-output property.
Program analysis on ZK circuits. Static analysis has been applied to ZK circuits primarily for soundness. QED [49] combines unique-constraint propagation with SMT to flag under-constrained circuits, finding genuine vulnerabilities in production Circom; Coda [42] uses a refinement-typed language to uncover bugs in widely-used libraries; and AC [75] and Ecne [69] detect under-constraint patterns algebraically or by uniqueness propagation. These tools ask whether the witness set of is too large; we ask whether individual constraints contribute to keeping it small. The analyses are therefore complementary.
Software debloating. Debloating is borrowed from work that removes unused code or runtime checks. Trimmer [56], RAZOR [53], and Chisel [30] trim against configurations, representative traces, or behavioral specifications, and BB-DSE [9] strips infeasible branches in obfuscated binaries; SanRazor [78] and ASAP [67] target redundant sanitizer checks. Closer in shape is LClean [45], which prunes redundant test-coverage labels by per-label SMT entailment (sound, incomplete). All these tools operate over control-flow IRs. Our setting has no control flow and requires exact witness-set preservation: each removal is a one-sided-sound entailment discharged via a pre-computed AND/OR provenance graph rather than per-candidate SMT, scaling to constraints.
9 Conclusion
We presented a sound debloater combining whole-circuit abstract interpretation with provenance-guided removal. Across ezk1 and zkml circuits from four architecture families, it preserves the witness set while removing 25.5% of constraints and reducing proving time by 33.4% on average.
Acknowledgments
The HKUST authors were supported in part by a grant from the Research Grants Council of the Hong Kong Special Administrative Region, China HKUST (No. R6005-25) and a RGC GRF grant under the contract 16214723.
References
[1] 0xPARC. 2022. circom-ecdsa. https://github.com/0xPARC/circom-ecdsa. Big integer arithmetic and secp256k1 ECC operations in circom. [2] Martin Abadi, Paul Barham, Jianmin Chen, Zhifeng Chen, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Geoffrey Irving, Michael Isard, Manjunath Kudlur, Josh Levenberg, Rajat Monga, Sherry Moore, Derek G. Murray, Benoit Steiner, Paul Tucker, Vijay Vasudevan, Pete Warden, Martin Wicke, Yuan Yu, and Xiaoqiang Zheng. 2016. TensorFlow: a system for large-scale machine learning. In Proceedings of the 12th USENIX Conference on Operating Systems Design and Implementation (Savannah, GA, USA) (OSDI'16). USENIX Association, USA, 265–283. [3] Elvira Albert, Marta Bellés-Muñoz, Miguel Isabel, Clara Rodríguez-Núñez, and Albert Rubio. 2022. Distilling Constraints in Zero-Knowledge Protocols. In Computer Aided Verification: 34th International Conference, CAV 2022, Haifa, Israel, August 7–10, 2022, Proceedings, Part I (Haifa, Israel). Springer-Verlag, Berlin, Heidelberg, 430–443. doi:10.1007/978-3-031-13185-1_21
[4] Arasu Arun, Srinath Setty, and Justin Thaler. 2024. Jolt: SNARKs for Virtual Machines via Lookups. In Advances in Cryptology – EUROCRYPT 2024: 43rd Annual International Conference on the Theory and Applications of Cryptographic Techniques, Zurich, Switzerland, May 26–30, 2024, Proceedings, Part VI (Zurich, Switzerland). Springer-Verlag, Berlin, Heidelberg, 3–33. doi:10.1007/978-3-031-58751-1_1
[5] Axiom. n.d.. halo2: Axiom's fork of the Halo2 proving system. https://github.com/axiom-crypto/halo2.
[6] Aztec. 2022. Disclosure of recent vulnerabilities. https://hackmd.io/@aztec-network/disclosure-of-recent-vulnerabilities.
[7] Aztec Labs. n.d.. Noir: The Programming Language for Private Apps. https://noir-lang.org/.
[8] Haniel Barbosa, Clark Barrett, Martin Brain, Gereon Kremer, Hanna Lachnitt, Makai Mann, Abdalrhman Mohamed, Mudathir Mohamed, Aina Niemetz, Andres Nötzli, Alex Ozdemir, Mathias Preiner, Andrew Reynolds, Ying Sheng, Cesare Tinelli, and Yoni Zohar. 2022. cvc5: A Versatile and Industrial-Strength SMT Solver. In Tools and Algorithms for the Construction and Analysis of Systems, Dana Fisman and Grigore Rosu (Eds.). Springer International Publishing, Cham, 415–442. doi:10.1007/978-3-030-09524-9_24
[9] Sébastien Bardin, Robin David, and Jean-Yves Marion. 2017. Backward-Bounded DSE: Targeting Infeasibility Questions on Obfuscated Codes. In 2017 IEEE Symposium on Security and Privacy (SP). 633–651. doi:10.1109/SP.2017.36
[10] Marta Bellés-Muñoz, Miguel Isabel, Jose Luis Muñoz-Tapia, Albert Rubio, and Jordi Baylina. 2023. Circom: A Circuit Description Language for Building Zero-Knowledge Applications. IEEE Transactions on Dependable and Secure Computing 20, 6 (2023), 4733–4751. doi:10.1109/TDSC.2022.3232813
[11] Eli Ben-Sasson, Alessandro Chiesa, Daniel Genkin, Eran Tromer, and Madars Virza. 2013. SNARKs for C: Verifying Program Executions Succinctly and in Zero Knowledge. Cryptology ePrint Archive, Paper 2013/507. https://eprint.iacr.org/2013/507
[12] Bing-Jyue Chen, Suppakt Waiwitlikhit, Ion Stoica, and Daniel Kang. 2024. ZKML: An Optimizing System for ML Inference in Zero-Knowledge Proofs. In Proceedings of the Nineteenth European Conference on Computer Systems (Athens, Greece) (EuroSys '24). Association for Computing Machinery, New York, NY, USA, 560–574. doi:10.1145/3627703.3650088
[13] Collin Chin, Howard Wu, Raymond Chu, Alessandro Coglio, Eric McCarthy, and Eric Smith. 2021. Leo: A Programming Language for Formally Verified, Zero-Knowledge Applications. Cryptology ePrint Archive, Paper 2021/651. https://eprint.iacr.org/2021/651
[14] Kyunghyun Cho, Bart van Merriënboer, Caglar Gulcehre, Dzmitry Bahdanau, Fethi Bougares, Holger Schwenk, and Yoshua Bengio. 2014. Learning Phrase Representations using RNN Encoder–Decoder for Statistical Machine Translation. In Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP), Alessandro Moschitti, Bo Pang, and Walter Daelmans (Eds.). Association for Computational Linguistics, Doha, Qatar, 1724–1734. doi:10.3115/v1/D14-1179
[15] Patrick Couset and Radhia Couset. 1977. Abstract interpretation: a unified lattice model for static analysis of programs by construction or approximation of fix-points. In Proceedings of the 4th ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages (Los Angeles, California) (POPL '77). Association for Computing Machinery, New York, NY, USA, 238–252. doi:10.1145/512950.512973
[16] Patrick Couset and Radhia Couset. 1979. Systematic design of program analysis frameworks. In Proceedings of the 6th ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages (San Antonio, Texas) (POPL '79). Association for Computing Machinery, New York, NY, USA, 269–282. doi:10.1145/567752.567778
[17] Johan de Kleer. 1986. An assumption-based TMS. Artif. Intell. 28, 2 (March 1986), 127–162. doi:10.1016/0004-3702(86)90008-0
[18] Jon Doyle. 1979. A truth maintenance system. Artificial Intelligence 12, 3 (1979), 231–272. doi:10.1016/0004-3702(79)90008-0
[19] Jacob Eberhardt and Stefan Tai. 2018. ZokRates - Scalable Privacy-Preserving Off-Chain Computations. In 2018 IEEE International Conference on Internet of Things (iThings) and IEEE Green Computing and Communications (GreenCom) and IEEE Cyber and Physical and Social Computing (CPSCom) and IEEE Smart Data (SmartData). 1084–1091. doi:10.1109/Cybermatics.2018.2018.00199
[20] Electric Coin Company. 2022. halo2. https://github.com/zcash/halo2. The Halo2 zero-knowledge proving system.
[21] Jeffrey L. Elman. 1990. Finding Structure in Time. Cognitive Science 14, 2 (1990), 179–211. doi:10.1207/s15516709cog1402_1
[22] Boyuan Feng, Lianke Qin, Zhenfei Zhang, Yufei Ding, and Shumo Chu. 2021. ZEN: An Optimizing Compiler for Verifiable, Zero-Knowledge Neural Network Inferences. Cryptology ePrint Archive, Paper 2021/087. https://eprint.iacr.org/2021/087
[23] Ariel Gabizon and Zachary J. Williamson. 2020. plookup: A simplified polynomial protocol for lookup tables. Cryptology ePrint Archive, Paper 2020/315. https://eprint.iacr.org/2020/315
[24] Ariel Gabizon, Zachary J. Williamson, and Oana Ciobotaru. 2019. PLONK: Permutations over Lagrange-bases for Oecumenical Noninteractive arguments
of Knowledge. Cryptology ePrint Archive, Paper 2019/953. https://eprint.iacr.org/2019/953
[25] Sanjam Garg, Aarushi Goel, Somesh Jha, Saeed Mahloujifar, Mohammad Mahmoody, Guru-Vamsi Policharla, and Mingyuan Wang. 2023. Experimenting with Zero-Knowledge Proofs of Training. In Proceedings of the 2023 ACM SIGSAC Conference on Computer and Communications Security (Copenhagen, Denmark) (CCS '23). Association for Computing Machinery, New York, NY, USA, 1880–1894. doi:10.1145/3576915.3623202
[26] Timon Gehr, Matthew Mirman, Dana Drachsler-Cohen, Petar Tsankov, Swarat Chaudhuri, and Martin Vechev. 2018. AI2: Safety and Robustness Certification of Neural Networks with Abstract Interpretation. In 2018 IEEE Symposium on Security and Privacy (SP). 3–18. doi:10.1109/SP.2018.00058
[27] S Goldwasser, S Micali, and C Rackoff. 1985. The knowledge complexity of interactive proof-systems. In Proceedings of the Seventeenth Annual ACM Symposium on Theory of Computing (Providence, Rhode Island, USA) (STOC '85). Association for Computing Machinery, New York, NY, USA, 291–304. doi:10.1145/22145.22178
[28] Jens Groth. 2016. On the Size of Pairing-Based Non-interactive Arguments. In Proceedings, Part II, of the 35th Annual International Conference on Advances in Cryptology – EUROCRYPT 2016 - Volume 9666. Springer-Verlag, Berlin, Heidelberg, 305–326. doi:10.1007/978-3-662-49896-5_11
[29] Ulrich Haböck. 2022. Multivariate lookups based on logarithmic derivatives. Cryptology ePrint Archive, Paper 2022/1530. https://eprint.iacr.org/2022/1530
[30] Kihong Heo, Woosuk Lee, Pardis Pashahkanloo, and Mayau Naik. 2018. Effective Program Debloating via Reinforcement Learning. In Proceedings of the 2018 ACM SIGSAC Conference on Computer and Communications Security (Toronto, Canada) (CCS '18). Association for Computing Machinery, New York, NY, USA, 380–394. doi:10.1145/3243734.3243838
[31] Sepp Hochreiter and Jürgen Schmidhuber. 1997. Long Short-Term Memory. Neural Computation 9, 8 (November 1997), 1735–1780. doi:10.1162/neco.1997.9.8.1735
[32] Daniel Kang, Tatsunori Hashimoto, Ion Stoica, and Yi Sun. 2022. Scaling up Trustless DNN Inference with Zero-Knowledge Proofs. arXiv:2210.08674 [cs.CR] https://arxiv.org/abs/2210.08674
[33] Guy Katz, Clark Barrett, David L Dill, Kyle Julian, and Mykel J Kochenderfer. 2017. Relupex: An efficient SMT solver for verifying deep neural networks. In International conference on computer aided verification. Springer, 97–117. doi:10.1007/978-3-319-63387-9_5
[34] Guy Katz, Derek A Huang, Duligur Ibeling, Kyle Julian, Christopher Lazarus, Rachel Lim, Parth Shah, Shantanu Thakoor, Haoze Wu, Aleksandar Zeljic, David L. Dill, Mykel J. Kochenderfer, and Clark W. Barrett. 2019. The marabou framework for verification and analysis of deep neural networks. In International conference on computer aided verification. Springer, Springer, Cham, 443–452. doi:10.1007/978-3-030-25540-4_26
[35] Ahmed Kosba, Charalampos Papamanthou, and Elaine Shi. 2018. xJsnark: A Framework for Efficient Verifiable Computation. In 2018 IEEE Symposium on Security and Privacy (SP). 944–961. doi:10.1109/SP.2018.00018
[36] Abhiram Kothapalli and Srinath Setty. 2024. HyperNova: Recursive Arguments for Customizable Constraint Systems. In Advances in Cryptology – CRYPTO 2024, Leonid Reyzin and Douglas Stebilia (Eds.). Springer Nature Switzerland, Cham, 345–379.
[37] Abhiram Kothapalli, Srinath Setty, and Ioanna Tzialia. 2022. Nova: Recursive Zero-Knowledge Arguments from Folding Schemes. In Advances in Cryptology – CRYPTO 2022, Yegveniy Dodis and Thomas Shrimpton (Eds.). Springer Nature Switzerland, Cham, 359–388. doi:10.1007/978-3-031-15985-5_13
[38] Y. Lecun, L. Bottou, Y. Bengio, and P. Haffner. 1998. Gradient-based learning applied to document recognition. Proc. IEEE 86, 11 (1998), 2278–2324. doi:10.1109/5.726791
[39] Seunghwa Lee, Hankyung Ko, Jihye Kim, and Hyunok Oh. 2024. vCNN: Verifiable Convolutional Neural Network Based on zk-SNARKs. IEEE Trans. Dependable Secur. Comput. 21, 4 (July 2024), 4254–4270. doi:10.1109/TDSC.2023.3348760
[40] Muyang Li, Yueteng Yu, Bangyan Wang, Xiong Fan, and Shuwen Deng. 2025. ZKPoG: Accelerating WitGen-Incorporated End-to-End Zero-Knowledge Proof on GPU. Cryptology ePrint Archive, Paper 2025/765. https://eprint.iacr.org/2025/765
[41] Paolo Liberatore. 2005. Redundancy in logic I: CNF propositional formulae. Artificial Intelligence 63, 2 (April 2005), 203–232. doi:10.1016/j.artint.2004.11.002
[42] Junrui Liu, Ian Kretz, Hanzhi Liu, Bryan Tan, Jonathan Wang, Yi Sun, Luke Pearson, Anders Miltner, Isl Dillig, and Yu Feng. 2024. Certifying zero-knowledge circuits with refinement types. In 2024 IEEE Symposium on Security and Privacy (SP). IEEE, 1741–1759. doi:10.1109/SP54263.2024.00078
[43] Tianyi Liu, Xiang Xie, and Yupeng Zhang. 2021. zkCNN: Zero Knowledge Proofs for Convolutional Neural Network Predictions and Accuracy. In Proceedings of the 2021 ACM SIGSAC Conference on Computer and Communications Security (Virtual Event, Republic of Korea) (CCS '21). Association for Computing Machinery, New York, NY, USA, 2968–2985. doi:10.1145/3460120.3485379
[44] Weiliang Ma, Qian Xiong, Xuanhua Shi, Xiaosong Ma, Hai Jin, Haozhiyu Kuang, Mingyu Gao, Ye Zhang, Haichen Shen, and Weifang Hu. 2023. GZKP: A GPU Accelerated Zero-Knowledge Proof System. In Proceedings of the 28th ACM
International Conference on Architectural Support for Programming Languages and Operating Systems, Volume 2 (Vancouver, BC, Canada) (ASPLOS 2023). Association for Computing Machinery, New York, NY, USA, 340–353. doi:10.1145/3575693.3575711
[45] Michaël Marcozzi, Sébastien Bardin, Nikolai Kosmatov, Mike Papadakis, Virgile Prevosto, and Loic Correnson. 2018. Time to clean your test objectives. In Proceedings of the 40th International Conference on Software Engineering (Gothenburg, Sweden) (ICSE '18). Association for Computing Machinery, New York, NY, USA, 456–467. doi:10.1145/3180155.3180191
[46] Modulus Labs. 2023. The Cost of Intelligence: Proving Machine Learning Inference with Zero-Knowledge. https://github.com/Modulus-Labs/Papers/blob/master/Cost_of_Intelligence.pdf.
[47] NIST. 2019. CVE-2019-7167. https://nvd.nist.gov/vuln/detail/cve-2019-7167.
[48] Alex Ozdemir, Fraser Brown, and Riad S Wahby. 2022. CirC: Compiler infrastructure for proof systems, software verification, and more. In 2022 IEEE Symposium on Security and Privacy (SP). IEEE, 2248–2266. doi:10.1109/SP46214.2022.9833782
[49] Shankara Pailoor, Yanju Chen, Franklyn Wang, Clara Rodriguez, Jacob Van Geffen, Jason Morton, Michael Chu, Brian Gu, Yu Feng, and Iraj Dillig. 2023. Automated Detection of Under-Constrained Circuits in Zero-Knowledge Proofs. Proc. ACM Program. Lang. 7, PLDI, Article 168 (June 2023), 23 pages. doi:10.1145/3591282
[50] Terence Parr. [n.d]. ANTLR4: Another Tool for Language Recognition. https://www.antlr.org.
[51] Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, Alban Desmaison, Andreas Köpf, Edward Yang, Zach DeVito, Martin Raison, Alykhan Tejani, Sasank Chilamkurtty, Benoit Steiner, Lu Fang, Junjie Bai, and Soumith Chintala. 2019. PyTorch: an imperative style, high-performance deep learning library. In Proceedings of the 33rd International Conference on Neural Information Processing Systems. Curran Associates Inc., Red Hook, NY, USA, 8024–8035.
[52] Zhizhi Peng, Chonghe Zhao, Taotao Wang, Guofu Liao, Zibin Lin, Yifeng Liu, Bin Cao, Long Shi, Qing Yang, and Shengli Zhang. 2026. A Survey of Zero-Knowledge Proof Based Verifiable Machine Learning. Artificial Intelligence Review 59, Article 157 (2026), 51 pages. doi:10.1007/s10462-026-11557-y
[53] Chenxiong Qian, Hong Hu, Mansour Alharthi, Pak Ho Chung, Taesoo Kim, and Wenke Lee. 2019. RAZOR: A Framework for Post-deployment Software Debloating. In 28th USENIX Security Symposium (USENIX Security 19). USENIX Association, Santa Clara, CA, 1733–1750. https://www.usenix.org/conference/usenixsecurity19/presentation/qian
[54] Mark Sandler, Andrew Howard, Menglong Zhu, Andrey Zhmoginov, and Liang-Chieh Chen. 2018. MobileNetV2: Inverted Residuals and Linear Bottlenecks. In 2018 IEEE/CVF Conference on Computer Vision and Pattern Recognition. 4510–4520. doi:10.1109/CVPR.2018.00474
[55] SRinath Setty, Justin Thaler, and Riad Wahby. 2024. Unlocking the Lookup Singularity with Lasso. In Advances in Cryptology – EUROCRYPT 2024. Marc Joye and Gregor Leander (Eds.). Springer Nature Switzerland, Cham, 180–209. doi:10.1007/978-3-031-58751-1_7
[56] Hashim Sharif, Muhammad Abubakar, Ashish Gehani, and Fareed Zaffar. 2018. TRIMMER: application specialization for code debloating. In Proceedings of the 33rd ACM/IEEE International Conference on Automated Software Engineering (Montpellier, France) (ASE '18). Association for Computing Machinery, New York, NY, USA, 329–339. doi:10.1145/3238147.3238160
[57] Gagandeep Singh, Timon Gehr, Matthew Mirman, Markus Püschel, and Martin Vechev. 2018. Fast and effective robustness certification. In Proceedings of the 32nd International Conference on Neural Information Processing Systems (Montréal, Canada) (NIPS'18). Curran Associates Inc., Red Hook, NY, USA, 10825–10836.
[58] Gagandeep Singh, Timon Gehr, Markus Püschel, and Martin Vechev. 2019. An abstract domain for certifying neural networks. Proc. ACM Program. Lang. 3, POPL, Article 41 (Jan. 2019), 30 pages. doi:10.1145/3290354
[59] socathie. [n.d.]. circomlib-ml: Circom Circuits Library for Machine Learning. https://github.com/socathie/circomlib-ml.
[60] Fatemeh Heidari Souneshjani, Mathias Hall-Andersen, MohammadMahdi Jahanara, Jeffrey Kam, Jan Gorzny, and Mohsen Ahmadvand. 2023. Automated Analysis of Halo2 Circuits. In Proceedings of the 21st International Workshop on Satisfiability Modulo Theories (SMT 2023) (CEUR Workshop Proceedings, Vol. 3429). CEUR-WS.org, 3–17. https://ceur-ws.org/Vol-3429/paper3.pdf
[61] Tobin South, Alexander Camuto, Shayla Nguyen, Robert Mahari, Christian Paquin, Jason Morton, and Alex 'Sandy' Pentland. 2024. Verifiable evaluations of machine learning models using zkSNARKs. arXiv:2402.02675 [cs.LG] https://arxiv.org/abs/2402.02675
[62] Marco Stronati, Denis Firsov, Antonio Locascio, and Benjamin Livshits. 2024. Clap: A Semantic-Preserving Optimizing eDSL for Plonkish Proof Systems. arXiv:2405.12115 [cs.CR]. https://arxiv.org/abs/2405.12115
[63] Haochen Sun, Jason Li, and Hongyang Zhang. 2024. zkLLM: Zero Knowledge Proofs for Large Language Models. In Proceedings of the 2024 ACM SIGSAC Conference on Computer and Communications Security. Association for Computing Machinery, New York, NY, USA, 4405–4419. doi:10.1145/3658644.3670334
[64] The LLVM Project. [n.d.]. Known Bits Analysis — LLVM Documentation. https://llvm.org/docs/GlobalSel/KnownBits.html.
[65] The Rocg development team. n.d.. The Rocg Prover. https://rocg-prover.org/
[66] Iulia Turc, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. Well-Read Students Learn Better: On the Importance of Pre-training Compact Models. arXiv:1908.08962 [cs.CL]. https://arxiv.org/abs/1908.08962
[67] Jonas Wagner, Volodymyr Kuznetsov, George Candea, and Johannes Kinder. 2015. High System-Code Security with Low Overhead. In 2015 IEEE Symposium on Security and Privacy. 866–879. doi:10.1109/SP.2015.558
[68] Riad S. Wahby, Ioanna Tzialla, Abhi Shelat, Justin Thaler, and Michael Wal-fish. 2018. Doubly-Efficient zkSNARKs Without Trusted Setup. In 2018 IEEE Symposium on Security and Privacy (SP). 926–943. doi:10.1109/SP.2018.00060
[69] Franklyn Wang. 2022. Ecne: Automated Verification of ZK Circuits. https://oxparc.org/blog/ecne. 0xPARC writeup.
[70] Shiqi Wang, Huan Zhang, Kaidi Xu, Xue Lin, Suman Jana, Cho-Jui Hsieh, and J Zico Kolter. 2021. Beta-CROWN: Efficient Bound Propagation with per-neuron Split Constraints for Neural Network Robustness Verification. In Advances in Neural Information Processing Systems, Vol. 34. Curran Associates, Inc., Red Hook, NY, USA, 29909–29921. https://proceedings.neurips.cc/paper/2021/hash/fac7fead96dafceaf80c1daffeea824-Abstract.html
[71] Jiasi Weng, Jian Weng, Gui Tang, Anjia Yang, Ming Li, and Jia-Nan Liu. 2023. pvCNN: Privacy-Preserving and Verifiable Convolutional Neural Network Testing. Trans. Info. For. Sec. 18 (Jan. 2023), 2218–2233. doi:10.1109/TIFS.2023.3262932
[72] Tiacheng Xie, Jiaheng Zhang, Yupeng Zhang, Charalampos Papamanthou, and Dawn Song. 2019. Libra: Succinct Zero-Knowledge Proofs with Optimal Prover Computation. In Advances in Cryptology — CRYPTO 2019: 39th Annual International Cryptology Conference, Santa Barbara, CA, USA, August 18–22, 2019, Proceedings, Part III (Santa Barbara, CA, USA). Springer-Verlag, Berlin, Heidelberg, 733–764. doi:10.1007/978-3-030-26954-8_24
[73] Kaidi Xu, Huan Zhang, Shiqi Wang, Yihan Wang, Suman Jana, Xue Lin, and Cho-Jui Hsieh. 2021. Fast and Complete: Enabling Complete Neural Network Verification with Rapid and Massively Parallel Incomplete Verifiers. In International Conference on Learning Representations. https://openreview.net/forum?id=nVZXBI6lLn
[74] Pengfei Yang, Renjie Li, Jianlin Li, Cheng-Chao Huang, Jingyi Wang, Jun Sun, Bai Xue, and Lijun Zhang. 2021. Improving Neural Network Verification through Spurious Region Guided Refinement. In Tools and Algorithms for the Construction and Analysis of Systems, Jan Friso Groote and Kim Guldstrand Larsen (Eds.). Springer International Publishing, Cham, 389–408. doi:10.1007/978-3-030-72016-2_21
[75] Qizhe Yang, Boxuan Liang, Hao Chen, and Guoqiang Li. 2026. AC4: Algebraic Computation Checker for Circuit Constraints in Zero-Knowledge Proofs. Form. Asp. Comput. 38, 1, Article 11 (March 2026), 20 pages. doi:10.1145/3786607
[76] Huan Zhang, Tsui-Wei Weng, Pin-Yu Chen, Cho-Jui Hsieh, and Luca Daniel. 2018. Efficient Neural Network Robustness Certification with General Activation Functions. In Advances in Neural Information Processing Systems, Vol. 31. Curran Associates, Inc., Red Hook, NY, USA, 4939–4948. https://proceedings.neurips.cc/paper/2018/hash/d04863f100d59b3e6688a11f95b0ae60-Abstract.html
[77] Jiaheng Zhang, Zhiyong Fang, Yupeng Zhang, and Dawn Song. 2020. Zero Knowledge Proofs for Decision Tree Predictions and Accuracy. In Proceedings of the 2020 ACM SIGSAC Conference on Computer and Communications Security (Virtual Event, USA) (CCS '20). Association for Computing Machinery, New York, NY, USA, 2039–2053. doi:10.1145/3372297.3417278
[78] Jiang Zhang, Shuai Wang, Manuel Rigger, Pinjia He, and Zhendong Su. 2021. SANRAZOR: Reducing Redundant Sanitizer Checks in C/C++ Programs. In 15th USENIX Symposium on Operating Systems Design and Implementation (OSDI 21). USENIX Association, 479–494. https://www.usenix.org/conference/osdi21/presentation/zhang
A Open Science
Our complete Rust implementation and evaluation artifact are available at https://github.com/xuezhantong/zk-debloater.
Artifacts provided. The bundle contains the tool; model generators and halo2-to-JSON extractor; R1CS corpus; prover/verifier sources; and drivers and results for every experiment in §6.
B Ethical Considerations
This work involves no human subjects, personal data, or vulnerability disclosure. Its static analysis removes only provably redundant constraints; we foresee no negative ethical implications.
C Generative AI Usage
We used OpenAI GPT and Anthropic Claude for proofreading, rephrasing, formatting, debugging, and implementation suggestions. The authors reviewed and verified all generated content and code for accuracy, correctness, and originality.
D Proof Sketches
We sketch the complexity theorem of §4.2 and the soundness theorems of §4.3.
PROOF SKETCH OF THEOREM 4.1. Each pair uses one transfer replay and premise trials of each, hence per pair and overall. The graph bounds follow from and at most premises per constraint node.
PROOF SKETCH OF THEOREM 4.2. By induction on the proof tree of under . Each internal node has , so satisfies . For an axiom node , Alg. 1 materializes precisely when . Since over-approximates , local soundness makes satisfy . Inductively, smaller subtrees prove that satisfies every . Thus over-approximates ; the replay that emitted (Alg. 2) and local soundness again imply that satisfies .
PROOF SKETCH OF THEOREM 4.3. Let witness the ordering. The forward inclusion is immediate. For the reverse, take . By Def. 6, every fact in is provable under and therefore holds by Theorem 4.2. Entailment soundness gives , hence . Iterating to yields .
E Illustrative Walkthrough
We trace interval facts through five constraints distilled from §3.2: , and . The and subsystems share no variables.
Phase 1: Abstract interpretation. Intersecting and tightens to ; propagating a partner bound through yields no tightening of or beyond their lookups. The fixpoint is and .
Phase 2: Provenance graph. Fig. 4(a) shows the result. Axiom nodes (blue) record lookups deriving their fact unconditionally: alone proves ; alone proves ; similarly for . Joint nodes (orange) record deriving a fact from a partner premise: together with yields , recorded as a premise edge from the fact node into the joint node. The four joint nodes form two 2-cycles among the facts.
Phase 3: Debloating. The filter admits the four lookups but rejects , whose gate rule requires constants. The loop removes because proves , then retains because no survivor targets . It removes because and prove its obligations (Fig. 4(b)). Finally, proving would require and then itself; cycle detection (Alg. 3) therefore retains it. The final removal set is .
F Case Studies of Removed Constraints
§3 sketches a small illustrative example of how such redundancies arise in a ZK ML pipeline fragment. This appendix walks through

(a) Phase 2: fixpoint provenance graph.

(b) Phase 3: trial of on top of .
Figure 4: Provenance graph for the walkthrough (§E).
three real cases drawn from the benchmarks of Table 2, each isolating a distinct removal mechanism; together they cover the patterns we observe across both pipelines.
F.1 Range subsumption (zkml/MNIST-MLP)
Of the 791 removed constraints, 788 are lookups and 3 are gates. Each removed lookup is a range proof on a variable whose range is already pinned to an at-least-as-tight interval by some other constraint in the circuit. Three patterns recur on this benchmark and account for nearly all 788 lookup trims (Fig. 5).

Figure 5: Three range-subsumption patterns. Dashed boxes are the redundant lookups.
Pattern (a). The ReLU gadget contains a lookup table that, by construction, pins its output variable to . Further downstream, the compiler emits a separate, generic range check on the same variable against the wider interval [0, 256]. The first lookup already implies the second, so the second is removable.
Pattern (b). The ReLU gadget's output lookup pins the post-activation variable to [0, 128]. zkml's polynomial Packer (the inter-layer commitment gadget that runs after each ReLU) then commits to the same by range-checking the shifted expression against [0, 256]. The ReLU's existing bound already implies , so the Packer's check is redundant.
Pattern (c). Within a single VarDiv invocation, three constraints jointly bound the remainder : a gate fixing the divisor , a lookup on the multi-input expression , and a standalone lookup on . The first two together force , so the standalone -lookup adds nothing. When the divisor's constant value is independently provable (e.g., from a shared fixed cell that multiple VarDiv invocations reach through copy chains), the divisor-fixing gate itself becomes entailed and is dropped along with the lookup, removing two constraints per such VarDiv rather than one.
F.2 Activation-bound cascade (ezkl/BERT-tiny)
On BERT-tiny (2.87 M constraints after equality merging), the debloater removes 715,517 constraints, with gate trims (404,924) outnumbering lookup trims (310,593). Because ezkl keeps model weights in private advice columns, their values remain unknown to the analysis, and all 309,696 dot-product gates that compute the network's weighted sums survive verbatim. The trims trace to one of two cascades, both seeded by an upstream range bound on a variable (Fig. 6).

Figure 6: Two cascades on ezkl BERT-tiny, both seeded by an upstream range bound on the decomposed variable .
Pattern (a) accounts for 303,485 of the gate trims. Each lookup-table activation in ezkl is wrapped in a small equals-zero gadget that produces a Boolean mask indicating whether the activation's input is zero, used downstream by sign-handling logic. Once an upstream range check on either excludes zero or pins to zero, the mask collapses to a single value, and the gadget's two enforcing gates reduce to trivial identities (e.g., becomes once either side is pinned to zero). The entailment check then discharges both gates.
Pattern (b) accounts for all 310,593 lookup trims and the remaining 101,439 gate trims. ezkl decomposes each variable into sign and digit components and range-checks the components in matched pairs of lookups. The upstream range bound on subsumes one lookup of each pair, while the other survives as the lookup that defines the gadget. When the subsumed lookup's input is additionally pinned to a single constant, the lookup is first rewritten as an equality gate and then discharged; this rewrite path accounts for the 101,439 gate trims.
F.3 Recurrent amplification (zkml/PTB-LSTM)
PTB-LSTM yields the largest reduction in our corpus: 15,240 of 31,280 post-merge constraints removed. The mechanisms match those of §F.1; the amplifier is the LSTM cell's gadget multiplicity, replicated across timesteps (Fig. 7).

Figure 7: Each LSTM timestep emits the same gadget infrastructure once per row of the hidden state; the redundancies of §F.1 fire on every instance.
11,200 trims come from the intra-VarDiv pattern of §F.1 (c), 4,000 from the Packer-after-activation pattern of §F.1 (b), and the remaining 40 are terminal output range checks. What survives across timesteps (the FC dot-product gates, the gating multiplications, and the activation lookups themselves) defines the model's actual arithmetic. Recurrent and gated architectures reach the largest reductions in our corpus because they unroll proportionally more redundant gadget infrastructure than feed-forward ones, while the surviving computational core scales similarly.
G Empirical Soundness Validation
Debloating soundness rests on two arguments: the pen-and-paper proof in §4, which establishes that any committed removal preserves the witness set, and the mechanized per-removal proof search built into the debloater itself, which only commits to removing a constraint once the AND/OR provenance graph exhibits an alternative proof for every fact supports. The study below is an independent cross-check: it does not extend those arguments, but it exercises the end-to-end pipeline (circuit extraction, entailment heuristics, greedy commit, output rendering) with adversarial witnesses drawn from boundary-violation and field wrap-around attack models, to detect implementation bugs in the debloater.
G.1 Test design
For each pipeline-model pair we capture two snapshots: the pre-debloat constraint set and the post-debloat set .
Fig. 8 illustrates one iteration. We sample a removed lookup , pick an advice cell that appears in 's input expression, and set to an adversarial value drawn from one of two regimes: an integer-boundary perturbation just outside 's range ( or ), or a field wrap-around value drawn from (e.g., , , or for small , exercising the case where a witness satisfies an integer-range constraint mod but escapes the integer range itself). agrees with the original witness on every other cell. The original rejects by construction, since is violated. Soundness requires that some constraint in also rejects ; if every constraint accepts , the debloater has unsoundly trimmed .
We implement the loop in Rust. Each pipeline-model pair runs to a budget of 3 days. Sampling is random over the removed lookup set but coverage-prioritized, so every removed lookup is tested at least once.
Limitations. This testing pipeline is a sampling cross-check, not a soundness proof:
(i) Single-cell perturbations: only one advice cell is modified per iteration, so coordinated multi-cell witnesses that preserve gate equalities while violating are out of scope.
(ii) Sampling, not enumeration: coverage is at-least-once per removed lookup, not exhaustive across rows or attack patterns. We accept these gaps because empirical fuzzing at this scale cannot enumerate ; soundness against worst-case adversaries is under-written by the proofs above, not by this study.

Figure 8: One validation iteration.
G.2 Results
Table 4 reports the results. Across all 13 pipeline-model pairs we executed adversarial iterations and observed zero divergences between and . Coverage of was complete
on every benchmark: each removed lookup was tested at least once and, on the smaller zkml side, typically thousands of times.
Table 4: Empirical soundness validation on the RQ1 corpus.
| Model | Removed lookup count | Tests | Unsound |
|---|---|---|---|
| zkml | |||
| MNIST-MLP | 788 | 0 | |
| LeNet-5 | 9,378 | 0 | |
| PTB-RNN | 3,550 | 0 | |
| PTB-GRU | 9,000 | 0 | |
| PTB-LSTM | 9,640 | 0 | |
| BERT-tiny | 4,928 | 0 | |
| ezkl | |||
| MNIST-MLP | 2,755 | 0 | |
| LeNet-5 | 38,343 | 0 | |
| MobileNet-v2 | 871,475 | 0 | |
| PTB-RNN | 63,201 | 0 | |
| PTB-GRU | 210,201 | 0 | |
| PTB-LSTM | 252,001 | 0 | |
| BERT-tiny | 310,593 | 0 | |
| Total | 1,785,853 | 0 | |