Computing the Missing Contract: Backward Quotients for Compositional Neural Network Verification

Checking that a deep neural network behaves safely usually fails for a simple reason: the checker runs out of GPU memory. One way around this is to cut the network into pieces and check each piece separately. That only works if someone states what the first piece must promise the second, meaning a bound on the activations at the cut. Today that promise is guessed. The front piece is run on random inputs, a box is drawn around the activations seen, and the box is widened each time a proof fails. Formal methods has a principled answer to this exact question. Given a whole-system requirement $S$ and a known component $A$, the specification quotient $S \div A$ is the weakest requirement that a missing component $B$ must meet so that the two together satisfy $S$. We propose to compute an approximation of this quotient for the back half of a network. The result is a property-directed interface contract that replaces the sampling-and-widening loop, and a failed check becomes either a real counterexample or a precise place to refine.

The two communities involved have developed mostly separately. Specification theorists treat the quotient as a central operation. Neural network verifiers reinvented assume-guarantee decomposition to escape memory limits and never borrowed it. This is the kind of parallel reinvention the interdisciplinary-silos direction describes, where different fields study the same structure under different vocabularies (TAMC preface). We use that direction as a lens rather than a mechanism. The contribution is carrying one precise algebraic tool, the adjoint of composition, into a setting where it has an obvious job to do.

Core Claim

Write a network as $f = g \circ h$, with a front piece $h$ and a back piece $g$ that meet at an interface activation $z$. The task is to prove $f(x) \in P$ for every input $x$ in an input set $X$. The weakest requirement on the front piece is the preimage

$$Q = \{\, z : g(z) \in P \,\},$$

and the property holds exactly when $h(X) \subseteq Q$. This is the Galois connection $A \parallel B \le S \iff B \le S \div A$ that underlies specification theories (Hennessy-Milner Logic with Greatest Fixed Points as a Complete Behavioural Specification Theory), instantiated for function composition.

For ReLU networks the exact $Q$ is a union of exponentially many polyhedra. However, any polyhedral inner approximation $\underline{Q} \subseteq Q$ still gives a sound decomposition, because the ordering is transitive: $h(X) \subseteq \underline{Q} \subseteq Q$. Such an inner approximation can be built by writing a linear lower bound on $g$ over a bounded region of the interface; the set where that bound satisfies $P$ lies inside $Q$. The claim is that a verifier which derives interface contracts by backward quotienting will solve strictly more of the CoVeNN benchmark suite than one that guesses them forward, at equal compute. The same procedure, unlike the current approach, produces counterexamples when a property is false.

Relation to Prior Work

The closest work, and the one this proposal is built against, is CoVeNN. CoVeNN cuts ResNets and variational autoencoders (VAEs) into subnetworks, guesses bounds on intermediate activations by sampling, verifies each piece with an off-the-shelf verifier, and loosens the bounds when a proof fails. It motivates this proposal in two ways. It shows that decomposition breaks the memory wall, solving 95 of 140 problems against 14 for the best standalone verifier. It also names tight intermediate assumptions as an open problem and is weak at falsification. Our proposal keeps CoVeNN's decomposition and underlying verifiers. It changes where the contract comes from: the contract is derived backward from the output property, instead of being inferred forward from samples.

Specification theory supplies the method. Moving from Specifications to Contracts in Component-Based Design proves that any specification theory with conjunction and quotient yields assume-guarantee contracts automatically. That result assumes the quotient is exact. We need, and will prove, the weaker statement that a sound under-approximate quotient keeps soundness and gives up only completeness.

Pacti implements quotients for polyhedral contracts using linear programming (LP) and a technique it calls context-aided variable elimination, and it applies them to derive perception-accuracy requirements from braking guarantees. Pacti also constrains the design. It works only for linear constraints, so it cannot be applied to a ReLU block directly. Our step is to linearize the back piece soundly over a region and then hand the resulting polyhedra to Pacti-style operations.

Other assume-guarantee work involving learned components takes different routes. Compositional Verification for Autonomous Systems with Deep Learning Components clusters inputs into safe regions and reports that writing contracts by hand is a barrier. Assume-Guarantee Reinforcement Learning fixes its contracts in advance. Both motivate automating contract generation, but neither computes a quotient.

Research Program

The procedure is a backward pass that meets a forward pass in the middle. The forward step runs a cheap bound propagation through $h$ and gives a box $R$ that contains $h(X)$. The backward step computes linear lower bounds on the margin of $g$ over $R$, one per output constraint in $P$. These define a polyhedron $\underline{Q}$ inside $R$ that is guaranteed to lie within the true quotient.

The check step then asks whether $h(X) \subseteq \underline{Q}$. We answer it by running a complete verifier on $h$ alone, with the facets of $\underline{Q}$ as linear output specifications. That subproblem fits in memory because $h$ is only part of the network.

If the check fails, the verifier returns an interface point $z^\*$ that is reachable from some input $x^\*$. We then evaluate $g(z^\*)$ exactly. If it violates $P$, we have a concrete counterexample $x^\*$. If it does not, the failure came from the looseness of the linear bound near $z^\*$. In that case we split $R$ around $z^\*$, recompute a tighter $\underline{Q}$ on each part, and repeat. The loop is counterexample-guided refinement over the interface space, which is where CoVeNN currently loosens by hand.

For $K$ cuts the quotient is applied repeatedly from the output backward, with each intermediate contract serving as the specification for the segment before it. To stop the number of facets from growing without bound across cuts, we cap it and merge facets using Pacti's elimination technique. The theoretical deliverables are a soundness theorem for the approximate quotient and a relative-completeness result stating that refinement converges whenever the property holds with a positive margin.

Baselines

The naive reference point is a monolithic verifier run on the whole network: NeuralSAT, and αβ-CROWN, which is a GPU verifier that combines linear bound propagation with branch-and-bound splitting. On the CoVeNN suite, NeuralSAT solves 14 of 140 problems, and monolithic verifiers run out of memory at around 9 residual blocks (CoVeNN). Beating this reference is necessary but uninformative, since CoVeNN already clears it.

The strongest competitor is CoVeNN itself, which reports 95 of 140 problems solved on its 7 networks, with successful verification up to ResNet-36. We will run it from its released code on the same GPU, with the same cut points, the same underlying verifiers, and the same per-property timeout. The file does not state CoVeNN's timeout, so we will adopt whatever its artifact uses. Beating CoVeNN means solving more of the 140 problems at matched wall-clock, or solving the same set with markedly fewer calls to the underlying verifier. It also means returning concrete counterexamples for properties that CoVeNN leaves undecided.

Two ablations isolate the quotient itself. The first is forward-only composition: $g$ is verified directly on the box $R$ produced by the forward pass, with no backward step. The second is our full refinement loop seeded with CoVeNN's sampled boxes instead of $\underline{Q}$. If either ablation matches the full method, the backward quotient is not what carries the result.

Why not just…?

Why not just keep CoVeNN and spend the extra budget on more sampling and loosening iterations? Sampling estimates where activations land. It carries no information about which activations matter for the property, so extra samples tighten the box uniformly rather than where proofs fail. The seeded-refinement ablation tests this directly by giving CoVeNN-style contracts the same refinement budget. If that ablation closes the gap, we will report the quotient as unnecessary.

Why not just propagate bounds forward through the front piece and use them as the back piece's assumption? This is the most serious alternative, because forward composition needs no quotient at all. Its weakness is that outer boxes lose precision with depth, and the back piece must then be verified over a region much larger than the property requires. The forward-only ablation settles the question. We expect it to lose mainly on the deeper ResNets, where box looseness compounds. If it does not lose there, the claim fails.

Why not just give αβ-CROWN more memory or finer input splitting? The reported memory wall at about 9 residual blocks is a property of joint bound tensors over the full depth, and input splitting does not shrink those tensors. That said, on shallow networks a monolithic verifier may well match us. We will report results stratified by depth rather than hide this.

Why not just use Pacti directly? Pacti's quotient is exact only for linear constraints, and a ReLU block is not linear. The linearization over a region is exactly what makes Pacti's operations applicable, so this is the component we reuse rather than a competitor.

Proposed Experiments

The main experiment uses CoVeNN's 7 networks and 140 properties. These cover local robustness for ResNet-6 through ResNet-36 on CIFAR-10, and reconstruction robustness for VAEs cut at the latent bottleneck. We report problems solved, wall-clock time, peak GPU memory, calls to the underlying verifier, and counterexamples found.

To measure contract tightness, we estimate the fraction of the true preimage covered by $\underline{Q}$. The true preimage is estimated by dense sampling of $g$ restricted to $R$. The comparison is against the sampled box CoVeNN would produce for the same cut.

A secondary, smaller experiment revisits Pacti's perception-braking example with a learned perception network in place of an abstract accuracy variable. The goal is to see whether a quotient-derived requirement on the network can be verified end to end. No reported result was found on Lacuna for Pacti's runtime on the autonomous-vehicle case, so this experiment is exploratory.

Two checks are decisive. The first is a soundness audit: every property we report as verified is attacked with strong gradient-based adversaries, and a single successful attack invalidates the method. The second is the forward-only ablation on ResNets deeper than 9 blocks. That is where the quotient must earn its place, and where a tie would mean the specification-theory transfer adds nothing beyond engineering.