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

Executing a Large Language Model (LLM) locally can be approached in several ways. Some solutions prioritize ease of use for quick setup, while others offer granular control or are optimized for handling multiple concurrent users. Selecting the appropriate tool hinges on your specific needs: whether you seek a straightforward local chat experience, a highly configurable inference engine, or a robust production-grade API.

Ollama

Ollama stands out as one of the most accessible methods for running models locally. It streamlines the process: install the software, download a model, and execute it via the command line. Additionally, it offers a local API endpoint, allowing applications and other tools to interact seamlessly with the model.

Advantages:

  • Straforward installation and model management
  • Intuitive command-line workflow
  • Provides an OpenAI-compatible API
  • Compatible with NVIDIA, AMD, Apple Silicon, and Vulkan-based GPU acceleration
  • Allows customization of models and parameters via Modelfiles
  • Handles concurrent requests efficiently, provided sufficient memory is available

Disadvantages:

  • Offers less low-level control compared to llama.cpp
  • Model management is tightly integrated with the Ollama ecosystem
  • Not the ideal choice for maximizing serving throughput or implementing distributed inference

Complexity: Low. Ideal for users who want to run a model quickly without delving into intricate inference settings.

llama.cpp

llama.cpp is a lightweight C/C++ inference engine designed to run models efficiently across diverse hardware platforms. It utilizes GGUF models and provides detailed control over the model loading and execution processes.

Advantages:

  • Granular control over context, GPU offloading, batching, threads, quantization, and other inference parameters
  • Extensive hardware support, including CUDA, HIP, Metal, Vulkan, and SYCL
  • Supports a wide range of quantization levels, from low-bit formats up to 8-bit
  • Capable of splitting models across multiple GPUs
  • Enables hybrid CPU and GPU usage when a model exceeds available VRAM
  • Includes llama-server for an OpenAI-compatible API

Disadvantages:

  • Requires more configuration than Ollama or LM Studio
  • GGUF models typically need to be downloaded and managed separately
  • Many advanced settings require a solid understanding of inference parameters

Complexity: Medium. Well-suited for users who desire precise control over model execution or wish to experiment with performance tuning and quantization.

LM Studio

LM Studio is a desktop application designed for downloading, configuring, and executing local LLMs. It features a graphical interface that simplifies model discovery and management, including settings for GPU offloading and context size.

Advantages:

  • User-friendly graphical interface
  • Facilitates model searching and downloading via Hugging Face
  • Displays model and resource information prior to loading
  • Includes an OpenAI-compatible API server
  • Can run models in headless mode via its llmster server
  • Supports GGUF models via llama.cpp and MLX models on Apple Silicon

Disadvantages:

  • Provides less low-level control than using llama.cpp directly
  • The desktop application may not be optimal for certain server deployments
  • Not primarily architected for large-scale, multi-user serving

Complexity: Low. A strong option for experimenting with local models without extensive command-line interaction.

vLLM

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

Advantages:

  • High throughput for multiple concurrent requests
  • Features continuous batching and efficient KV-cache management
  • Offers an OpenAI-compatible API server
  • Integrates directly with numerous Hugging Face models
  • Supports various quantization methods, including FP8, INT4, GPTQ, AWQ, GGUF, and more
  • Supports tensor, pipeline, expert, and other forms of parallelism
  • Built specifically for production inference and serving environments

Disadvantages:

  • Setup and configuration are more complex
  • Primarily targeted at Linux environments
  • Generally overkill for single-user, interactive model runs
  • Hardware and model compatibility must be verified before deployment

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

Which option is right for you?

  • Seeking ease of use: Consider Ollama or LM Studio. Opt for Ollama if you prefer the command line and simple APIs, or LM Studio for a graphical interface.
  • Desiring inference control: Choose llama.cpp. It offers direct control over model loading, quantization, context, GPU offloading, and other settings.
  • Requiring a local API: Ollama, llama.cpp, or LM Studio are all viable options, as each provides an OpenAI-compatible API.
  • Serving multiple users: vLLM is the recommended choice, with its continuous batching and distributed inference features designed for this scale.
  • Exploring quantizations: llama.cpp or LM Studio offer the best flexibility for experimenting with different quantization levels.

Run it on DaDesktop

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

Ollama and LM Studio are excellent for simple local environments. llama.cpp offers deeper control over hardware and inference settings. vLLM is the ideal choice when you need to expose a model as a high-throughput API.

View available GPUs to compare VRAM and other specifications.