deepspeedai / deepspeedai/DeepSpeed

[BUG] 8 bit quantized inference not as fast as hoped for?

Open
#4,560 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug inference
Dominant language
Python
Stars
43.1k
Forks
5k
Avg merge
4d 15h
Merged PRs (30d)
112

Description

Describe the bug
I am using the 4 bit post init quantization approach. I was hopping it would make inference faster in addition to saving memory.
But it is not the case.

To Reproduce
Quantize a model such as StarCoder.

Expected behavior
inference being memory bound due to reading model weights, I thought it would be almost linearly faster when quantizing.
But it is instead 2x slower.
Is that because the weights are first dequantized, then torch linear is used? I guess it would be faster if it was fused together?

ds_report output
Please run ds_report to give us details about your setup.

Screenshots
If applicable, add screenshots to help explain your problem.

System info (please complete the following information):

  • OS: [e.g. Ubuntu 18.04]
  • GPU count and types [e.g. two machines with x8 A100s each]
  • (if applicable) what DeepSpeed-MII version are you using
  • (if applicable) Hugging Face Transformers/Accelerate/etc. versions
  • Python version
  • Any other relevant info about your setup

Docker context
Are you using a specific docker image that you can share?

Additional context
Add any other context about the problem here.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running ds_report and collecting the missing OS, GPU, DeepSpeed-MII, Transformers, Accelerate, and Python versions. Reproduce the StarCoder 4-bit post-init quantization case and compare inference speed and memory use with the unquantized model; done means the slowdown is explained or a specific quantization performance issue is isolated.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.