Skip to content

Conversation

@bjmsong
Copy link
Contributor

@bjmsong bjmsong commented Jan 1, 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.224
fp8 Yes 0.224
After fp8 No 0.224
fp8 Yes 0.236

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

@github-actions
Copy link

github-actions bot commented Jan 1, 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 [Bugfix] change kv scaling factor by param json on nvidia gpu [Bugfix] Change kv scaling factor by param json on nvidia gpu Jan 1, 2025
@mergify mergify bot added documentation Improvements or additions to documentation frontend labels Jan 2, 2025
@mergify
Copy link

mergify bot commented Jan 2, 2025

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @bjmsong.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

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

Labels

documentation Improvements or additions to documentation frontend needs-rebase

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant