How language models actually work — and how to build the machine around them. From neurons to harnesses.
by Kay · august 2026 · slides, notes, and sources, all public
?print-pdf for an offline copyAI engineering = harness engineering + context engineering + memory engineering + prompt engineering.
Seventy years of neural networks, told in order, so that "AI" now meaning "language models" feels less like a fad and more like the next chapter of one long story.
A neural network is one big function: numbers in, numbers out. Everything else is plumbing.
Training doesn't store the examples. It squeezes their patterns into the knobs — which is why one function can complete code it has never seen.
A language model's last layer outputs a score for every token it knows. A step called softmax turns those scores into probabilities, and that's the whole trick.
Try it live in Transformer Explainer (Act 2) — it has the actual slider.
| Year | Beat | What it proved |
|---|---|---|
| 1958 | Perceptron | A machine can learn a boundary from examples |
| 1986 | Backpropagation | Deep stacks of neurons are trainable at all |
| 2012 | AlexNet | GPUs + data beat forty years of hand-built features |
| 2017 | Attention Is All You Need | One architecture for all of language — and it parallelizes |
| 2018–20 | GPT-1 → GPT-3 | Same recipe + more scale = new abilities, unprompted |
| 2022 | ChatGPT | Next-token prediction becomes a product — and "AI" starts meaning this |
| 2024– | Reasoning models | The same engine, allowed to think before speaking |
Every row is the same story: less hand-engineering, more learning. Hold that thought — it's about to happen to us, one layer up.
MAT1510, Deep Learning: Theory & Data Science — Vardan Papyan, University of Toronto. Same course, five years:
| Year | What's in | What's telling |
|---|---|---|
| 2021 | Sparse coding, random matrix theory, adversarial examples | No transformers. At all. |
| 2023 | First transformers lecture appears | Six years after the paper |
| 2024 | Chain-of-thought, LoRA, safety, diffusion | The LLM era arrives in the theory dept |
| 2025 | Whole sections: scaling laws, in-context learning, superposition, grokking, jailbreaking | The syllabus IS the history slide |
Course site: sites.google.com/view/mat1510 — public lecture decks for all of it. The one reference this act is built on; full notes in research/track3-papyan-course.md.
The tokenizer is the chopper that turns your text into chunks before the model ever sees it. Half of all "LLMs are dumb" stories are really tokenizer stories.
"strawberry" arrives as one or two opaque chunks. Asking for the r's is like asking you how many times the letter e appears in a word you've only ever heard spoken.
"1234567890" isn't a number — it's chunks like
123·456·7890, split by frequency,
not place value. Long division over that is a miracle when it works.
These aren't intelligence failures — they're eyesight failures. Reasoning models patch them by thinking in steps; the eyesight never changed.
try/catchOptional live beat: search a word, look at its neighbors. Meaning with no dictionary anywhere — just geometry, learned from co-occurrence.
Attention reads the whole context at once — to it, "dog bites man" and "man bites dog" are the same bag of tokens.
That's the intuition. The full math lives in the appendix; nothing later depends on it.
For each token, in parallel: "of everything before me, what matters to what I'm about to be?"
Keep in the back pocket: if the room drifts during Transformer Explainer, this is the softer landing. Also embeddable if you want it inline.
Not the training run. Not the answer. One single token of output. The numbers here are cited, and they should feel wrong.
Llama 3.1 405B — open weights, every parameter public. Each parameter does one multiply-add per token: 2 × 405 billion.
The "two operations per parameter" rule: Kaplan et al., Scaling Laws for Neural Language Models (2020) · parameter count official: Meta, arXiv:2407.21783 · full arithmetic in research/track3-flops.md
And a typical chat answer is ~500 tokens: thirteen million years of human arithmetic, delivered before you finish blinking.
This is why "just train your own" isn't a real option. Engines come from a handful of labs. Everyone else builds vehicles.
| Model | Total params | Active per token | FLOPs/token |
|---|---|---|---|
| Llama 3.1 405B (dense) | 405B | 405B — all of them | 8.1×10¹¹ |
| DeepSeek-V3 (MoE) | 671B | 37B — routed experts | 7.4×10¹⁰ — 11× cheaper |
"Mixture of experts" means only the relevant slice of the model wakes up for each token — store many parameters, compute with few. More knowledge in the warehouse, fewer workers per shift.
Official figures: arXiv:2412.19437. One more honest caveat: at 128K context, attention adds ~67% on top of the 2N cost — long context is not free. That fact returns in Act 7.
Reasoning models don't have a different brain. They have permission to use scratch paper — and you pay for every sheet.
| Task shape | Engine mode | Why |
|---|---|---|
| Autocomplete, rename, boilerplate | Fast, no thinking | Latency is the product — you're mid-keystroke |
| Explain this file, write a test | Standard | One honest pass is enough |
| Debug across files, plan a migration | Reasoning | Traps and dead ends — drafting pays for itself |
| Long agent task, issue → PR | Reasoning + harness | Being wrong is expensive; thinking is cheap by comparison |
Rule of thumb: pay for thinking when being wrong costs more than waiting.
The same model, given 10× the thinking budget, can jump a capability tier on hard problems — capability became a dial, not a constant.
Caveat for the careful: the visible reasoning is legible, but not guaranteed to be the true cause of the answer. Treat it as a draft, not a confession.
What the field broadly agrees on — kept separate, deliberately, from what I think. The flag will be visible.
| Axis | Status, honestly |
|---|---|
| Pre-training (bigger runs) | Diminishing returns per dollar; data wall is real |
| Post-training (reinforcement learning, distillation) | Steep and young — nobody knows the ceiling |
| Inference (thinking longer) | Scales per-task, priced per-use — a different economy entirely |
Any confident claim about "the end of scaling" that doesn't say which curve is too vague to argue with.
— speak to it —
which curve I think is
genuinely done, and the evidence I find decisive
— speak to it —
the curve I think people
are underrating, and why
— speak to it —
what this means for anyone
building on these engines in the next two years
Scaffold by design — the argument's shape stays on screen while the argument itself is spoken.
Everything before this slide was the engine. Everything after it is the harness — and the harness is where your leverage is.
The engine is a commodity. The harness is the product.
Motorcycles, cars, vans, and trucks are all correct. The shape follows the job.
| Vehicle | The harness it maps to | Built for |
|---|---|---|
| Motorcycle | Bare chat + one sharp tool | An expert going fast, fully exposed |
| Car | Your configured IDE assistant | Daily driving — you, every day, comfortable |
| Van | Team workspace: shared instructions, custom agents, MCP racks | A crew and its equipment |
| Truck | Autonomous coding agent in CI: issue in, pull request out | Heavy cargo, long haul, nobody in the cab |
Works anywhere, tuned for nobody. Base trim. Smells faintly of someone else. Engineered to be returnable, not to be loved.
Seat memory, mirrors set, your music. One instructions file and it knows your stack, your conventions, your definition of done.
Spec'd for one job: racked, wrapped, upfitted. Custom agents, MCP tools, hooks in CI. Nobody asks if the fleet truck is "good in general."
People judge Copilot as a rental — they're right that it's mediocre, and wrong that it has to stay one.
Prompt tricks that paper over engine weakness: walls of pasted examples, forced step-by-step recipes, rigid rule lists. 2023 needed them. 2026 engines are degraded by them.
Tools, context plumbing, permissions, memory. The better the engine, the more machine you can safely bolt to it.
The Copilot customization surface, in real depth —
every piece copy-pasteable. As of August 2026; this
surface moves monthly, sources in /research.
| Piece | File / place | It's the… |
|---|---|---|
| Repo instructions | .github/copilot-instructions.md | Seat position — always applied |
| Path instructions | .github/instructions/*.instructions.md | Per-terrain suspension (applyTo globs) |
| AGENTS.md | Anywhere in repo, nested | Cross-tool standard — one manual, every vehicle |
| Prompt files | .github/prompts/*.prompt.md | Preset routes — /slash-invoked tasks |
| Custom agents | .github/agents/*.agent.md | Purpose-built vehicles — role + tools + model |
| Skills | .github/skills/<name>/SKILL.md | Toolbox in the trunk — loaded only when needed |
| Hooks | .github/hooks/*.json | Safety interlocks — code that gates the agent |
| MCP | .vscode/mcp.json · repo settings | Trailer hitch — standard plug for external tools |
| Memory & Spaces | Machine-written repo facts (cited, 28-day expiry) · curated context bundles | Logbook in the glovebox — writes itself |
| Cloud agent + code review | github.com, reads all of the above | The trucks — nobody in the cab |
# Payments service — Express + TypeScript + Prisma
## Architecture
- Routes in `src/routes/` are thin: validate, call a service, return.
- All data access goes through `src/services/` — routes never touch Prisma.
- All routes require `requireAuth` middleware unless listed in PUBLIC_ROUTES.
## Conventions
- pnpm, never npm. Strict TS — `any` fails CI.
- Errors: return typed `Result`, never throw across service boundaries.
## Definition of done
- Colocated `*.test.ts` (vitest) covering auth failure + happy path.
Applies to chat, cloud agent, and code review. Guidance: ~2 pages max, never task-specific. Saved = live, no restart. Docs: docs.github.com → “Adding repository custom instructions”.
app.get('/export/:id', async (req, res) => {
const user = await db.query(
`SELECT * FROM users WHERE id=${req.params.id}`
);
const csv = Object.keys(user).join(',') + '\n'
+ Object.values(user).join(',');
res.send(csv);
});
Plausible. Also: SQL injection, no auth, raw SQL in a Prisma repo, no test, JavaScript in a strict-TS codebase.
// src/routes/users/export.ts
router.get('/users/:id/export', requireAuth,
async (req, res) => {
const rows = await userService.exportRows(
req.params.id, req.auth); // Result, not throw
res.type('text/csv').send(toCsv(rows));
});
// + export.test.ts: 403 without auth, happy path
requireAuth ← “all routes require auth” ·
service layer ← “routes never touch Prisma” ·
test ← “definition of done”
Same engine. Same request. The file did that — every fix traces to a line you wrote once.
---
applyTo: "prisma/migrations/**,src/services/**/*.ts"
excludeAgent: "code-review"
---
- Never edit a shipped migration; create a new one.
- Every schema change ships with a rollback note in the PR body.
- Data-shape changes require a fixture update in `test/fixtures/`.
excludeAgent (new in 2026): keep a rule out of
code review while the cloud agent still gets itCLAUDE.md and GEMINI.md as equivalents, so one file travels everywhereBoth are injected when both exist (Copilot's file ranks higher). Pragmatic 2026 answer: write AGENTS.md as the portable manual, keep copilot-instructions.md for Copilot-only quirks — or skip it entirely.
Why it matters: your harness investment survives changing tools. Nobody wants to rewrite the manual because they switched trucks.
---
agent: 'agent'
model: Claude Sonnet 5
tools: ['search/codebase']
description: 'Generate tests matching our conventions'
---
Write vitest tests for ${input:target:file or function to test}.
Follow the patterns in src/services/user.service.test.ts:
table-driven cases, one behavior per test, fixtures from
test/fixtures/ — never inline literals for user objects.
/gen-tests target=src/services/billing.ts2026 heads-up: the frontmatter key is now agent:
(was mode:), and hosted agents skip prompt files entirely — VS Code ships a
migration setting that converts them to skills. Watch that boundary.
---
name: Planner
description: Implementation plans for new features — no code edits
tools: ['search/codebase', 'search/usages', 'web/fetch']
model: ['Claude Opus 4.5', 'GPT-5.2'] # fallback list, in order
handoffs:
- label: Implement Plan
agent: agent
prompt: Implement the plan outlined above.
---
You are in planning mode. Produce a step-by-step plan with file
paths and risks. Do NOT edit code. End with open questions.
agents: list) — sub-agent orchestration, in markdownFormerly “custom chat modes” — same feature, renamed .agent.md, Aug 2026.
---
name: release-notes
description: Draft release notes from merged PRs. Use when asked
for release notes, a changelog entry, or "what shipped".
---
# Release notes
1. List PRs merged since the last tag (`git log --oneline v*..HEAD`).
2. Group: Features / Fixes / Internal. One line each, user-facing voice.
3. Follow the tone of CHANGELOG.md. Flag breaking changes in bold.
.claude/skills/ folders unchanged{
"version": 1,
"hooks": {
"preToolUse": [{
"type": "command",
"matcher": "bash",
"bash": "./scripts/guard-tool.sh",
"timeoutSec": 10
}],
"postToolUse": [{
"type": "command",
"matcher": "edit",
"bash": "pnpm lint --fix"
}]
}
}
{"permissionDecision": "allow" | "deny" | "ask"} —
plain code, not the model, decides what the agent may dopreToolUse guard errors, the action is blocked, not waved throughNew to Copilot in 2026, mirroring Claude Code's design — CLI + cloud agent, VS Code in preview.
{
"servers": {
"github": { "type": "http", "url": "https://api.githubcopilot.com/mcp/" },
"postgres-readonly": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@example/mcp-postgres", "--read-only"]
}
}
}
copilot-setup-steps.yml; outbound firewall on by defaultThe punchline of the whole act: the same files drive every surface. Write the harness once; the chat, the agent, and the reviewer all inherit it.
Fine print worth knowing: cloud agent sessions cap at 59 minutes; and
GitHub Agentic Workflows (preview) let one markdown workflow choose its engine —
engine: copilot | claude | codex | gemini. The harness went multi-vendor
before the engines did.
The model only knows what you put in front of it. Managing that budget, not writing clever prompts, is the discipline now. And the rules changed completely between model generations.
“Context, therefore, must be treated as a finite resource with diminishing marginal returns.” Anthropic, Effective context engineering for AI agents (2025)
| Technique | Mechanism | You've already seen it |
|---|---|---|
| Progressive disclosure | Store lightweight identifiers; load detail only when needed | Skills: name+description in context, body on demand |
| Compaction | Summarize the transcript, keep goals + recent state, continue fresh | Now vendor infrastructure, not app code |
| Structured notes | Agent writes durable notes outside the window, re-reads on return | Instructions files by hand; Copilot Memory does it automatically — cited facts, 28-day expiry |
| Sub-agents | Specialist burns 100K tokens exploring, returns a 1K summary | Custom agents with agents: lists |
Honest cost line: agents ≈ 4× the tokens of chat; multi-agent ≈ 15× (Anthropic, multi-agent research system) — sub-agents are for when the task genuinely parallelizes, not for decoration.
| You did this for 2023 engines | The vendors' own guides now say |
|---|---|
| “Think step by step” in every prompt | Unnecessary — reasoning models already think internally; the instruction is dead weight (OpenAI) |
| Pasting in walls of worked examples ("few-shot") | “Examples actually constrain them to a certain exploration space” (Anthropic) |
| “CRITICAL: You MUST use this tool when…” | “…you can use more normal prompting: ‘Use this tool when…’” — MUST-stacks now overtrigger |
| “Before you finish, verify your answer against…” | Frontier models self-verify; leaving it in causes over-verification and wasted tokens |
| “You are an agent — keep going until fully resolved…” | Drop it — frontier models need reining in, not spurring on |
| Enumerate every rule and prohibition | “Write code that reads like the surrounding code” — rules become judgment |
Every row traces to a vendor page, fetched Aug 2026 — research/track2-generation-shift.md. These are the models in your Copilot picker, not lab exotica.
“we removed over 80% of Claude Code's system prompt — and saw no measurable loss on our coding evaluations.” Thariq Shihipar, Anthropic — “The new rules of context engineering for Claude 5 generation models,” claude.com/blog, Jul 24 2026
Stated honestly: their number, their internal coding evals, frontier models only — older models still get the fat prompt, because they lack the judgment for lean instructions. Which is precisely the point: the harness was matched to the engine.
“poorly-constructed prompts containing contradictory or vague instructions can be more damaging to GPT-5 than to other models, as it expends reasoning tokens searching for a way to reconcile the contradictions.” OpenAI, GPT-5 prompting guide
Vehicle version: choke and hand-crank on a modern engine — the ritual doesn't help; now it floods the engine.
| Question | Anthropic | OpenAI |
|---|---|---|
| Multi-agent? | First-class: frontier models delegate naturally (and need reining in, not spurring) | Last resort: "maximize a single agent's capabilities first" |
| Migrating to a new model? | Audit and delete — "simplify just like we did" | Freeze prompts first, then tune — "switch models, don't change prompts yet" |
| Prompt structure? | XML-native house style | Markdown-first, XML situational |
| Agent frameworks? | Own the loop; frameworks obscure | Ships an SDK (a minimal one) |
And where they agree so hard it's boring: contradictions are the new prompt bug, simplicity beats scaffolding, measure everything. When rivals converge independently, believe the convergence.
Model selection by task shape — and why the number on the leaderboard is a property of the harness as much as the engine.
SWE-bench is the standard "fix a real GitHub issue" test. Same engine, different harness, and the score moves:
| Same model, different scaffold (the harness code around it) | Score swing |
|---|---|
| GPT-4o, two scaffolds | 23% → 33.2% (+10) |
| DeepSeek R1, scaffold switch | 33% → 57.6% (+25) |
| Vendor harness vs standardized harness (2026 frontier) | ~17 points of vendor advantage |
The harness is worth more points than a model generation. The industry has quietly known since 2024 — Anthropic: "performance…can vary significantly based on this scaffolding, even when using the same underlying AI model."
Epoch AI, What skills does SWE-bench Verified evaluate? · anthropic.com/engineering/swe-bench-sonnet · full table in research/track3-benchmarks.md
| Benchmark | Measures | Aug 2026 read |
|---|---|---|
| SWE-bench Verified | Real GitHub issues → passing patch | Maxed out (~96%, vendor-reported) and leaked into training data — no longer tells you anything |
| Terminal-Bench 2.1 | Agent + terminal, real environments | Closest to day-to-day agent work; leaderboard shows model+scaffold pairs honestly |
| LiveCodeBench | Problems dated after training cutoff | Sidesteps the leak problem by design; narrow (contest code) |
| Aider polyglot | Precise edit-format discipline | Honest but stale — top rows are 2025 models |
| METR time horizons | Length of task done at 50% success | Best mental model we have — currently doubling every ~4–7 months |
METR's framing is the keeper: don't ask "what % does it score," ask "how long a task can it carry?" — that's the question your roadmap actually depends on.
A saturated benchmark doesn't measure engineering anymore. It measures marketing.
| Your task looks like… | Pick | Pay attention to |
|---|---|---|
| Autocomplete, quick edits | Fastest cheap model | Latency — nothing else |
| Everyday chat & code Q&A | Mid-tier default | Token prices span ~20× between tiers — credits add up |
| Gnarly debugging, planning | Frontier reasoning model | Quality of thought — pay the multiplier |
| Long agent runs, issue → PR | Frontier + your best harness | The harness — it's worth 10–25 points |
And the only benchmark that predicts your own work: run two models on the same real task in your own repo. One afternoon of that beats every leaderboard combined.
Copilot reality, Aug 2026: billing is AI credits (1 credit = $0.01, priced per token per model — “premium requests” are legacy since June 2026); ~25 models in the picker incl. GPT-5.6, Claude Opus 5, Gemini 3.x, Kimi K3, Grok 4.5, Microsoft's own MAI-Code; auto model selection takes 10% off. Sources: research/track1-models.md.
Everything so far was understanding. This act is twenty minutes of your Monday.
| Job | Harness piece to build | Why it compounds |
|---|---|---|
| Test generation | A .prompt.md encoding YOUR test conventions | Same quality bar every time, any teammate |
| PR review | Code-review instructions file | The nitpicks get automated; humans review design |
| Migrations | Prompt file with the before/after pattern + one worked example | The 400-file chore becomes an afternoon |
| Docs & runbooks | A docs-writer custom agent, docs-path instructions | Docs stop rotting because updating is cheap |
| Onboarding | The instructions file itself | New hire's assistant knows the codebase from day one |
# _____________ (what this repo is, one sentence)
## Stack
- Language/runtime: _____________ (versions matter — say them)
- Framework: _____________ · Tests: _____________
- Build & run: `_____________` · Test: `_____________`
## Conventions the model keeps getting wrong
- We use _____________, never _____________ (e.g. "pnpm, never npm")
- Errors are handled by _____________ (e.g. "Result types, never throw")
- _____________ (the thing you've corrected three times this month)
## Definition of done
- Tests colocated as `*.test.ts`, run in CI
- _____________ (lint? typecheck? changelog entry?)
The last blank in "Conventions" is the whole trick: an instructions file is just your code-review comments, written once instead of forever.
copilot-instructions.md — stack, conventions, definition of done.prompt.md for your most-repeated requestEach rung is ~30 minutes. Nobody needs permission for rung one.
Twenty-four questions. Everything was on a slide. Winner gets bragging rights and nothing else.
Questions drafted in kahoot-questions.md — create the Kahoot, then drop the join QR into the box.
kahoot.it · PIN on screen
built by Kay · august 2026
Everything below this slide exists for readers of the site, not for the room. Down-arrow at your own risk.
Good rabbit holes: “Attention Is All You Need” §3.5 · RoFormer (RoPE) paper · the positional-encoding chapter of Papyan's MAT1510 transformer deck.
See it: Transformer Explainer's attention-matrix view (Act 2) · BertViz for head-by-head archaeology (new-tab only — Colab blocks iframes).
deck by Kay — errors are mine, sources are theirs