llama.cpp
Also known as: llama-cpp
Open-source C and C++ engine for running large language models locally on consumer hardware, known for its quantized GGUF model format.
llama.cpp is an open-source software library and set of command-line tools for running large language models locally, written in C and C++ with minimal dependencies. It performs inference, not training: it loads model weights, processes prompts and generates text on ordinary hardware, from laptops and desktop computers to single-board machines and servers. It supports many model families beyond the Meta Llama models that inspired its name, and includes an HTTP server that exposes a chat completion interface similar to those of commercial APIs.
Georgi Gerganov released llama.cpp in March 2023, shortly after Meta's first LLaMA models became available to researchers and their weights spread online. It is built on ggml, Gerganov's tensor library, and achieved its speed through careful use of CPU vector instructions and aggressive quantization, which stores weights in 8, 5, 4 or fewer bits to cut memory use at some cost in accuracy. Models are packaged in GGUF, a single-file format introduced by the project in 2023. Additional backends added support for Apple's Metal, NVIDIA's CUDA, Vulkan and other GPU interfaces.
llama.cpp did much to make local AI practical for individuals, showing that capable models could run without data center hardware or cloud accounts. Running models locally keeps prompts and data on the user's machine, which matters for privacy, offline use and experimentation. Many downstream tools build on it or on its GGUF format, including Ollama and various desktop chat applications. Quality and speed depend heavily on model size, quantization level and available memory, and small quantized models are generally less capable than large hosted systems.
Key points
- llama.cpp runs large language model inference in C and C++ on consumer hardware.
- Quantization to 8, 4 or fewer bits lets large models fit in limited memory.
- The project introduced GGUF, a widely used single-file format for distributing quantized models.
- Georgi Gerganov released it in March 2023, building on his ggml tensor library.
Related entries
Ollama
Tool for downloading and running open-weight language models on a personal computer or server through a simple command line and local API.
Llama
Family of large language models from Meta, distributed as downloadable weights that developers can run, study and adapt on their own hardware.
Quantization
Technique that stores and computes a model's numbers at lower precision, such as 8 or 4 bits, to cut memory use and speed up inference.
Inference
The stage at which a trained machine learning model is run on fresh inputs to produce predictions or generated outputs, as distinct from training.
Open-Weight Model
AI model whose trained weights are publicly released for download, letting others run, study and adapt it, though often under restrictive licenses.
Neural network trained on very large amounts of text to predict the next token, able to generate language and perform many tasks from prompts.
Model Weights
The learned numerical values inside a machine learning model, set during training, that determine how it transforms inputs into outputs.
Hugging Face
Company that runs a widely used platform for sharing machine learning models, datasets and demos and maintains popular open-source AI libraries.
Featured in guides
Referenced by
Other entries that discuss or point to llama.cpp.