-
Notifications
You must be signed in to change notification settings - Fork 123
[Docs] add benchmark refer #358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,67 @@ | ||||||||||||||||||||||||||
| # Benchmarking for Speculative Decoding | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ## Overview | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| We provide a unified script to test the performance of the Speculative Decoding with EAGLE3 algorithm on multiple datasets. You can follow the steps below to run the benchmarks. | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ## Run Benchmarks | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ### Launch SGLang and Benchmarker Concurrently | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| `bench_eagle3.py` can help you launch a SGLang server process and a Benchmarking process concurrently. In this way, you don't have to launch the SGLang server manually, this script will manually handle the SGLang launch under different speculative decoding configurations. Some important arguments are: | ||||||||||||||||||||||||||
| - `--model-path`: the path to the target model. | ||||||||||||||||||||||||||
| - `--speculative-draft-model-path`: the path to the draft model. | ||||||||||||||||||||||||||
| - `--port`: the port to launch the SGLang server. | ||||||||||||||||||||||||||
| - `--trust-remote-code`: trust the remote code. | ||||||||||||||||||||||||||
| - `--mem-fraction-static`: the memory fraction for the static memory. | ||||||||||||||||||||||||||
| - `--tp-size`: the tensor parallelism size. | ||||||||||||||||||||||||||
| - `--attention-backend`: the attention backend. | ||||||||||||||||||||||||||
| - `--config-list`: the list of speculative decoding configuration to test, the format is `<batch-size>,<num-steps>,<topk>,<num-draft-tokens>`. | ||||||||||||||||||||||||||
| - `--benchmark-list`: the list of benchmarks to test, the format is `<benchmark-name>:<num-prompts>:<subset>`. | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ```shell | ||||||||||||||||||||||||||
| python3 bench_eagle3.py \ | ||||||||||||||||||||||||||
| --model-path meta-llama/Llama-3.1-8B-Instruct \ | ||||||||||||||||||||||||||
| --speculative-draft-model-path lmsys/sglang-EAGLE3-LLaMA3.1-Instruct-8B \ | ||||||||||||||||||||||||||
| --port 30000 \ | ||||||||||||||||||||||||||
| --trust-remote-code \ | ||||||||||||||||||||||||||
| --mem-fraction-static 0.8 \ | ||||||||||||||||||||||||||
| --tp-size 1 \ | ||||||||||||||||||||||||||
| --attention-backend fa3 \ | ||||||||||||||||||||||||||
| --config-list 1,0,0,0 1,3,1,4 \ | ||||||||||||||||||||||||||
| --benchmark-list mtbench gsm8k:5 ceval:5:accountant \ | ||||||||||||||||||||||||||
| --dtype bfloat16 | ||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ### Launch Benchmarker Independently | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| If you want to launch the SGLang server independently, you can use the following command. | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ```shell | ||||||||||||||||||||||||||
| # you can launch a server | ||||||||||||||||||||||||||
| python3 -m sglang.launch_server \ | ||||||||||||||||||||||||||
| --model meta-llama/Llama-3.1-8B-Instruct \ | ||||||||||||||||||||||||||
| --speculative-algorithm EAGLE3 \ | ||||||||||||||||||||||||||
| --speculative-draft-model-path lmsys/sglang-EAGLE3-LLaMA3.1-Instruct-8B \ | ||||||||||||||||||||||||||
| --speculative-num-steps 3 \ | ||||||||||||||||||||||||||
| --speculative-eagle-topk 1 \ | ||||||||||||||||||||||||||
| --speculative-num-draft-tokens 4 \ | ||||||||||||||||||||||||||
| --mem-fraction-static 0.75 \ | ||||||||||||||||||||||||||
| --cuda-graph-max-bs 1 \ | ||||||||||||||||||||||||||
| --tp 1 \ | ||||||||||||||||||||||||||
| --trust-remote-code \ | ||||||||||||||||||||||||||
| --host 0.0.0.0 \ | ||||||||||||||||||||||||||
| --port 30000 \ | ||||||||||||||||||||||||||
| --dtype bfloat16 | ||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| Then we can start benchmarking. Note that you should use the same host and port as the one used in the SGLang server. Note that `--skip-launch-server` is required to skip the launch of the SGLang server. | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||
| python bench_eagle3.py \ | ||||||||||||||||||||||||||
| --model-path meta-llama/Llama-3.1-8B-Instruct \ | ||||||||||||||||||||||||||
| --port 30000 \ | ||||||||||||||||||||||||||
| --config-list 1,3,1,4 \ | ||||||||||||||||||||||||||
| --benchmark-list mtbench:5 ceval:5:accountant gsm8k:5 humaneval:5 math500:5 mtbench:5 aime:1 \ | ||||||||||||||||||||||||||
| --skip-launch-server | ||||||||||||||||||||||||||
|
Comment on lines
+61
to
+66
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This command example has several issues that should be addressed:
Suggested change
|
||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The path to the
bench_eagle3.pyscript is missing. Assuming users run commands from the repository root, the script will not be found. The path should be updated tobenchmarks/bench_eagle3.pyfor the command to execute correctly.