C.W.K.
Stream
Lesson 03 of 12 · published

Model Testing

~11 min · model, testing, drift

Level 0Apprentice
0 XP0/101 lessons0/10 achievements
0/120 XP to next level120 XP to go0% complete

Models are non-deterministic; tests must be too

For local-trained or fine-tuned models, the testing problem differs from prompt regression. You're not asking 'does this prompt produce the right shape' — you're asking 'did the model regress on a held-out evaluation set'.

Standard model tests

  • Held-out accuracy — score on a frozen test set.
  • Latency / throughput — inference budget per request.
  • Output format — does the model still produce the agreed schema?
  • Slice metrics — accuracy on subgroups (Korean inputs, edge-case tokens, long context).
  • Drift — distribution of scores on a recent traffic sample, compared to a baseline.

CI shape

Model tests typically need GPU runners and model weights. Three options:

  1. Self-hosted GPU runner — runs full eval on every PR.
  2. Hosted cloud GPU (Modal, RunPod) — pay-per-eval, scale to zero.
  3. CPU-only smoke + scheduled GPU full eval — affordable middle ground.

Don't use macOS runners for ML. They're 10× the cost of Linux + GPU isn't available.

Code

Model test job — CPU smoke + scheduled GPU full·yaml
name: model-eval
on:
  pull_request: { paths: ['models/**', 'src/**'] }
  push: { branches: [main] }
  schedule: [{ cron: '0 6 * * *' }]

jobs:
  smoke:
    if: github.event_name == 'pull_request'
    runs-on: ubuntu-latest    # CPU
    steps:
      - uses: actions/checkout@v4
      - run: pip install -e '.[dev]'
      - run: pytest tests/model/test_smoke.py    # tiny held-out, CPU-runnable

  full:
    if: github.event_name != 'pull_request'
    runs-on: [self-hosted, gpu, linux-x64]
    timeout-minutes: 60
    steps:
      - uses: actions/checkout@v4
      - run: pip install -e '.[dev]'
      - run: pytest tests/model/test_full.py    # GPU-required held-out

External links

Exercise

If you have any model in CI, classify your tests: which are CPU-runnable smoke vs which need GPU. Set up the two-tier shape (smoke on PR, full on schedule) and watch the cost drop.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.