How to Run an LLM Locally and Verify Where It Runs

To run an LLM locally, install a model runner, download a model that fits your computer, and verify that the response is generated on that machine. A concrete starting point is Ollama’s Llama 3.1 package: the explicit llama3.1:8b download is 4.9GB with Q4_K_M quantization. The workflow below takes that package from installation to a measured local response, then adds an optional browser interface with persistent storage.

A model download, its runtime memory and a chat interface are separate parts of the setup. Getting the native runner working first makes failures easier to locate: a missing model, CPU fallback and a browser connection problem need different fixes. It also gives you a usable baseline before buying hardware.

Google · Preferred Sources

Don't miss new tech stories on Google

Add Tech Insider once in the Google app and our stories appear in your news suggestions.

Add Now

Start with the machine you already own

Ollama’s hardware support list identifies supported NVIDIA, AMD and Apple GPU paths. NVIDIA support starts at compute capability 5.0 and driver 550, with driver 570 required for compute capabilities 5.0 through 6.2. AMD support depends on the operating system and driver stack; Apple acceleration uses Metal. Check the actual device against that list instead of assuming that a brand name guarantees support.

For a desktop alternative, LM Studio’s system requirements give explicit operating-system and memory guidance. Those application recommendations are a starting point for choosing software, not a promise that every model will fit. LM Studio can also work offline once its model files have been downloaded.

Runtime and platformDocumented compatibility or recommendation
LM Studio on macOSApple Silicon; macOS 14.0 or newer; 16GB+ RAM recommended. Smaller models and modest context may work on 8GB; Intel Macs are unsupported.
LM Studio on Windowsx64 with AVX2, or supported ARM systems; at least 16GB RAM and 4GB dedicated VRAM recommended.
LM Studio on Linuxx64 or ARM64 AppImage; Ubuntu 20.04 or newer; the x64 build uses AVX2.
Ollama accelerationNVIDIA support depends on compute capability and driver; AMD has separate Linux/Windows lists; Apple uses Metal; Vulkan adds Windows/Linux GPU support.

On a discrete GPU system, model memory competes with other GPU workloads. On a machine using unified memory, applications and the model share the same overall pool. Keep room for the operating system, browser and conversation state; the download size alone is an incomplete capacity estimate.

Install Ollama and complete a local round trip

Use the Ollama application installer for Windows or macOS. On Linux, the official installation instructions provide this command. After installation, confirm the service is available before downloading a model:

curl -fsSL https://ollama.com/install.sh | sh
sudo systemctl status ollama

For NVIDIA hardware on Linux, nvidia-smi should identify the GPU and driver. That checks driver visibility; model residency is checked separately below. A full browser stack is optional, so leave Docker out of this first native setup.

The Ollama CLI reference documents model download, listing and execution. Run these commands in a terminal after the application or service has started:

ollama pull llama3.1:8b
ollama ls
ollama run llama3.1:8b

Enter a short prompt and read the response. Using an explicit model identifier makes the API example and later comparisons refer to the same package. A successful response is the first milestone; the next step is checking which memory holds the model. Our Ollama setup guide develops the runner-specific workflow further.

Starter package propertyPublished value
Model identifierllama3.1:8b
Package size4.9GB
Parameters8.03B
Weight quantizationQ4_K_M

Read memory residency before changing the hardware

While the model is loaded, open another terminal and run ollama ps. The Ollama local configuration documentation explains the PROCESSOR column: 100% GPU means the model is entirely in GPU memory, 100% CPU means system memory, and a split value means both. These are placement indicators, not a measurement of instantaneous GPU utilization.

If the model spills into system memory, first reduce the workload that must fit. Close another loaded model with ollama stop, shorten the active context, or select a smaller package. Ollama normally keeps a model loaded for 5 minutes after use, so an idle model can still occupy memory. The hardware guide also notes that NVIDIA discovery can fall back to CPU after Linux suspend and resume, making a fresh residency check useful after wake.

The FAQ documents a 4096-token default context and an interactive override. Inside the running chat, set the context explicitly so a comparison does not silently change its memory budget:

/set parameter num_ctx 4096

A longer context stores more conversation state. Parallel requests multiply that requirement as well: memory sized for a short single chat can become insufficient when several requests run together. Change context or concurrency deliberately, then repeat the same prompt and inspect residency again.

KV-cache settingApproximate cache memory relative to f16Tradeoff
f16Full baselineDefault cache representation
q8_01/2Lower precision with a smaller cache
q4_01/4More aggressive compression; output quality can be affected more

Cache quantization uses OLLAMA_KV_CACHE_TYPE and requires Flash Attention. It is a later tuning step, after a basic model works. Weight quantization and cache quantization affect different allocations, so compare answer quality on your own task as well as memory consumption. Choosing a model family is a separate decision explored in our open model comparison.

Measure generation separately from loading

The Generate API reference exposes output-token count, generation duration, model-loading duration and prompt-processing duration. This lets you distinguish a slow cold start from slow generation. The Python client below uses the standard library, requests a complete response instead of a stream, and reports the response plus those timings. Save it as local_benchmark.py and run python3 local_benchmark.py while Ollama is running.

import json
from urllib.request import Request, urlopen

payload = {
    "model": "llama3.1:8b",
    "prompt": "Explain quantization in one paragraph.",
    "stream": False,
    "options": {"num_ctx": 4096},
}
request = Request(
    "http://localhost:11434/api/generate",
    data=json.dumps(payload).encode("utf-8"),
    headers={"Content-Type": "application/json"},
)
with urlopen(request, timeout=300) as response:
    result = json.load(response)

print(result["response"])
seconds_per_nanosecond = 1e-9
for field in ("load_duration", "prompt_eval_duration", "eval_duration"):
    print(f"{field}: {result[field] * seconds_per_nanosecond:.3f} seconds")
generation_seconds = result["eval_duration"] * seconds_per_nanosecond
if generation_seconds > 0:
    print(f"Generation: {result['eval_count'] / generation_seconds:.2f} tokens/s")

The throughput calculation divides generated tokens by generation time after converting nanoseconds to seconds. It excludes model loading and prompt processing, so it is not the same as total response latency. Run the same request again to see how a warm model changes the loading component; keep model, context, prompt and other active workloads consistent when comparing settings.

Our assessment is that this breakdown is more useful for a first local deployment than a universal tokens-per-second target. A setup that loads slowly but generates comfortably needs a different change from one spending most of its time generating on the CPU. For lower-level runtime control, our llama.cpp tutorial provides a separate implementation path.

Add a browser without exposing the model server

Open WebUI’s installation documentation offers a bundled image containing both the browser application and Ollama. Use it as an alternative persistent deployment after the native test, rather than pointing a container at an accidentally exposed host API. The following project uses that bundled image, stores model files and chat data in separate volumes, and publishes only the browser port on loopback.

In a new project directory, generate a session-signing key and save it locally. Keep this file with the project so recreating the container does not change the key:

umask 077
printf 'WEBUI_SECRET_KEY=%s\n' "$(openssl rand -hex 32)" > .env

Save this as docker-compose.yml. This is the CPU version, which avoids assuming GPU passthrough is already configured:

services:
  open-webui:
    image: ghcr.io/open-webui/open-webui:ollama
    container_name: open-webui
    ports:
      - "127.0.0.1:3000:8080"
    environment:
      WEBUI_SECRET_KEY: ${WEBUI_SECRET_KEY:?Set WEBUI_SECRET_KEY in .env}
      OLLAMA_NO_CLOUD: "1"
    volumes:
      - ollama_data:/root/.ollama
      - webui_data:/app/backend/data
    restart: unless-stopped

volumes:
  ollama_data:
  webui_data:
docker compose up -d
docker exec -it open-webui ollama pull llama3.1:8b

Open http://localhost:3000 and select the downloaded model. The bundled runner has its own model volume, so this download is separate from the earlier native installation. The app-data volume preserves users, chats and settings. Stopping a container and deleting its volumes are different operations; preserve both named volumes when replacing the container.

For NVIDIA acceleration on a supported Linux or Windows/WSL2 Docker setup, install the NVIDIA Container Toolkit and add this under the service. On macOS, Ollama documents that Docker Desktop cannot provide its GPU acceleration; keep the native Metal runner for GPU work instead.

    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: all
              capabilities: [gpu]

The Open WebUI image documentation makes another important distinction: its separate :cuda image accelerates the interface’s embedding, reranking and speech models. A separate Ollama container needs its own GPU access for language-model inference. The bundled :ollama tag follows rolling builds; after validating a deployment, pin a release version for repeatable updates.

Keep downloaded models local and maintain the installation

A localhost endpoint identifies the server you contact, but the selected model can still be cloud-hosted. The local-only configuration instructions let you disable Ollama’s cloud models and web search. For a native installation, merge this setting into ~/.ollama/server.json, preserving any existing settings, and restart Ollama:

{
  "disable_ollama_cloud": true
}

Alternatively, set OLLAMA_NO_CLOUD=1 in the server’s environment and restart it; the container project already does this. A terminal variable does not automatically reconfigure an already running app or service. Ollama documents macOS application settings through launchctl, Linux service overrides through systemctl, and Windows user environment settings followed by restarting the application.

Native Ollama binds to 127.0.0.1:11434 by default. Keep that boundary for a single-machine setup. The container project separately restricts the browser to loopback and leaves the model API unpublished. Download the application and model before relying on an offline session, and check any additional browser integrations before giving them sensitive content.

Record the model identifier, weight format, context setting and application version alongside the recorded timings. Use ollama stop llama3.1:8b to unload the native model and ollama rm llama3.1:8b when you want to delete its local files. On Linux, service status and logs help distinguish a stopped runner from a model problem; updates should be followed by the same response and residency checks.

Only price a hardware upgrade after identifying the constraint. If your chosen workload consistently exceeds available GPU memory, compare capacity and supported hardware against current GPU pricing. If the existing machine already meets your response-time and quality needs, preserve that working configuration and add complexity only when a specific task requires it.

Elias Virtanen

Elias Virtanen

Games and consoles

Elias Virtanen covers games and consoles for Tech Insider: console and handheld hardware, game releases, emulators and the business of the games industry. His comparisons start from the makers' specifications and published independent results, and he says plainly what the evidence supports.

View all articles