News

日本語 · English · 中文

[Ask the Teacher] GGUF, llama.cpp, and vLLM: What’s the Difference When Running the Same Model?

The discussion about running models locally involves GGUF, llama.cpp, and vLLM, each serving different roles: GGUF is a packaging format, llama.cpp is a tool for local execution, and vLLM is a tool for batch processing. Based on our site’s empirical measurements, we explain that these tools may not always keep pace with models.

Hinata: Mr. Saeki, while reading an article about running AI models on your own PC, I came across the terms GGUF, llama.cpp, and vLLM all mentioned together. They all seem to be related to running models, but I have no idea what exactly distinguishes them.

Saeki: That’s a great observation, Hinata-san. These three have different roles, so it’s easy to understand them by keeping them in mind side by side. If we use a cooking analogy, GGUF is the "packaging method," while llama.cpp and vLLM are "cooking tools." Packaging and tools are fundamentally different things.

Let’s start with GGUF. This is the name of the format for packing the contents of a model into a single file. It includes the model weights (the collection of numbers obtained through learning) and the settings required to run it. Since it is just a file format, it doesn’t do anything on its own; you need something on the receiving end to take it out and run it.

Hinata: So, the name of the box and the tools used to open and use the box are separate. Then, are llama.cpp and vLLM both tools for opening the box? Why are there two tools that do the same thing?

Saeki: It’s because they are suited for different scenarios. llama.cpp is a tool for running models on a single local machine. It reads the GGUF box and runs it on your PC's GPU. On the other hand, vLLM is a tool designed to handle orders from many users simultaneously. It is placed on a server to efficiently process incoming inquiries that arrive at the same time.

The articles that our site actually benchmarked all used llama.cpp, because the topic was about seeing how far a single local machine could go.

Hinata: So, if you want to test locally, you use llama.cpp, and for batch processing, you use vLLM. By the way, I saw the phrase "build from source" in the articles. I had thought that tools were something you could just buy and use right out of the box.

Saeki: llama.cpp is distributed as design blueprints (source code), and the user assembles it according to their own machine. This is what "build" means. Even with the same design blueprint, the assembly method needs to change depending on the GPU generation. Even in our site’s actual measurements, we rebuilt it separately for the RTX 3090 and for newer cards.

Hinata: So it has to be rebuilt for each machine. But if you build it correctly, any model should run, right?

Saeki: ⚠️ This is the most important thing to know. Sometimes it won’t run.

When our site tried testing a 176B model, it could not be loaded by the main branch of llama.cpp. The model’s architecture was so new that the tool itself didn’t know that format. The distribution page stated, "To run this, please use our llama.cpp PR," so we fetched the specified branch, rebuilt it, and were finally able to load it.

We have written the details of that incident in Benchmarking LLMs on an RTX 3090—How many tokens per second are needed for reading speed?.

Hinata: So even if you get the official version, it might not work? That sounds like it could waste hours if you don’t know about it.

Saeki: That’s right. Therefore, ⭐ when trying a new model, check first whether the runtime can keep up. Just doing that can significantly reduce wasted effort.

With another model, a GGUF version was released the day after the official weights were made available. While that speed is appreciated, until it is merged into the main branch, you have to rely on someone’s forked version. It is safest to keep in mind that this is something you touch with that understanding.

Hinata: So you need to look at the box format (GGUF), the tools (llama.cpp and vLLM), and whether the tools are up to date. All three need to be checked. So, in reality, how well do things run on a local PC?

Saeki: Let me answer that with our site’s actual measurements.

On a 24GB GPU (RTX 3090), running a quantized 176B model resulted in 4.92 tokens per second. This is exactly the same speed as a human reading text. It’s not a problem if you wait while reading, but there’s no margin.

On a 96GB GPU, a 320B model fit entirely and output 66.97 tokens per second. This is more than 10 times the reading speed.

In other words, there is still a large gap between "it runs" and "it runs comfortably." Thanks to GGUF and llama.cpp, it has become possible to run models locally. However, the current situation is that comfortable usage still requires 96GB-class memory.

Hinata: To summarize: GGUF is the packaging format, llama.cpp is the tool for running locally, and vLLM is the tool for batch processing. And since the tools sometimes lag behind the models, you need to check that first. It seems that while you can run models locally, comfort is still a work in progress.

Saeki: Exactly. The next shift in the situation will depend on either how much memory can be packed into affordable GPUs or how much less memory will be needed to achieve the same performance. ⚠️ I don’t know when either of those will come. However, I think the fact that ⭐ we can now try things out locally is a change that won’t go back.

This article was translated from the Japanese original. 日本語で読む

← Latest articles