[Generative Score API] Scoring(Prefill-only) optimizations.#9748
Merged
hnyls2002 merged 9 commits intosgl-project:mainfrom Sep 13, 2025
Merged
[Generative Score API] Scoring(Prefill-only) optimizations.#9748hnyls2002 merged 9 commits intosgl-project:mainfrom
hnyls2002 merged 9 commits intosgl-project:mainfrom
Conversation
chanh
reviewed
Sep 5, 2025
hnyls2002
approved these changes
Sep 9, 2025
4 tasks
Collaborator
Author
|
Moved the benchmarking scripts to a separate PR will rebase on this. |
d065789 to
97f0d91
Compare
6 tasks
18 tasks
6 tasks
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.
🚀 Motivation
Performance Impact:
🔧 Modifications
⚡ Optimization 1: Skip Input Token Logprobs Computation
For scoring requests like:
⚡ Optimization 2: Skip Sampling Step
Sampler.compute_logprobs_only()to compute logprobs without sampling for prefill-only scoring:⚡ Optimization 3: Delayed GPU→CPU Copy with Overlap
get_token_ids_logprobs_batch_optimized(logprobs, token_ids, delay_cpu_copy=True), Single vectorized gather on GPU for the entire batch. Optionally defers .tolist() until result processing, improving overlap with the next batch’s compute.Accuracy Tests
Benchmarking and Profiling
🧪 Benchmark Comparison: Qwen3-0.6B on H100 (CUDA 12.8)
Setup:
Server Start:
Benchmark Script:
🔍 Summary of Improvement
Profiling
Checklist