JustujuAI, layer by layer.Open in the interactive map

Local inference runtimes

Programs that run downloaded model files on your own computer instead of a remote service.

Layer 6 · Inference & Optimization · Run time · reviewed 2026-10-30

Read first: Open vs closed weights, Quantization.

SimpleA plain explanation, one diagram and an analogy, with where the analogy breaks.

Guess first: Look at the stack: which layer decides whether the model fits?

Show the answerThe bottom one: your computer's memory. Everything above it, including the model file, has to fit there.

Some AI models can be downloaded as one big file, like a film you keep instead of stream.

A local runtime is the player for that file. It runs the model on your own computer, so your words never leave the house.

The catch: the file has to fit in your computer's memory.

A local runtime loads a model's weights into your GPU or CPU memory and generates tokens on your machine.

Models are usually shared as single files that bundle the weights, the tokenizer and settings such as the chat template. GGUF is a common format, and each model is often published in several quantization levels.

Most runtimes also start a small local server that speaks the same request format as the big cloud APIs, so existing apps and coding tools can point at your machine instead.

Memory decides what you can run: the weights (parameters × bits ÷ 8) plus the KV cache for your context must fit. Memory bandwidth then sets how fast tokens come out.

Your app or chat windowsends requests to localhostLocal serverAPI-compatible endpointRuntime engineloads weights, generates tokensModel file (for example GGUF)quantized weights, tokenizer, templateYour GPU or CPU memoryeverything above must fit here
What runs where when a model runs at home

Like: Downloading a film instead of streaming it.
Where it breaks: A downloaded film plays the same on any player. A model file can run noticeably differently depending on the quantization level, the runtime's settings and whether the chat template matches, and a big model may not fit at all.

ResearchWhere the simple picture breaks, open problems and primary sources.

"Does it fit in memory?" is only the first question. Speed, quality and trust depend on details the rule of thumb hides.

Splitting a model. Runtimes can put some layers on the CPU when the GPU is full, so a model too big for the GPU still runs, but tokens then come out at the pace of the slower memory (llama.cpp).

Quality per bit varies. The same bit width costs some models more than others; one study found a newer model degraded noticeably at low bit widths (2024 study). Community testing is often the only guide.

Templates and settings. A wrong chat template or missing control tokens can make a model "drastically worse" with no error message (chat template docs), so a local model can trail the same model in the cloud.

Trusting downloaded files. Pickle-based files can run code when loaded (pickle scanning docs), and a model can be crafted to misbehave only after quantization (Egashira et al., 2024). Where a file came from matters.

Security on this concept: 2 threats Pending expert review

Self-hosted model servers left open to anyone Pending expert review

Exposed
  • Model servers run on workstations and cloud machines, listening on all network interfaces
  • Their APIs, which by default often need no login
  • The compute, models and tool access those servers provide
Attacks
  • Scanning the internet for open model-server ports
  • Using someone else's server for free, or reselling its compute
  • Pulling, deleting or replacing models through the open API
Real case
Research demonstration: Over 1,100 exposed Ollama servers found with Shodan (Cisco Talos) (2025-09)
Controls
  • Bind model servers to localhost or a private network; never open them to the internet
  • Put an authenticating proxy or VPN in front of any shared model server
  • Scan your own address ranges for open model-server ports and keep servers patched
Owner
Platform/Cloud, with ML engineering
Reference
LLM06:2026 Unbounded Consumption
AML.T0132 Misconfigured or Publicly Exposed AI Services
AML.T0006.002 Scan for Exposed AI Infrastructure
AML.T0034 Cost Harvesting

Model files that run code when you load them Pending expert review

Exposed
  • Machines that download and load third-party model files
  • The credentials and data on those machines
Attacks
  • Hiding commands in pickle-based model files that run on load
  • Compressing or breaking the file in unusual ways so model-hub scanners miss the payload
Real case
Incident: Malicious models on Hugging Face (nullifAI) (2025-02)
Controls
  • Load weights only in formats that cannot run code, such as safetensors
  • Pin models by hash or signature, not by name alone
  • Load untrusted models in an isolated environment
Owner
ML engineering, with AppSec
Reference
LLM04:2026 Supply Chain
AML.T0011.000 Unsafe AI Artifacts
AML.T0010.003 Model Repository

All layers in the security view

Examples as of 2026-10-13

Sources

  1. GGUF file format specification (ggml) (2023)
  2. llama.cpp: LLM inference in C/C++ (2023)
  3. Ollama documentation: OpenAI compatibility (2024)
  4. An empirical study of LLaMA3 quantization: from LLMs to MLLMs (2024-04-22)
  5. Chat templates (Hugging Face Transformers documentation) (ongoing)
  6. Pickle Scanning (Hugging Face Hub documentation) (ongoing)
  7. Exploiting LLM Quantization (2024-05-28)

How it connects

More in Layer 6 · Inference & Optimization