Skip to content

Add custom method with model_config to choose_gs#4727

Closed
saitcakmak wants to merge 2 commits intofacebook:mainfrom
saitcakmak:export-D89906836
Closed

Add custom method with model_config to choose_gs#4727
saitcakmak wants to merge 2 commits intofacebook:mainfrom
saitcakmak:export-D89906836

Conversation

@saitcakmak
Copy link
Contributor

Summary:
This diff adds the ability to use custom ModelConfig objects with choose_generation_strategy by introducing a new "custom" method option.

Motivation

After D83062555, the internal choose_gs_internal function now uses the OSS choose_generation_strategy for default GS dispatch. However, there was no way to pass custom model configurations (like MAP SAAS) through this function - they had to be handled as special cases outside the dispatch flow.

Solution

Rather than adding specific method types for each model variant (which would turn the Literal type into a "zoo" of options), we add a single "custom" method that allows passing a ModelConfig as a separate function argument. This keeps the API clean while providing full flexibility.

Key changes:

  • Add "custom" to the method Literal type in GenerationStrategyDispatchStruct
  • Add optional model_config parameter to choose_generation_strategy()
  • Add validation: model_config must be provided iff method="custom"
  • Update _get_mbm_node() to handle custom model configs

Differential Revision: D89906836

@meta-codesync
Copy link

meta-codesync bot commented Dec 30, 2025

@saitcakmak has exported this pull request. If you are a Meta employee, you can view the originating Diff in D89906836.

@meta-cla meta-cla bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Dec 30, 2025
@codecov-commenter
Copy link

codecov-commenter commented Dec 30, 2025

Codecov Report

❌ Patch coverage is 93.42105% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.71%. Comparing base (ca36693) to head (952f070).

Files with missing lines Patch % Lines
ax/utils/testing/modeling_stubs.py 37.50% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4727      +/-   ##
==========================================
- Coverage   96.72%   96.71%   -0.01%     
==========================================
  Files         582      582              
  Lines       60694    60764      +70     
==========================================
+ Hits        58705    58770      +65     
- Misses       1989     1994       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Summary:

Simplifies common checks for num initialization trials etc that we do for node based GS

Differential Revision:
D89932177

Privacy Context Container: L1307644
Summary:

This diff adds the ability to use custom `ModelConfig` objects and a custom `botorch_acqf_class` with `choose_generation_strategy` by introducing a new `"custom"` method option.

## Motivation

After D83062555, the internal `choose_gs_internal` function now uses the OSS `choose_generation_strategy` for default GS dispatch. However, there was no way to pass custom model configurations (like MAP SAAS) through this function - they had to be handled as special cases outside the dispatch flow.

## Solution

Rather than adding specific method types for each model variant (which would turn the Literal type into a "zoo" of options), we add a single `"custom"` method that allows passing a `ModelConfig` as a separate function argument. This keeps the API clean while providing full flexibility.

Key changes:
- Add `"custom"` to the `method` Literal type in `GenerationStrategyDispatchStruct`
- Add optional `model_config` parameter to `choose_generation_strategy()`
- Add validation: `model_config` must be provided iff `method="custom"`
- Update `_get_mbm_node()` to handle custom model configs

Differential Revision: D89906836
@meta-codesync
Copy link

meta-codesync bot commented Jan 2, 2026

This pull request has been merged in d740cb4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed Do not delete this pull request or issue due to inactivity. fb-exported Merged meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants