How to run a local LLM server step by step

 

There are multiple inference engines to run AI models on your own hardware: including llama.cpp, vllm, ollama, lm studio. Etc.Each one is built for a different use case.  find the one that fits your use. 

 

Ollama vs llama.cpp vs vLLM — Which Should You Use?

Ollama vs LiteLLM vs llmama.cpp vs vvllm vs lm studio

These tools represent different layers of the AI stack. While they overlap, they generally serve distinct purposes:

Serving (Llama.cpp, vLLM),

Managing (Ollama, LM Studio), 

Routing (LiteLLM).

 

Comparing local AI runtimes

 Ollamallama.cppvLLM
Setup time2 min10 min5 min
GPU requiredNoNoYes
QuantizationAutoFull controlLimited
APIOpenAI-compatOpenAI-compatOpenAI-compat
Best forGetting startedTweakingProduction

 

 

Managing (Ollama, LM Studio)

Ollama

A local LLM inference/runtime platform.It handles model downloads, storage, and execution with a simple CLI/API. Think of it as a “local LLM server”.

Run AI Models locally  integrate via API。Ollama is popular but not the fastest.

 

LM Studio

A  desktop application.

Run AI Models locally with a Chat UI

 

Serving (Llama.cpp, vLLM)

llama.cpp - run ai model on edge devices.

Run a model on a Raspberry Pi5 8GB.

 

vLLM

Build a high-traffic AI startup or production API.

 

Routing (LiteLLM)

LiteLLM

LiteLLM is not an inference engine; it is a Proxy/Router.A proxy/gateway layer that provides a unified, OpenAI-compatible API for calling many LLM providers (cloud and local).

 

Modles

There are multiple model:

 

fast local model

larger reasoning model

vision model

cloud models

 

Best models for CPU-only

 

RAM availableBest modelWhy
4GBQwen3.5-2BBest quality at this size
8GBQwen3.5-4BGood balance
16GBQwen3.5-9BBest quality-per-resource
32GBQwen3.5-27B (Q4)Strong but slow (~2-4 tok/s)

 

Pi 5 vs other hardware

DeviceRAMPriceBest modelSpeed
Raspberry Pi 5 (8GB)8GB~$80Qwen3.5-0.8B~10 tok/s
Raspberry Pi 5 (16GB)16GB~$120Qwen3.5-35B-A3B~4.5 tok/s
Mac Mini M4 (16GB)16GB$599Qwen3.5-9B~35 tok/s
Used mini PC (16GB)16GB~$150-200Qwen3.5-4B~8-12 tok/s

 

works on a Pi 5

ModelSizeSpeed on Pi 5 (8GB)Speed on Pi 5 (16GB)Quality
Qwen3.5-0.8B0.8B~8-10 tok/s~10-12 tok/sBasic tasks, fast
Qwen 2.5 0.5B0.5B~12-15 tok/s~15 tok/sSimple Q&A
TinyLlama 1.1B1.1B~6-8 tok/s~8-10 tok/sDecent for size
Qwen3.5-4B (Q2)4BToo slow~3-4 tok/sGood quality, slow
Qwen3.5-35B-A3B (Q2)3B activeToo slow~4.5 tok/sSurprisingly good

 

Summary

Ollama - Two commands, simplest setup, good for beginners

llama.cpp - More control, CPU-optimized, works on any hardware

Unsloth - Python integration, full customization, best for developers

 

This is my current setup:

 

Gemma 4 runs in llama.cpp server, exposed through the OpenAI-compatible http://192.168.2.125:8091/v1 API.

Home Assistant connects  llama.cpp server  using the Local OpenAI LLM integration .

 

I’m using the same model for both:

Assist Conversation Agent (streaming responses + device control via the Assist API)

AI Task automations (camera analysis, BMS battery summaries, pool sensor analysis, etc.)

 

For vision, Home Assistant converts camera snapshots into OpenAI-style image_url (base64) inputs and sends them straight to Gemma. The llama.cpp container loads both the GGUF and the matching mmproj (configured in the container, not in HA).

 

For STT I’m also using Gemma via a Wyoming endpoint. The flow looks like this:

Voice Satellite → HA Assist → Wyoming STT (Gemma) → transcript → Gemma via llama.cpp → TTS

 

Camera analysis is similarly straightforward:

Camera Snapshot → HA AI Task → llama.cpp (GGUF + mmproj) → Vision Analysis

 

useful links

Gemma 4 model overview

https://ai.google.dev/gemma/docs/core

 

Comments


Comments are closed