# karitselmuthu/enterprise_llm_systems architecture

> Architecture diagram of the GitHub repository karitselmuthu/enterprise_llm_systems, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/karitselmuthu/enterprise_llm_systems
- Repository: https://github.com/karitselmuthu/enterprise_llm_systems

## Overview

This is a local-first LLM inference lab, combining a bounded generation API and command-line experiments. Users submit prompts through the API or choose an experiment from the CLI; requests reach the runtime, which uses the deterministic toy model by default or an optionally configured local Transformers model. The experiments cover serving benchmarks, caching, speculative decoding, attention, quantization, memory estimates, and analytical parallelism. The excerpts establish the API/runtime and experiment/model relationships; CLI routing is documented in the README, but its implementation was not sampled.

Main entry points: [`src/enterprise_llm/cli.py`](https://github.com/karitselmuthu/enterprise_llm_systems/blob/main/src/enterprise_llm/cli.py) (Lab CLI), [`src/enterprise_llm/runtime.py`](https://github.com/karitselmuthu/enterprise_llm_systems/blob/main/src/enterprise_llm/runtime.py) (Inference runtime), [`src/enterprise_llm/toy.py`](https://github.com/karitselmuthu/enterprise_llm_systems/blob/main/src/enterprise_llm/toy.py) (Toy causal model), [`src/enterprise_llm/api.py`](https://github.com/karitselmuthu/enterprise_llm_systems/blob/main/src/enterprise_llm/api.py) (HTTP API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User interfaces"]
  node_cli["Lab CLI<br/>[cli.py]"]
  node_api["HTTP API<br/>[api.py]"]
end

subgraph group_serving["Inference serving"]
  node_runtime["Inference runtime<br/>[runtime.py]"]
end

subgraph group_experiments["Optimization experiments"]
  node_benchmark["Serving benchmark<br/>[experiments.py]"]
  node_parallelism["Parallelism analysis<br/>[experiments.py]"]
  node_kv["KV cache experiment<br/>[experiments.py]"]
  node_speculative["Speculative decoding<br/>[experiments.py]"]
  node_attention["Attention benchmark<br/>[experiments.py]"]
  node_quantization["Quantization experiment<br/>[experiments.py]"]
  node_memory["Memory estimator<br/>[experiments.py]"]
end

subgraph group_backend["Model backends"]
  node_toy["Toy causal model<br/>[toy.py]"]
  node_transformers["Transformers model"]
end

node_user(("User"))

node_user -->|"runs experiments"| node_cli
node_user -->|"sends requests"| node_api
node_cli -->|"selects experiment"| node_parallelism
node_cli -->|"selects benchmark"| node_benchmark
node_cli -->|"selects experiment"| node_kv
node_cli -->|"selects experiment"| node_speculative
node_cli -->|"selects benchmark"| node_attention
node_cli -->|"selects experiment"| node_quantization
node_cli -->|"selects estimate"| node_memory
node_api -->|"generates with"| node_runtime
node_benchmark -->|"benchmarks"| node_runtime
node_kv -->|"compares generation"| node_toy
node_speculative -->|"tests decoding"| node_toy
node_runtime -->|"generates with"| node_toy
node_runtime -.->|"loads optionally"| node_transformers

click node_cli "https://github.com/karitselmuthu/enterprise_llm_systems/blob/main/src/enterprise_llm/cli.py"
click node_api "https://github.com/karitselmuthu/enterprise_llm_systems/blob/main/src/enterprise_llm/api.py"
click node_runtime "https://github.com/karitselmuthu/enterprise_llm_systems/blob/main/src/enterprise_llm/runtime.py"
click node_benchmark "https://github.com/karitselmuthu/enterprise_llm_systems/blob/main/src/enterprise_llm/experiments.py"
click node_parallelism "https://github.com/karitselmuthu/enterprise_llm_systems/blob/main/src/enterprise_llm/experiments.py"
click node_kv "https://github.com/karitselmuthu/enterprise_llm_systems/blob/main/src/enterprise_llm/experiments.py"
click node_speculative "https://github.com/karitselmuthu/enterprise_llm_systems/blob/main/src/enterprise_llm/experiments.py"
click node_attention "https://github.com/karitselmuthu/enterprise_llm_systems/blob/main/src/enterprise_llm/experiments.py"
click node_quantization "https://github.com/karitselmuthu/enterprise_llm_systems/blob/main/src/enterprise_llm/experiments.py"
click node_memory "https://github.com/karitselmuthu/enterprise_llm_systems/blob/main/src/enterprise_llm/experiments.py"
click node_toy "https://github.com/karitselmuthu/enterprise_llm_systems/blob/main/src/enterprise_llm/toy.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_cli,node_api,node_user toneBlue
class node_runtime toneAmber
class node_benchmark,node_parallelism,node_kv,node_speculative,node_attention,node_quantization,node_memory toneMint
class node_toy,node_transformers toneRose
```

## Components

### User interfaces

- [Lab CLI](https://github.com/karitselmuthu/enterprise_llm_systems/blob/main/src/enterprise_llm/cli.py): `src/enterprise_llm/cli.py`
- [HTTP API](https://github.com/karitselmuthu/enterprise_llm_systems/blob/main/src/enterprise_llm/api.py): `src/enterprise_llm/api.py`

### Inference serving

- [Inference runtime](https://github.com/karitselmuthu/enterprise_llm_systems/blob/main/src/enterprise_llm/runtime.py): `src/enterprise_llm/runtime.py`

### Optimization experiments

- [Serving benchmark](https://github.com/karitselmuthu/enterprise_llm_systems/blob/main/src/enterprise_llm/experiments.py): `src/enterprise_llm/experiments.py`
- [Parallelism analysis](https://github.com/karitselmuthu/enterprise_llm_systems/blob/main/src/enterprise_llm/experiments.py): `src/enterprise_llm/experiments.py`
- [KV cache experiment](https://github.com/karitselmuthu/enterprise_llm_systems/blob/main/src/enterprise_llm/experiments.py): `src/enterprise_llm/experiments.py`
- [Speculative decoding](https://github.com/karitselmuthu/enterprise_llm_systems/blob/main/src/enterprise_llm/experiments.py): `src/enterprise_llm/experiments.py`
- [Attention benchmark](https://github.com/karitselmuthu/enterprise_llm_systems/blob/main/src/enterprise_llm/experiments.py): `src/enterprise_llm/experiments.py`
- [Quantization experiment](https://github.com/karitselmuthu/enterprise_llm_systems/blob/main/src/enterprise_llm/experiments.py): `src/enterprise_llm/experiments.py`
- [Memory estimator](https://github.com/karitselmuthu/enterprise_llm_systems/blob/main/src/enterprise_llm/experiments.py): `src/enterprise_llm/experiments.py`

### Model backends

- [Toy causal model](https://github.com/karitselmuthu/enterprise_llm_systems/blob/main/src/enterprise_llm/toy.py): `src/enterprise_llm/toy.py`
- **Transformers model**

### Other components

- **User**

## Connections

- User → Lab CLI: runs experiments (evidence: `README.md`)
- User → HTTP API: sends requests (evidence: `README.md`)
- Lab CLI → Parallelism analysis: selects experiment (evidence: `README.md`)
- Lab CLI → Serving benchmark: selects benchmark (evidence: `README.md`)
- Lab CLI → KV cache experiment: selects experiment (evidence: `README.md`)
- Lab CLI → Speculative decoding: selects experiment (evidence: `README.md`)
- Lab CLI → Attention benchmark: selects benchmark (evidence: `README.md`)
- Lab CLI → Quantization experiment: selects experiment (evidence: `README.md`)
- Lab CLI → Memory estimator: selects estimate (evidence: `README.md`)
- HTTP API → Inference runtime: generates with (evidence: `src/enterprise_llm/api.py`)
- Serving benchmark → Inference runtime: benchmarks (evidence: `src/enterprise_llm/experiments.py`)
- KV cache experiment → Toy causal model: compares generation (evidence: `src/enterprise_llm/experiments.py`)
- Speculative decoding → Toy causal model: tests decoding (evidence: `src/enterprise_llm/experiments.py`)
- Inference runtime → Toy causal model: generates with (evidence: `src/enterprise_llm/runtime.py`)
- Inference runtime → Transformers model: loads optionally (evidence: `src/enterprise_llm/runtime.py`)
