Skip to content
AgenticAIWiki
  1. Learn
  2. Part 5
  3. 30. Local inference
  4. 30.1

Lesson 30.1 · 1 of 8 · 4 min read · Reviewed 24 Nov 2026

Why run models locally

By the end, you can

  • Give the reasons to run models locally.
  • Weigh them against the costs.

Reasons to go local

Reason Example
Privacy Legal or medical text that must never leave the machine
Offline Field work, aircraft, secure sites
Latency Autocomplete or voice features on a device
Cost at volume Millions of simple classifications a day on owned hardware
Control Pinning an exact model version for years
Experimentation Trying open models and fine-tunes cheaply

Costs

Cost Detail
Hardware GPUs or high-memory machines (30.4)
Capability Smaller local models trail frontier models on hard tasks
Operations Updates, monitoring, security, scaling
Engineering Serving, batching, quantization choices (30.2, 30.3)

A balanced view

Local models are excellent for narrow, well-defined tasks: redaction, classification, embeddingsEmbedding: A list of numbers (a vector) that represents the meaning of a piece of text, so similar meanings land close together., simple extraction, offline helpers. For complex reasoning, coding agentsAgent: A system where a model decides its own next steps, calling tools in a loop until the task is done. and long documents, a frontier API model is usually better value once you count engineering time. Hybrid setups combine both (30.5).

Key points

  • Local inference runs a model on your own laptop, server or device instead of calling a hosted API.
  • Reasons include privacy, offline use, predictable cost at high volume, low latency on device, and control.
  • Costs include hardware, setup, lower capability than frontier models, and operating it yourself.
  • Local models suit narrow tasks; hard reasoning usually still goes to a frontier API.
Hands-on labRuns in the Playground

Route five jobs to local or cloud

Turn the reasons for local inference into a routing rule you can apply to real jobs.

You will have: A route() function and a printed table of five jobs with where each runs and why.

Steps

  1. Read the five jobs and their flags: private, offline, high volume, hard.
  2. Fill in route() so private and offline jobs stay local first: those are hard limits.
  3. Send hard reasoning to the cloud and narrow high-volume work to local.
  4. Run it and read each reason. Add a sixth job from your own work and route it.

Done when

  • Both private and offline jobs come out local.
  • The two hard reasoning jobs go to the cloud.
  • The script prints local: 3, cloud: 2.

Open in the Playground No API key needed.

Starter code (Python)
# Decide where each job should run, using the reasons from lesson 30.1.
jobs = [
    {"name": "Redact names in medical notes", "private": True, "offline": False, "high_volume": False, "hard": False},
    {"name": "Field helper with no signal", "private": False, "offline": True, "high_volume": False, "hard": False},
    {"name": "Classify a million tickets a day", "private": False, "offline": False, "high_volume": True, "hard": False},
    {"name": "Coding agent across a big repo", "private": False, "offline": False, "high_volume": False, "hard": True},
    {"name": "Find risks in a long contract", "private": False, "offline": False, "high_volume": False, "hard": True},
]


def route(job):
    # TODO: return ("local", reason) for private or offline jobs first: those are hard limits.
    # TODO: send hard reasoning jobs to "cloud", and narrow high-volume jobs to "local".
    return "cloud", "not decided yet"


counts = {"local": 0, "cloud": 0}
for job in jobs:
    where, why = route(job)
    counts[where] += 1
    print(f"{job['name']:<36} -> {where:<5} ({why})")
print(f"local: {counts['local']}, cloud: {counts['cloud']}")
Show a solution
# Decide where each job should run, using the reasons from lesson 30.1.
jobs = [
    {"name": "Redact names in medical notes", "private": True, "offline": False, "high_volume": False, "hard": False},
    {"name": "Field helper with no signal", "private": False, "offline": True, "high_volume": False, "hard": False},
    {"name": "Classify a million tickets a day", "private": False, "offline": False, "high_volume": True, "hard": False},
    {"name": "Coding agent across a big repo", "private": False, "offline": False, "high_volume": False, "hard": True},
    {"name": "Find risks in a long contract", "private": False, "offline": False, "high_volume": False, "hard": True},
]


def route(job):
    # Hard limits first: private or offline work must stay local.
    if job["private"]:
        return "local", "data must not leave the machine"
    if job["offline"]:
        return "local", "no network to reach an API"
    if job["hard"]:
        return "cloud", "hard reasoning favours a frontier model"
    if job["high_volume"]:
        return "local", "narrow task at high volume, predictable cost"
    return "cloud", "no strong reason to run it yourself"


counts = {"local": 0, "cloud": 0}
for job in jobs:
    where, why = route(job)
    counts[where] += 1
    print(f"{job['name']:<36} -> {where:<5} ({why})")
print(f"local: {counts['local']}, cloud: {counts['cloud']}")
Quick checkA field app must work in places with no internet connection. What does that require?
How sure are you?
Pick an answer and how sure you are