Intro
L1
Β·
Quiz
Β·
Lab
L2
Β·
Quiz
Β·
Lab
L3
Β·
Quiz
Β·
Lab
L4
Β·
Quiz
Β·
Lab
Module Test
Running Models Locally Β· Introduction

The Mainframe Died. The Personal Computer Didn't Ask Permission.

Why control over AI infrastructure is the defining question of the next decade β€” and why your laptop is already part of the answer.

In 1977, Ken Olsen, founder of Digital Equipment Corporation, told the World Future Society that there was "no reason for any individual to have a computer in their home." DEC was then the second-largest computer company on earth. Its VAX minicomputers filled climate-controlled server rooms; access came through terminals, through time-sharing accounts, through institutional gatekeepers. The idea that compute could simply belong to a person β€” unconstrained, unmetered, unmonitored β€” was not taken seriously by the people who controlled the infrastructure. Then Apple shipped the II. Then IBM shipped the PC. By 1984, the individuals Olsen had dismissed were running spreadsheets, writing code, and managing small-business payroll on machines that sat on kitchen tables. The gatekeepers lost not because they were defeated in court but because the hardware became cheap enough that individuals could opt out entirely.

The same structural shift is now underway in AI. Since late 2023, a succession of capable open-weight language models β€” Meta's Llama 2 and 3, Mistral's 7B, Microsoft's Phi-3, Google's Gemma β€” have been released under licenses that allow anyone to download, run, and modify them. Tools like Ollama (released 2023) and LM Studio made local inference possible without compiling code or managing CUDA drivers. By early 2025, a quantized 8-billion-parameter model runs at useful speeds on an M-series MacBook or a consumer GPU. The centralized API is not the only path anymore.

This course is about that opt-out. You will learn why someone would choose to run a model locally β€” privacy, cost, latency, compliance, customization β€” and how to actually do it. The limits are real: a laptop cannot match a datacenter. But control has its own value, and that value is what this course examines honestly.

Running Models Locally Β· Lesson 1 of 4

The API Is a Leash

Understanding what you give up β€” and what you gain β€” when inference moves off the cloud.
What does it actually mean to "own" an AI model, and why does it matter who controls the compute?

In March 2023, Italian regulators at the Garante β€” Italy's data protection authority β€” blocked ChatGPT within the country's borders for 23 days. The stated concern was that OpenAI had no legal basis under GDPR for collecting Italian users' data to train its models. Italian businesses that had integrated ChatGPT into customer-service workflows found themselves with broken pipelines overnight. The block was lifted on April 28 after OpenAI introduced opt-out controls, but the episode made a structural vulnerability visible: every organization running AI through a remote API is exposed to the policy decisions of a single vendor, the regulatory actions of any jurisdiction, and the commercial choices that vendor makes about pricing, availability, and terms of service.

That dependency is precisely what local inference eliminates. When the model weights live on your own hardware and inference runs on your own processor, the Italian regulator's order β€” or its equivalent in any other jurisdiction β€” does not interrupt your workflow. Neither does a vendor outage, a deprecation notice, a price increase, or a terms-of-service clause you did not read carefully enough. The tradeoff is real: you absorb the hardware cost, the maintenance burden, and the capability gap between what you can run locally and what the largest frontier models offer. But for a specific class of use cases, that tradeoff resolves clearly in favor of local.

What "Running Locally" Actually Means

When practitioners say "running a model locally," they mean that inference β€” the computational process of generating output from a prompt β€” occurs on hardware you physically control. The model weights, the numerical parameters that define the model's behavior, are stored on your disk. No query leaves your machine to reach an external server. No response travels back over a network.

This is distinct from several adjacent concepts. Fine-tuning locally means training on your own data, which requires more compute. Self-hosting on a cloud VM means you control the software stack but not the physical machine, and your data still crosses a network. Local inference specifically means the weights and the computation share the same physical box as the user.

The enabling development was quantization β€” mathematically compressing model weights from 32-bit or 16-bit floating-point numbers to 4-bit or 8-bit integers. A 7-billion-parameter model at full 16-bit precision requires roughly 14 GB of VRAM; the same model quantized to 4-bit requires approximately 4 GB β€” enough to fit on mainstream consumer hardware. The quality degradation from well-executed quantization is measurable but modest for most practical tasks.

Key Distinction

Local inference β‰  local training. Training requires enormous compute. Inference on quantized open-weight models requires only what you likely already own. This course covers inference, not training from scratch.

The Six Reasons People Run Models Locally

Practitioners who have moved to local inference generally cite overlapping combinations of six motivations. None of these is hypothetical β€” each maps to documented organizational decisions and product choices.

1. Privacy
Sensitive data β€” patient records, legal documents, financial models, proprietary source code β€” never leaves the organization's infrastructure. GitHub Copilot's 2022 enterprise offering, which runs inference on Microsoft's servers, prompted several law firms and financial institutions to evaluate local alternatives specifically because client data would otherwise transit external systems.
2. Cost
API pricing scales with tokens. A high-volume application generating millions of requests per day can accumulate five- or six-figure monthly API bills. At sufficient scale, the amortized cost of hardware plus electricity falls below per-token API costs. The crossover point varies by use case but is often reached sooner than intuition suggests for always-on workloads.
3. Latency
A round-trip to a remote inference endpoint introduces network latency on top of computation time. For applications requiring near-real-time response β€” voice assistants, embedded device interaction, certain gaming or simulation use cases β€” local inference on fast hardware can produce lower end-to-end latency than a remote API call, even if the remote model is technically faster per token.
4. Availability
Remote APIs have outages. OpenAI's status page recorded multiple incidents in 2023 and 2024 affecting production applications. A locally-running model is subject only to local hardware failure, which the operator controls. For offline environments β€” aircraft, submarines, remote field operations, air-gapped government networks β€” local inference is not a preference but a requirement.
5. Customization and Control
Open-weight models can be fine-tuned, modified, and deployed with custom system prompts and behavioral constraints that no remote API permits. Organizations can pin a specific model version indefinitely β€” preventing the behavioral drift that occurs when providers silently update models β€” or strip safety filters for legitimate research contexts.
6. Regulatory Compliance
Data residency laws in the EU (GDPR), healthcare (HIPAA in the United States), and financial services (various national frameworks) can require that certain data be processed only on infrastructure within specific legal jurisdictions. Local inference provides the strongest compliance posture because data never leaves the regulated environment at all.

The Honest Tradeoffs

Local models are not free lunches. The capability gap between a quantized 8B model and GPT-4o or Claude 3.5 Sonnet is real and relevant for tasks requiring extended reasoning, broad world knowledge, or nuanced instruction-following. Hardware costs are front-loaded β€” a machine capable of running a 13B model smoothly costs more than a year of moderate API usage for most individuals. Maintenance falls on you: updates, security patches, and model management become your responsibility.

The decision framework is therefore not "cloud API vs. local" as a universal answer but rather a per-use-case analysis: what are the data sensitivity requirements, the volume, the latency constraints, the compliance obligations, and the acceptable capability floor? This module gives you the conceptual vocabulary to run that analysis. The subsequent modules give you the practical tools to execute whatever decision it produces.

The Central Premise of This Course

You cannot make a principled choice between cloud and local inference without understanding both sides clearly. This course does not advocate for local inference universally. It builds the knowledge needed to choose deliberately β€” and to execute that choice when local is the right answer.

Lesson 1 Quiz

Five questions Β· The API Is a Leash
1. In March 2023, Italian regulators blocked ChatGPT primarily due to concerns about which legal framework?
Correct. The Garante cited GDPR as the legal basis, specifically the absence of a lawful mechanism for collecting Italian users' data to train OpenAI's models.
Not quite. The Garante's stated concern was GDPR compliance β€” the lack of legal basis for processing Italian users' data under EU data protection law.
2. Which technical development most directly enabled practical local inference on consumer hardware?
Correct. Quantization reduces a 7B model's memory requirement from ~14 GB at 16-bit precision to ~4 GB at 4-bit, making it viable on mainstream consumer hardware.
Not quite. The key enabler was quantization β€” mathematically compressing weights so that large models fit within the VRAM limits of consumer GPUs and Apple Silicon unified memory.
3. Which of the following is NOT one of the six motivations for local inference described in Lesson 1?
Correct. Carbon efficiency was not listed. The six motivations are: privacy, cost, latency, availability, customization/control, and regulatory compliance.
Not quite. Carbon efficiency is not one of the six. Check the lesson's key-term list: privacy, cost, latency, availability, customization/control, and regulatory compliance.
4. "Running locally" as defined in the lesson specifically requires that inference occurs on hardware you physically control β€” distinct from which similar-sounding option?
Correct. Self-hosting on a cloud VM means you control the software stack but data still crosses a network to hardware you don't physically own. True local inference shares the physical box with the user.
Not quite. The lesson distinguishes local inference from self-hosting on cloud VMs β€” in the cloud case you control software but not the physical hardware, and data still transits a network.
5. According to the lesson, the decision between cloud API and local inference should be treated as what kind of analysis?
Correct. The lesson explicitly frames this as a per-use-case analysis across multiple dimensions, not a universal recommendation in either direction.
Not quite. The lesson is explicit: no universal answer applies. Each use case requires evaluating data sensitivity, volume, latency needs, compliance obligations, and acceptable capability floor.

Lab 1 β€” The Local vs. Cloud Decision Framework

Practice applying the six-factor analysis to real scenarios Β· 3 exchanges to complete

Your Task

You are talking with an AI assistant that has been briefed on the six motivations for local inference covered in Lesson 1. Present it with a real or hypothetical use case β€” your own work context, a scenario from the lesson, or a situation you're curious about β€” and ask it to help you reason through whether local inference or a cloud API is the better fit.

Engage with its analysis. Push back. Ask follow-up questions. The goal is to internalize the decision framework, not to get a single answer.

Suggested opening: "I work at [describe your context]. We're considering using an AI model to [describe the task]. Help me think through whether running it locally makes sense."
AI Lab Assistant
Local vs. Cloud Reasoning
Ready to work through the local-vs-cloud decision with you. Describe your use case β€” what's the task, what kind of data is involved, and roughly what scale β€” and we'll reason through the six factors together.
Running Models Locally Β· Lesson 2 of 4

The Open-Weight Ecosystem in 2024–2025

Which models can actually run locally, who released them, and what the licensing landscape looks like.
If you decided to run a model locally today, what would you actually download β€” and what are you allowed to do with it?

On July 18, 2023, Meta released Llama 2. Unlike its predecessor, which had been distributed only via research application, Llama 2 came with a commercial license permitting use in products β€” subject to a ceiling of 700 million monthly active users, a threshold no individual company except Google, Microsoft, or Meta itself was likely to approach. Within 48 hours, the model had been downloaded hundreds of thousands of times. Within weeks, it had been quantized, fine-tuned, and integrated into tools like LM Studio and text-generation-webui. The release did not make headlines in the way that ChatGPT's launch had, but in practical terms it was the moment when capable, commercially-usable, locally-runnable language models became a real option for organizations rather than a research curiosity.

In the eighteen months that followed, the ecosystem expanded rapidly. Mistral AI, a French startup, released a 7-billion-parameter model in September 2023 under the Apache 2.0 license β€” genuinely permissive, no usage ceiling, no restrictions on commercial deployment. Microsoft's Phi-3-mini, released in April 2024, demonstrated that a 3.8-billion-parameter model trained on carefully curated synthetic data could match much larger models on many benchmarks. Meta's Llama 3 family, released in April 2024, raised the quality ceiling considerably. Google's Gemma models brought further competition. By early 2025, the available open-weight model landscape was broader and more capable than most observers had predicted two years earlier.

Key Models and Their Practical Profiles

The following are the open-weight models most relevant to local inference as of early 2025. Parameter counts, licensing terms, and hardware requirements are the three dimensions that matter most for practical deployment decisions.

Llama 3 (Meta)
Released April 2024 in 8B and 70B sizes, with a 405B version following. The 8B model runs on consumer hardware; the 70B requires either a high-end workstation GPU (48 GB VRAM) or CPU offloading at reduced speed. License permits commercial use with restrictions; derivatives must be labeled as Llama-based. Instruction-tuned variants ("Llama-3-8B-Instruct") are the conversational versions most relevant for local deployment.
Mistral 7B / Mistral Nemo
Mistral 7B (September 2023) remains one of the most capable models at its parameter scale. Apache 2.0 license β€” no usage restrictions, no attribution requirement beyond standard open-source norms. Mistral Nemo (July 2024), a 12B model developed jointly with NVIDIA, further raised the capability bar at the sub-15B tier. Both run on consumer GPUs with 8–12 GB VRAM at reasonable quantization.
Phi-3 / Phi-3.5 (Microsoft)
The Phi series demonstrated that scale is not the only axis of quality. Phi-3-mini (3.8B parameters) was released in April 2024 under MIT license and matched much larger models on academic reasoning benchmarks, attributed to training on high-quality synthetic data. Phi-3.5-mini and Phi-3.5-MoE extended the family. These models are particularly relevant for edge and mobile deployment due to their small footprint.
Gemma / Gemma 2 (Google)
Released February 2024 (Gemma) and June 2024 (Gemma 2), these models use a custom Google license that permits commercial use but prohibits use to train other models. Available in 2B and 9B sizes for local deployment; the 9B Gemma 2 performs exceptionally well for its size on standard benchmarks.
Qwen 2.5 (Alibaba)
Released September 2024 under Apache 2.0, the Qwen 2.5 family is notable for multilingual capability, particularly in Chinese and other East Asian languages, and for strong performance on coding tasks. Available in sizes from 0.5B to 72B. Apache 2.0 license makes it fully permissive.

Understanding Open-Weight Licensing

"Open-weight" is not synonymous with "open-source." True open-source software, by the Open Source Initiative's definition, requires access to training data and training code in addition to model weights, and imposes no restrictions on use. Most major AI model releases do not meet this standard. Understanding the actual license of a model you deploy matters for legal compliance and for what you can build on top of it.

Apache 2.0
The most permissive common license in the AI space. Allows commercial use, modification, and redistribution. Requires attribution (preserving copyright notices) but imposes no usage restrictions. Mistral 7B, Qwen 2.5, and Phi-3 are Apache 2.0.
MIT License
Equivalent permissiveness to Apache 2.0 for most practical purposes. Also allows commercial use and modification with minimal attribution requirements. Some Phi models use MIT.
Llama Community License
Custom Meta license. Permits commercial use below 700M MAU; requires labeling derivatives as "Llama-based"; prohibits use to train competing foundation models. More permissive than a proprietary license but not fully open.
Gemma Terms of Use
Permits commercial use but explicitly prohibits using Gemma outputs or weights to train other AI models. Narrower than Apache 2.0 in this specific respect.
Practical Guidance

For most organizational deployments, Apache 2.0 models (Mistral 7B, Qwen 2.5) offer the cleanest legal posture. Llama 3 is appropriate for commercial use in the vast majority of cases given the 700M MAU threshold. Always read the specific license for any model you deploy in a production context.

Hardware Tiers for Local Inference

The minimum viable hardware for running a quantized model depends on the parameter count you need and the speed you can tolerate. The following tiers reflect realistic performance as of early 2025.

Tier 1: Laptop (Apple M-series or modern x86 with 16 GB RAM)
Can run 3B–8B models at 4-bit quantization at 15–30 tokens/second on Apple Silicon (M2/M3/M4), which is comfortable for interactive use. Intel/AMD laptops without discrete GPUs are significantly slower but functional for non-interactive workloads. Suitable for personal use, prototyping, and offline capability.
Tier 2: Consumer GPU (RTX 3090 / 4090, 24 GB VRAM)
Runs 7B–13B models at full speed; can handle 30B models with quantization. An RTX 4090 runs a quantized Llama 3 8B at 80–100 tokens/second. This tier is suitable for team-level inference, light production workloads, and local fine-tuning experiments.
Tier 3: Professional GPU (A100, H100, or multi-GPU rigs)
Runs 70B models comfortably; enables multi-model serving. These are datacenter cards costing $10,000–$40,000+ for the hardware alone. Relevant for organizations running local inference as a serious infrastructure choice rather than individual exploration.

Lesson 2 Quiz

Five questions Β· The Open-Weight Ecosystem
1. What distinguished Llama 2's July 2023 release from its predecessor, making it a practical option for organizations?
Correct. The commercial license was the key distinction β€” Llama 1 had been distributed only via research applications, while Llama 2 permitted product use up to 700M MAU.
Not quite. The defining difference was the commercial license. Llama 1 required a research application; Llama 2 permitted commercial deployment, which opened it to organizational use.
2. Which model family uses the Apache 2.0 license, making it the most permissive option among those listed in the lesson?
Correct. Both Mistral 7B and Qwen 2.5 are released under Apache 2.0, which allows commercial use, modification, and redistribution with minimal restrictions.
Not quite. Mistral 7B and Qwen 2.5 are the Apache 2.0 models. Llama 3 uses a custom Meta license; Gemma uses Google's custom terms; GPT-4o is proprietary.
3. What specific restriction does the Gemma Terms of Use impose that is NOT present in Apache 2.0?
Correct. Gemma's terms specifically prohibit using its outputs or weights to train competing AI models β€” a restriction absent from Apache 2.0.
Not quite. The distinctive Gemma restriction is the prohibition on using its outputs or weights to train other AI models. The 700M MAU ceiling is Llama's restriction.
4. Microsoft's Phi-3-mini demonstrated what notable principle about AI model capability?
Correct. Phi-3-mini showed that data quality and curation can compensate for smaller parameter counts β€” challenging the assumption that scale is the only axis of capability.
Not quite. Phi-3-mini's significance was showing that careful training on synthetic data allowed a 3.8B model to match much larger ones β€” scale is not the only axis of quality.
5. For an organization choosing a model for production local inference and wanting the cleanest legal posture with no usage-ceiling risk, which tier of license should they prioritize?
Correct. Apache 2.0 offers no usage ceiling, no restrictions on what you build, and no prohibition on training other models β€” the cleanest legal posture for most organizational contexts.
Not quite. Apache 2.0 (Mistral 7B, Qwen 2.5) offers the fewest restrictions. Llama has a usage ceiling; Gemma restricts model training; open-weight licenses are definitely not all equivalent.

Lab 2 β€” Model Selection and Licensing

Apply your knowledge of the open-weight ecosystem to a realistic selection decision Β· 3 exchanges to complete

Your Task

The assistant is briefed on the models and licenses from Lesson 2. Describe a deployment scenario β€” the task type, the hardware available, and any legal constraints β€” and ask it to help you narrow down which open-weight model is the best fit. Then dig into the reasoning: why that model over others, what the license permits, and what the hardware requirements actually mean in practice.

Try: "I need to deploy a local model on a MacBook Pro M3 with 16 GB RAM for summarizing internal legal documents. What should I choose and why?" β€” or use your own scenario.
AI Lab Assistant
Model Selection Advisor
Tell me about your deployment scenario β€” the task, your available hardware, and any licensing constraints β€” and I'll help you work through the model selection decision.
Running Models Locally Β· Lesson 3 of 4

The Tooling Layer: Ollama, LM Studio, and the Infrastructure Stack

The software that turns raw model weights into something you can actually use β€” and how the pieces fit together.
A model weight file is inert data. What software stack transforms it into a running inference server, and what does each layer actually do?

In October 2023, a developer named Jeffrey Morgan published the first public release of Ollama β€” a tool that reduced the process of running a local language model to a single terminal command: ollama run llama2. Before Ollama, running a local model meant compiling llama.cpp from source, navigating CUDA or Metal driver configurations, converting model weights between formats, and managing a custom Python environment. That barrier excluded everyone who was not comfortable with build toolchains. Ollama packaged the inference engine, the model download, and a REST API server into a single binary that installed like any other macOS or Linux application. Within six months the project had accumulated over 30,000 GitHub stars. The tooling problem β€” not the model availability problem β€” had been the real bottleneck, and Ollama solved it.

The Local Inference Stack: Three Layers

A working local inference setup involves three distinct layers. Understanding what each layer does β€” and what the alternatives are at each layer β€” is necessary for troubleshooting, optimization, and making informed choices about your own stack.

Layer 1: Inference Engine
The low-level software that actually executes the numerical computation of a forward pass through the model. The dominant open-source inference engine is llama.cpp, written by Georgi Gerganov and first released in March 2023. It implements efficient quantized matrix multiplication in portable C++, runs on CPU without a GPU, and has backends for Apple Metal, CUDA (NVIDIA), and ROCm (AMD). Almost every local inference tool β€” Ollama, LM Studio, Jan β€” uses llama.cpp as its underlying engine. Alternatives include GGML (llama.cpp's predecessor format), vLLM (Python, optimized for server-grade GPU throughput), and ExLlamaV2 (CUDA-specific, highest throughput on NVIDIA hardware).
Layer 2: Model Management and API Server
Software that downloads model files in the correct format, manages multiple models, and exposes a consistent API for applications to call. Ollama handles this layer for most users, providing a CLI, a local REST API compatible with the OpenAI API format (making it a drop-in replacement for many integrations), and automatic hardware detection. LM Studio provides a graphical interface for the same functions, with a more accessible UI for non-command-line users. Jan is an open-source alternative with a desktop application. At the production end, vLLM and TGI (Text Generation Inference) from Hugging Face handle this layer for server deployments.
Layer 3: Application Interface
The software that users or developers interact with. This can be a desktop chat interface (LM Studio's built-in chat, the Open WebUI project), a programmatic API call from application code, or an integration layer like LangChain or LlamaIndex that connects local models to document retrieval, tool use, and multi-step workflows. Because Ollama exposes an OpenAI-compatible API at localhost:11434, any application built against the OpenAI API can be redirected to a local model with a single configuration change.

Ollama in Practice

Ollama is the most common entry point for local inference as of 2025. Its key design choices have practical implications:

Model files in GGUF format. Ollama downloads models from its registry in GGUF format β€” the successor to GGML format, designed for llama.cpp. GGUF files are self-contained: the weights, quantization metadata, and architecture configuration are bundled in a single file. A Llama 3 8B model at Q4_K_M quantization is approximately 4.7 GB.

Automatic hardware detection. Ollama detects available GPU memory and selects the highest quantization level that fits. On Apple Silicon it uses Metal for GPU acceleration automatically. On systems without a GPU, it falls back to CPU inference, which is slower but functional.

OpenAI API compatibility. Ollama's local server accepts requests in the same JSON format as the OpenAI API, with the base URL changed to http://localhost:11434/v1. This means tools like Continue (a VS Code extension for AI-assisted coding) can be configured to use a local Llama 3 model instead of GPT-4 with a single settings change.

The Quantization Naming Conventions You Will Encounter

GGUF model files use naming conventions like Q4_K_M, Q5_K_S, Q8_0. The number indicates bits per weight (4, 5, 8). K means "k-quant" β€” a more sophisticated quantization method that preserves quality better. M/S/L indicates size variant (Medium/Small/Large within that bit level). Q4_K_M is the most common practical choice: good quality, reasonable file size. Q8_0 is near-lossless but nearly doubles the file size and VRAM requirement vs. Q4.

LM Studio: The GUI Path

LM Studio, released in 2023 and available for macOS, Windows, and Linux, provides a graphical interface for the same underlying stack. It includes a model browser connected to Hugging Face's model repository, a chat interface, and a local server mode. For users who prefer not to use a terminal, LM Studio offers equivalent functionality to Ollama with a lower barrier to entry. Its server mode also exposes an OpenAI-compatible API, enabling the same downstream integrations.

The practical choice between Ollama and LM Studio is largely one of interface preference and workflow. Ollama integrates more naturally into scripting and automated pipelines; LM Studio is more accessible for exploratory use and model comparison. Many practitioners use both depending on context.

The Open WebUI Project

Open WebUI (formerly Ollama WebUI) is a self-hosted web interface that provides a ChatGPT-like experience over a local Ollama installation. It runs as a Docker container, adds conversation history, model switching, RAG (retrieval-augmented generation) capability, and multi-user support. For teams sharing a local inference server, Open WebUI is the most common interface layer as of 2025.

Lesson 3 Quiz

Five questions Β· Tooling and Infrastructure
1. What was the significance of Ollama's first public release in October 2023?
Correct. Ollama's key contribution was accessibility β€” packaging the inference engine, model download, and API server into a single binary that eliminated the prior requirement for compile toolchains and driver configuration.
Not quite. Ollama's significance was collapsing a complex multi-step build and configuration process into a single command (ollama run llama2), removing the tooling barrier that had excluded non-technical users.
2. llama.cpp, the most common underlying inference engine, was written by whom and first released when?
Correct. Georgi Gerganov released llama.cpp in March 2023, implementing efficient quantized inference in portable C++ β€” and it became the engine underlying nearly every local inference tool that followed.
Not quite. llama.cpp was written by Georgi Gerganov and first released in March 2023. Jeffrey Morgan created Ollama, which uses llama.cpp as its underlying engine.
3. Ollama exposes a local REST API compatible with which external service's format β€” enabling applications to switch to local inference with minimal code changes?
Correct. Ollama's local server at localhost:11434/v1 is OpenAI API-compatible, so any application built against the OpenAI API can be redirected to a local model by changing only the base URL.
Not quite. Ollama exposes an OpenAI-compatible API, meaning the base URL is the only change needed to redirect OpenAI API calls to a local model.
4. In GGUF quantization naming (e.g., Q4_K_M), what do the number, the K, and the M/S/L suffix respectively indicate?
Correct. Number = bits per weight (4, 5, 8). K = k-quant, a more sophisticated quantization that preserves quality better. M/S/L = Medium/Small/Large size variants within that quantization level.
Not quite. In GGUF naming: the number is bits per weight; K indicates the k-quant method (higher quality than basic quantization); M/S/L indicates size variant within that quantization level.
5. Open WebUI is best described as which layer of the local inference stack?
Correct. Open WebUI is a Layer 3 application interface β€” a self-hosted web UI that runs on top of Ollama, providing a ChatGPT-like experience with conversation history and multi-user support.
Not quite. Open WebUI is Layer 3 β€” the application interface. It sits on top of Ollama (Layer 2), which uses llama.cpp (Layer 1) underneath. It provides the user-facing chat experience.

Lab 3 β€” Tooling Stack Design

Design a complete local inference stack for a specific use case Β· 3 exchanges to complete

Your Task

The assistant knows the three-layer local inference stack from Lesson 3 β€” inference engine, model management/API server, and application interface. Describe a concrete deployment goal (coding assistant for a team, document summarization, private chatbot, etc.) and ask it to help you design the appropriate stack at each layer. Then probe the reasoning: why those specific tool choices, what the tradeoffs are, and how the layers connect.

Try: "I want to set up a private AI coding assistant for a five-person engineering team on a single workstation with an RTX 4090. Walk me through the stack." β€” or design a stack for your own context.
AI Lab Assistant
Stack Architecture Advisor
Describe your deployment goal and the hardware you're working with. I'll help you design the inference engine, model management, and application interface layers β€” and explain the tradeoffs at each one.
Running Models Locally Β· Lesson 4 of 4

Limits, Risks, and Realistic Expectations

What local models cannot do, where they fail, and how to make decisions that account for both sides of the ledger honestly.
Given everything local inference offers, what does it actually cost you in capability β€” and when does that cost become disqualifying?

In August 2024, researchers at Stanford HAI published a benchmark comparison across local and frontier models on a suite of complex reasoning tasks β€” multi-step math, legal document analysis, scientific question answering. The results were unambiguous in their directional finding: the capability gap between a locally-runnable 7B or 13B model and GPT-4o or Claude 3.5 Sonnet was real, consistent, and largest precisely on the tasks that require extended chain-of-thought reasoning and broad factual recall. A quantized Llama 3 8B model produced correct answers on roughly 60–70% of questions that GPT-4o answered correctly at 85–92%. That gap is not trivial for high-stakes applications. The researchers noted, however, that for constrained tasks β€” summarization of provided text, extraction of structured data from documents, classification of customer feedback β€” the smaller local models performed within 5–8 percentage points of the frontier models, and that gap was often smaller than the variance introduced by prompt engineering differences.

The Capability Gap: What It Looks Like in Practice

The capability difference between frontier cloud models and locally-runnable open-weight models is best understood as task-dependent, not uniform. Flattening it into a single statement ("local models are worse") obscures the structure of where and why the gap exists.

Tasks Where the Gap Is Large
Multi-step mathematical reasoning requiring more than 5–6 inference steps. Complex coding tasks requiring synthesis of multiple design patterns or debugging unfamiliar frameworks. Tasks requiring broad, current factual knowledge (local models have knowledge cutoffs and cannot browse the web). Nuanced instruction-following with many simultaneous constraints. Long-context tasks exceeding 4–8K tokens on smaller models.
Tasks Where the Gap Is Small or Negligible
Summarization of provided documents (the information is in context). Extraction and classification of structured data from text. Simple code generation and explanation within a known framework. Conversational chat with well-defined domains. Reformatting, translation, and text transformation tasks. Sentiment analysis and content moderation over short inputs.
The Practical Implication

If your use case falls primarily in the second category β€” working with information already in context, constrained transformation tasks β€” a local model is likely sufficient. If it falls in the first β€” open-ended reasoning, broad knowledge retrieval, complex multi-step generation β€” the capability gap is real and should factor into the decision.

Security Considerations Specific to Local Inference

Running a model locally introduces security considerations that are different from β€” not simply fewer than β€” cloud API deployment. Organizations sometimes assume that local inference is inherently more secure. The reality is more nuanced.

Model weight integrity. GGUF model files downloaded from Hugging Face or Ollama's registry should be verified against published checksums. A malicious actor who substituted a backdoored model file could introduce consistent adversarial outputs. This risk is low with models from major publishers but non-zero with community fine-tunes from unverified sources.

Local API exposure. Ollama by default binds its API to localhost only. If configured to bind to 0.0.0.0 for network access (a common requirement for team deployments), the inference server becomes a network-accessible endpoint that requires authentication and firewall rules. The default Ollama configuration has no authentication.

Prompt injection via retrieved content. Local models integrated with document retrieval (RAG pipelines) are equally susceptible to prompt injection attacks through malicious content in retrieved documents. This is not a local-specific risk, but the absence of cloud-provider safety filters may make the attack surface slightly larger depending on which model and configuration is used.

The Hardware Maintenance Reality

Organizations that evaluate local inference on capability and cost grounds sometimes underweight the operational cost. Hardware fails. Driver updates can break inference performance. New model releases require re-evaluating which version to deploy. GPU memory constraints require active management as model sizes grow. These are not insurmountable problems, but they are real ongoing costs that a cloud API shifts onto the provider.

For a single practitioner running local inference on their own machine, this overhead is minimal β€” comparable to any other software maintenance. For an organization deploying a shared inference server for a team, it requires dedicated operational attention. This is worth factoring into total cost of ownership calculations alongside hardware amortization and electricity.

A Decision Framework for This Module

The following questions, applied in sequence, provide a practical decision framework for whether local inference is appropriate for a given use case. They synthesize the considerations from all four lessons in this module.

Question 1: Data Sensitivity
Does the data involved require that it never leave your controlled infrastructure? If yes, local inference is a strong candidate unless cloud isolation products (Azure OpenAI Service's private deployments, etc.) satisfy the requirement.
Question 2: Task Complexity
Does the task require open-ended reasoning, broad factual knowledge, or complex multi-step generation? If yes, assess whether the capability gap at locally-runnable model sizes is acceptable for your quality requirements. If not acceptable, cloud is the better choice regardless of other factors.
Question 3: Volume and Cost
At what token volume does local hardware cost fall below API cost for this use case? Calculate the break-even point using current hardware prices, amortization period, electricity costs, and the API pricing of the cloud model you would otherwise use.
Question 4: Latency and Availability
Are there offline requirements or latency constraints that make a remote API architecturally infeasible? If yes, local inference is required regardless of capability considerations.
Question 5: Operational Capacity
Does your organization have the capacity to manage local inference infrastructure β€” hardware maintenance, model updates, security configuration, monitoring? If no, the hidden costs of local inference may exceed the visible savings.
The Honest Summary

Local inference is not a universal improvement over cloud APIs. It is a legitimate architectural choice with real advantages for specific use cases β€” and real costs and limitations for others. The practitioner who understands both sides clearly is better positioned than one who has simply decided on principle. That is what this module was designed to build.

Lesson 4 Quiz

Five questions Β· Limits, Risks, and Realistic Expectations
1. According to the Stanford HAI benchmark comparison cited in Lesson 4, the capability gap between local 7B–13B models and frontier models is largest for which type of task?
Correct. The gap was most pronounced on tasks requiring extended chain-of-thought reasoning and broad factual recall β€” multi-step math, legal document analysis, scientific QA β€” while being much smaller on constrained tasks with information already in context.
Not quite. The gap was largest for extended reasoning tasks β€” multi-step math, scientific QA, complex legal analysis. For constrained tasks like summarization or classification, the gap was much smaller (within 5–8 percentage points).
2. Which of the following is a security consideration specific to local inference that the lesson highlights?
Correct. When Ollama is configured to bind to 0.0.0.0 rather than localhost β€” a common requirement for team deployments β€” it creates a network-accessible API endpoint that has no authentication by default, requiring explicit security configuration.
Not quite. The key security consideration highlighted is Ollama's lack of built-in authentication when configured for network access (0.0.0.0 binding). Local models are equally susceptible to prompt injection; the other options are not accurate.
3. For which of these use cases would a local model most likely be sufficient, according to the capability gap analysis?
Correct. Structured data extraction from provided documents is a constrained task where the information is already in context β€” exactly the category where local models perform within 5–8 percentage points of frontier models.
Not quite. Extraction of structured data from provided documents is in the "small gap" category β€” all needed information is in context, the task is constrained. The other options require open-ended reasoning or broad knowledge retrieval where the gap is larger.
4. In the five-question decision framework from Lesson 4, which question should be answered FIRST?
Correct. Data sensitivity is Question 1 in the framework. If the data must not leave your infrastructure, local inference immediately becomes a strong candidate β€” that constraint can be disqualifying for cloud regardless of other factors.
Not quite. The framework starts with Data Sensitivity (Question 1) β€” because a hard requirement that data not leave controlled infrastructure can make cloud infeasible before any other analysis is necessary.
5. The lesson characterizes local inference as which of the following?
Correct. The lesson's "Honest Summary" explicitly frames local inference this way: not a universal improvement, but a legitimate choice with advantages for specific use cases and real limitations for others.
Not quite. The lesson is deliberately balanced: local inference is a legitimate architectural choice with real advantages in the right contexts and real costs and limitations in others. No universal claim in either direction.

Lab 4 β€” Applying the Full Decision Framework

Synthesize all four lessons into a recommendation for a real scenario Β· 3 exchanges to complete

Your Task

The assistant is briefed on the complete decision framework from Lesson 4, incorporating the capability gap analysis, security considerations, and operational cost factors from across the module. Bring it a real or realistic scenario from your own context β€” something where the local-vs-cloud decision has genuine stakes β€” and work through all five framework questions together.

The goal is a defensible recommendation with explicit reasoning, not just an answer. Push the assistant to justify each step and identify where uncertainty remains.

Try: "My company processes medical intake forms and we want to extract structured data from them automatically. Walk me through whether we should use a local model or a cloud API." β€” or bring your own high-stakes scenario.
AI Lab Assistant
Full Framework Analysis
Let's work through the five-question decision framework together. Describe your scenario β€” the task, the data involved, the scale you're operating at, and any constraints you know about β€” and we'll reason through each factor systematically.

Module 1 Test

15 questions across all four lessons Β· 80% to pass
1. The Italian data protection authority (Garante) blocked ChatGPT in March 2023 for how long?
Correct. The block lasted 23 days, from late March to April 28, 2023, when OpenAI introduced opt-out controls.
Incorrect. The block lasted 23 days, ending April 28, 2023 after OpenAI introduced opt-out controls satisfying the Garante's requirements.
2. What is quantization, as used in the context of local inference?
Correct. Quantization compresses weights β€” e.g., from 16-bit to 4-bit integers β€” reducing memory requirements by roughly 4x, which is what makes large models viable on consumer hardware.
Incorrect. Quantization is the compression of model weights from high-bit-depth floats to lower-bit integers, reducing memory requirements enough to fit large models on consumer hardware.
3. Which of the six motivations for local inference is most relevant when an application must function on an air-gapped network or in an environment without internet access?
Correct. Availability β€” independence from remote infrastructure β€” is the most directly relevant motivation for air-gapped or offline environments, where local inference is not a preference but a requirement.
Incorrect. Availability is the primary motivation for air-gapped environments. Without internet access, remote APIs are architecturally infeasible; local inference is the only option.
4. The Llama Community License includes what specific usage ceiling?
Correct. The Llama Community License permits commercial use but imposes a 700 million MAU ceiling β€” a threshold that effectively only a handful of companies globally would approach.
Incorrect. The Llama Community License sets the ceiling at 700 million monthly active users β€” a threshold almost no deploying organization would reach.
5. Mistral 7B was released in September 2023 under which license?
Correct. Mistral 7B was released under Apache 2.0 β€” genuinely permissive, with no usage ceiling and no restriction on commercial deployment or derivative works.
Incorrect. Mistral 7B uses Apache 2.0, which is the most permissive major license in the open-weight AI space β€” no usage ceiling, no restrictions on commercial use or model training.
6. What is the key technical difference between "open-weight" and "open-source" AI models?
Correct. The Open Source Initiative's definition requires training data and code access in addition to weights. Most "open-weight" releases only provide the weights themselves β€” which is significant but falls short of the full OSI standard.
Incorrect. Open-source (by OSI definition) requires training data, training code, and weights. Open-weight releases typically only provide the weights β€” a meaningful but more limited form of openness.
7. llama.cpp's significance in the local inference stack is best described as:
Correct. llama.cpp is Layer 1 β€” the inference engine. It does the actual numerical computation of a forward pass and serves as the foundation that Ollama, LM Studio, Jan, and others build on top of.
Incorrect. llama.cpp is the low-level inference engine β€” Layer 1 in the stack. It executes the actual matrix computations and underpins almost every higher-level local inference tool.
8. Ollama's default API binding is to localhost. What security implication arises when it is reconfigured to bind to 0.0.0.0?
Correct. Binding to 0.0.0.0 exposes the Ollama API across the network. Because Ollama has no built-in authentication, this creates an accessible endpoint that requires explicit security measures β€” firewall rules, a reverse proxy with auth, etc.
Incorrect. When Ollama binds to 0.0.0.0, its API is accessible across the network β€” and since Ollama has no built-in authentication, this requires explicit security configuration to avoid unauthorized access.
9. What does Q4_K_M in a GGUF filename indicate about the quantization?
Correct. 4 = bits per weight, K = k-quant method (more sophisticated, better quality than basic quantization), M = Medium size variant within the 4-bit tier.
Incorrect. Q4_K_M: 4 bits per weight, K indicates the k-quant method (preserves quality better than naive quantization), M indicates the Medium size variant within that bit level.
10. Open WebUI (formerly Ollama WebUI) is primarily designed to serve what function?
Correct. Open WebUI is the Layer 3 application interface β€” a Docker-deployed web app that provides a polished user experience on top of a running Ollama installation.
Incorrect. Open WebUI is a web-based chat interface β€” Layer 3 β€” that runs over Ollama and adds conversation history, model switching, RAG, and multi-user support for teams.
11. For which task did the Stanford HAI benchmark find local models performing within 5–8 percentage points of frontier models?
Correct. Constrained tasks with information already in context β€” summarization, classification, extraction β€” showed much smaller performance gaps than open-ended reasoning tasks.
Incorrect. The small-gap category is constrained tasks with provided context: summarization, data extraction, classification. The large-gap category is open-ended reasoning and broad knowledge retrieval.
12. Microsoft's Phi-3-mini was released under which license?
Correct. Phi-3-mini was released under MIT license β€” equivalent in permissiveness to Apache 2.0, with minimal attribution requirements and no usage restrictions.
Incorrect. Phi-3-mini uses the MIT License, which like Apache 2.0 permits commercial use, modification, and redistribution with minimal attribution requirements.
13. In the five-question decision framework, Question 5 asks about operational capacity. What specific concern does this address?
Correct. Operational capacity covers the ongoing costs that cloud APIs eliminate: hardware maintenance, driver updates, model version management, security configuration, and monitoring. These hidden costs can exceed visible savings.
Incorrect. Question 5 addresses operational overhead β€” the ongoing costs of managing local inference infrastructure that a cloud API shifts onto the provider: hardware upkeep, model updates, security, monitoring.
14. The Gemma Terms of Use permit commercial use but impose a restriction not found in Apache 2.0. What is that restriction?
Correct. Gemma's unique restriction prohibits using its outputs or weights to train competing AI models β€” a restriction aimed at preventing Gemma from being used as a data source for rival foundation model training.
Incorrect. The Gemma-specific restriction is the prohibition on using its outputs or weights to train other AI models β€” absent from Apache 2.0, which imposes no such limitation.
15. Which of the following best describes the course's overall position on local inference vs. cloud APIs?
Correct. The course is explicitly balanced: local inference is a legitimate choice for specific use cases, not a universal improvement β€” and the goal is equipping practitioners to make that determination deliberately.
Incorrect. The module consistently resists universal claims in either direction. The goal is a principled per-use-case analysis, not a predetermined preference for local or cloud.