Skip to content

Conversation

@AiKiAi-stack
Copy link

Summary

This PR adds support for per-strategy constraints in the sweep benchmarking mode, allowing constraint parameters to be c2onfigured individually for each strategy phase of the sweep.

Details

Core Implementation

  • Added a per_constraints field in the SweepProfile class to store per-strategy constraints.
  • Introduced a next_strategy_constraints method to dynamically compute and apply constraints based on the current strategy index.
  • per_constraints is only allowed in sweep mode, and the constraint list must not contain None values.
  • Added a --per-constraints CLI option that accepts constraints in JSON format.

Testing

  • Add unit tests for test_per_constraints.
  • Added tests for the CLI --per-constraints parameter in test_main.

Documents

  • Create guide in benchmark.md how to use --per-constraints with --profile sweep via the CLI and within a JSON scenario configuration file.

Test Plan

Automated Testing

  1. Run --per-constraints in CLI: pytest tests/test_main.py
  2. Run pytest tests/unit/benchmark/

Manual Testing

  1. Start the mock server:
    guidellm mock-server --port 8000
  2. Test scenario file:
    { "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_requests as specified in the per-constraints.
  3. Test CLI parameter
    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_seconds as specified in the per-constraints.

Related Issues

issue451:[Usage] Per-strategy max_requests constraints not respected in Sweep Mode

  • Resolves #

  • "I certify that all code in this PR is my own, except as noted below."

Use of AI

  • Includes AI-assisted code completion
  • Includes code generated by an AI application
  • Includes AI-generated tests (NOTE: AI written tests should have a docstring that includes ## WRITTEN BY AI ##)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant