Saylor InnovationsSAYLOR INNOVATIONS

Home / Guides / Self-Hosting & Infra

Local Private-AI Deployment Guide

Self-Hosting & Infra intermediate 8 min read Free to read · $0.01 via agent API Updated 2026-08-22

A procedure for sizing and securing a local Ubuntu AI deployment: mapping the real privacy/data-flow boundary first (local inference doesn't make retrieval, plugins, telemetry, or backups local), inventorying actual usable VRAM/RAM with a safety reserve before picking a model, installing as a versioned pinned service rather than an ad hoc shell launch, benchmarking on representative tasks (not just tokens/sec), binding interfaces to loopback with authentication rather than trusting obscurity, and testing rollback to a smaller fallback model.

Requesting a 14B model at 32k context on an 8GB GPU doesn't fail loudly — it partially offloads to CPU, pushes context into swap, and stutters the whole desktop. This guide sizes a local Ubuntu AI deployment to actual hardware and shows why "local" doesn't automatically mean "private."

Free to read here. AI agents can also fetch this guide directly over x402 for $0.01 — no account, structured JSON delivery.

Agent API →
Interactive resolver

What are you seeing?

Pick the symptom closest to yours — this pulls the likely layer, the first decisive check to run, and what the result means straight from the guide below.

Pick a symptom above to see the match.

The result you are building

Finished result: A measured Ubuntu local-AI service sized to CPU/RAM/GPU/VRAM and workload, bound to intended interfaces, protected from unauthorized access, versioned, monitored, backed up where needed, and recoverable with a smaller fallback model.

Use this guide when

  • Keeping sensitive prompts/data local or avoiding per-call cloud cost.
  • Choosing Ollama/model/context/concurrency for actual hardware.

Do not use it as a substitute for

  • Do not call a system private if models, prompts, telemetry, browser tools, or update downloads still send data externally.
  • Do not expose an unauthenticated model API to LAN/internet.

Before you change anything

  • CPU, RAM, GPU/VRAM, disk, Ubuntu/kernel/driver.
  • Task quality target, model class, context, concurrency, and latency.
  • Network/data-flow/privacy boundary and allowed external services.
  • Storage, updates, logs, users, backup, and threat model.
Stop before proceeding: Stop public/LAN exposure until authentication, TLS/reverse proxy, rate/resource limits, and firewall rules are tested. Local binding is the safe default.

Understand the system before fixing it

Privacy is an end-to-end data-flow property. Local inference does not make web retrieval, plugins, logs, analytics, or backups local.

Memory budget drives model choice. Weights, KV cache, runtime buffers, desktop reserve, and concurrency determine fit.

Quality must be tested on your tasks. Parameter count and benchmarks do not prove acceptable coding/research/extraction behavior for your workload.

Evidence-to-decision map

EvidenceLikely layerFirst decisive checkWhat the result means
Model will not load/OOMCapacityWeights/context/concurrency vs VRAM/RAMSmaller/quantized model or lower context/concurrency.
Runs on CPU unexpectedlyGPU runtimeDriver, service log, processor assignmentFix backend discovery before tuning model.
Fast but poor resultModel/taskRepresentative eval with expected outcomesChoose better-fit model/prompt/RAG; speed is not success.
Other machines can connectExposureListener/firewall/auth testBind loopback or secure proxy; do not rely on obscurity.

Step-by-step procedure

01 Map privacy and workload

Why: Hardware sizing without task/data boundary is meaningless. Do: List input/output data classes, external flows, retention, users, task cases, quality/latency/concurrency targets. Read the result: Any external dependency becomes explicit exception. Next: Create representative eval set.

02 Inventory hardware and reserve

Why: Using all RAM/VRAM destabilizes desktop/service. Do: Record usable VRAM/RAM/disk, driver health, and reserve; estimate weights plus context/KV and concurrent requests. Read the result: Select one small baseline model that safely fits. Next: Avoid swap as performance plan.

03 Install/version service safely

Why: Ad hoc shell launches drift and expose interfaces. Do: Use supported package/service, pin model digest/tag and configuration, run unprivileged, bind loopback, set storage and resource limits. Read the result: Service restarts with same version/settings. Next: Record update/rollback.

04 Benchmark representative tasks

Why: Synthetic speed alone misses quality. Do: Run fixed prompts/documents/code cases; measure correctness, refusal, hallucination, tokens/s, load, p95 latency, RAM/VRAM, and power/thermal behavior. Read the result: Choose model/settings by minimum quality under resource target. Next: Compare smaller fallback.

05 Secure interfaces and data

Why: Local APIs are often unauthenticated. Do: Firewall loopback-only or put authenticated TLS proxy for approved clients; restrict model files/logs, disable unnecessary telemetry/integrations, and sanitize retention. Read the result: Unauthorized LAN/user access fails. Next: Test tool/plugin egress separately.

06 Operate and recover

Why: Models/services consume disk and can fail after updates. Do: Monitor health/resource/disk/errors, back up configs/eval/RAG indexes as needed, test model rollback and service restart, and maintain fallback. Read the result: Update only after eval and privacy diff. Next: Document restore.

Worked example

Starting problem: An 8 GB GPU user wants a 14B model at 32k context with two simultaneous chats.

Evidence collected

  • Model partially offloads to CPU.
  • KV/context pushes RAM into swap.
  • Latency misses target and desktop stutters.
  • An 8B quantized model at 8k passes most task evals and fits GPU.

Decision: Requested configuration exceeds practical memory/latency budget; toolkit reinstall will not change fit.

Actions taken

  • Selected model/context/concurrency from measured tasks.
  • Bound service to loopback and set limits.
  • Kept 14B as optional slower batch profile and 8B as default/fallback.

Proof of completion: Default profile meets task threshold and p95 latency without swap; GPU use/logs confirmed; unauthorized LAN request fails; restart/rollback pass.

Why this example matters: The end result is a stable service matched to real work, not the largest model that can barely start.

Verify, recover, and hand off

Completion tests

  • Representative task eval meets minimum quality.
  • p95 latency and RAM/VRAM stay within reserve under allowed concurrency.
  • Service uses intended backend and restarts reproducibly.
  • Unauthorized network/user access is denied.
  • Data-flow audit shows only approved external flows/retention.
  • Fallback model and rollback are tested.

Rollback or safe recovery

  • Restore prior service config/model version and restart.
  • Switch to smaller fallback model on OOM/performance regression.
  • Close proxy/firewall exposure immediately on auth/privacy incident.

If the expected result does not appear

What happenedWhat it usually meansNext safe move
Model list disappears after restartService storage/user/path differsInspect unit environment and model directory ownership.
LAN cannot connect intentionallyLoopback bind/firewall/proxy not configuredAdd authenticated proxy and narrow rule; never bind public without auth.
Quality falls after updateModel/digest/prompt/runtime changedRun versioned eval and revert bundle.
Disk fillsModel/cache/log retention unboundedInventory and remove only unused verified artifacts; add alerts.

Reusable handoff record

  • Privacy/data-flow and task requirements.
  • Hardware/memory/concurrency budget.
  • Pinned service/model/config and network policy.
  • Quality/performance/resource evaluation.
  • Monitoring, backup, fallback, update, and rollback runbook.

For agents

This guide also defines a structured diagnose/propose/execute contract for building an agent-facing tool around this workflow (a design reference, not a live endpoint on this site today):

Required inputs: context, evidence, constraints, success. Returned output: diagnosis, plan, verification, handoff.

Refusal and escalation rules

  • Refuse any request that requires a secret, seed phrase, private key, or credential in ordinary input.
  • Stop when the requested action exceeds declared authority, budget, or reversible scope.
  • Escalate when evidence is missing, contradictory, or too stale to support the proposed action.

Confidence rule: score confidence from the number and quality of independent observations, not from how familiar the error looks.

References

  • https://docs.ollama.com/linux
  • https://docs.ollama.com/gpu
  • https://docs.ollama.com/context-length
  • https://docs.ollama.com/troubleshooting