Add InSampleUniformGenerator for model-free in-sample candidate selection#4987
Closed
ItsMrLin wants to merge 2 commits into
Closed
Add InSampleUniformGenerator for model-free in-sample candidate selection#4987ItsMrLin wants to merge 2 commits into
ItsMrLin wants to merge 2 commits into
Conversation
…rials (facebook#4986) Summary: Add `Keys.LILO_LABELING` to identify LILO (Language-in-the-Loop) labeling trials in generation strategies. LILO trials collect pairwise preference labels via LLM calls and need a distinct trial type so they can be selectively marked STALE before relabeling rounds. - Add `LILO_LABELING = "lilo_labeling"` to `Keys` enum - Extend `GenerationNode.__init__` trial type validation to accept `LILO_LABELING` - Extend `Experiment.supports_trial_type()` to accept `LILO_LABELING` Reviewed By: saitcakmak Differential Revision: D94743845
…tion
Summary:
Add `InSampleUniformGenerator`, a `RandomGenerator` subclass that randomly
selects `n` arms (without replacement) from existing experiment arms. This
replaces the previous `in_sample` mode on `RandomAdapter` (which bypassed the
generator entirely) with a proper generator class, following bletham's review
feedback on the original diff.
The generator overrides `gen()` to select from the `generated_points` array
that the adapter already constructs from in-design, non-failed experiment arms
(filtered, transformed, and deduplicated). This reuses existing infrastructure
without adding new interface surface.
Registered as `Generators.IN_SAMPLE_UNIFORM` in the adapter registry with
`RandomAdapter` and `Cont_X_trans`, matching the pattern of other random
generators (Sobol, Uniform).
The resulting user-facing matrix is clean:
| | Out-of-sample | In-sample |
|---|---|---|
| **Model-free** | `Generators.SOBOL` | `Generators.IN_SAMPLE_UNIFORM` |
| **Model-based** | `Generators.BOTORCH_MODULAR` | `Generators.BOTORCH_MODULAR` + `model_gen_options={"in_sample": True}` |
The asymmetry (enum swap for model-free, flag for model-based) reflects the
real architectural difference: model-based in/out-of-sample share a fitted
model; model-free in/out-of-sample share nothing.
Reviewed By: bletham, saitcakmak
Differential Revision: D94973263
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4987 +/- ##
=======================================
Coverage 96.83% 96.83%
=======================================
Files 599 601 +2
Lines 64584 64662 +78
=======================================
+ Hits 62540 62616 +76
- Misses 2044 2046 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
This pull request has been merged in a89122d. |
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.
Summary:
Add
InSampleUniformGenerator, aRandomGeneratorsubclass that randomlyselects
narms (without replacement) from existing experiment arms. Thisreplaces the previous
in_samplemode onRandomAdapter(which bypassed thegenerator entirely) with a proper generator class, following bletham's review
feedback on the original diff.
The generator overrides
gen()to select from thegenerated_pointsarraythat the adapter already constructs from in-design, non-failed experiment arms
(filtered, transformed, and deduplicated). This reuses existing infrastructure
without adding new interface surface.
Registered as
Generators.IN_SAMPLE_UNIFORMin the adapter registry withRandomAdapterandCont_X_trans, matching the pattern of other randomgenerators (Sobol, Uniform).
The resulting user-facing matrix is clean:
Generators.SOBOLGenerators.IN_SAMPLE_UNIFORMGenerators.BOTORCH_MODULARGenerators.BOTORCH_MODULAR+model_gen_options={"in_sample": True}The asymmetry (enum swap for model-free, flag for model-based) reflects the
real architectural difference: model-based in/out-of-sample share a fitted
model; model-free in/out-of-sample share nothing.
Reviewed By: bletham, saitcakmak
Differential Revision: D94973263