-
Notifications
You must be signed in to change notification settings - Fork 68
Add LFBO Pattern Search #1115
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
base: main
Are you sure you want to change the base?
Add LFBO Pattern Search #1115
Conversation
|
|
||
| def encode_dim(self) -> int: | ||
| """ | ||
| Returns the dimension of the output of encode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand what this is? What is it encoding?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just the dimension of the encoding
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed the name to be more clear
| """ | ||
| raise NotImplementedError | ||
|
|
||
| def encode(self, value: object) -> list[float]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we reuse encode_scalar here? If not, I'd like to combine this with encode_scalar since they are solving the same problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jansel This is pretty much identical to encode_scalar for integer and poweroftwo. But the previous encode_scalar did not have any functionality for ListOf or PermutationFragments. How should we handle those two?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happy to rename everything to encode_scalar, but given ListOf and PermutationFragments, I think we should allow encode to output a list of floats
| self.cat_dims = [] | ||
| offset = 0 | ||
| for spec in self.config_gen.flat_spec: | ||
| n_dims = spec.encode_dim() | ||
| if spec.is_categorical(): | ||
| # All dimensions of this encoder are categorical | ||
| self.cat_dims.extend(range(offset, offset + n_dims)) | ||
| offset += n_dims |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems kind of error prone, can we have a cleaner way to do it?
…into ucb_pattern_search
| # Initialize config encoder | ||
| self.frac_selected = frac_selected | ||
|
|
||
| # compute offsets from the flat_spec |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this better?
…into ucb_pattern_search
|
Just for some background, I performed some new experiments and found that a new method, called LFBO Pattern Search, performs just as well as UCBPatternSearch, but doesn't need any new imports. It's based on a RandomForestClassifier surrogate. It is trained on classifying which configs are among the top x% in performance. As such, it can be trained without having to filter out configs that time-out or have poor accuracy. I've structured the file to be similar to de-surrogate. |
Includes the LFBO Pattern Search autotuner, which modifies PatternSearch to search through configs using a learned acquisition function (RandomForestClassifier) according to the likelihood-free bayesian optimization framework [1].
This improves over PatternSearch in kernel latency and autotuning wall-clock time on B200 for a set of benchmark kernels. DifferentialEvolution can improve further upon this, but takes substantially longer. DESurrogate in #1096, has comparable performance. We also compare to UCBPatternSearch, a previous proposal which uses a Gaussian Process + UCB acquisition function.
Kernel latency:

Autotuning Wall-clock Speedup:

Autotuning Convergence Time:

Some example convergence plots:
[1] J. Song, et al. A General Recipe for Likelihood-free Bayesian Optimization