Self-Hosting Models: Ollama, vLLM, llama.cpp, and LM Studio

10 min read Module 2 of 9 Topic 5 of 25

What you'll learn

  • Serve a local model with Ollama, vLLM, or llama.cpp and point Hermes at it
  • Explain why --tool-call-parser matters when self-hosting a model for agent use
  • Configure a named custom provider so multiple local endpoints can coexist
  • Choose between Ollama, vLLM, and llama.cpp based on your hardware and reliability needs
Building this at your company? For enterprise and company teams taking this to production: book a 30-minute session with our AI engineers for architecture guidance, code review, and a rollout plan for your use case.
Book a Team Session

Why Self-Host at All

Cloud providers are the fastest path to a working agent, but self-hosting matters once you care about data never leaving your infrastructure, predictable fixed costs at high volume, or running Hermes somewhere with no reliable internet access. Every option below speaks the OpenAI-compatible /v1 API, which is what makes them all straightforward to wire into Hermes.

Ollama: the Quick Path

Best for trying a model locally with minimal setup.

ollama pull qwen2.5-coder:32b
OLLAMA_CONTEXT_LENGTH=64000 ollama serve
# ~/.hermes/config.yaml
model:
  default: qwen2.5-coder:32b
  provider: custom
  base_url: http://localhost:11434/v1
  context_length: 64000

Note the explicit OLLAMA_CONTEXT_LENGTH and context_length settings, Ollama’s default context window is smaller than the 64K floor Hermes Agent needs for reliable multi-turn tool use (Lesson 2). Skipping this is the single most common cause of “my local model keeps forgetting earlier tool results” reports.

vLLM: Production-Grade Local Serving

vLLM is built for throughput and concurrent requests, the right choice once you’re serving more than one interactive session at a time.

vllm serve meta-llama/Llama-3.1-70B-Instruct \
  --port 8000 \
  --max-model-len 65536 \
  --enable-auto-tool-choice \
  --tool-call-parser hermes

The two tool-calling flags matter more than they look. --enable-auto-tool-choice turns on vLLM’s ability to let the model decide when to call a tool (versus forcing it every turn). --tool-call-parser hermes tells vLLM which output format to expect and parse into structured tool calls, this is the same Hermes function-calling format you’ll study in depth in Module 3, and it is why models trained with Hermes-style tool-call formatting (including the Hermes model family from Lesson 1) work especially cleanly here.

Point Hermes at it:

hermes model   # choose "Custom endpoint" → http://localhost:8000/v1

or directly in config:

model:
  default: your-model-name
  provider: custom
  base_url: http://localhost:8000/v1

llama.cpp: Maximum Portability

llama-server runs GGUF-quantized models with minimal dependencies, useful on constrained or unusual hardware (covered further in Module 5’s lesson on RTX and DGX Spark deployment).

llama-server \
  --jinja -fa \
  -c 64000 \
  -ngl 99 \
  -m models/qwen2.5-coder-32b-instruct-Q4_K_M.gguf \
  --port 8080 --host 0.0.0.0

--jinja applies the model’s actual chat template rather than a generic fallback, essential for correct tool-call formatting. -ngl 99 offloads as many layers as possible to GPU. -c 64000 again satisfies the context floor.

LM Studio: GUI-First Local Serving

For a point-and-click option that still exposes an OpenAI-compatible endpoint:

lms server start
lms load qwen2.5-coder --context-length 64000

Hermes finds it at the default http://localhost:1234/v1 via hermes model → “LM Studio”.

Naming Multiple Local Endpoints

Running more than one local server at once (say, a fast small model for quick lookups and a larger one for hard reasoning)? Give each a name in custom_providers instead of overwriting the single default endpoint:

custom_providers:
  - name: local
    base_url: http://localhost:8080/v1
  - name: work
    base_url: https://gpu-server.internal.corp/v1
    key_env: CORP_API_KEY

Switch between them mid-session:

/model custom:local:qwen-2.5
/model custom:work:llama3-70b

Choosing Between Them

EngineBest forConcurrencySetup effort
OllamaQuick local testing, single userLowMinimal
vLLMProduction, multiple concurrent sessionsHighModerate
llama.cppConstrained hardware, GGUF quantization, portabilityLow-MediumModerate
LM StudioGUI-first workflow, non-CLI usersLowMinimal

Exercise: pull a small model with Ollama, serve it with an explicit 64K context length, and point Hermes at it as a named custom provider. Ask it to call a simple built-in tool (Lesson 8 covers exactly what’s available). If the tool call fails to parse, that’s your first hands-on encounter with why --tool-call-parser and chat templates matter, revisit this lesson’s vLLM section for the fix.

Knowledge Check

3 questions to test your understanding

1 You start vLLM with `vllm serve meta-llama/Llama-3.1-70B-Instruct --port 8000` but omit `--enable-auto-tool-choice --tool-call-parser hermes`. What breaks?

2 Why does the llama-server startup command in this lesson include `--jinja -fa -c 64000`?

3 You are running two local model servers at once, one on port 8000 (vLLM) for coding tasks and one on port 11434 (Ollama) for general chat. How do you let Hermes address both without constantly re-running hermes model?

Go further with expert guidance

Ready to build production AI?
Talk to our R&D team.

These courses give you the foundation. Our embedded AI teams take you from prototype to production in 30–90 days, with your team, your codebase, your goals. Book a free strategy call to see how we can accelerate your AI initiative.

30 minutes · No obligation · Expert AI engineers, not sales reps

AI Architecture Review

Audit your current stack and identify high-impact improvements

Project Review

Get expert feedback on your AI implementation and codebase

Team Mentoring

Upskill your engineers with hands-on AI coaching sessions

AI Strategy

Define your AI roadmap, prioritization, and implementation plan