Muhammad Atashi
LLMLAB — PRODUCTION LLM SYSTEMS — LLM SYSTEMS ARCHITECTURE · SERVING MATH · DURABLE EXECUTIONCase 07 of 11 · /work/llmlab
Index07 / 11
SourcePublic repo
Work / llmlab — Production LLM SystemsCore systemIsolated Evaluation HarnessPublic sourcePinned @ 892aa1f

llmlab — Production LLM Systems

Production LLM systems fail at the seams between latency math, memory contracts, and durable state.

CORE QUESTION — How do memory walls, queueing coupling, and ambiguous side effects constrain production LLM architectures from first principles?

OwnsModels inference budgets, KV-cache serving, and durable PostgreSQL executionStackPython 3.11 · PostgreSQL 16 · SQLAlchemy · Pydantic v2 · Roofline · PagedAttentionPublic referenceTensorScholar/llmlab @ 892aa1f · verification: make verify-part1

llmlab pairs formal analytical systems models (Part 1: tracing DAGs, four budgets, H100/H200/B200 Roofline, MHA/GQA/MLA KV-cache bytes, Radix prefix caching, and P/D disaggregation) with a zero-cloud PostgreSQL 16 durable execution engine (Part 3: append-only ledger, HMAC two-phase side effects, zero-compute HITL suspension, and capability-enforced envelopes).

Maturity · Isolated Evaluation Harness — MIT v0.1.2 companion reference repository for Inside Production LLM Systems (Ch. 1–4 & Ch. 10), verified on GitHub Actions CI.

FIG. 2 — Systems & durable execution planesPart 1 Math + Part 3 Durable SQL
analytical roofline + queue models are CI-verified math — live GPU silicon profiling remains external

COMPANION REFERENCE RUNTIME · V0.1.2

Select architectural plane inside TensorScholar/llmlab

CH. 01 · TRACING

Four-Budget Ledger

TraceGraph DAG decomposition across Latency, Memory, Financial, and Trust budgets plus five runtime enforcement contracts.

llmlab/tracing/

CH. 02 · MEMORY WALL

Roofline & KV Accounting

H100_SXM5, H200_SXM, and B200_SXM ridge models paired with MHA/GQA/MLA KV-byte solvers across FP16/FP8/INT4/NVFP4.

llmlab/memory/

CH. 03 · LOADGEN

Kingman & Open-Loop Tail

Little's Law KV saturation coupling plus open-loop Poisson/burst vs closed-loop coordinated-omission diagnostics.

llmlab/loadgen/

CH. 04 · SCHEDULER

Paged, Radix & P/D Fabric

PagedKVBlockManager CoW branching, chunked prefill slack, RadixPrefixTree LRU, and NVLink/RDMA P/D topology planning.

llmlab/serving/

CI gate: make verify-part1 (Python 3.11 + PG 16)

Analytical capacity and queueing models (Part 1) coupled with PostgreSQL 16 durable execution (Part 3).
FIG. F — Architecture, operating pathStages in record order
  1. 01Budgets

    Latency · Memory · Financial · Trust

  2. 02Roofline

    H100/B200 ridge · MHA/GQA/MLA bytes

  3. 03Queueing

    Kingman VUT · Little's Law KV saturation

  4. 04Serving

    PagedAttention · chunked prefill · Radix · P/D

  5. 05Ledger

    PostgreSQL 16 append-only state machine

  6. 06Effects

    HMAC-SHA256 two-phase & HITL suspension

FIG. F — The operating path as recorded. Nodes are stages of the system, not claims about deployment.

Engineering decisions — ledger of 3, as recorded. The signal edge marks the rejected alternative in each row.

RefDecision — and whyTrade-off acceptedRejected alternative
AKeep Part 1 analytical models dependency-free Latency decomposition, KV bytes, and queueing coupling should be testable and reproducible in milliseconds without spinning up databases or GPUs.Analytical estimators model hardware specs instead of reading live NVML hardware counters.Couple queueing and Roofline checks to heavyweight GPU simulation containers.
BEnforce state & fencing inside PostgreSQL SQL transitions Application-level locks fail under split-brain workers; single-use CAS redemption and lease fencing must hold in the storage engine.Full integration verification requires PostgreSQL 16 rather than SQLite.Reimplement optimistic locking purely in Python worker memory.
CModel open-loop vs closed-loop load omission explicitly Closed-loop benchmarks mask tail queueing collapse under coordinated omission.Open-loop generators produce harsher tail spikes that reject undersized cluster configs early.Report closed-loop fixed-concurrency median latency as production SLO capacity.

Revision table — evidence provenance, verbatim from the record

RevEvidenceResultSemantics
APart 1 analytical & contract suite
Reproducible without Docker via make verify-part1; verifies analytical equations and contract invariants rather than physical GPU silicon counters.
mypy --strict + non-DB pytest suite covering Ch. 1–4 & Ch. 10 graph invariantsREPRODUCIBLE Verified
BPostgreSQL 16 durable execution CI
Verified in .github/workflows/ci.yml on ubuntu-latest; power-loss fsync durability relies on OS storage semantics.
GitHub Actions runs full pytest suite against PostgreSQL 16 service containerREPRODUCIBLE Verified
CServing & disaggregation envelope models
Parameterized analytical capacity & migration evaluators; not a live multi-node cluster telemetry claim.
H100_SXM5 / H200_SXM / B200_SXM Roofline + NVLink4/NVLink5/RDMA P/D estimatorsREPRODUCIBLE Synthetic

Schedule of capabilities — 10 entries, as recorded

  • Four-budget ledger & 5 runtime contracts
  • GPU Roofline & critical batch solver
  • MHA / GQA / MLA / FP8 / INT4 KV accounting
  • Open- vs closed-loop queueing simulator
  • PagedKVBlockManager & CoW fragmentation audit
  • RadixPrefixTree & tool-order cache sensitivity
  • Prefill-Decode (P/D) NVLink/RDMA topology planner
  • HMAC-SHA256 two-phase idempotent side effects
  • Zero-compute SUSPENDED HITL checkpoints
  • FOR UPDATE SKIP LOCKED lease & expiration sweepers

Audience — LLM Inference & Platform Engineers · AI Infrastructure Architects · Distributed Systems Engineers · Agent Reliability Teams

REF. — Class A public evidencepinned · reproducible
Artifacthttps://github.com/TensorScholar/llmlab
Pinned commit892aa1f383f4ab6f2c79777004def0b355744c81
Verificationmake verify-part1
REF. — The pinned public artifact. Verification command as recorded; the boundary rows above still apply.

Measurement contract — what would make the preferred answer fail?

EVALUATION METHOD

Inference capacity and agentic durability depend on quantitative hardware/queueing math and transactional SQL transitions, not intuition.

Strict mypy --strict checking, dependency-free analytical unit checks (make verify-part1), and full CI verification against PostgreSQL 16 service containers.

01

Roofline ridge

H100/H200/B200 compute vs memory bound
02

KV byte budget

MHA · GQA · MLA · FP8/INT4/NVFP4
03

Open-loop tail

Kingman VUT & Little's Law coupling
04

Prefix hit efficiency

Radix cache + chunked prefill slack
05

Side-effect protocol

HMAC-SHA256 two-phase commit states
06

HITL suspension

single-use CAS resumption & lease sweep

NOTE 1 — OWNERSHIP.

Personal authored book & reference runtime

Published under MIT at github.com/TensorScholar/llmlab (v0.1.2). Companion code for Inside Production LLM Systems; GPU hardware throughput and power-loss fsync durability are explicitly out of scope for local CI.

NOTE 2 — READING. Numbers on this page carry their boundary lines. Quoting a result without its boundary omits its scope.

Exclusions — Not a distributed CUDA kernel library · GPU cluster hardware throughput not benchmarked in CI · Power-loss durability relies on underlying OS/PG fsync

Quick navigation

Jump to System or Page

↑↓ select↵ openESC close