Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ATM: Remove redundant code #11321

Open
wants to merge 5 commits into
base: tiferet/endpoint-filters
Choose a base branch
from

Conversation

tiferet
Copy link
Contributor

@tiferet tiferet commented Nov 17, 2022

This PR is the code cleanup made possible by the previous few PRs. As such, it has a lot of lines of change (mostly code deletion 🥳), but the changes are conceptually small. I tried to make the commits as clear as possible, tackling one piece of complexity reduction per commit, and explaining it in the commit comment. Commit-by-commit review warmly recommended 😄

Note that this PR is based on the branch tiferet/endpoint-filters, because that branch has not yet been merged and I don't want to see the commits from #11281 in this PR as well.

main code deletions / simplifications

  • isOtherModeledArgument and isArgumentToBuiltinFunction contained the old logic for selecting negative endpoints for training. These can now be deleted, and replaced by a single base class that collects all EndpointCharacteristics that are currently used to indicate negative training samples: OtherModeledArgumentCharacteristic. This in turn lets us delete code from StandardEndpointFilters that effectively said that endpoints that are high-confidence non-sinks shouldn't be scored at inference time, either.
  • FilteringReason is no longer being used and can be deleted.
  • Delete CoreKnowledge and StandardEndpointFilters: All remaining functionality in CoreKnowledge and StandardEndpointFilters is only being used in EndpointCharacteristics, so it can be moved there as a small set of helper predicates.

Timing checks

Closes github/ml-ql-adaptive-threat-modeling#2110

@github-actions github-actions bot added the ATM label Nov 17, 2022
@tiferet tiferet marked this pull request as ready for review Nov 18, 2022
@tiferet tiferet requested a review from a team as a code owner Nov 18, 2022
@tiferet tiferet requested review from kaeluka and removed request for a team Nov 18, 2022
@tiferet tiferet force-pushed the tiferet/complexity-reduction branch from e6c76a5 to 9a37061 Compare Nov 19, 2022
tiferet added 5 commits Nov 21, 2022
`isOtherModeledArgument` and `isArgumentToBuiltinFunction` contained the old logic for selecting negative endpoints for training.

These can now be deleted, and replaced by a single base class that collects all EndpointCharacteristics that are currently used to indicate negative training samples: `OtherModeledArgumentCharacteristic`.

This in turn lets us delete code from `StandardEndpointFilters` that effectively said that endpoints that are high-confidence non-sinks shouldn't be scored at inference time, either.
All remaining functionality in `CoreKnowledge` is only being used in `EndpointCharacteristics`, so it can be moved there as a small set of helper predicates.
All remaining functionality in `StandardEndpointFilters` is only being used in `EndpointCharacteristics`, so it can be moved there as a small set of helper predicates.
@tiferet tiferet force-pushed the tiferet/complexity-reduction branch from 9a37061 to fac6641 Compare Nov 21, 2022
Copy link
Contributor

@kaeluka kaeluka left a comment

Approve

This is the kind of PR where I'm extra glad we have CI checks: big surface, but not much new logic ;)

I'll give this a formal approval once the first PR is merged and this has been rebased; but I've done the review now and it all looks good to me. I've left one question for my own understanding.

@owen-mc owen-mc changed the title Remove redundant code ATM: Remove redundant code Nov 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants