Skip to content

B.3 Pass 1: The Tracer

The tracer is a thin system through every layer of the final one, built before any layer is deep. Its model is a byte-level bigram fitted by counting, which is about as simple as a language model can be. But that bigram is written to a real checkpoint, served by a real Rust engine that streams completions over HTTP, fronted by a Go gateway that checks an API key and streams without buffering, packaged as images and Helm charts on a local kind cluster, and observed as one trace across the gateway and the engine in Jaeger. The pass also runs a first incident drill with its runbook and writes a first architecture decision record.

Concepts from other sections (7)

This section uses these ideas. Each has a short definition and a link to the section that explains it in full. Tap a dotted term in the text to preview it.

Building every layer thinly first is what makes the rest of the course safe. Each later pass deepens one layer behind a contract this pass fixes, and because the whole system already runs end to end, a change that breaks a seam shows up immediately. The pass introduces Python, Rust, HTTP and SSE, Go, and containers as they are needed. C remains optional depth later in the course.

Learning objectives

  • Explain how a count-based bigram reaches the maximum-likelihood NLL and how it is written to safetensors.
  • Trace an HTTP request and an SSE stream through a hand-written Rust server and a Go streaming proxy.
  • Explain how the system is deployed on kind behind Helm charts and NodePorts.
  • Explain how trace context propagates so one request shows as one trace.
  • Diagnose the engine crashloop drill and explain the decision recorded in ADR-0001.

This pass needs Pass 0: a working toolchain and a repository whose CI gate is green. Stages 1 to 7 run as local processes; stages 8 to 11 run on a local kind cluster.

The sections build the system from the model outward, then deploy and observe it:

  1. Matmul in Python. Afterwards you can explain how the triple-loop Python matmul indexes rows and columns and why it matches numpy on the golden cases.
  2. Byte bigram. Afterwards you can explain why the count-based bigram reaches the maximum-likelihood NLL and how it is written to a safetensors file.
  3. Rust. Afterwards you can explain how the Rust echo server serves two clients at once and who owns each connection.
  4. HTTP and SSE. Afterwards you can trace how an HTTP request is parsed and how an SSE stream is framed by hand.
  5. Your first endpoint. Afterwards you can trace how the Rust server loads the checkpoint, streams SSE completions, and exports its span.
  6. Go. Afterwards you can explain how the Go streaming proxy propagates a deadline through its context.
  7. Your gateway. Afterwards you can explain why the Go gateway rejects bad keys before proxying and how it streams without buffering.
  8. Containers and Kubernetes. Afterwards you can explain how the image runs on kind behind a Helm chart and a NodePort.
  9. Images, kind, and Helm. Afterwards you can trace how helm install brings up the gateway and the engine on kind and how a curl reaches the engine through the gateway.
  10. One trace. Afterwards you can explain how trace context propagates so one request shows as one trace across gateway and engine in Jaeger.
  11. First drill. Afterwards you can diagnose the engine crashloop from its symptoms, explain the fix, and explain what its runbook says.
  12. First ADR. Afterwards you can explain why ADR-0001 has the languages meet at process and file boundaries.
  13. What the System Does After Pass 1. Afterwards you can explain how every layer runs end to end, starting with the CLI training and sampling the bigram from a clean shell.

The engine serves exactly the checkpoint the tinyllm CLI wrote, so by the end of the pass every layer exists and runs end to end. The stages are also in this pass’s manifest, path.tsv. Pass 2 keeps the engine and replaces how its model is trained.

Generated from path.tsv.

StageReadDone when
1Matmul in Python
9.1 Vectors, matrices, row-major layout, and matmul
You can explain how the triple-loop Python matmul indexes rows and columns and why it matches numpy on the golden cases.
2Byte bigram
6.1 Byte bigram: counts, logits, safetensors v0
You can explain why the count-based bigram reaches the maximum-likelihood NLL and how it is written to a safetensors file.
3Rust
1.4 Rust: ownership, traits, Result, cargo workspaces, std TCP
You can explain how the Rust echo server serves two clients at once and who owns each connection.
4HTTP and SSE
1.5 HTTP/1.1, JSON, and Server-Sent Events from the wire up
You can trace how an HTTP request is parsed and how an SSE stream is framed by hand.
5Your first endpoint
23.1 Your first endpoint: a std-only Rust HTTP/1.1 + SSE server
You can trace how the Rust server loads the checkpoint, streams SSE completions, and exports its span.
6Go
1.6 Go: packages, interfaces, goroutines, channels, context, net/http, testing
You can explain how the Go streaming proxy propagates a deadline through its context.
7Your gateway
25.1 The tracer gateway
You can explain why the Go gateway rejects bad keys before proxying and how it streams without buffering.
8Containers and Kubernetes
1.7 Containers and Kubernetes: images, layers, Pods, Deployments, Services, Helm, kind
You can explain how the image runs on kind behind a Helm chart and a NodePort.
9Images, kind, and Helm
10.1 Tracer deploy: images, a kind cluster, two Helm charts, and Jaeger
You can trace how helm install brings up the gateway and the engine on kind and how a curl reaches the engine through the gateway.
10One trace
11.1 One trace from gateway to engine
You can explain how trace context propagates so one request shows as one trace across gateway and engine in Jaeger.
11First drill
12.1 First drill: the engine crashloops
You can diagnose the engine crashloop from its symptoms, explain the fix, and explain what its runbook says.
12First ADR
12.1 Architecture decision records
You can explain why ADR-0001 has the languages meet at process and file boundaries.
13What the system does after Pass 1
B.3.1 What the System Does After Pass 1
You can explain how every layer runs end to end, starting with the CLI training and sampling the bigram from a clean shell.