Click any block in the diagram below to dive into a detailed page for that subsystem. Last updated 2026-06-14.
A request walks left to right. The HTTP layer turns text into a job, the scheduler decides who runs when, the backend does the math, and the KV cache makes sure we don't redo work we've already done.
↓ Each colored block is a link — click to open its detail page.
| Subsystem | One-line job | Detail page |
|---|---|---|
| HTTP & Server | Accept requests, tokenize, stream tokens back, serve dashboard. | arch-server.html |
| Scheduler | Decide which requests run together, when, and at what speed — fairly. | arch-scheduler.html |
| Backend | Own the model. Run prefill and decode forward passes. | arch-backend.html |
| KV Cache | Remember attention state so we don't recompute prompt prefixes. | arch-cache.html |
| Tokenizer | Stateless text ↔ tokens with the Gemma chat template. | covered in HTTP & Server |
| Metrics tracker | Sliding-window TTFT / TPOT / throughput with percentiles. | covered in HTTP & Server |
| Load simulator | Built-in multi-user load generator for stress testing. | covered in HTTP & Server |
| Dashboard | Browser UI for live cache and scheduler stats. | covered in HTTP & Server |
| Config | Env-var-driven settings, no hardcoded paths. | covered on every page |
Read this once and the rest of the diagrams will make sense.
/generate with the prompt text, max tokens, optional session_id, and optional priority.ScheduledRequest object that carries the session ID and arrival time.What's done, what's in progress, what's deferred.
| Phase | What it built | Status |
|---|---|---|
| 0 — Foundation | Project structure, env-driven config, backend interface | done |
| 1 — Tokenization | Chat template + edge-case handling | done |
| 2 — Generation loop | Token-by-token decode, EOS / max-tokens handling, runs in executor | done |
| 3 — Streaming | SSE endpoint, TTFT measurement | done |
| 4 — Fixed-window batching | Replaced by Phase 6 continuous batching | superseded |
| 5 — KV cache | Block pool, radix tree, exact-match index, three eviction policies | done H2O wiring deferred |
| 6 — Continuous batching | Iteration-level scheduling, immediate slot fill | done |
| 6 — Fair scheduling | FCFS + Fair (VTC) + priority hooks | done preemption deferred |
| 6 — Backpressure | Queue gate + active-KV gate + cache-pool gate, soft-hold and hard-reject | done |
| 6 — Chunked prefill (alternating) | Long prompts split across ticks so they don't block decode | in progress |
| 6 — Chunked prefill (mixed-batch, vLLM-style) | Needs custom attention path | deferred — CUDA only |
| 6 — Load simulator | Built-in weighted multi-user simulator with per-user RNG | done |
| 6 — Locust load testing | External load generator, throughput-vs-latency curves | next |
| 6 — vLLM head-to-head benchmark | Same model, same hardware, measured against vLLM | later |
| 7 — Hardware auto-detect | CUDA → MPS → CPU fallback, partial | partial |
| 8 — Observability | Rolling p50/p95/p99 + Prometheus /metrics (aggregate) + structured JSON logs + timing middleware; Grafana dashboard in monitoring/ | mostly |
Diagram color key — blue = HTTP, purple = scheduler, orange = backend, green = KV cache, pink = queues, yellow dashed = scheduler loop, red dashed = eviction. Maintenance: any new feature or component change must update this file and the relevant detail page (see CLAUDE.md → Documentation Maintenance).