[Feat] grid cardinality auto switch#7
Merged
VincentG1234 merged 3 commits intomainfrom Apr 27, 2026
Merged
Conversation
Signed-off-by: Vincent Gimenes <vincent.gimenes@gmail.com>
Signed-off-by: Vincent Gimenes <vincent.gimenes@gmail.com>
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
This PR adds grid cardinality calculation and implements smart sampler selection logic to automatically switch between optimization strategies based on the study configuration.
Changes
New: Grid Cardinality Calculator (
auto_tune_vllm/utils/grid_cardinality.py)ListParameter,RangeParameter,BooleanParameterSmart Sampler Auto-Switching (
auto_tune_vllm/cli/main.py)Case 1:
n_trials >= grid_cardinalitysampler="grid"and setn_trials = cardinalityCase 2:
n_trials <= n_startup_trialssampler="random"and ignoren_startup_trialsCLI Enhancement
validatecommand outputExample Behavior
study_config.yaml with small search space
parameters:
tensor_parallel_size:
type: list
options: [1, 2] # 2 values
dtype:
type: list
options: [float16, bfloat16] # 2 values
→ Grid cardinality = 2 × 2 = 4
If user requests --trials 10 (> 4) → Warning: n_trials (10) exceeds grid cardinality (4). Search set to grid mode with n_trials = 4.
If user requests --trials 5 with n_startup_trials=10 → Warning: n_trials (5) <= n_startup_trials (10). Search set to random mode; n_startup_trials ignored.