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

Executing Large Language Models (LLMs) locally can be achieved through various methods. Some platforms are engineered to streamline the initial setup, while others offer greater configurability or are architected to handle high-concurrency serving. Selecting the optimal tool hinges on your specific requirements, whether you need a straightforward local chat interface, a highly configurable inference engine, or a robust production API.

Ollama

Ollama stands out as one of the most accessible entry points for local model execution. The workflow is streamlined: install the software, download a model, and launch it via the command line. Additionally, it exposes a local API to facilitate integration with applications and external tools.

Pros:

  • Streamlined installation and model management
  • Intuitive command-line workflow
  • OpenAI-compatible API endpoints
  • GPU acceleration support for NVIDIA, AMD, Apple Silicon, and Vulkan-based hardware
  • Customization of models and parameters via Modelfiles
  • Handling of concurrent requests when sufficient memory resources are available

Cons:

  • Limited low-level control compared to llama.cpp
  • Model management is tightly coupled to the Ollama ecosystem
  • Not ideal for maximizing serving throughput or distributed inference scenarios

Difficulty: Low. Recommended for those seeking to operationalize a model rapidly without navigating complex inference configurations.

llama.cpp

llama.cpp is a lean C/C++ inference engine optimized for efficient model execution across diverse hardware architectures. It utilizes GGUF models and affords granular control over the model loading and execution processes.

Pros:

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

Cons:

  • Requires more configuration effort than Ollama or LM Studio
  • GGUF models typically require separate download and management
  • Optimizing performance often demands a deep understanding of inference parameters

Difficulty: Medium. Suitable for users who require 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 the management of parameters such as GPU offloading and context size.

Pros:

  • User-friendly graphical interface
  • Integrated search and download capabilities via Hugging Face
  • Pre-loading display of model and resource specifications
  • OpenAI-compatible API server functionality
  • Headless operation support via its llmster server
  • Support for GGUF models through llama.cpp and MLX models on Apple Silicon

Cons:

  • Less low-level control than direct use of llama.cpp
  • Desktop application format may be less suitable for certain server deployments
  • Not primarily architected for large-scale, multi-user serving environments

Difficulty: Low. Ideal for users who prefer to explore local models with minimal reliance on command-line interfaces.

vLLM

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

Pros:

  • High throughput for handling multiple concurrent requests
  • Continuous batching and optimized KV-cache management
  • OpenAI-compatible API server
  • Direct compatibility with numerous Hugging Face models
  • Support for diverse quantization methods, including FP8, INT4, GPTQ, AWQ, GGUF, and others
  • Support for tensor, pipeline, expert, and other parallelism strategies
  • Designed specifically for production-grade inference and serving

Cons:

  • Complex setup and configuration requirements
  • Primarily targeted at Linux environments
  • Generally overkill for single-user, interactive model execution
  • Hardware and model compatibility must be verified prior to deployment

Difficulty: High. Best suited for professionals deploying inference services rather than individuals running models on personal computers.

Which one should you pick?

  • For easy model execution: Consider Ollama or LM Studio. Opt for Ollama for a command-line and simple API approach, or LM Studio for a graphical interface.
  • For inference control: Choose llama.cpp. It offers direct oversight of model loading, quantization, context management, GPU offloading, and other settings.
  • For a local API: Ollama, llama.cpp, or LM Studio are all viable options, as each provides an OpenAI-compatible API.
  • For serving multiple users: vLLM is the recommended choice, given its features for continuous batching and distributed inference.
  • For quantization experimentation: llama.cpp or LM Studio are suitable platforms for testing different quantization strategies.

Run it 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 effective for establishing simple local environments. llama.cpp provides deeper control over hardware and inference settings. vLLM is the preferred option when exposing a model as a high-throughput API is required.

View available GPUs to compare VRAM and other specifications.