fix(ai-red-teaming): make extraction/membership/inversion work in the TUI - #138
Merged
Merged
Conversation
…st in the TUI Via the TUI the agent ran extraction with an empty query pool -> 0 target queries -> a bogus '0% clone' finding, while the SDK path (which fetches /pool) worked. Membership had the same latent gap, and model inversion had no agent tool at all. - Extraction: derive the query pool from the target's sibling /pool when none is given, and fail loudly on an empty pool instead of reporting a 0-query clone. Surface the full result the SDK already computes (soft fidelity, KL divergence, per-class fidelity, fidelity-vs-budget curve, surrogate accuracy) to the agent, and actually run the transfer test (measure_transfer now defaults on, exposed as a tool param). - Membership inference: derive member/non-member sets from the target's /members and /nonmembers endpoints when not supplied; fail loudly if either is empty. - Model inversion: add generate_inversion_attack (confidence / nes) - it did not exist as an agent tool. Infers input_dim/input_shape from a /pool sample, reconstructs per class, and reports per-class confidence + classes recovered. Bumps capability 1.12.0 -> 1.13.0. 14 new unit tests cover pool/member-set derivation, fail-loud guards, metric surfacing, and the new inversion tool.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Running the traditional-ML privacy attacks through the TUI agent did not match the SDK:
/pooland passes it in.metrics_detail.Evasion was unaffected (it perturbs a single input, no external dataset).
Fix (capability-only)
generate_extraction_attack): derive the query pool from the target's sibling/poolendpoint when none is given; fail loudly on an empty pool instead of a 0-query clone; surface the full SDK result to the agent (soft fidelity, KL divergence, per-class fidelity, fidelity-vs-budget curve, surrogate accuracy); actually run the transfer test (measure_transferdefaults on, exposed as a tool param).generate_membership_attack): derive member/non-member sets from/membersand/nonmemberswhen not supplied; fail loudly if either is empty.generate_inversion_attack): new agent tool (confidence / nes). Infersinput_dim/input_shapefrom a/poolsample, reconstructs per class, reports per-class confidence + classes recovered.Bumps capability 1.12.0 -> 1.13.0 (immutable content requires a bump).
Tests
14 new unit tests (
tests/test_attack_runner.py): pool/member-set derivation, fail-loud guards, rich-metric surfacing, transfer wiring, and the new inversion tool (dispatch registration, shape inference, per-class output, unknown-attack error).Validation
pytest tests/test_attack_runner.py-> 152 passed, 1 pre-existing failure (TestGenerateMultimodalAttack::test_generates_compiling_script_with_image) confirmed failing onorigin/main, unrelated to this change.ml-extraction-*targets to confirm extraction now queries the pool (non-zero fidelity), membership derives its sets, and inversion runs.