Free self-study · No account needed · Progress stays in this browser. Back it up before clearing site data or changing devices.

← All weeks

Advanced and Production AI / Week 21

Local AI Models

Build a local-model benchmark and router. Operate two appropriately small local models and test workload-based routing under bounded concurrency.

Your lessons

  1. 01

    Choosing a model that fits the machine

    60 minutes planned · 7 sections
    Start →
  2. 02

    Serving and benchmarking a local model

    60 minutes planned · 7 sections
    Start →
  3. 03

    Routing inference under explicit constraints

    60 minutes planned · 7 sections
    Start →

// Put it into practice

A local-model benchmark and router

  1. Download week21.py from a lesson's practice section. Follow its setup instructions before running it.
  2. Lesson 1: Estimate capacity for candidate models, then measure a suitably small local model.
  3. Lesson 2: Benchmark two hardware-appropriate models sequentially with warm-up and fixed prompt lengths.
  4. Lesson 3: Build a router with a real local endpoint and a hosted test double.
  5. Run the supplied assertions and record actual results; a simulated contract check does not certify real model quality.
Download week 21 Python lab ↓

Read the script’s setup instructions and run it on your own computer. The website does not execute code or verify your results.

// Independent work

W21-LAB

Week 21: A local-model benchmark and router

Operate two appropriately small local models and test workload-based routing under bounded concurrency.

Extend the guided artifact rather than start a second project. Report actual hardware and memory measurements; a hosted test double cannot receive restricted inputs.

What to produce

  • A local-model benchmark and router
  • Setup commands, data or generation procedure, versions, and recorded outputs
  • Acceptance results and a precise limitation

Check your work

  • Report actual hardware and memory measurements; a hosted test double cannot receive restricted inputs.
  • Each claimed execution is supported by actual saved output.
  • Fixture results and real model results are identified separately.
  • Setup and reproduction use the taught tools without private credentials.
Self-assessment rubric
Technical correctness · 35 points
Implementation or analysis follows the relevant technical mechanism and handles the stated case.
Evaluation and evidence · 30 points
Reproducible tests, appropriate baseline, and accurate interpretation.
Engineering quality · 20 points
Clear structure, safe boundaries, and usable reproduction instructions.
Explanation and reflection · 15 points
Explains tradeoffs, limitations, and next experiment with evidence.

// Retrieve before you reread

Week 21 knowledge check

Try all 6 questions. Check your answers, review the explanations, and retry whenever you like. Answers are checked on this device.

1. A 750-million-parameter candidate uses nominal 4-bit weights. What is ideal weight-only storage before overhead?
2. A model fits a short single request but exceeds memory with long concurrent contexts. What explanation is supported?
3. A concurrent batch produces 360 output tokens in 3 seconds, after each request waited 2 seconds. What comparison is correct?
4. Two models receive identical prompt text but report different input token counts. What should the benchmark do?
5. A local-only incident request fails because the model is unavailable. A hosted route is healthy but forbidden for that data. What is correct?
6. A fixed local monthly cost is 84 units for 4200 useful requests. What is average cost before other declared terms?

Next: week 22 →