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/distributed-inference-with-llama-cpp/_index.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,10 +11,10 @@ who_is_this_for: This learning path is for developers with some experience using
11
11
12
12
learning_objectives:
13
13
- Set up the main host and worker nodes using llama.cpp
14
-
- Run a large quantized model (e.g., Llama 3.1 405B) on CPUs in a distributed manner on Arm machines
14
+
- Run a large quantized model (e.g., Llama 3.1 70B) on CPUs in a distributed manner on Arm machines
15
15
16
16
prerequisites:
17
-
- Three AWS c8g.16xlarge instances with at least 2TB EBS space.
17
+
- Three AWS c8g.4xlarge instances with at least 500GB EBS space.
18
18
- Python installed on the AWS instances.
19
19
- Access to Meta’s gated repository for the Llama 3.1 model family, with a Hugging Face token generated for downloading the models.
20
20
- Familiarity with -> [Deploy a Large Language Model (LLM) chatbot with llama.cpp using KleidiAI on Arm servers](/learning-paths/servers-and-cloud-computing/llama-cpu)
Copy file name to clipboardExpand all lines: content/learning-paths/servers-and-cloud-computing/distributed-inference-with-llama-cpp/how-to-1.md
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,20 +6,20 @@ weight: 2
6
6
layout: learningpathall
7
7
---
8
8
## Overview
9
-
This example will run on three AWS Graviton4 c8g.16xlarge instances with 64 cores and 128GB of RAM. The instances should have 2TB disk storage, to store downloaded and quantized model weights.
9
+
This example will run on three AWS Graviton4 c8g.4xlarge instances with 16 cores and 32GB of RAM. The instances should have 500GB disk storage, to store downloaded and quantized model weights.
10
10
11
11
You will perform these steps in this Learning Path:
2. Download and build llama.cpp, a C++ library that enables efficient inference of LLaMA and similar large language models on CPUs, optimized for local and embedded environments.
15
15
3. Convert Meta's safetensors files to a single gguf file.
16
16
4. Quantize the 16 bit gguf weights file to 4 bit weights.
17
17
5. Load and run the model.
18
18
19
-
{{% notice Note %}}The "reading time" mentioned on the Introduction page doesn't include downloading, converting, and requantizing the model. The process mentioned on this page will take 6+ hours. You may skip the model download and quantization if you have a quantized gguf file ready to use.{{% /notice %}}
19
+
{{% notice Note %}}The "reading time" mentioned on the Introduction page doesn't include downloading, converting, and requantizing the model. The process mentioned on this page will take 1-2 hours. You may skip the model download and quantization if you have a quantized gguf file ready to use.{{% /notice %}}
20
20
21
21
## Procedure
22
-
First, ensure you have permissions to access to Meta's [405B parameter llama 3.1 model](https://huggingface.co/meta-llama/Llama-3.1-405B).
22
+
First, ensure you have permissions to access to Meta's [70B parameter llama 3.1 model](https://huggingface.co/meta-llama/Llama-3.1-70B).
23
23
24
24
{{% notice Note %}}
25
25
Remember that you will need to replicate the install steps below on each device. Do NOT replicate the download and quantization step, llama.cpp will send the tensors to the cache.
@@ -29,7 +29,7 @@ Remember that you will need to replicate the install steps below on each device.
Copy file name to clipboardExpand all lines: content/learning-paths/servers-and-cloud-computing/distributed-inference-with-llama-cpp/how-to-2.md
+6-5Lines changed: 6 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,18 +6,18 @@ weight: 3
6
6
layout: learningpathall
7
7
---
8
8
## Cluster overview
9
-
llama.cpp is a C++ library that enables efficient inference of LLaMA and similar large language models on CPUs, optimized for local and embedded environments. Just over a year ago from the publication date of this article, rgerganov’s RPC code was merged into llama.cpp, enabling distributed inference of large LLMs across multiple CPU-based machines—even when the models don’t fit into the memory of a single machine. In this learning path, we’ll explore how to run a 405B parameter model on Arm-based CPUs.
9
+
llama.cpp is a C++ library that enables efficient inference of LLaMA and similar large language models on CPUs, optimized for local and embedded environments. Just over a year ago from the publication date of this article, rgerganov’s RPC code was merged into llama.cpp, enabling distributed inference of large LLMs across multiple CPU-based machines—even when the models don’t fit into the memory of a single machine. In this learning path, we’ll explore how to run a 70B parameter model on Arm-based CPUs.
10
10
11
11
For the purposes of this demonstration, the following experimental setup will be used:
12
12
- Total number of instances: 3
13
-
- Instance type: c8g.16xlarge
14
-
- Model: model.gguf (Llama-3.1-405B_Q4_0)
13
+
- Instance type: c8g.4xlarge
14
+
- Model: model.gguf (Llama-3.1-70B_Q4_0, ~38GB when quantized to 4 bits)
15
15
16
16
One of the three nodes will serve as the master node, which physically hosts the model file. The other two nodes will act as worker nodes. In llama.cpp, remote procedure calls (RPC) are used to offload both the model and the computation over TCP connections between nodes. The master node forwards inference requests to the worker nodes, where all the actual computation is performed.
17
17
18
18
## Cluster setup
19
19
20
-
Choose two of the three devices to act as backend workers. If the devices had varying compute capacities, the ones with the highest compute should be selected—especially for a 405B model. However, since all three devices have identical compute capabilities in this case, you can select any two to serve as backend workers.
20
+
Choose two of the three devices to act as backend workers. If the devices had varying compute capacities, the ones with the highest compute should be selected. However, since all three devices have identical compute capabilities in this case, you can select any two to serve as backend workers.
21
21
22
22
Communication between the master node and the worker nodes occurs through a socket created on each worker. This socket listens for incoming data from the master—such as model parameters, tokens, hidden states, and other inference-related information.
23
23
{{% notice Note %}}The RPC feature in llama.cpp is not secure by default, so you should never expose it to the open internet. To mitigate this risk, ensure that the security groups for all your EC2 instances are properly configured—restricting access to only trusted IPs or internal VPC traffic. This helps prevent unauthorized access to the RPC endpoints.{{% /notice %}}
@@ -36,4 +36,5 @@ Below are the available flag options that can be used with the rpc-server functi
36
36
-m MEM, --mem MEM backend memory size (in MB)
37
37
-c, --cache enable local file cache
38
38
```
39
-
Setting the host to 0.0.0.0 might seem counterintuitive given the earlier security warning, but it’s acceptable in this case because the security groups have been properly configured to block any unintended or unauthorized access.
39
+
40
+
There is currently no way to pre-load tensors onto the workers, the `-c` option will cache tensors during runtime. The first time inference runs the tensors will be distributed to the workers.
0 commit comments