# llm-d/llm-d-latency-predictor architecture

> Architecture diagram of the GitHub repository llm-d/llm-d-latency-predictor, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/llm-d/llm-d-latency-predictor
- Repository: https://github.com/llm-d/llm-d-latency-predictor
- Video tour (about a minute): https://gitdiagram.com/llm-d/llm-d-latency-predictor/video

## Overview

This repository provides separate HTTP services for training latency models from request traces and serving TTFT/TPOT predictions. The principal workflow is trace submission to training, model availability through HTTP synchronization, then single or bulk prediction requests. The graph also captures model readiness and shared model types. Source excerpts are partial, so internal training details and deployment wiring are limited to relationships explicitly shown in the excerpts or README.

Main entry points: [`prediction/prediction_server.py`](https://github.com/llm-d/llm-d-latency-predictor/blob/main/prediction/prediction_server.py) (Prediction API), [`training/training_server.py`](https://github.com/llm-d/llm-d-latency-predictor/blob/main/training/training_server.py) (Training API), [`common/types.py`](https://github.com/llm-d/llm-d-latency-predictor/blob/main/common/types.py) (Model types)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_training["Model training"]
  node_training_api["Training API<br/>[training_server.py]"]
  node_trainer["Model trainer<br/>[training_server.py]"]
  node_model_artifacts[("Model artifacts<br/>[training_server.py]")]
end

subgraph group_serving["Prediction serving"]
  node_prediction_api["Prediction API"]
  node_predictor["Latency predictor"]
  node_model_sync["Model synchronizer"]
end

subgraph group_shared["Shared domain"]
  node_model_types["Model types<br/>[types.py]"]
end

node_client(("Ecosystem client"))
node_training_service{{"Training service"}}

node_client -->|"submits traces"| node_training_api
node_training_api -->|"adds samples"| node_trainer
node_client -->|"requests predictions"| node_prediction_api
node_prediction_api -->|"predicts"| node_predictor
node_prediction_api -->|"reloads models"| node_model_sync
node_model_sync -->|"checks and downloads"| node_training_service
node_training_service -->|"provides model files"| node_model_artifacts
node_trainer -->|"uses model types"| node_model_types
node_predictor -->|"uses model types"| node_model_types

click node_training_api "https://github.com/llm-d/llm-d-latency-predictor/blob/main/training/training_server.py"
click node_trainer "https://github.com/llm-d/llm-d-latency-predictor/blob/main/training/training_server.py"
click node_model_artifacts "https://github.com/llm-d/llm-d-latency-predictor/blob/main/training/training_server.py"
click node_prediction_api "https://github.com/llm-d/llm-d-latency-predictor/blob/main/prediction/prediction_server.py"
click node_predictor "https://github.com/llm-d/llm-d-latency-predictor/blob/main/prediction/prediction_server.py"
click node_model_sync "https://github.com/llm-d/llm-d-latency-predictor/blob/main/prediction/prediction_server.py"
click node_model_types "https://github.com/llm-d/llm-d-latency-predictor/blob/main/common/types.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_training_api,node_trainer,node_model_artifacts,node_client toneBlue
class node_prediction_api,node_predictor,node_model_sync toneAmber
class node_model_types toneMint
class node_training_service toneIndigo
```

## Components

### Model training

- [Training API](https://github.com/llm-d/llm-d-latency-predictor/blob/main/training/training_server.py): `training/training_server.py`
- [Model trainer](https://github.com/llm-d/llm-d-latency-predictor/blob/main/training/training_server.py): `training/training_server.py`
- [Model artifacts](https://github.com/llm-d/llm-d-latency-predictor/blob/main/training/training_server.py): `training/training_server.py`

### Prediction serving

- [Prediction API](https://github.com/llm-d/llm-d-latency-predictor/blob/main/prediction/prediction_server.py): `prediction/prediction_server.py`
- [Latency predictor](https://github.com/llm-d/llm-d-latency-predictor/blob/main/prediction/prediction_server.py): `prediction/prediction_server.py`
- [Model synchronizer](https://github.com/llm-d/llm-d-latency-predictor/blob/main/prediction/prediction_server.py): `prediction/prediction_server.py`

### Shared domain

- [Model types](https://github.com/llm-d/llm-d-latency-predictor/blob/main/common/types.py): `common/types.py`

### Other components

- **Ecosystem client**
- **Training service**

## Connections

- Ecosystem client → Training API: submits traces (evidence: `README.md`)
- Training API → Model trainer: adds samples (evidence: `training/training_server.py`)
- Ecosystem client → Prediction API: requests predictions (evidence: `README.md`)
- Prediction API → Latency predictor: predicts (evidence: `prediction/prediction_server.py`)
- Prediction API → Model synchronizer: reloads models (evidence: `prediction/prediction_server.py`)
- Model synchronizer → Training service: checks and downloads (evidence: `prediction/prediction_server.py`)
- Training service → Model artifacts: provides model files (evidence: `training/training_server.py`)
- Model trainer → Model types: uses model types (evidence: `training/training_server.py`)
- Latency predictor → Model types: uses model types (evidence: `prediction/prediction_server.py`)
