← Training Platform
Private AI on your own machine

Run Local AI & LLMs
on your M2 Max

A hands-on roadmap to running powerful open models privately on Apple Silicon β€” what they are, which to pick, and how to build with them. No cloud, no per-token bills, no data leaving your Mac.

7
Stages
42
Hands-on Tasks
100%
Private & Offline
$0
Per-token Cost
Your Learning Path
🧠

Foundations

What local AI is, why run models yourself, and the honest trade-offs versus the cloud.

Stage 1
5 tasks
🧭

The Landscape

Runtimes & apps, the open model families worth knowing, plus formats and quantization.

Stage 2
6 tasks
πŸ’»

Your M2 Max

Why Apple Silicon excels, check your specs, and predict exactly which models will fit.

Stage 3
6 tasks
πŸ¦™

Getting Started with Ollama

Install, download and chat with your first model, use the API, and customize with a Modelfile.

Stage 4
6 tasks
⚑

LM Studio & Apple MLX

A no-terminal GUI, plus Apple's own framework for top speed and local fine-tuning.

Stage 5
6 tasks
πŸ› οΈ

Building with Local LLMs

Real code: chat, streaming, embeddings, and a private RAG pipeline over your own data.

Stage 6
6 tasks
πŸš€

Workflow & Final Project

Daily habits β€” a local coding assistant, a privacy policy β€” then build a private offline assistant.

Stage 7
7 tasks
πŸ’‘

How to use this track: Work top to bottom β€” each stage builds on the last. Stages 1–3 are understanding; 4–5 get models running; 6–7 turn them into real tools. Check off tasks as you go; your progress is saved in this browser.

🧠

Foundations

Stage 1 Β· 5 tasks Β· What local AI is and why it matters

Local AI means running models β€” LLMs, image generators, speech-to-text, embeddings β€” entirely on your own hardware, with no data ever leaving your machine. Instead of sending prompts to a provider's servers, the model weights live on your disk and your Mac's GPU does the work.

Core Topics
01

What a model actually is

Weights = billions of numbers; an inference engine loads them and multiplies your tokens through them

02

Privacy & control

Your code, documents, and prompts never leave the machine β€” viable for confidential work

03

Cost & offline

Free after the hardware; no per-token bills; works on a plane or in an air-gapped room

04

The honest limits

Laptop-sized models trail frontier cloud models on the hardest reasoning; RAM caps model size

05

The hybrid mindset

Local for private/high-volume/offline work; cloud for maximum capability β€” use both

06

Why learn it now

Running models yourself teaches quantization, context, and memory β€” making you better with every AI tool

Cloud vs Local at a glance
# CLOUD AI # LOCAL AI prompt ─▢ internet ─▢ provider GPU prompt ─▢ your Mac's GPU + frontier-level capability + fully private, nothing leaves + nothing to install + free after hardware, no metering - data leaves your machine + works offline / air-gapped - billed per token - capped by your RAM & slower on hard tasks - needs a network - you own setup & updates
Practice Checklist
Write your top 2 reasons local AI matters for YOUR work
List 3 tasks you'd rather keep fully private (never send to the cloud)
Make an honest cloud-vs-local comparison table across privacy, cost, capability, offline
Name 2 tasks a small local model would struggle with, and explain why
Draft your personal hybrid rule: which tasks go local vs cloud
πŸ’‘

You don't have to choose: most practitioners run a fast local model for everyday and private tasks, and reach for a frontier cloud model on the hardest problems. Learning local AI expands your toolkit β€” it doesn't replace it.

🧭

The Local AI Landscape

Stage 2 Β· 6 tasks Β· Tools, models, and formats

Three layers to keep straight: the model (the trained weights, e.g. Llama, Qwen), the runtime that loads them (llama.cpp, MLX), and the app you interact with (Ollama, LM Studio). Most people start at the app and learn downward.

Runtimes & Apps
01

Ollama

The most popular start β€” one command to download & run, plus a built-in API server

02

LM Studio

Polished desktop GUI β€” browse, download, chat, and run an OpenAI-compatible server

03

llama.cpp

The fast C/C++ engine behind much of the ecosystem; runs GGUF with Metal acceleration

04

MLX / mlx-lm

Apple's own framework β€” often fastest on M-series and the path to local fine-tuning

05

Model families

Llama, Qwen (+ Coder), Mistral/Mixtral, Gemma, Phi, DeepSeek (reasoning)

06

Formats & quantization

GGUF / safetensors / MLX; Q4_K_M compresses weights to ~4-bit with small quality loss

Reading a model name
# Every part of a model name tells you something: qwen2.5-coder : 7b - instruct - q4_K_M β”” family β”˜ β””sizeβ”˜ β”” tuning β”˜ β”” quantization β”˜ # family -> Qwen 2.5, the coder-tuned variant # size -> 7 billion parameters # tuning -> "instruct" = chat-tuned (not a raw base model) # quant -> 4-bit, medium quality (a great default) # Picking a GGUF file, rule of thumb: # *-Q4_K_M.gguf best general default (4-bit, balanced) # *-Q5_K_M.gguf a bit higher quality (larger) # *-Q8_0.gguf near-full quality (much larger)
Practice Checklist
Tour Ollama, LM Studio, and MLX β€” note what makes each distinct
Browse ollama.com/library; pick a chat, a coding, and a small/fast model
Decode 3 model names into family / size / tuning / quantization
Filter Hugging Face by the 'GGUF' tag and the 'mlx-community' org
Compare Q4_K_M vs Q5_K_M vs Q8_0 file sizes for one model
Match each model family to the job you'd reach for it first
πŸ’‘

Where to get models: start with ollama.com/library (curated, one-command installs). Graduate to Hugging Face for everything β€” filter by "GGUF" for llama.cpp/Ollama/LM Studio, or the "mlx-community" org for Apple Silicon.

πŸ’»

Your M2 Max

Stage 3 Β· 6 tasks Β· Hardware & what fits in memory

Apple Silicon is unusually good at LLMs: unified memory lets the GPU directly use tens of GB (a PC's discrete GPU is capped by smaller separate VRAM), ~400 GB/s bandwidth is exactly what token generation is bound by, and Metal acceleration is built into both llama.cpp and MLX.

Core Topics
01

Unified memory

CPU and GPU share one pool β€” the GPU can address tens of GB for model weights

02

Memory bandwidth

LLM speed is mostly bandwidth-bound; the M2 Max's ~400 GB/s is the key spec

03

The sizing rule

~0.6 GB per billion params at Q4, plus 1–3 GB for context & overhead

04

What fits

32GB β†’ up to ~13B comfortably; 64GB β†’ 70B at Q4 (tight); 96GB β†’ 70B with real context

05

Leave headroom

Never fill 100% of RAM with a model or macOS swaps and everything crawls

06

GPU memory limit

On big-RAM Macs, raise iogpu.wired_limit_mb so larger models load fully on the GPU

Check your machine & size a model
# Chip, cores, and memory system_profiler SPHardwareDataType | grep -E "Chip|Memory|Cores" # Total RAM in GB sysctl -n hw.memsize | awk '{print $1/1024/1024/1024 " GB"}' # GPU core count system_profiler SPDisplaysDataType | grep -i "Total Number of Cores" # Sizing rule of thumb (Q4 / 4-bit): params(B) x ~0.6 GB + overhead # 7B -> ~5 GB 34B -> ~20 GB # 13B -> ~8-9 GB 70B -> ~40-45 GB # The model's file size on disk is a good lower bound for RAM needed.
Practice Checklist
Profile your Mac: record chip, exact unified memory (GB), GPU cores
Calculate RAM needed for 7B / 13B / 34B / 70B at Q4; mark which fit
Set your memory budget (leave 8–12 GB for macOS + apps)
Predict a model's RAM from its file size, then verify in Activity Monitor
Explain in your own words why unified memory helps
Pick your shortlist: a small, a mid-coding, and your largest-fit model
πŸ’‘

Bigger isn't always better: a fast 7B–14B model at Q4 that stays fully in memory will feel more useful day-to-day than a 70B that's slow and leaves no room for a long conversation. Start small, measure tokens/second, size up only when you need more quality.

πŸ¦™

Getting Started with Ollama

Stage 4 Β· 6 tasks Β· Your fastest path to a running model

Ollama handles downloading, quantization, memory management, and Metal acceleration for you, and ships a local API on port 11434. If you learn one local tool first, make it this one.

Core Topics
01

Install & run

brew install ollama (or the app); `ollama run <model>` downloads and chats in one step

02

Managing models

pull, list, show, ps, rm β€” download, inspect, see what's loaded, free disk

03

The HTTP API

/api/generate and /api/chat let your code and editors drive the model

04

OpenAI compatibility

It also serves the OpenAI format at /v1 β€” existing code just repoints here

05

Modelfiles

Bake a system prompt and parameters into a reusable custom model

06

Keeping models warm

First token is slow (loading); loaded models respond instantly, unload when idle

Essential commands
# Install & run your first model brew install ollama ollama run llama3.2 # downloads, then opens a chat (type /bye to exit) # Manage models ollama pull qwen2.5-coder:7b # download without chatting ollama list # installed models + sizes ollama ps # what's loaded in memory right now ollama rm llama3.2 # free disk space # Drive it over the API curl http://localhost:11434/api/chat -d '{ "model": "llama3.2", "messages": [{"role":"user","content":"Give me 3 uses for a local LLM"}], "stream": false }'
Customize with a Modelfile
# Save as "Modelfile", then: ollama create py-helper -f Modelfile FROM qwen2.5-coder:7b PARAMETER temperature 0.3 # lower = more focused code PARAMETER num_ctx 8192 # bigger context window SYSTEM """ You are a senior Python engineer. Write concise, typed, tested code. Prefer the standard library. Explain only when asked. """ # then: ollama run py-helper
Practice Checklist
Install Ollama and confirm it works with `ollama --version`
Run your first model and have a real back-and-forth conversation
Pull a general + a coding model; compare them on the same prompt
Drive the model over the HTTP API with curl (/api/chat)
Write a Modelfile with a custom SYSTEM prompt; `ollama create` it
Watch `ollama ps` + Activity Monitor; record memory & tokens/second
πŸ’‘

The magic endpoint: Ollama speaks the OpenAI API at http://localhost:11434/v1. That one fact lets almost any OpenAI tutorial or library run against your local model β€” you'll use it in Stage 6.

⚑

LM Studio & Apple MLX

Stage 5 Β· 6 tasks Β· A friendly GUI and maximum Apple-Silicon speed

Two more tools worth knowing: LM Studio makes local AI point-and-click (and runs an OpenAI-compatible server), while MLX β€” Apple's own framework β€” often delivers the best tokens/second on M-series and is the practical path to fine-tuning on your Mac.

Core Topics
01

LM Studio GUI

Browse a catalog that flags which quantizations fit your RAM; chat with zero terminal

02

LM Studio server

One click exposes an OpenAI API on port 1234 β€” same shape as Ollama's /v1

03

What MLX is

Apple's array/ML framework built for unified memory; mlx-lm runs LLMs on top

04

Running mlx-lm

pip install mlx-lm; generate, chat, or serve β€” models under the mlx-community org

05

Local fine-tuning

LoRA trains a tiny adapter, not the whole model β€” feasible on an M2 Max in minutes-hours

06

Which tool when

Ollama for everyday, LM Studio for a GUI, MLX for top speed or fine-tuning

MLX & LM Studio in the terminal
# MLX β€” Apple's native engine (great inside a venv) pip install mlx-lm # One-shot generation (downloads on first run) mlx_lm.generate --model mlx-community/Qwen2.5-7B-Instruct-4bit \ --prompt "Explain MLX in two sentences." --max-tokens 200 # Serve an OpenAI-compatible API on port 8080 mlx_lm.server --model mlx-community/Qwen2.5-7B-Instruct-4bit --port 8080 # LM Studio: load a model, open "Local Server", Start -> port 1234 curl http://localhost:1234/v1/chat/completions -d '{ "model": "local-model", "messages": [{"role":"user","content":"Say hello from LM Studio"}] }'
Practice Checklist
Install LM Studio; download a model it says fits your RAM and chat in the GUI
Start LM Studio's server and hit it with curl on :1234
`pip install mlx-lm` and run `mlx_lm.generate` with a mlx-community model
Benchmark the same 7B model via Ollama vs MLX (tokens/second)
Start `mlx_lm.server` and send it a chat request with curl
Read the mlx-lm LoRA docs; write down one fine-tune idea + data needed
πŸ’‘

Same models, different engines: all three (Ollama, LM Studio, mlx-lm) expose an OpenAI-compatible API, so you can swap the engine under your apps by changing a URL and port. Don't install all three at once β€” get comfy with Ollama first, then add these when you need a GUI or top speed.

πŸ› οΈ

Building with Local LLMs

Stage 6 Β· 6 tasks Β· Real code β€” chat, streaming, embeddings, RAG

The key developer insight: Ollama, LM Studio, and mlx-lm all speak the same OpenAI-compatible API. Point the standard OpenAI client at localhost and every OpenAI tutorial, library, and snippet just works.

Core Topics
01

One API everywhere

Change only base_url; any string works as the api_key locally

02

Streaming

Print tokens as they generate for a far more responsive feel

03

Embeddings

Turn text into vectors (e.g. nomic-embed-text) to search by meaning

04

RAG

Retrieve the most relevant chunks of YOUR data, then answer grounded in them

05

Structured output

JSON mode & tool calling turn a local model into an agent's brain

06

Vector stores

Chroma / LanceDB / FAISS scale RAG past a handful of documents

Call a local model from Python
# pip install openai from openai import OpenAI client = OpenAI( base_url="http://localhost:11434/v1", # LM Studio :1234/v1 | MLX :8080/v1 api_key="ollama", # required by the client, ignored locally ) stream = client.chat.completions.create( model="llama3.2", messages=[{"role": "user", "content": "Write a haiku about local AI."}], stream=True, ) for chunk in stream: delta = chunk.choices[0].delta.content if delta: print(delta, end="", flush=True)
A minimal private RAG pipeline
# pip install openai numpy && ollama pull nomic-embed-text import numpy as np from openai import OpenAI client = OpenAI(base_url="http://localhost:11434/v1", api_key="ollama") def embed(texts): r = client.embeddings.create(model="nomic-embed-text", input=texts) return [np.array(d.embedding) for d in r.data] docs = ["Refunds are allowed within 30 days.", "The API rate limit is 100 requests per minute."] doc_vecs = embed(docs) q = embed(["How long do I have to return something?"])[0] best = docs[int(np.argmax([q @ d /(np.linalg.norm(q)*np.linalg.norm(d)) for d in doc_vecs]))] resp = client.chat.completions.create(model="llama3.2", messages=[ {"role":"system","content":"Answer using only the provided context."}, {"role":"user","content": f"Context: {best}\n\nQuestion: How long to return?"}]) print(resp.choices[0].message.content)
Practice Checklist
Call a local model from Python via the OpenAI SDK (localhost)
Add token streaming to your script
Swap the backend by changing only the base_url/port (Ollama β†’ LM Studio/MLX)
Generate embeddings with nomic-embed-text; print the vector length
Build the minimal RAG pipeline over YOUR own documents
Force JSON output and parse it in Python (handle a malformed response)
πŸ’‘

Build the 20-line RAG by hand once β€” it demystifies what every "chat with your docs" product is doing. Then switch to a real vector store (Chroma, LanceDB, FAISS) for thousands of documents, persistence, and fast search.

πŸš€

Workflow & Final Project

Stage 7 Β· 7 tasks Β· Daily habits + a capstone you'll actually use

Turn everything into habits: a local coding assistant in your editor, a written privacy policy, and automation β€” then build a fully offline assistant over your own documents as your capstone.

Core Topics
01

Local coding assistant

Continue (VS Code / JetBrains) + Ollama for chat & autocomplete, zero code leaving your machine

02

Private document chat

Your RAG assistant over contracts, notes, research that must stay local

03

Bulk & automation

Classify, summarize, and tag at any volume β€” free, unattended, no metering

04

A privacy policy

3 tiers: must-stay-local / prefer-local / cloud-ok β€” turns a gut call into a rule

05

When to fine-tune

Only for consistent style, a narrow skill, or a smaller/faster specialized model

06

The capstone

An offline, grounded, streaming, citing assistant over documents you care about

A local coding assistant (Continue + Ollama)
# 1. Install the "Continue" extension in VS Code / JetBrains # 2. Pull good local coding models: ollama pull qwen2.5-coder:7b # chat & edits ollama pull qwen2.5-coder:1.5b # fast inline autocomplete # 3. Point Continue at Ollama in ~/.continue/config.json # (a chat model + an autocomplete model, provider "ollama"). # Result: Copilot-style help with nothing leaving your machine. # Note: Claude Code itself runs on Anthropic's CLOUD models. For a fully # LOCAL editor assistant, Continue + Ollama is the common setup.
Final Project β€” Your private local assistant
# Build a fully offline assistant over documents you care about. # It must: # 1. run entirely locally (no network calls) # 2. answer questions grounded in YOUR documents (RAG) # 3. stream its responses # 4. cite which source chunk each answer came from # # Stack: Ollama (or MLX) for generation + nomic-embed-text for # embeddings + Chroma/LanceDB if > a handful of docs. # Ship the smallest version first: 10 docs, one model, a CLI question box.
Practice Checklist
Set up Continue + Ollama as a fully-local coding assistant; use it on a real edit
Write your 3-tier privacy policy (must-local / prefer-local / cloud-ok)
Automate one repetitive task with a local model β€” zero cloud calls
Build the final project's retrieval + generation core over your docs
Add streaming + source citations; verify the citations match the answer
Wrap it in a CLI or minimal web UI; confirm it works with the network OFF
Revisit your Stage 1 hybrid split and finalize what runs local vs cloud
πŸ’‘

Ship small first: 10 documents, one model, a command-line question box β€” get that working end-to-end before adding a UI, citations, or a bigger model. A tiny assistant that actually runs beats an ambitious one that never quite comes together.