-
Notifications
You must be signed in to change notification settings - Fork 68
Add UCB 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 UCB 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?
Includes the UCB Pattern Search autotuner, which modifies PatternSearch to search through configs using a Gaussian Process and the Upper Confidence Bound (UCB) acquisition function.
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.
Kernel latency:

Autotuning Wall-clock Speedup:

Autotuning Convergence Time:
