TorchLean API

NN.Examples.Verification.Robustness.VerifyMarginCert

VerifyMarginCert #

Lean checker for per-example logit-margin certificates (robust_margin_cert_v0_1).

This checker is intentionally lightweight: it does not re-run bound propagation. Instead, it verifies that the exported logit bounds imply the certified margin predicate:

logits_lo[label] > max_{j≠label} logits_hi[j]

Run: python3 scripts/verification/robustness/export_margin_cert.py lake exe verify -- margin-cert

Check the logit-margin predicate from exported bounds.

Returns true if lo[label] > max_{j≠label} hi[j].

Instances For

    Running counters for reporting nominal vs certified accuracy.

    • total : Nat

      total.

    • nominalOk : Nat

      nominal Ok.

    • certifiedOk : Nat

      certified Ok.

    Instances For

      Internal helpers.

      Check a robust_margin_cert_v0_1 JSON certificate file.

      If timing=true, prints per-example timings every timingEvery examples.

      Instances For

        Check a margin cert file with timing disabled (thin wrapper around checkWithTiming).

        Instances For

          CLI entry point: lake exe verify -- margin-cert [cert.json].

          If --timing is passed, prints timing information (optionally controlled by --timing-every=N).

          Instances For