You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/learning-paths/servers-and-cloud-computing/vllm-acceleration/1-overview-and-build.md
+58-31Lines changed: 58 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,101 +8,128 @@ layout: learningpathall
8
8
9
9
## What is vLLM?
10
10
11
-
vLLM is an open‑source, high‑throughput inference and serving engine for large language models. It focuses on efficient execution of the LLM inference prefill and decode phases with:
12
-
13
-
- Continuous batching to keep hardware busy across many requests.
14
-
- KV cache management to sustain concurrency during generation.
15
-
- Token streaming so results appear as they are produced.
16
-
17
-
You interact with vLLM in multiple ways:
18
-
19
-
- OpenAI‑compatible server: expose `/v1/chat/completions` for easy integration.
20
-
- Python API: load a model and generate locally when needed.
21
-
22
-
vLLM works well with Hugging Face models, supports single‑prompt and batch workloads, and scales from quick tests to production serving.
11
+
vLLM is an open-source, high-throughput inference and serving engine for large language models (LLMs).
12
+
It’s designed to make LLM inference faster, more memory-efficient, and scalable, particularly during the prefill (context processing) and decode (token generation) phases of inference.
13
+
14
+
### Key Features
15
+
* Continuous Batching – Dynamically combines incoming inference requests into a single large batch, maximizing CPU/GPU utilization and throughput.
16
+
* KV Cache Management – Efficiently stores and reuses key-value attention states, sustaining concurrency across multiple active sessions while minimizing memory overhead.
17
+
* Token Streaming – Streams generated tokens as they are produced, enabling real-time responses for chat or API scenarios.
18
+
### Interaction Modes
19
+
You can use vLLM in two main ways:
20
+
* OpenAI-Compatible REST Server:
21
+
vLLM provides a /v1/chat/completions endpoint compatible with the OpenAI API schema, making it drop-in ready for tools like LangChain, LlamaIndex, and the official OpenAI Python SDK.
22
+
* Python API:
23
+
Load and serve models programmatically within your own Python scripts for flexible local inference and evaluation.
24
+
25
+
vLLM supports Hugging Face Transformer models out-of-the-box and scales seamlessly from single-prompt testing to production batch inference.
23
26
24
27
## What you build
25
28
26
-
You build a CPU‑optimized vLLM for aarch64 with oneDNN and the Arm Compute Library (ACL). You then validate the build with a quick offline chat example.
29
+
In this learning path, you will build a CPU-optimized version of vLLM targeting the Arm64 architecture, integrated with oneDNN and the Arm Compute Library (ACL).
30
+
This build enables high-performance LLM inference on Arm servers, leveraging specialized Arm math libraries and kernel optimizations.
31
+
After compiling, you’ll validate your build by running a local chat example to confirm functionality and measure baseline inference speed.
27
32
28
33
## Why this is fast on Arm
29
34
35
+
vLLM’s performance on Arm servers is driven by both software optimization and hardware-level acceleration.
36
+
Each component of this optimized build contributes to higher throughput and lower latency during inference:
37
+
30
38
- Optimized kernels: The aarch64 vLLM build uses direct oneDNN with the Arm Compute Library for key operations.
31
-
- 4‑bit weight quantization: INT4 quantization support & acceleration by Arm KleidiAI microkernels.
- Optimized Paged attention: Arm SIMD tuned paged attention implementation in vLLM.
34
-
- System tuning: Thread affinity and `tcmalloc` help keep latency and allocator overhead low under load.
39
+
- 4‑bit weight quantization: vLLM supports INT4 quantized models, and Arm accelerates this using KleidiAI microkernels, which take advantage of DOT-product (SDOT/UDOT) and SME2 (Scalable Matrix Extension) instructions.
40
+
- Efficient MoE execution: For Mixture-of-Experts (MoE) models, vLLM fuses INT4 quantized expert layers to reduce intermediate memory transfers, which minimizes bandwidth bottlenecks
41
+
- Optimized Paged attention: The paged attention mechanism, which handles token reuse during long-sequence generation, is SIMD-tuned for Arm’s NEON and SVE (Scalable Vector Extension) pipelines.
42
+
- System tuning: Using thread affinity ensures efficient CPU core pinning and balanced thread scheduling across Arm clusters.
43
+
Additionally, enabling tcmalloc (Thread-Caching Malloc) reduces allocator contention and memory fragmentation under high-throughput serving loads.
35
44
36
45
## Before you begin
37
46
38
-
- Use Python 3.12 on Ubuntu 22.04+
39
-
- Make sure you have at least 32 vCPUs, 64 GB RAM, and 32 GB free disk.
47
+
Verify that your environment meets the following requirements:
48
+
49
+
Python version: Use Python 3.12 on Ubuntu 22.04 LTS or later.
50
+
Hardware requirements: At least 32 vCPUs, 64 GB RAM, and 64 GB of free disk space.
51
+
52
+
This Learning Path was validated on an AWS Graviton4 c8g.12xlarge instance with 64 GB of attached storage.
40
53
41
-
Install the minimum system package used by vLLM on Arm:
54
+
### Install Build Dependencies
42
55
56
+
Install the following packages required for compiling vLLM and its dependencies on Arm64:
Optional performance helper you can install now or later:
63
+
You can optionally install tcmalloc, a fast memory allocator from Google’s gperftools, which improves performance under high concurrency:
50
64
51
65
```bash
52
66
sudo apt-get install -y libtcmalloc-minimal4
53
67
```
54
68
55
69
{{% notice Note %}}
56
-
On aarch64, vLLM’s CPU backend automatically builds with Arm Compute Library via oneDNN.
70
+
On aarch64, vLLM’s CPU backend automatically builds with the Arm Compute Library (ACL) through oneDNN.
71
+
This ensures optimized Arm kernels are used for matrix multiplications, layer normalization, and activation functions without additional configuration.
57
72
{{% /notice %}}
58
73
59
-
## Build vLLM for aarch64 CPU
74
+
## Build vLLM for Arm64 CPU
75
+
You’ll now build vLLM optimized for Arm (aarch64) servers with oneDNN and the Arm Compute Library (ACL) automatically enabled in the CPU backend.
60
76
61
-
Create and activate a virtual environment:
77
+
1. Create and Activate a Python Virtual Environment
78
+
It’s best practice to build vLLM inside an isolated environment to prevent conflicts between system and project dependencies:
62
79
63
80
```bash
64
81
python3.12 -m venv vllm_env
65
82
source vllm_env/bin/activate
66
83
python3 -m pip install --upgrade pip
67
84
```
68
85
69
-
Clone vLLM and install build requirements:
86
+
2. Clone vLLM and Install Build Requirements
87
+
Download the official vLLM source code and install its CPU-specific build dependencies:
The specific commit (5fb4137) pins a verified version of vLLM that officially adds Arm CPUs to the list of supported build targets, ensuring full compatibility and optimized performance for Arm-based systems.
77
96
78
-
Build a wheel targeted at CPU:
97
+
3. Build the vLLM Wheel for CPU
98
+
Run the following command to compile and package vLLM as a Python wheel optimized for CPU inference:
Do NOT delete vLLM repo. Local vLLM repository is required for corect inferencing on aarch64 CPU after installing the wheel.
114
+
Do not delete the local vLLM source directory.
115
+
The repository contains C++ extensions and runtime libraries required for correct CPU inference on aarch64 after wheel installation.
93
116
{{% /notice %}}
94
117
95
-
## Quick validation via offline inferencing
118
+
## Quick validation via Offline Inferencing
96
119
97
-
Run the built‑in chat example to confirm the build:
120
+
Once your Arm-optimized vLLM build completes, you can validate it by running a small offline inference example. This ensures that the CPU-specific backend and oneDNN and ACL optimizations were correctly compiled into your build.
121
+
Run the built-in chat example included in the vLLM repository:
98
122
99
123
```bash
100
124
python examples/offline_inference/basic/chat.py \
101
125
--dtype=bfloat16 \
102
126
--model TinyLlama/TinyLlama-1.1B-Chat-v1.0
103
127
```
104
128
105
-
You should see tokens streaming and a final response. This verifies the optimized vLLM build on your Arm server.
129
+
Explanation:
130
+
--dtype=bfloat16 runs inference in bfloat16 precision. Recent Arm processors support the BFloat16 (BF16) number format in PyTorch. For example, AWS Graviton3 and Graviton3 processors support BFloat16.
131
+
--model specifies a small Hugging Face model for testing (TinyLlama-1.1B-Chat), ideal for functional validation before deploying larger models.
132
+
You should see token streaming in the console, followed by a generated output confirming that vLLM’s inference pipeline is working correctly.
0 commit comments