Repository navigation
Preserve attacker features and loss config on MIA data slices. - #656
Merged
Merged
Conversation
copybara-service
Bot
force-pushed
the
cl/1013662085
branch
2 times, most recently
from
November 6, 2026 08:47
c759753 to
f9fdde0
Compare
`dataset_slicing._slice_data_by_indices` builds each subgroup slice as a fresh `AttackInputData` and copies only logits, probabilities, labels, losses, entropies and sample weights. It silently drops `extra_features_train` and `extra_features_test` and resets `loss_function` and `loss_function_using_logits` to their defaults. Every class, percentile, correctness or custom slice therefore trains attacks without the adversary features the caller supplied, and, when losses are not supplied, derives them with cross-entropy (and from logits) even when the caller configured a squared or custom loss on probabilities. Separately, `AttackInputData.get_loss_test` resolves the logits default with `bool(self.logits_test)`, which raises ValueError for any multi-element logits array when it is called before `get_loss_train`. Per-slice membership-inference results are computed against a different attacker and loss signal than the entire-dataset result, so subgroup privacy risk is mis-reported (typically understated when the dropped features or configured loss carry membership signal) for exactly the slices that subgroup auditing is meant to surface. The `get_loss_test` defect is a crash rather than a silent mis-measurement. Slices now carry the sliced extra features and inherit the parent's loss function and logits/probabilities choice, and `get_loss_test` uses the same `is not None` check as `get_loss_train`. Tests check that a class slice keeps the matching extra-feature rows and a custom probability-based loss (with losses equal to the parent's on those rows), and that calling `get_loss_test` first works with logits, probabilities or both. PiperOrigin-RevId: 1015345413
copybara-service
Bot
force-pushed
the
cl/1013662085
branch
from
November 6, 2026 09:02
f9fdde0 to
3e2b283
Compare
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.
Preserve attacker features and loss config on MIA data slices.
dataset_slicing._slice_data_by_indicesbuilds each subgroup slice as a freshAttackInputDataand copies only logits, probabilities, labels, losses, entropies and sample weights. It silently dropsextra_features_trainandextra_features_testand resetsloss_functionandloss_function_using_logitsto their defaults. Every class, percentile, correctness or custom slice therefore trains attacks without the adversary features the caller supplied, and, when losses are not supplied, derives them with cross-entropy (and from logits) even when the caller configured a squared or custom loss on probabilities. Separately,AttackInputData.get_loss_testresolves the logits default withbool(self.logits_test), which raises ValueError for any multi-element logits array when it is called beforeget_loss_train.Per-slice membership-inference results are computed against a different attacker and loss signal than the entire-dataset result, so subgroup privacy risk is mis-reported (typically understated when the dropped features or configured loss carry membership signal) for exactly the slices that subgroup auditing is meant to surface. The
get_loss_testdefect is a crash rather than a silent mis-measurement.Slices now carry the sliced extra features and inherit the parent's loss function and logits/probabilities choice, and
get_loss_testuses the sameis not Nonecheck asget_loss_train. Tests check that a class slice keeps the matching extra-feature rows and a custom probability-based loss (with losses equal to the parent's on those rows), and that callingget_loss_testfirst works with logits, probabilities or both.