Running Local LLMs: A Comparative Analysis of Ollama, llama.cpp, LM Studio, and vLLM

There are multiple avenues for executing Large Language Models (LLMs) locally. Certain frameworks are optimised for seamless onboarding, whereas others provide granular control or are architected to handle high-concurrency user loads. The optimal selection hinges on whether your objective is a straightforward local chat interface, a highly configurable inference engine, or a robust production-ready API.

Ollama

Ollama stands out as one of the most accessible methods for initiating local model deployment. The process is streamlined: install the software, fetch a model, and execute it via the command line. Additionally, it offers a local API endpoint for integration with applications and other tools.

Advantages:

  • Streamlined installation and model management
  • User-friendly command-line workflow
  • OpenAI-compatible API
  • Compatibility with NVIDIA, AMD, Apple Silicon, and Vulkan-based GPU acceleration
  • Customisable model parameters via Modelfiles
  • Capability to handle concurrent requests, provided sufficient memory is available

Disadvantages:

  • Offers less low-level control compared to llama.cpp
  • Model management is tightly coupled to the Ollama ecosystem
  • Not the primary candidate for scenarios demanding maximum serving throughput or distributed inference

Complexity: Low. Ideal for users seeking to deploy a model rapidly without navigating complex inference configurations.

llama.cpp

llama.cpp is a lean C/C++ inference engine engineered for efficient model execution across diverse hardware landscapes. It utilises GGUF models, affording precise oversight over model loading and runtime behaviour.

Advantages:

  • Granular control over context, GPU offloading, batching, threading, quantization, and other inference parameters
  • Extensive hardware support, encompassing CUDA, HIP, Metal, Vulkan, and SYCL
  • Support for a wide spectrum of quantization levels, from low-bit formats up to 8-bit
  • Ability to partition models across multiple GPUs
  • Hybrid CPU/GPU execution when model size exceeds available VRAM
  • Includes llama-server for an OpenAI-compatible API

Disadvantages:

  • Requires more configuration effort than Ollama or LM Studio
  • GGUF models typically require separate download and management
  • Optimising many settings necessitates a solid understanding of inference parameters

Complexity: Medium. Suitable for users desiring precise control over model execution or wishing to experiment with performance tuning and quantization strategies.

LM Studio

LM Studio is a desktop application designed for the retrieval, configuration, and execution of local LLMs. It features a graphical interface that simplifies model discovery and management of parameters such as GPU offloading and context size.

Advantages:

  • Intuitive graphical interface
  • Model search and download capabilities via Hugging Face
  • Displays model and resource metrics prior to loading
  • OpenAI-compatible API server
  • Capability to operate models in headless mode via its llmster server
  • Supports GGUF through llama.cpp and MLX models on Apple Silicon

Disadvantages:

  • Offers less low-level control than direct use of llama.cpp
  • The desktop application format may be less optimal for certain server-based deployments
  • Not primarily architected for large-scale, multi-user serving environments

Complexity: Low. A fitting choice for users looking to experiment with local models without extensive command-line interaction.

vLLM

vLLM is purpose-built for serving LLMs to applications and multiple concurrent users. Its core strength lies in efficient high-concurrency serving, leveraging techniques such as PagedAttention, continuous batching, prefix caching, and distributed inference.

Advantages:

  • High throughput for multiple simultaneous requests
  • Continuous batching and optimised KV-cache management
  • OpenAI-compatible API server
  • Direct compatibility with numerous Hugging Face models
  • Support for various quantization methods, including FP8, INT4, GPTQ, AWQ, and GGUF
  • Supports tensor, pipeline, expert, and other forms of parallelism
  • Designed specifically for production-grade inference and serving

Disadvantages:

  • More complex setup and configuration process
  • Primarily targeted at Linux environments
  • Typically overkill for a single user running one model interactively
  • Hardware and model compatibility must be verified prior to deployment

Complexity: High. Best suited for professionals deploying an inference service rather than simply running a model on a personal device.

Which option is right for you?

  • Prioritising ease of use: Ollama or LM Studio. Opt for Ollama for a command-line focused approach with a simple API, or LM Studio for a graphical interface.
  • Seeking granular inference control: llama.cpp. It provides direct command over model loading, quantization, context management, GPU offloading, and related settings.
  • Requiring a local API: Ollama, llama.cpp, or LM Studio. All three deliver OpenAI-compatible APIs.
  • Necessitating high-user serving: vLLM. Its continuous batching and distributed inference capabilities are tailored for this use case.
  • Desiring to test various quantizations: llama.cpp or LM Studio.

Execute on DaDesktop

If local GPU hardware is insufficient, these tools can be executed on a DaDesktop cloud desktop. Select a GPU with adequate VRAM for your target model, launch the desktop environment, and install your preferred inference software.

Ollama and LM Studio are ideal when a simple local environment is required. llama.cpp offers greater command over hardware and inference settings. vLLM serves as an option when exposing a model as a high-throughput API is necessary.

View available GPUs to compare VRAM and other technical specifications.