Add per-constraints feature for Sweep, with docs and tests
#511
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 support for per-strategy constraints in the
sweepbenchmarking mode, allowing constraint parameters to be c2onfigured individually for each strategy phase of the sweep.Details
Core Implementation
per_constraintsfield in theSweepProfileclass to store per-strategy constraints.next_strategy_constraintsmethod to dynamically compute and apply constraints based on the current strategy index.per_constraintsis only allowed insweepmode, and the constraint list must not containNonevalues.--per-constraintsCLI option that accepts constraints in JSON format.Testing
test_per_constraints.--per-constraintsparameter intest_main.Documents
benchmark.mdhow to use--per-constraintswith--profile sweepvia the CLI and within a JSON scenario configuration file.Test Plan
Automated Testing
--per-constraintsin CLI:pytest tests/test_main.pypytest tests/unit/benchmark/Manual Testing
guidellm mock-server --port 8000{ "target": "http://localhost:8000", "profile": "sweep", "rate": 5, "per_constraints": { "max_requests": [20, 100, 200, 200, 300], "max_errors": [1, 10, 10, 20, 30] }, "max_seconds": 60, "data": [ "prompt_tokens=512,output_tokens=256" ] }Expected: each strategy terminates at its respective
max_requestsas specified in theper-constraints.guidellm benchmark --target http://localhost:8000 --profile sweep --rate 5 --per-constraints " {\"max_seconds\": [10,15,20,25,30]}" --max-requests 1000 --data "prompt_tokens=128,output_tokens=256"Expected: each strategy terminates at its respective
max_secondsas specified in theper-constraints.Related Issues
issue451:[Usage] Per-strategy max_requests constraints not respected in Sweep Mode
Use of AI
## WRITTEN BY AI ##)