Skip to content

Commit 6f5a3fc

Browse files
committed
Minor updates based on review feedback.
Signed-off-by: Anna Mayne <anna.mayne@arm.com>
1 parent 2fc3bcb commit 6f5a3fc

5 files changed

Lines changed: 18 additions & 15 deletions

File tree

content/learning-paths/servers-and-cloud-computing/vllm-benchmark-quantisation/1-overview-and-setup.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ sudo apt-get install -y libtcmalloc-minimal4
4040

4141
## Create and activate a Python virtual environment
4242

43-
It’s best practice to install vLLM inside an isolated environment to prevent conflicts between system and project dependencies:
43+
It is considered best practice to install vLLM inside an isolated environment to prevent conflicts between system and project dependencies:
4444
```bash
4545
python3.12 -m venv vllm_env
4646
source vllm_env/bin/activate
@@ -49,7 +49,7 @@ python -m pip install --upgrade pip
4949

5050
## Install vLLM for CPU
5151

52-
Install a recent CPU specific build of vLLM:
52+
Install a CPU-specific build of vLLM:
5353
```bash
5454
export VLLM_VERSION=0.20.0
5555
pip install https://github.com/vllm-project/vllm/releases/download/v${VLLM_VERSION}/vllm-${VLLM_VERSION}+cpu-cp38-abi3-manylinux_2_35_aarch64.whl --extra-index-url https://download.pytorch.org/whl/cpu
@@ -60,9 +60,8 @@ If you wish to build vLLM from source you can follow the instructions in the [Bu
6060

6161
## Set up access to LLama3.1-8B models
6262

63-
To access the Llama models hosted by Hugging Face, you will need to install the Hugging Face CLI so that you can authenticate yourself and the harness can download what it needs. You should create an account on https://huggingface.co/ and follow the instructions [in the Hugging Face CLI guide](https://huggingface.co/docs/huggingface_hub/en/guides/cli) to set up your access token. You can then install the CLI and login:
63+
To access the Llama models hosted by Hugging Face, you will need to install the Hugging Face CLI so that you can authenticate yourself and the harness can download what it needs. You should create an account on https://huggingface.co/ and follow the instructions [in the Hugging Face CLI guide](https://huggingface.co/docs/huggingface_hub/en/guides/cli) to install the CLI and setup your access token. You can then login to HF:
6464
```bash
65-
curl -LsSf https://hf.co/cli/install.sh | bash
6665
hf auth login
6766
```
6867

content/learning-paths/servers-and-cloud-computing/vllm-benchmark-quantisation/2-quantisation-recipe.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ layout: learningpathall
88

99
## Understanding quantisation
1010

11-
Quantised models have their weights converted to a lower precision data type, which reduces the memory requirements of the model and can improve performance significantly. In the [Run vLLM inference with INT4 quantization on Arm servers](/learning-paths/servers-and-cloud-computing/vllm-acceleration/) Learning Path we have covered how to quantise a model yourself. There are also many publicly available quantised versions of popular models, such as https://huggingface.co/RedHatAI/Meta-Llama-3.1-8B-quantized.w8a8 and https://huggingface.co/RedHatAI/whisper-large-v3-quantized.w8a8, which we will be using in this Learning Path.
11+
Quantised models have their weights converted to a lower precision data type which reduces the memory requirements of the model and can improve performance significantly. In the [Run vLLM inference with INT4 quantization on Arm servers](/learning-paths/servers-and-cloud-computing/vllm-acceleration/) Learning Path we have covered how to quantise a model yourself. There are also many publicly available quantised versions of popular models, such as https://huggingface.co/RedHatAI/Meta-Llama-3.1-8B-quantized.w8a8 and https://huggingface.co/RedHatAI/whisper-large-v3-quantized.w8a8, which we will be using in this Learning Path.
1212

1313
The notation w8a8 means that the weights have been quantised to 8-bit integers and the activations (the input data) are dynamically quantised to the same. This allows our kernels to utilise Arm's 8-bit integer matrix multiply feature I8MM. You can learn more about this in the [KleidiAI and matrix multiplication](/learning-paths/cross-platform/kleidiai-explainer/) Learning Path.
1414

content/learning-paths/servers-and-cloud-computing/vllm-benchmark-quantisation/3-run-inference.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Start vLLM’s OpenAI-compatible API server using Llama3.1-8B:
1515
vllm serve meta-llama/Llama-3.1-8B
1616
```
1717

18-
Then we can create a test script that sends a request to the server using the OpenAI library. Copy the below to a file named llama_test.py.
18+
Then we can create a test script that sends a request to the server using the OpenAI library. Copy the Python script below to a file named llama_test.py.
1919

2020
```python
2121
import time
@@ -63,7 +63,7 @@ python llama_test.py
6363

6464
This will return the text generated by the model from your prompt. In the server logs you can see the throughput measured in tokens per second.
6565

66-
You can do the same for the quantised model. Start the server:
66+
You can do the same for the pre-quantised model loaded directly from Hugging Face. Start the server:
6767
```bash
6868
vllm serve RedHatAI/Meta-Llama-3.1-8B-quantized.w8a8
6969
```
@@ -78,7 +78,7 @@ Run inference on the quantised model:
7878
python llama_test.py
7979
```
8080

81-
You have now run inference using both the non-quantised and quantised Llama3.1-8B models.
81+
You have now run inference using both the non-quantised and quantised Llama3.1-8B models!
8282

8383
## Run inference on Whisper
8484

@@ -89,7 +89,7 @@ pip install vllm[audio]
8989
vllm serve openai/whisper-large-v3
9090
```
9191

92-
Then we can create a test script that sends a request with an audio file to the server using the OpenAI library. Copy the below to a file named whisper_test.py.
92+
Then we can create a test script that sends a request with an audio file to the server using the OpenAI library. Copy the Python script below to a file named whisper_test.py.
9393

9494
```python
9595
import time
@@ -130,7 +130,7 @@ Now run the script with:
130130
python whisper_test.py
131131
```
132132

133-
You can do the same for the quantised model. Start the server:
133+
You can do the same for the pre-quantised model loaded directly from Hugging Face. Start the server:
134134
```bash
135135
vllm serve RedHatAI/whisper-large-v3-quantized.w8a8
136136
```
@@ -145,4 +145,4 @@ Run inference on the quantised model:
145145
python whisper_test.py
146146
```
147147

148-
You now have the quantised and non-quantised Llama and Whisper models on your local machine. You have installed vLLM and demonstrated you can run inference on your models. Now you can move on to benchmarking the Llama models and compare their performance.
148+
You now have the quantised and non-quantised Llama and Whisper models on your local machine! You have installed vLLM and demonstrated you can run inference on your models. Now you can move on to benchmarking the Llama models and compare their performance.

content/learning-paths/servers-and-cloud-computing/vllm-benchmark-quantisation/4-benchmarking.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ vllm serve \
1919
```
2020

2121
vLLM uses dynamic continuous batching to maximise hardware utilisation. Two key parameters govern this process:
22-
* max-model-len, which is the maximum sequence length (number of tokens per request). No single prompt or generated sequence can exceed this limit.
23-
* max-num-batched-tokens, which is the total number of tokens processed in one batch across all requests. The sum of input and output tokens from all concurrent requests must stay within this limit.
22+
* max-model-len, which is the maximum sequence length (number of tokens per request). No single prompt or generated sequence can exceed this limit. We've chosen a value large enough for the selected model and dataset.
23+
* max-num-batched-tokens, which is the total number of tokens processed in one batch across all requests. The sum of input and output tokens from all concurrent requests must stay within this limit. We've chosen a value that, combined with our concurrency limit shown below, gives optimal throughput and latency.
2424

2525
Now the server is running, we can benchmark using the public ShareGPT dataset.
2626
```bash
@@ -33,10 +33,13 @@ vllm bench serve \
3333
--num-prompts 256 \
3434
--request-rate 8 \
3535
--max-concurrency 10 \
36+
--top-p 1 --temperature 0 \
3637
--percentile-metrics ttft,tpot \
3738
--metric-percentiles 50,95,99 \
3839
--save-result --result-dir bench_out --result-filename serve.json
3940
```
41+
Here we are using greedy decoding: '''--top-p 1 --temperature 0'''. This selects the next token with the highest probability at each step, instead of sampling from a selection of likely tokens.
42+
4043
The interesting results are request throughput, output token throughput, total token throughput, TTFT (time to first token) and TPOT (time per output token). We're aiming for a mean TPOT < 100ms, so the maximum concurrency selected should be as high as possible while meeting that TPOT requirement.
4144

4245
Repeat with the quantised model. The smaller model allows us to increase the concurrency. You should see a significant improvement in the throughput results (increased tokens/s).
@@ -53,14 +56,15 @@ vllm bench serve \
5356
--num-prompts 256 \
5457
--request-rate 8 \
5558
--max-concurrency 24 \
59+
--top-p 1 --temperature 0 \
5660
--percentile-metrics ttft,tpot \
5761
--metric-percentiles 50,95,99 \
5862
--save-result --result-dir bench_out --result-filename serve.json
5963
```
6064

6165
## Llama accuracy benchmarking
6266

63-
The lm-evaluation-harness is the standard way to measure model accuracy across common academic benchmarks (for example MMLU, HellaSwag, GSM8K) and runtimes (such as Hugging Face, vLLM, and llama.cpp). In this section, you’ll run accuracy tests for both BF16 and INT8 deployments of your Llama models served by vLLM on Arm-based servers.
67+
The lm-evaluation-harness is the standard way to measure model accuracy across common academic benchmarks (for example [MMLU](https://github.com/EleutherAI/lm-evaluation-harness/tree/main/lm_eval/tasks/mmlu), [HellaSwag](https://github.com/EleutherAI/lm-evaluation-harness/tree/main/lm_eval/tasks/hellaswag), [GSM8K](https://github.com/EleutherAI/lm-evaluation-harness/tree/main/lm_eval/tasks/gsm8k)) and runtimes (such as [Hugging Face](https://github.com/huggingface/transformers), [vLLM](https://github.com/vllm-project/vllm), and [llama.cpp](https://github.com/ggml-org/llama.cpp)). In this section, you’ll run accuracy tests for both BF16 and INT8 deployments of your Llama models served by vLLM on Arm-based servers.
6468

6569
You will:
6670
- Install the lm-eval harness with vLLM support

content/learning-paths/servers-and-cloud-computing/vllm-benchmark-quantisation/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ prerequisites:
1414
- An Arm-based Linux server (Ubuntu 22.04+ recommended) with a minimum of 32 vCPUs, 96 GB RAM, and 64 GB free disk space
1515
- Python 3.12 and basic familiarity with Hugging Face Transformers and quantisation
1616

17-
author: Anna Mayne
17+
author: Anna Mayne, Nikhil Gupta, Marek Michałowski
1818

1919
### Tags
2020
skilllevels: Introductory

0 commit comments

Comments
 (0)