Repository navigation
Disambiguate abbreviated custom slice indices in SingleSliceSpec. - #657
Merged
Merged
Conversation
copybara-service
Bot
force-pushed
the
cl/1013668176
branch
2 times, most recently
from
November 5, 2026 15:33
cb023f9 to
831b7b3
Compare
SingleSliceSpec.__str__ formats unnamed custom slices by interpolating the train and test index arrays directly. NumPy abbreviates arrays above its print threshold (1000 elements by default) to their first and last three values, so two custom groupings over more than 1000 examples that agree on those six values and share a group value produce the same string. AttackResults._group_results_by_slice keys per-slice results by that string, so summary(by_slices=True) merges the colliding slices into one section. This is a report-correctness issue: an audit over several custom subgroups can report the best attack of two subgroups under one label and drop the other subgroup's section. Callers can avoid it today by giving each grouping distinct group values and naming them via SlicingSpec.custom_slices_names. When NumPy would abbreviate an index array, the slice string now appends its shape, dtype and a truncated SHA-256 digest of its contents; smaller arrays format exactly as before. Slice strings (and summary keys) for large unnamed custom slices therefore change. Tests cover int and bool groupings of 2000 examples that differ only mid-array, determinism, unchanged output at the threshold, and separate per-slice summary sections. PiperOrigin-RevId: 1014685339
copybara-service
Bot
force-pushed
the
cl/1013668176
branch
from
November 5, 2026 15:35
831b7b3 to
8450e16
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.
Disambiguate abbreviated custom slice indices in SingleSliceSpec.
SingleSliceSpec.str formats unnamed custom slices by interpolating
the train and test index arrays directly. NumPy abbreviates arrays above
its print threshold (1000 elements by default) to their first and last
three values, so two custom groupings over more than 1000 examples that
agree on those six values and share a group value produce the same
string. AttackResults._group_results_by_slice keys per-slice results by
that string, so summary(by_slices=True) merges the colliding slices into
one section.
This is a report-correctness issue: an audit over several custom
subgroups can report the best attack of two subgroups under one label
and drop the other subgroup's section. Callers can avoid it today by
giving each grouping distinct group values and naming them via
SlicingSpec.custom_slices_names.
When NumPy would abbreviate an index array, the slice string now appends
its shape, dtype and a truncated SHA-256 digest of its contents; smaller
arrays format exactly as before. Slice strings (and summary keys) for
large unnamed custom slices therefore change. Tests cover int and bool
groupings of 2000 examples that differ only mid-array, determinism,
unchanged output at the threshold, and separate per-slice summary
sections.