aiml

Building AI Systems

Choose, measure and improve an AI system against explicit quality, latency, cost and failure requirements.

What is an AI system?

An AI system combines a model with the data, application code and checks needed to carry out a task. An application contract defines accepted inputs, required outputs and refusals. Architecture and evaluation follow from that contract: a response can fit a byte limit while giving the wrong command, or cite a real page while making an unsupported claim.

Follow a version-aware docuctl lookup and an action proposal. Use their existing cases to separate source selection, answer support, action permission and resource limits. Later experiments examine model interfaces, attention work and parameter updates within their explicitly stated local scope.

What you can build now

The seventeen available lessons are separate experiments, not one integrated deployment. Their tasks include docuctl support, classification, policy boundaries, request tracing and inference measurements. Each article identifies its own data and execution mode. Follow the five modules in order, then use the planned integration work to connect the components into the course project.

What you'll learn

  • Define task acceptance, resource budgets and separate response-quality checks.
  • Compare model interfaces and candidates with reproducible evaluation contracts.
  • Apply access boundaries, output guards, tracing and monitoring.
  • Inspect inference work and low-rank updates in bounded local experiments.
  • Separate preference-pair and sampled-reward objectives; inspect packed weight error and decoding admission schedules.

Lessons

Module 1 · 3 lessons · about 1 hourDefine the task and its acceptance contract

Define accepted inputs, required answers and resource limits before choosing the application structure.

  1. Choose an architecture from task requirementsRead

    Build a version-aware documentation lookup and an approval-bound action proposal. Use their contracts to choose an application boundary.

    25 min readLabQuiz

  2. Create an evaluation set and a failure taxonomyRead

    Turn version, environment, role and action requirements into evaluation cases. Distinguish failed task contracts from incomplete execution.

    25 min readLabQuiz

  3. Set task acceptance criteria and request resource budgetsRead

    Define task acceptance and request resource limits. Reuse application graders and distinguish admission decisions from post-execution checks.

    25 min readLabQuiz

Module 2 · 5 lessons · about 2 hoursEvaluate answers and compare system changes

Score answers against explicit criteria, inspect failure groups and compare repeated trials.

  1. Define a task-specific answer rubricRead

    Write source-based criteria for a documentation answer, bind example judgements to exact revisions and keep pending review separate from scored outcomes.

    30 min readLabQuiz

  2. Separate source support, action correctness and format validityRead

    Diagnose a structured answer without letting valid JSON, a matching citation or a correct command stand in for the other requirements.

    25 min readLabQuiz

  3. Measure quality by request slice and asymmetric failure costRead

    Inspect request-group coverage and explicit error costs. Keep critical failures, incomplete runs and empty groups visible beside the overall score.

    25 min readLabQuiz

  4. Build a resumable repeated-trial benchmarkRead

    Repeat evaluation cases across sampled model replies, log each trial and resume interrupted runs. Report per-case passes, pass@k and pass^k.

    22 min readLabQuiz

  5. Compare paired evaluation runs with uncertaintyRead

    Compare prompt versions on paired cases and seeds. Bootstrap differences over cases, source groups and trials, then inspect uncertainty by slice.

    22 min readLabQuiz

Module 3 · 2 lessons · about 48 minAdapt model interfaces and select a candidate

Keep provider differences behind tested adapters and compare candidates on the same task cases.

  1. Build a portable model adapter with contract testsRead

    Use one chat contract for Ollama’s native and OpenAI-compatible APIs. Test recorded traffic for request, response and error behavior.

    26 min readLabQuiz

  2. Build a model selection harnessRead

    Define requirements for a small task, test two local models on development and held-out cases, and inspect the recorded model-selection rule.

    22 min readLabQuiz

Module 4 · 5 lessons · about 2 hoursControl access, guard output and inspect requests

Control access and tool requests, inspect untrusted inputs and trace failures across the application.

  1. Check user and tool permissions across service boundariesRead

    Delegate a docuctl tool call with limited authority. Test role, tenant, actor, audience, expiry and replay checks without forwarding session tokens.

    22 min readLabQuiz

  2. Check tool proposals and untrusted agent handoffsRead

    Check docuctl proposals against trusted page and reviewer records. Keep handoffs untrusted and hold publication after external input arrives.

    22 min readLabQuiz

  3. Build a guardrails proxy with streaming-output testsRead

    Build a streaming proxy that redacts or blocks email addresses and card numbers across chunk boundaries. Test it with saved streams and failures.

    20 min readLabQuiz

  4. Build end-to-end request tracing with source provenanceRead

    Propagate a trace across two local docuctl processes. Inspect parent links and distinguish current, stale and dropped sources before returning a citation.

    25 min readLabQuiz

  5. Build LLM monitoring for latency, cost and errorsRead

    Aggregate simulated model-service requests into latency, token, cost, error and queue metrics. Test alert transitions and histogram estimates.

    22 min readLabQuiz

Module 5 · 4 lessons · about 2 hoursCompare inference work and adaptation choices

Compare cache work, parameter updates, quantization error and request admission in bounded experiments.

  1. Compare cached and uncached attention workRead

    Compare cached and uncached causal attention across workloads. Check equivalent outputs, counted operations and local CPU timings before interpreting savings.

    25 min readLabQuiz

  2. Compare full updates and low-rank adaptationRead

    Train full and low-rank updates of a small text classifier, compare held-out predictions and count the parameters each method changes.

    25 min readLabQuiz

  3. Compare packed weight quantization and output errorRead

    Pack trained matrices into eight-bit values or paired four-bit codes. Compare numeric payload sizes and output errors using dequantized CPU inference.

    30 min readLabQuiz

  4. Admit decoding requests between token stepsRead

    Compare fixed batches with admission between decoding steps. Follow unequal-length requests through a padded CPU model and check the generated tokens.

    30 min readLabQuiz

Module 6 · 2 lessons · about 1 hourInspect preference and reward policy updates

Separate fixed-pair DPO from online sampled group-relative updates in bounded CPU experiments.

  1. Inspect a direct preference optimization updateRead

    Update a tiny transformer from chosen and rejected completions. Trace completion-token scores, a frozen reference and the direction of the DPO loss.

    30 min readLabQuiz

  2. Run group-relative policy updates on sampled completionsRead

    Sample completions from a tiny CPU policy, normalize rewards within each group, and inspect clipped updates with fixed old scores and a frozen reference.

    30 min readLabQuiz

Planned modules and capstone

The lessons above are available now. The following topics are planned; they have no lesson pages or labs yet.

Module 7: Integrate the reviewed components into docuctlPlanned
  • Choose source correction, retrieval or adaptation from observed failures
  • Apply the Context & Memory course components to the docuctl request
  • Connect the reviewed identity and tool boundaries to the application
  • Compare a candidate under unchanged quality and resource budgets
  • Measure dependency recovery and hand off a versioned release decision
Module 8: Measure inference and serving under loadPlanned
  • Locate prefill, decoding and application work in one request
  • Budget weights, activations and KV state for a workload
  • Compare MHA, MQA and grouped-query serving requirements
  • Measure real serving queueing, first-token latency and throughput
  • Test prefix-cache isolation and deployment-scale quantized quality
Module 9: Adapt a language modelPlanned
  • Prepare supervised language-model examples and a training objective
  • Fine-tune a pinned language model with LoRA
  • Run an actual QLoRA experiment and measure its memory tradeoff
Module 10: Evaluate preference learning and reasoningPlanned
  • Build and audit human preference pairs
  • Train and evaluate a reward model
  • Evaluate pretrained-model preference and reward updates on held-out tasks
  • Evaluate reasoning strategies under a fixed request budget
Final capstone: Build a versioned docuctl support system, compare its baseline and candidate on held-out tasks, inject dependency failures, and write a release decision from the results.Planned

This project is planned. No project lab is available yet.