TorchLean API

NN.Verification.Robustness.TorchLean

TorchLean Robustness Workflow #

End-to-end robustness certification for a TorchLean model.

We build a compact 2-class classifier in TorchLean, compile it to the verifier IR, and certify a margin condition on an $\ell^\infty$ input box using:

Spec we certify (binary logits):

$$ \forall x\in[x_0-\varepsilon,x_0+\varepsilon],\quad \operatorname{logit}_0(x)>\operatorname{logit}_1(x). $$

Run: lake exe verify -- torchlean-robustness lake exe verify -- torchlean-robustness --float32-mode ieee754exec

Input dimension for the TorchLean robustness example.

Instances For

    Hidden width for the TorchLean robustness example.

    Instances For

      Number of output logits/classes.

      Instances For

        Spec.Shape of one input vector supplied to the certified two-layer network.

        Instances For

          Parameter shapes list used by the compiled TorchLean program ([hiddenWeight,hiddenBias,outputWeight,outputBias]).

          Instances For

            Compute a conservative margin lower bound $\mathrm{lo}_0-\mathrm{hi}_1$ from logit bounds.

            Instances For

              Decide if the output bounds certify $\operatorname{logit}_0>\operatorname{logit}_1$.

              Instances For

                TorchLean program for a 2-layer ReLU MLP producing two logits.

                Instances For

                  Run the robustness check once under a chosen scalar backend α.

                  This compiles the TorchLean program to the verifier IR, then computes output bounds with IBP and an affine/CROWN-style pass.

                  Instances For

                    CLI entry point for the TorchLean robustness workflow.

                    This is wired into lake exe verify -- torchlean-robustness.

                    Instances For