TorchLean API

NN.Verification.VNNComp.MnistFC

VNN-COMP MNIST-FC Checker #

VNN-COMP-style mini-suite checker for the MNIST-FC benchmark.

The command consumes exported ONNX/VNNLIB JSON artifacts, runs TorchLean IBP or CROWN bounds on the imported MLP, and checks the VNNLIB disjunction-of-conjunctions constraints using a sufficient condition on the output box.

The checker expects exported JSON artifacts. Keep large VNN-COMP snapshots outside git, for example under _external/vnncomp/mnist_fc/, and pass explicit paths when needed.

Run (Lean): scripts/lake.sh exe verify -- vnncomp-mnistfc

Bound propagation/checking mode for the MNIST-FC mini-suite.

  • ibp : Mode

    IBP only: fast but loose.

  • crown : Mode

    Forward CROWN output box.

  • crownObj : Mode

    Backward CROWN objective pass for each VNNLIB row.

Instances For

    CLI spelling for a VNN-COMP checker mode.

    Instances For

      Parse the --mode value accepted by the MNIST-FC checker.

      Instances For

        Default ignored-local MNIST-FC weights export.

        Instances For

          Default ignored-local MNIST-FC suite export.

          Instances For

            Command-line options for the MNIST-FC VNN-COMP mini-suite verifier.

            The defaults point at ignored local artifact paths under _external/vnncomp/mnist_fc/.

            • weights : String

              Path to exported weights (model_weights.json).

            • suite : String

              Path to exported instance suite (suite.json).

            • max : ℕ

              Maximum number of instances to check (useful for local checks).

            • mode : Mode

              Bound propagation mode:

              • ibp: IBP only (fast, loose)
              • crown: forward CROWN (still produces just an output box)
              • crownobj: backward objective pass for each spec row
            Instances For

              Usage text printed by this tool (returned as an error message on --help).

              Instances For

                Fail early with a helpful message when an external artifact is missing.

                Unlike Data.requireFile, this appends the full usage text, since a missing VNN-COMP snapshot usually means the artifacts were never exported. It also keeps NN.API.Data.Sources and its CSV/.npy loader stack off this checker's import path.

                Instances For

                  Weights for one exported fully-connected layer ($y=Wx+b$).

                  Each layer stores PyTorch's row-major weights and bias with their checked dimensions.

                  Instances For

                    State-dict keys for the i-th linear layer exported by the Python script.

                    Instances For

                      Load an exported MNIST-FC model from JSON weights.

                      This expects keys like layers.0.weight, layers.0.bias, etc, and checks that the linear layer dimensions form a consistent chain.

                      Instances For

                        Lower the loaded weights into a CROWN Graph + ParamStore.

                        The graph alternates linear layers and ReLUs, ending with a linear layer. The number of layers comes from the export. Return its parameters, input/output dimensions, and output node id.

                        Instances For

                          Compute an output interval box using IBP (fast, loose).

                          Instances For

                            Compute an output interval box by running forward CROWN and evaluating the affine bounds on the input box.

                            Instances For

                              Compute per-node interval boxes to be used by the backward objective pass.

                              We start from IBP boxes and (when the input dimension is small) refine a small set of parent-node intervals by evaluating forward CROWN affines on the input box. This makes objective bounds tighter without paying the full cost of "evaluate every affine on the input box".

                              Instances For

                                Try to refute a single spec row using a backward CROWN objective bound.

                                We build an objective $\mathrm{obj}=\mathrm{row}$ and lower-bound $\mathrm{row}^{\mathsf{T}}y$ over the input box. If the lower bound is strictly greater than rhs, then the constraint rowᵀ y <= rhs cannot hold.

                                Instances For

                                  Refute a VNNLIB disjunction-of-conjunctions spec using per-row CROWN objective bounds.

                                  Each row is bounded directly, avoiding some correlations lost when evaluating a row over an output interval box. This implementation does not guarantee that every resulting bound is tighter.

                                  Instances For

                                    CLI entry point.

                                    This is wired into scripts/lake.sh exe verify -- vnncomp-mnistfc.

                                    Instances For