Comparing Local LLM Execution: Ollama, llama.cpp, LM Studio, and vLLM

Executing a Large Language Model (LLM) locally can be approached in multiple ways. Some platforms are engineered for effortless onboarding, while others prioritize granular control or high-concurrency serving capabilities. Selecting the optimal solution hinges on your specific requirements, whether that involves a straightforward local chat interface, a highly configurable inference engine, or a robust production-grade API.

Ollama

Ollama stands out as one of the most accessible entry points for local model execution. It allows users to install the software, retrieve a model, and execute it directly from the command line. Additionally, it exposes a local API to facilitate integration with other applications and tools.

Pros:

  • Streamlined installation and model management
  • User-friendly command-line experience
  • OpenAI-compatible API interface
  • Hardware acceleration support for NVIDIA, AMD, Apple Silicon, and Vulkan-based GPUs
  • Modelfiles enable customization of models and parameters
  • Concurrent request handling when sufficient memory is available

Cons:

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

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

llama.cpp

llama.cpp is a lightweight C/C++ inference engine optimized for efficient model execution across diverse hardware environments. It utilizes GGUF models and offers detailed oversight of model loading and runtime behavior.

Pros:

  • Granular control over context, 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 up to 8-bit
  • Ability to partition models across multiple GPUs
  • Hybrid CPU and GPU execution for models exceeding available VRAM
  • Included llama-server provides an OpenAI-compatible API

Cons:

  • Requires more configuration effort than Ollama or LM Studio
  • GGUF models typically require separate downloading and management
  • Advanced settings necessitate a solid understanding of inference parameters

Difficulty: Medium. Well-suited for users who wish to precisely dictate model execution or experiment with performance and quantization techniques.

LM Studio

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

Pros:

  • Intuitive graphical user interface
  • Model search and download capabilities via Hugging Face
  • Pre-loading display of model and resource details
  • OpenAI-compatible API server functionality
  • Headless execution capability through its llmster server
  • Support for GGUF models via 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 ideal for certain server deployments
  • Not primarily architected for large-scale multi-user serving

Difficulty: Low. A strong choice for those who wish to explore local models without extensive command-line interaction.

vLLM

vLLM is built to serve LLMs to applications and multiple concurrent users. Its primary strength lies in high-efficiency serving at scale, leveraging 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 various quantization methods, including FP8, INT4, GPTQ, AWQ, GGUF, and more
  • Support for tensor, pipeline, expert, and other forms of parallelism
  • Designed specifically for production inference and serving workloads

Cons:

  • Complex setup and configuration process
  • Primarily targeted at Linux environments
  • Often excessive for single-user interactive model execution
  • Requires verification of hardware and model compatibility prior to deployment

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

Which one should you pick?

  • For effortless model execution: Consider Ollama or LM Studio. Opt for Ollama if you prefer the command line and simple API, or LM Studio for a graphical interface.
  • For inference control: Choose llama.cpp. It offers direct oversight of model loading, quantization, context, GPU offloading, and other settings.
  • For a local API: Ollama, llama.cpp, or LM Studio are all viable options, as they provide OpenAI-compatible APIs.
  • For multi-user serving: vLLM is the recommended choice, featuring continuous batching and distributed inference for this specific use case.
  • For quantization experimentation: llama.cpp or LM Studio provide suitable environments for testing different quantization levels.

Run it on DaDesktop

If local GPU hardware is insufficient, you can execute these tools via 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 excellent for simple local environments. llama.cpp offers greater control over hardware and inference settings. vLLM serves as an option when you need to expose a model as a high-throughput API.

View available GPUs to compare VRAM and other specifications.