Skip to content
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

[Bugfix] Change kv scaling factor by param json on nvidia gpu #11688

Merged
merged 2 commits into from
Jan 2, 2025

Conversation

bjmsong
Copy link
Contributor

@bjmsong bjmsong commented Jan 2, 2025

According to the docs, when the checkpoint is in FP16, the kv-cache scaling factors can be loaded via --quantization-param-path.
With the help of this change, the accuracy will increase.

kv_cache_dtype quantization_param_path gsm8k
Before fp8 No 0.22
fp8 Yes 0.22
After fp8 No 0.22
fp8 Yes 0.228

Reproduce script:

lm_eval --model vllm \
  --model_args pretrained="{Llama-2-7b-chat-hf}",add_bos_token=true,kv_cache_dtype=fp8 \
  --tasks gsm8k \
  --num_fewshot 5 \
  --limit 250 \
  --batch_size 'auto'
  
lm_eval --model vllm \
  --model_args pretrained="{Llama-2-7b-chat-hf}",add_bos_token=true,kv_cache_dtype=fp8,quantization_param_path="{kv_cache_scales.json}" \
  --tasks gsm8k \
  --num_fewshot 5 \
  --limit 250 \
  --batch_size 'auto'

Caution: lm_eval doesn't support the kv_cache_dtype params, I have pulled a PR here

Copy link

github-actions bot commented Jan 2, 2025

👋 Hi! Thank you for contributing to the vLLM project.
Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run fastcheck CI which starts running only a small and essential subset of CI tests to quickly catch errors. You can run other CI tests on top of those by going to your fastcheck build on Buildkite UI (linked in the PR checks section) and unblock them. If you do not have permission to unblock, ping simon-mo or khluu to add you in our Buildkite org.

Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging.

To run CI, PR reviewers can do one of these:

  • Add ready label to the PR
  • Enable auto-merge.

🚀

@bjmsong bjmsong changed the title Change kv scaling factor by param json on nvidia gpu [Bugfix] Change kv scaling factor by param json on nvidia gpu Jan 2, 2025
Signed-off-by: bjmsong <[email protected]>
Copy link
Member

@mgoin mgoin left a comment

Choose a reason for hiding this comment

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

As the comments mention we'd like to move away from the quantization_param_path interface in the future as we also support kv cache quantization through quantization backends like compressed-tensors, but this change makes sense as a bugfix. Thank you

@mgoin mgoin added the ready ONLY add when PR is ready to merge/full CI is needed label Jan 2, 2025
@mgoin mgoin enabled auto-merge (squash) January 2, 2025 18:54
@mgoin mgoin merged commit 187e329 into vllm-project:main Jan 2, 2025
68 checks passed
mgoin pushed a commit that referenced this pull request Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready ONLY add when PR is ready to merge/full CI is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants