Skip to content

feat(perf): add --same-request option for benchmark#1214

Open
yonlunwu wants to merge 2 commits intomodelscope:mainfrom
yonlunwu:feat/same-request
Open

feat(perf): add --same-request option for benchmark#1214
yonlunwu wants to merge 2 commits intomodelscope:mainfrom
yonlunwu:feat/same-request

Conversation

@yonlunwu
Copy link
Copy Markdown
Contributor

@yonlunwu yonlunwu commented Mar 9, 2026

When enabled, all concurrent requests will send the same prompt (only for dataset mode).

This is useful for simulating cache hit scenarios with different input lengths. By reusing a single prompt, you can easily measure the performance of cache hits without preparing multiple prompts of different lengths. It also helps with model warm-up testing.

When enabled, all concurrent requests will send the same prompt
(only for dataset mode).

This is useful for simulating cache hit scenarios with different
input lengths. By reusing a single prompt, you can easily measure
the performance of cache hits without preparing multiple prompts
of different lengths. It also helps with model warm-up testing.
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a new feature to the benchmarking tool, allowing users to specify that all concurrent requests should use the same prompt when operating in dataset mode. This enhancement is designed to facilitate more focused performance testing, particularly for simulating cache hit scenarios and aiding in model warm-up by providing a consistent input across multiple requests.

Highlights

  • New Feature: Same Request Option: Introduced a new --same-request option for the benchmarking tool, allowing all concurrent requests to send the same prompt when operating in dataset mode.
  • Performance Testing Enhancement: This feature is designed to facilitate specific performance testing scenarios, such as simulating cache hits with consistent input and aiding in model warm-up.
  • Argument Handling and Logic: Added the same_request argument to the Arguments class and the command-line parser, along with logic in benchmark.py to apply this behavior and issue a warning if used outside of dataset mode.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • evalscope/perf/arguments.py
    • Added the same_request boolean field to the Arguments class.
    • Registered the --same-request command-line argument with argparse.
  • evalscope/perf/benchmark.py
    • Added a check to warn users if --same-request is used without dataset mode.
    • Modified request generation to use only the first dataset prompt when same_request is enabled.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a --same-request option to use the same prompt for all requests in dataset mode, which is useful for cache testing. The implementation is mostly correct, but I've found a couple of issues. There's a minor typo in the command-line help text. More importantly, the logic to warn users when --same-request is used incorrectly is flawed and will not work as intended. I've provided suggestions to fix these issues.

Comment on lines +30 to +31
if args.same_request and not args.dataset:
logger.warning("--same-request only works in dataset mode, ignoring...")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The condition to warn when --same-request is used outside of dataset mode is incorrect. The args.dataset argument has a default string value ('openqa'), so not args.dataset will almost always evaluate to False, and the warning will never be triggered. The check should instead verify if args.prompt is being used, as --same-request is redundant in that mode.

Suggested change
if args.same_request and not args.dataset:
logger.warning("--same-request only works in dataset mode, ignoring...")
if args.same_request and args.prompt:
logger.warning("--same-request only works in dataset mode, ignoring...")

# Dataset settings
parser.add_argument('--dataset', type=str, default='openqa', help='Specify the dataset')
parser.add_argument('--dataset-path', type=str, required=False, help='Path to the dataset file')
parser.add_argument('--same-request', action='store_true', default=False, help='Use the same prompt for all iterations(only for dataset mode)')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There's a typo in the help message for the --same-request argument. The opening parenthesis is attached to the word iterations, which makes it harder to read. Adding a space would improve readability.

Suggested change
parser.add_argument('--same-request', action='store_true', default=False, help='Use the same prompt for all iterations(only for dataset mode)')
parser.add_argument('--same-request', action='store_true', default=False, help='Use the same prompt for all iterations (only for dataset mode)')

@Yunnglin
Copy link
Copy Markdown
Collaborator

Yunnglin commented Mar 9, 2026

This feature's necessity can be further discussed. Currently, you can use random dataset and configure the prefix-length to ensure that the request is the same, thereby testing cache hits.

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.

2 participants