# karitselmuthu/enterprise_llm_transfomer architecture

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

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

## Overview

This repository is an educational support-ticket NLP and LLM demo, not a production support integration. Its main workflow classifies a ticket, generates a proposed reply, stores a pending draft, and lets a reviewer approve or reject it; only approval writes a ticket response to local SQLite. The graph also preserves the documented classifier generations and decoder concepts. Edges are limited to README statements and sampled imports/calls; unsampled implementation links are omitted.

Main entry points: [`api/main.py`](https://github.com/karitselmuthu/enterprise_llm_transfomer/blob/main/api/main.py) (FastAPI routes), [`src/llm/inference/review.py`](https://github.com/karitselmuthu/enterprise_llm_transfomer/blob/main/src/llm/inference/review.py) (Draft and response store), [`src/llm/architectures/decoder.py`](https://github.com/karitselmuthu/enterprise_llm_transfomer/blob/main/src/llm/architectures/decoder.py) (Causal decoder), [`src/llm/inference/generate.py`](https://github.com/karitselmuthu/enterprise_llm_transfomer/blob/main/src/llm/inference/generate.py) (Draft generation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_classification["Ticket classification"]
  node_classifier["Classifier runtime<br/>[runtime.py]"]
  node_baselines["V1–V4 baselines"]
  node_encoder["V5 Transformer encoder<br/>[model.py]"]
  node_pretrained["V6–V7 pretrained models<br/>[pretrained.py]"]
  node_tokenizer["Text tokenization<br/>[tokenizer.py]"]
  node_vocabulary["Neural vocabulary<br/>[vocabulary.py]"]
end

subgraph group_decoder["LLM decoder"]
  node_decoder["Causal decoder<br/>[decoder.py]"]
  node_attention["Attention variants<br/>[variants.py]"]
  node_cache["KV context cache<br/>[cache.py]"]
  node_moe["Expert routing<br/>[routing.py]"]
  node_rope["Rotary positions<br/>[rope.py]"]
  node_sampling["Token sampling<br/>[strategies.py]"]
  node_generation["Draft generation<br/>[generate.py]"]
  node_llm_tokenizer["Decoder tokenizer<br/>[tokenizer.py]"]
end

subgraph group_workflow["Draft review API"]
  node_api["FastAPI routes<br/>[main.py]"]
  node_store[("Draft and response store<br/>[review.py]")]
end

subgraph group_training["Training and evaluation"]
  node_split["Locked data splits<br/>[split.py]"]
  node_training["Classifier training<br/>[train.py]"]
  node_neural_training["Neural training<br/>[train_neural.py]"]
  node_evaluation["Model evaluation<br/>[evaluate.py]"]
end

node_customer(("Ticket submitter"))
node_reviewer(("Human reviewer"))

node_customer -->|"submits ticket"| node_api
node_api -->|"loads predictor"| node_classifier
node_classifier -->|"dispatches versions"| node_baselines
node_classifier -->|"loads V6–V7"| node_pretrained
node_baselines -->|"tokenizes text"| node_tokenizer
node_baselines -.->|"uses neural vocabulary"| node_vocabulary
node_api -->|"requests suggestion"| node_generation
node_generation -->|"generates tokens"| node_decoder
node_generation -->|"encodes text"| node_llm_tokenizer
node_generation -->|"selects tokens"| node_sampling
node_decoder -->|"runs attention"| node_attention
node_decoder -->|"checks cache length"| node_cache
node_decoder -->|"routes experts"| node_moe
node_attention -->|"applies RoPE"| node_rope
node_api -->|"creates draft"| node_store
node_api -->|"serves review"| node_store
node_reviewer -->|"reviews draft"| node_api
node_store -->|"returns draft"| node_reviewer
node_store -->|"writes approved response"| node_store
node_training -->|"loads locked split"| node_split
node_training -->|"fits V1 model"| node_baselines
node_neural_training -->|"uses split"| node_split
node_neural_training -->|"builds V5 model"| node_encoder
node_evaluation -->|"loads ticket rows"| node_training
node_evaluation -->|"checks split fingerprint"| node_split

click node_api "https://github.com/karitselmuthu/enterprise_llm_transfomer/blob/main/api/main.py"
click node_classifier "https://github.com/karitselmuthu/enterprise_llm_transfomer/blob/main/src/inference/runtime.py"
click node_baselines "https://github.com/karitselmuthu/enterprise_llm_transfomer/tree/main/src/baselines"
click node_encoder "https://github.com/karitselmuthu/enterprise_llm_transfomer/blob/main/src/transformer/model.py"
click node_pretrained "https://github.com/karitselmuthu/enterprise_llm_transfomer/blob/main/src/inference/pretrained.py"
click node_tokenizer "https://github.com/karitselmuthu/enterprise_llm_transfomer/blob/main/src/preprocessing/tokenizer.py"
click node_vocabulary "https://github.com/karitselmuthu/enterprise_llm_transfomer/blob/main/src/preprocessing/vocabulary.py"
click node_decoder "https://github.com/karitselmuthu/enterprise_llm_transfomer/blob/main/src/llm/architectures/decoder.py"
click node_attention "https://github.com/karitselmuthu/enterprise_llm_transfomer/blob/main/src/llm/attention/variants.py"
click node_cache "https://github.com/karitselmuthu/enterprise_llm_transfomer/blob/main/src/llm/context/cache.py"
click node_moe "https://github.com/karitselmuthu/enterprise_llm_transfomer/blob/main/src/llm/moe/routing.py"
click node_rope "https://github.com/karitselmuthu/enterprise_llm_transfomer/blob/main/src/llm/positional_encoding/rope.py"
click node_sampling "https://github.com/karitselmuthu/enterprise_llm_transfomer/blob/main/src/llm/sampling/strategies.py"
click node_generation "https://github.com/karitselmuthu/enterprise_llm_transfomer/blob/main/src/llm/inference/generate.py"
click node_llm_tokenizer "https://github.com/karitselmuthu/enterprise_llm_transfomer/blob/main/src/llm/inference/tokenizer.py"
click node_store "https://github.com/karitselmuthu/enterprise_llm_transfomer/blob/main/src/llm/inference/review.py"
click node_split "https://github.com/karitselmuthu/enterprise_llm_transfomer/blob/main/src/training/split.py"
click node_training "https://github.com/karitselmuthu/enterprise_llm_transfomer/blob/main/src/training/train.py"
click node_neural_training "https://github.com/karitselmuthu/enterprise_llm_transfomer/blob/main/src/training/train_neural.py"
click node_evaluation "https://github.com/karitselmuthu/enterprise_llm_transfomer/blob/main/src/evaluation/evaluate.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_classifier,node_baselines,node_encoder,node_pretrained,node_tokenizer,node_vocabulary,node_reviewer toneBlue
class node_decoder,node_attention,node_cache,node_moe,node_rope,node_sampling,node_generation,node_llm_tokenizer toneAmber
class node_api,node_store toneMint
class node_split,node_training,node_neural_training,node_evaluation toneRose
class node_customer toneIndigo
```

## Components

### Ticket classification

- [Classifier runtime](https://github.com/karitselmuthu/enterprise_llm_transfomer/blob/main/src/inference/runtime.py): `src/inference/runtime.py`
- [V1–V4 baselines](https://github.com/karitselmuthu/enterprise_llm_transfomer/tree/main/src/baselines): `src/baselines`
- [V5 Transformer encoder](https://github.com/karitselmuthu/enterprise_llm_transfomer/blob/main/src/transformer/model.py): `src/transformer/model.py`
- [V6–V7 pretrained models](https://github.com/karitselmuthu/enterprise_llm_transfomer/blob/main/src/inference/pretrained.py): `src/inference/pretrained.py`
- [Text tokenization](https://github.com/karitselmuthu/enterprise_llm_transfomer/blob/main/src/preprocessing/tokenizer.py): `src/preprocessing/tokenizer.py`
- [Neural vocabulary](https://github.com/karitselmuthu/enterprise_llm_transfomer/blob/main/src/preprocessing/vocabulary.py): `src/preprocessing/vocabulary.py`

### LLM decoder

- [Causal decoder](https://github.com/karitselmuthu/enterprise_llm_transfomer/blob/main/src/llm/architectures/decoder.py): `src/llm/architectures/decoder.py`
- [Attention variants](https://github.com/karitselmuthu/enterprise_llm_transfomer/blob/main/src/llm/attention/variants.py): `src/llm/attention/variants.py`
- [KV context cache](https://github.com/karitselmuthu/enterprise_llm_transfomer/blob/main/src/llm/context/cache.py): `src/llm/context/cache.py`
- [Expert routing](https://github.com/karitselmuthu/enterprise_llm_transfomer/blob/main/src/llm/moe/routing.py): `src/llm/moe/routing.py`
- [Rotary positions](https://github.com/karitselmuthu/enterprise_llm_transfomer/blob/main/src/llm/positional_encoding/rope.py): `src/llm/positional_encoding/rope.py`
- [Token sampling](https://github.com/karitselmuthu/enterprise_llm_transfomer/blob/main/src/llm/sampling/strategies.py): `src/llm/sampling/strategies.py`
- [Draft generation](https://github.com/karitselmuthu/enterprise_llm_transfomer/blob/main/src/llm/inference/generate.py): `src/llm/inference/generate.py`
- [Decoder tokenizer](https://github.com/karitselmuthu/enterprise_llm_transfomer/blob/main/src/llm/inference/tokenizer.py): `src/llm/inference/tokenizer.py`

### Draft review API

- [FastAPI routes](https://github.com/karitselmuthu/enterprise_llm_transfomer/blob/main/api/main.py): `api/main.py`
- [Draft and response store](https://github.com/karitselmuthu/enterprise_llm_transfomer/blob/main/src/llm/inference/review.py): `src/llm/inference/review.py`

### Training and evaluation

- [Locked data splits](https://github.com/karitselmuthu/enterprise_llm_transfomer/blob/main/src/training/split.py): `src/training/split.py`
- [Classifier training](https://github.com/karitselmuthu/enterprise_llm_transfomer/blob/main/src/training/train.py): `src/training/train.py`
- [Neural training](https://github.com/karitselmuthu/enterprise_llm_transfomer/blob/main/src/training/train_neural.py): `src/training/train_neural.py`
- [Model evaluation](https://github.com/karitselmuthu/enterprise_llm_transfomer/blob/main/src/evaluation/evaluate.py): `src/evaluation/evaluate.py`

### Other components

- **Ticket submitter**
- **Human reviewer**

## Connections

- Ticket submitter → FastAPI routes: submits ticket (evidence: `README.md`)
- FastAPI routes → Classifier runtime: loads predictor (evidence: `api/main.py`)
- Classifier runtime → V1–V4 baselines: dispatches versions (evidence: `src/inference/runtime.py`)
- Classifier runtime → V6–V7 pretrained models: loads V6–V7 (evidence: `src/inference/runtime.py`)
- V1–V4 baselines → Text tokenization: tokenizes text (evidence: `src/baselines/traditional.py`)
- V1–V4 baselines → Neural vocabulary: uses neural vocabulary
- FastAPI routes → Draft generation: requests suggestion (evidence: `api/main.py`)
- Draft generation → Causal decoder: generates tokens (evidence: `src/llm/inference/generate.py`)
- Draft generation → Decoder tokenizer: encodes text (evidence: `src/llm/inference/generate.py`)
- Draft generation → Token sampling: selects tokens (evidence: `src/llm/inference/generate.py`)
- Causal decoder → Attention variants: runs attention (evidence: `src/llm/architectures/decoder.py`)
- Causal decoder → KV context cache: checks cache length (evidence: `src/llm/architectures/decoder.py`)
- Causal decoder → Expert routing: routes experts (evidence: `src/llm/architectures/decoder.py`)
- Attention variants → Rotary positions: applies RoPE (evidence: `src/llm/attention/variants.py`)
- FastAPI routes → Draft and response store: creates draft (evidence: `api/main.py`)
- FastAPI routes → Draft and response store: serves review (evidence: `api/main.py`)
- Human reviewer → FastAPI routes: reviews draft (evidence: `README.md`)
- Draft and response store → Human reviewer: returns draft (evidence: `README.md`)
- Draft and response store → Draft and response store: writes approved response (evidence: `src/llm/inference/review.py`)
- Classifier training → Locked data splits: loads locked split (evidence: `src/training/train.py`)
- Classifier training → V1–V4 baselines: fits V1 model (evidence: `src/training/train.py`)
- Neural training → Locked data splits: uses split (evidence: `src/training/train_neural.py`)
- Neural training → V5 Transformer encoder: builds V5 model (evidence: `src/training/train_neural.py`)
- Model evaluation → Classifier training: loads ticket rows (evidence: `src/evaluation/evaluate.py`)
- Model evaluation → Locked data splits: checks split fingerprint (evidence: `src/evaluation/evaluate.py`)
