llama.cpp
LLM inference engine in C/C++ โ powers Ollama, LM Studio, and the local AI stack
๐ Overview
llama.cpp is the foundational C/C++ inference engine that makes local LLM running practical on consumer hardware. Developed by Georgi Gerganov, it implements efficient inference for GGUF-formatted models with no external dependencies โ running on CPU, CUDA, Metal, Vulkan, and WebGPU. It is the backend that powers Ollama, LM Studio, Jan, LM Studio, Open WebUI, and dozens of other local AI tools. The GGUF format and quantization-aware memory mapping allow running 70B+ parameter models on a laptop with clever memory management. The project has forked into ggml-org/llama.cpp and remains the most important infrastructure project in the local AI ecosystem.
โจ Key Features
- โข120K+ GitHub stars โ most important local AI infrastructure project
- โขZero external dependencies โ pure C/C++ implementation
- โขMulti-backend: CPU, CUDA, Metal, Vulkan, WebGPU, and browser
- โขGGUF format enables single-file model distribution with quantization
- โขPowers Ollama, LM Studio, Jan, Open WebUI, and dozens more
- โขServer mode exposes OpenAI-compatible REST API
- โขRuns 70B+ models on consumer hardware via memory-mapped quantization
๐ฏ The Problem It Solves
Running LLMs locally was previously limited to Python frameworks with heavy PyTorch dependencies โ unusable on consumer hardware. llama.cpp proved that optimized C/C++ with quantization could run 7B models on a Raspberry Pi and 70B models on a MacBook, democratizing local inference.
๐ง How It Works
llama.cpp loads GGUF (Georgi GPU Format) files โ a single-file format containing quantized weights, tokenizer, and metadata. Inference runs via optimized matrix multiplication kernels written in C/C++ with SIMD/NEON/AVX acceleration. GPU offloading supports CUDA (NVIDIA), Metal (Apple), Vulkan (AMD/Intel), and WebGPU (browser). The server mode exposes an OpenAI-compatible API, making it a drop-in backend for any tool. llama-cli provides a local chat interface; llama-server mimics the OpenAI REST API.
๐ Installation & Quick Start
Installation
See websiteQuick Start
- See documentation
โ Pros
- โขZero dependencies โ compiles anywhere with a C++ compiler
- โขMost optimized local inference engine available
- โขMulti-hardware: CPU, NVIDIA, AMD, Intel, Apple Silicon
- โขGGUF format is the de facto standard for local LLMs
- โขPowers the entire local AI ecosystem
- โขOpenAI-compatible server mode
- โขMIT licensed โ completely free
โ Cons
- โขBuilding from source requires C++ knowledge
- โขCLI is bare-bones โ needs a frontend for usability
- โขGGUF conversion from other formats is lossy
- โขLimited multimodal support compared to commercial APIs
- โขDocumentation lags behind features
๐ฌ Practitioner Verdict
โllama.cpp is the most important local AI infrastructure project โ without it, Ollama, LM Studio, Jan, and most local AI tools simply would not exist. The zero-dependency C/C++ implementation is a engineering marvel. The trade-off: building from source requires C++ knowledge, the CLI is bare-bones compared to polished UIs, and GGUF conversion from other formats is lossy. For anyone running LLMs locally, llama.cpp is the invisible engine that makes it possible.โ
Self-Hosted (Free)
Open source, MIT/Apache licensed. Run it yourself.
โญ Star & Clone on GitHubFree forever. Your infrastructure, your data.
Deployment Options
Ways to run llama.cpp in production
๐ Specifications
- Language
- C++
- License
- MIT
- Platform
- Linux, macOS, Windows
- Supported Models
- REST API, CLI
๐ฐ Pricing Reality
100% free and open source MIT license. No paid tier, no usage caps. You supply your own hardware. GGUF models are free to download from Hugging Face.