Skip to content

Per-adapter budget-kwarg vocabulary: robustness semantics hardcodes torchattacks/foolbox spellings #323

Description

@stanlrt

From /simplify codebase sweep (2026-06-10).

robustness/semantics.py:68-70 (_TARGET_KWARG_KEYS), :132-156 (_resolve_epsilon over "eps"/"epsilon"/"epsilons"; _BUDGET_KEY_GROUPS with "alpha"/"step_size"/"steps"): the shared semantics builder knows torchattacks'/foolbox's parameter spellings by name. budget_kwarg_source correctly delegated WHICH dict to the adapter, but WHICH KEYS stayed central.

Cost: a new adapter with different spellings (ART #287: eps_step; cleverhans: nb_iter) silently reports epsilon=None/steps=None in RobustnessSemantics -- the "what actually executed" record degrades without an error. The misplaced-budget warning also misses unknown spellings.

Fix: per-adapter ClassVar mapping canonical budget fields to that library's kwarg names, declared next to budget_kwarg_source, e.g.

budget_kwarg_names = {"epsilon": ("eps",), "step_size": ("alpha",), "steps": ("steps",)}

Semantics consumes the mapping. Same pattern as baseline_kwarg_name on transparency adapters.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions