"""SCI Figure Hub — Diagram-as-Code: Distributed LLM Training & Serving Cluster (CC0-1.0) Requires: pip install diagrams (mingrammer/diagrams, MIT) + Graphviz """ from diagrams import Cluster, Diagram, Edge from diagrams.onprem.compute import Server from diagrams.onprem.database import PostgreSQL from diagrams.onprem.inmemory import Redis from diagrams.onprem.network import Nginx from diagrams.programming.framework import FastAPI with Diagram("Distributed LLM Training & Inference Stack", show=False, direction="LR"): ingress = Nginx("API Gateway") with Cluster("Training Cluster (ZeRO-3 / FSDP)"): gpu_nodes = [Server("GPU Node 0\n8x H100"), Server("GPU Node 1\n8x H100"), Server("GPU Node N\n8x H100")] with Cluster("vLLM Serving Fleet"): workers = [FastAPI("vLLM Worker 1"), FastAPI("vLLM Worker 2")] kv = Redis("Prefix KV Cache") ckpt = PostgreSQL("Checkpoint & Eval Store") gpu_nodes >> Edge(label="Weights") >> ckpt ckpt >> Edge(label="Deploy") >> workers ingress >> workers >> kv