From a first Python function to a private local chatbot.
⬇ Download the complete study materials (.zip)
Looking for the study plan overview? Open the project page ↗
docs/ · example programs: examples/| Days | Course focus | What you can demonstrate |
|---|---|---|
| 1 | AI intuition | Explain training vs inference |
| 2–6 | Mac workbench + Python | Use Terminal + VS Code; build a rule-based chatbot |
| 7–9 | Developer workflow | Use a virtual environment, JSON files and Git |
| 10–12 | Neural networks + Transformers | Explain weights, loss and next-token generation |
| 13–15 | Local LLMs with Ollama | Call a local model from a Python chat client |
| 16–17 | Web interface with Streamlit | Build browser chat with history and model selection |
| 18–19 | Product quality | Add controls, run tests and handle offline errors |
| 20–21 | Catch-up + graduation; Docker optional | Repeat the demo, change the app and explain it |
At 1 hour/day, allow 25–35 study days. Move on when you can explain and modify the exercise. Full day-by-day plan ↗
gemma3:4b; later compare to qwen3:8b if useful.For a one-hour day, split a topic rather than skipping practice.
uname -m gives arm64; create virtual environments with python3 -m venv .venv.Rule-based computation vs search/planning vs trained models.
Discuss: Does changing temperature re-train the network? No.
Watch ~19 min: neurons, weights, biases, layers.
Open original video ↗ · If the player fails, open the link.
Start with minutes 00:00–18:00; security section is useful in session 7.
Open original video ↗ · If the player fails, open the link.
Imagine asking a chatbot: “Why is the sky blue?”
Put these three cards in order. You can point or say the answer — no drawing or coding necessary:
Try: Which card is first? Which card makes the words? Which card displays them?
Pause and let the beginner order the three cards orally. Do not require knowledge of Python or Ollama yet. Say that this is a simplified view. Show the answer on the next slide and briefly introduce the model server there.
YOU CHAT APP LANGUAGE MODEL
| question | |
+-----------> | --- question ------> |
| <-- answer --------- |
<------------ + |
see reply
Bonus question: A simple rule-based chatbot could replace the model with if statements. How would its answers differ?
Before writing the first function, build a real editor + terminal workflow.
The optional VS Code Copilot CLI is not required. If code is absent, use File → Open Folder instead. Learners must not modify the system-owned Python.
hello.py.python3 hello.py.code . fails, choose File → Open Folder in VS Code.⌘C copy selected terminal output
⌘V paste at shell prompt / in editor
⌘S save a file in VS Code
⌘T new Terminal.app tab
⌃A start · ⌃E end of command
⌃P previous · ⌃N next command
⌃R reverse history search
⌃C interrupt a running command
| In the zsh prompt | Action |
|---|---|
| Control-A | move cursor to start (A) |
| Control-E | move cursor to end (E) |
| Control-P | previous command (P) |
| Control-N | next command (N) |
| Control-R | reverse search in command history (R) |
These act in the terminal shell prompt, not when VS Code's editor has focus.
echo APPLES; then echo BANANAS.APPLES, select it.echo hello there without Enter.Perform live; keep the cursor visible. In default zsh Emacs-style line editing these bindings are standard. Optional plugins may remap them. Allow mistakes: use the arrow keys to recover, then try again.
sleep 30 → ⌃C.Never blindly paste multiline commands or run unknown curl | sh installers.
In VS Code create hello.py and type:
python3 hello.py.friend to your name → ⌘S → ⌃P → Enter.Check: Can you explain which app each key affected?
def respond(message: str) -> str:
text = message.lower().strip()
if "hello" in text:
return "Hello!"
if text.endswith("?"):
return "I don't know yet."
return "Tell me more."
print(respond("Hello there"))Independent change: detect three additional phrases.
Harvard CS50's Introduction to Programming with Python · Week 0: functions and variables.
Open 32-page PDF ↗ · Current lecture page ↗ · Lecture video ↗
quitprint and returnNow that you can edit, save and run, learn to manage a project:
python -m venv: isolate project packagesIn Terminal.app, create a separate project for experimenting:
mkdir -p ~/Projects/prompt-library
cd ~/Projects/prompt-library
python3 -m venv .venv
source .venv/bin/activate
python -m pip --version
code ..venv/ stays out of Git.Introduce only after the Control-A/E/P/N/R drill and getting comfortable in stock zsh. Discuss tradeoffs, original README, backups, rollback. Do not pipe a remote script into a shell for a beginner.
Choose only: shell, debugging, Git. No need for every lecture.
cd ~/Projects/python-ai-playground
curl --fail --location --show-error \
--output lesson.md \
https://study.fkr.dev/docs/01-ai-intuition.md
code lesson.mdSafety: curl saves the lesson; never pipe unknown downloads into sh.
~/Projects/prompt-library, git init, git status, then commit source..venv/ and secrets should not be committed.The intuitive chain:
~21 min · What training means in practice.
Open original video ↗ · If the player fails, open the link.
~14 min · The gradients come from propagating sensitivity backward.
Open original video ↗ · If the player fails, open the link.
Live exercise: vary layers, learning rate and noise. Compare training and test loss.
~27 min · Tokens, embeddings, attention and next-token prediction.
Open original video ↗ · If the player fails, open the link.
Interact with a small GPT-2 model in-browser and inspect probable next tokens and attention.
You need a model, a runtime/server, and a Python client.
Python (ollama client)
│ HTTP /api/chat
▼
Ollama (inference runtime)
│ loads quantized model weights
▼
Local model (CPU or GPU)
cd ~/Projects/py-ai-studyplan
source .venv/bin/activate # create .venv first if absent
ollama pull gemma3:4b
ollama run gemma3:4b
# In another Terminal tab (⌘T):
cd ~/Projects/py-ai-studyplan
source .venv/bin/activate
python -m pip install -r examples/requirements.txt
python examples/cli_chat.py --model gemma3:4bgemma3:4b; check available memory and disk first.qwen3:8b later (optional).gemma3:1b only if the larger model is too slow or unavailable.Streamlit makes a first browser UI possible without teaching JavaScript.
st.chat_input · user questionst.chat_message · display turnsst.session_state · keep app state across rerunsBrowser → Streamlit server → Ollama HTTP API
│ │
chat history model weights
│ │
UI rendering ◀──── generated response
cd ~/Projects/py-ai-studyplan
source .venv/bin/activate
python -m pip install -r examples/requirements.txt
# Ollama desktop app is already running and model pulled.
python -m streamlit run examples/chat_app.py --server.address 127.0.0.1Observe: when you stop Ollama, Python can still display the web UI but cannot serve model completions.
| Input type | Test |
|---|---|
| Exact format | Is JSON parseable and schema-valid? |
| Arithmetic | Verify with ordinary Python |
| Summarization | Check facts against original |
| Failures | Stop Ollama and observe feedback |
| Compare models | Record model, settings, latency |
Optional segment near 45:40. Ask: why can't we trust instructions inside model outputs?
Open original video ↗ · If the player fails, open the link.
Pack the web UI after it works locally.
docker build -t py-ai-studyplan-ui ./examples
docker compose -f examples/compose.yaml up --build
docker compose -f examples/compose.yaml downDocker-internal 127.0.0.1 is not host-localhost. Keep Ollama private; the UI can demonstrate its offline fallback in a container.
Must-have:
A Tetris solver is primarily a search/planning lesson. Do not imply that an LLM inherently solves Tetris.
Can they independently:
Success is understanding and modifying the system — not copying a chatbot.
Full curated catalog: docs/resources.md (also linked from the project README).