ml_switcheroo.testing.bisector

Semantics Bisector: Automated Spec Repair.

This module implements a feedback loop (“Bisector”) that attempts to fix failing verification tests by incrementally relaxing the constraints in the ODL specifications. It closes the loop between Testing and Definition.

Capabilities:

  1. Tolerance Relaxation: If a test fails on numeric comparison, the bisector retries with looser rtol/atol values.

  2. Suggestion Generation: Returns a mutated OperationDef dict that passes tests, which can be used to patch the Knowledge Base.

Classes

SemanticsBisector

Automated tool to find working constraints for an operation.

Module Contents

class ml_switcheroo.testing.bisector.SemanticsBisector(runner: ml_switcheroo.testing.runner.EquivalenceRunner)

Automated tool to find working constraints for an operation.

Iterates through progressively relaxed constraints (e.g., tolerances) to find a configuration where the operation passes verification across frameworks.

runner
logger
propose_fix(op_name: str, op_def: Dict[str, Any]) Dict[str, Any] | None

Attempts to satisfy verification by mutating verification parameters.

Strategies: 1. Increase tolerances (1e-3 -> 1e-2 -> 1e-1).

Parameters:
  • op_name – Name of the operation.

  • op_def – The definition dictionary from SemanticsManager.

Returns:

A patched version of op_def if a fix was found, else None.

Return type:

Dict