AI Infrastructure & Local LLMs
0/24 complete

Module 01 · Why Run Models Locally

Local LLMs vs. Cloud APIs: A Practical Decision Framework

15 minfocused lesson0copyable prompts3completion checks3source links
Open lesson + course map

On this lesson

Course outline

Choose local or cloud inference per workload, not by ideology. Local models can provide data control, offline operation, predictable hardware ownership, and deep configuration. Cloud APIs can provide fast setup, elastic capacity, managed reliability, and access to capabilities that may exceed a local machine. Neither option is automatically cheaper, safer, faster, or more private.

// concept

Define the Workload First

Write a workload card with task, acceptable quality, input/output length, requests per hour, peak concurrency, latency target, uptime, data classification, retention rules, integration needs, and a test set. “We need AI” is not enough.

Classify data before choosing infrastructure. Public product copy may be suitable for either route. Customer documents, source code, health information, financial records, credentials, and personal data require an approved handling policy. “Local” still leaks data if prompts are logged, backups are exposed, a browser extension captures text, or an untrusted model package runs code.

// concept

Compare Five Dimensions

  1. Capability: Run the same representative evaluation against candidate models. Model size is not a quality guarantee.
  2. Economics: Compare cloud input/output/storage charges with hardware, electricity, cooling, repairs, staff time, financing, and idle capacity.
  3. Operations: Include installation, updates, monitoring, backups, incident response, and replacement hardware.
  4. Risk: Review licenses, data location, network exposure, vendor terms, model provenance, and abuse controls.
  5. Flexibility: Consider offline use, custom runtimes, portability, rate limits, scaling, and how easily the decision can be reversed.

Score evidence, not preferences. A cloud API may win for an uncertain pilot with ten daily requests. A local server may win for a stable high-volume classification task that a tested smaller model handles well. A hybrid design may keep sensitive preprocessing local and route approved requests to a managed model.

// worked_example

Worked Example

A legal-document team wants internal summarization. It creates 50 authorized, redacted test documents and a rubric for factual coverage, citations, refusal behavior, latency, and reviewer corrections. Local and cloud candidates are tested under the same prompt and output limit.

The decision sheet records measured quality, p50/p95 latency, throughput, full monthly cost assumptions, privacy review, and operational owner. If the local model misses critical clauses, its lower per-token cost does not make it suitable. If the cloud option conflicts with approved data handling, its stronger benchmark does not authorize use.

// failure_cases

Failure Cases

7 cases to diagnose

  • Buying a GPU before measuring the task and request volume.

  • Calling local inference private while exposing an unauthenticated port.

  • Comparing model list prices without staff, electricity, or idle time.

  • Using one impressive prompt instead of a fixed test set.

  • Assuming open weights mean open source or unrestricted commercial use.

  • Sending confidential data to a tool without policy and consent.

  • Treating a prototype laptop as a production reliability plan.

// pakistan_angle

Pakistan Angle

Use dated PKR quotes from multiple sellers and verify exact GPU model, VRAM, warranty, condition, power supply, and return policy. Add electricity, UPS/inverter losses, cooling, load-shedding downtime, exchange-rate exposure, and replacement lead time. Do not publish a universal “Pakistan local AI cost”; inputs differ by city, tariff, equipment, and workload.

Offline capability may be valuable where connectivity is unreliable, but a powered local server also depends on stable electricity and thermal control. Test both failure modes. Keep a degraded path—queue work, reduce model size, or switch to an approved cloud service—rather than claiming uninterrupted service.

// hands_on

Hands-On Exercise

Create a decision sheet for one real workload. Include 20 representative tests, data classification, quality rubric, monthly/peak volume, latency target, local and cloud cost formulas, operational owner, top five risks, and a reversible pilot. End with local, cloud, hybrid, or “insufficient evidence.”

// completion_rubric

Completion Rubric

3 grading bands

  • Complete

    task evidence, privacy, quality, cost, reliability, and reversal are evaluated under the same workload.

  • Needs revision

    the comparison has prices but no measured quality, concurrency, or operating effort.

  • Not complete

    the choice is based on hype, a single demo, or unsupported privacy and savings claims.

// sources

Sources