Local LLM Deployment

Local LLM Deployment on Mac and Linux

Run capable LLMs on your own hardware without depending on cloud APIs. This guide covers the practical tradeoffs between Ollama, llama.cpp, and direct model serving on Mac and Linux for offline-first workflows.

FreeLast tested: 2026-08-28Audience: Engineers / technical operators

Why run models locally

Local deployment removes three practical risks from cloud-only AI workflows: API outages, per-token cost spikes, and data leaving your environment. For repetitive tasks such as formatting, classification, and local RAG over private docs, local models often deliver acceptable quality at zero marginal cost.

The tradeoff is hardware. Smaller models can run comfortably on a MacBook Air; larger models require GPU memory, unified memory bandwidth, or a Linux box with a decent consumer GPU. Choose the tool that matches your hardware and operational tolerance.

Ollama for fast iteration

Ollama is the fastest path from download to inference. It handles model packaging, quantization, and an OpenAI-compatible API out of the box. On a Mac with 16 GB or more unified memory, ollama run llama3.1:8b-instruct-q4_K_M is usually enough for drafting, rewriting, and structured extraction.

When Ollama is the right choice

When to look elsewhere

llama.cpp for control and portability

llama.cpp remains the most portable backend for GGUF models. It compiles cleanly on Mac and Linux, exposes explicit memory controls, and supports CPU-only inference when GPU access is limited. The workflow is longer than Ollama, but the knobs are yours.

A practical Linux pattern is to run llama-server on a machine with more memory than your laptop, then call it from your primary workstation. For Mac, Metal acceleration usually removes the need for that split unless you are running 70B-class models.

If you want a concrete workflow for shipping prompts alongside model setup, see Prompt engineering for structured outputs. For a comparison of cloud-vs-local tooling across a real team, see AI coding assistant code review.

Hardware and model selection

Use this rough sizing to avoid surprise OOMs:

MachinePractical maxTypical use
MacBook Air 8 GB7B Q4Light drafting, classification
MacBook Pro 16 GB13B Q4Structured extraction, translation
MacBook Pro 32 GB34B Q4Long context, local RAG
Linux 24 GB VRAM70B Q5Reasoning, agent-style tasks

Prefer Q4 or Q5 quantization for general use. Q2 and Q3 are cheaper but degrade reasoning and instruction following more than most benchmarks suggest. Measure on your own workload rather than trusting leaderboard summaries.

Prompting differences

Local models often require shorter, more explicit instructions than large cloud APIs. Avoid assuming the same prompt will transfer directly. Reduce ambiguity, include the desired output format, and add a one-shot example when accuracy matters more than brevity.

Operational checklist

  1. Start with one model, one runtime, and one benchmark task.
  2. Pin the model file hash and runtime version in a short local README.
  3. Use an API gateway or script wrapper so your tooling does not hardcode one runtime.
  4. Schedule a monthly model refresh cadence; local models drift quickly in capability.

Local deployment is a reliability play, not a set-and-forget install. The benefit is control, and control only counts if you keep the stack current.

Troubleshooting common failures

If Ollama hangs on model load, check unified memory pressure first. On Mac, close GPU-heavy apps and rerun. On Linux, verify no other process is locking the GPU device file. If llama.cpp crashes immediately, rebuild from source after updating system OpenBLAS or cuBLAS dependencies.

Quantization mismatches also cause silent quality regressions. If responses degrade after a model update, compare the GGUF filename and quantization level against the previous pinned version. Do not treat a newer model file as automatically equivalent.

Cost comparison

Cloud APIs charge per token. Local models charge for hardware and electricity once. For high-volume tasks such as classification, normalization, or internal search, the crossover point is often much lower than teams expect.

ScenarioCloud APILocal model
Low volume, ad hoc queriesLow fixed costNot worth the setup
High volume, repetitive tasksExpensive at scaleUsually cheaper
Private or regulated dataCompliance review requiredOften simpler
Offline or air-gapped useNot possibleFits naturally

Latency reality check

Local inference is not always faster than a good cloud API. Network latency can be lower than first-token time on an underpowered CPU. Benchmark your actual workflow, not isolated token speeds.