# pranjulkaran/llm-evaluation architecture

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

- Interactive diagram: https://gitdiagram.com/pranjulkaran/llm-evaluation
- Repository: https://github.com/pranjulkaran/llm-evaluation

## Overview

This repository is an LLM diagnostic and failure-analysis harness. Its principal workflow loads benchmark tasks, evaluates target models, probes robustness with meaning-preserving prompt perturbations, analyzes failure clusters and epistemic stability, then produces reports, visualizations, and remediation JSONL. SQLite stores evaluation and run data. The graph follows the shown orchestration and module references; links for pipeline calls not visible in the excerpts are dashed and unevidenced.

Main entry points: [`main.py`](https://github.com/pranjulkaran/llm-evaluation/blob/main/main.py) (Run harness), [`schemas.py`](https://github.com/pranjulkaran/llm-evaluation/blob/main/schemas.py) (Evaluation data models), [`layer0_ingest.py`](https://github.com/pranjulkaran/llm-evaluation/blob/main/layer0_ingest.py) (Baseline evaluation), [`reporter.py`](https://github.com/pranjulkaran/llm-evaluation/blob/main/reporter.py) (Vulnerability report)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_orchestration["Run orchestration"]
  node_main["Run harness<br/>[main.py]"]
end

subgraph group_evaluation["Evaluation pipeline"]
  node_benchmarks["Benchmark loader<br/>[benchmarks.py]"]
  node_ingest["Baseline evaluation<br/>[layer0_ingest.py]"]
  node_perturb["Prompt perturbations<br/>[layer1_perturb.py]"]
end

subgraph group_analysis["Failure analysis"]
  node_topology["Failure topology<br/>[layer2_topology.py]"]
  node_hypothesis["Cluster verification"]
  node_epistemic["Epistemic audit"]
end

subgraph group_outputs["Reporting and outputs"]
  node_reporter["Vulnerability report<br/>[reporter.py]"]
  node_visualize["Diagnostic visualizations<br/>[visualize.py]"]
  node_remediation["Remediation export"]
end

subgraph group_shared["Shared data and state"]
  node_config["Run configuration<br/>[config.py]"]
  node_storage[("SQLite diagnostic store<br/>[storage.py]")]
  node_schemas["Evaluation data models<br/>[schemas.py]"]
end

node_user(("CLI user"))
node_model(("Target LLM"))

node_user -->|"runs CLI"| node_main
node_main -->|"loads settings"| node_config
node_main -->|"loads tasks"| node_benchmarks
node_main -->|"evaluates tasks"| node_ingest
node_main -->|"verifies clusters"| node_hypothesis
node_main -->|"audits stability"| node_epistemic
node_main -->|"generates report"| node_reporter
node_main -->|"exports patches"| node_remediation
node_main -.->|"runs perturbations"| node_perturb
node_main -.->|"maps failures"| node_topology
node_main -.->|"plots results"| node_visualize
node_ingest -->|"requests inference"| node_model
node_ingest -->|"saves records"| node_storage
node_perturb -.->|"requests inference"| node_model
node_reporter -->|"reads stats"| node_storage
node_reporter -->|"saves run metadata"| node_storage
node_remediation -->|"uses record types"| node_schemas
node_ingest -->|"creates records"| node_schemas
node_topology -->|"analyzes records"| node_schemas
node_epistemic -->|"produces metrics"| node_schemas
node_visualize -->|"renders records"| node_schemas

click node_main "https://github.com/pranjulkaran/llm-evaluation/blob/main/main.py"
click node_config "https://github.com/pranjulkaran/llm-evaluation/blob/main/config.py"
click node_benchmarks "https://github.com/pranjulkaran/llm-evaluation/blob/main/benchmarks.py"
click node_ingest "https://github.com/pranjulkaran/llm-evaluation/blob/main/layer0_ingest.py"
click node_perturb "https://github.com/pranjulkaran/llm-evaluation/blob/main/layer1_perturb.py"
click node_topology "https://github.com/pranjulkaran/llm-evaluation/blob/main/layer2_topology.py"
click node_hypothesis "https://github.com/pranjulkaran/llm-evaluation/blob/main/layer2_5_hypothesis.py"
click node_epistemic "https://github.com/pranjulkaran/llm-evaluation/blob/main/layer3_epistemic.py"
click node_reporter "https://github.com/pranjulkaran/llm-evaluation/blob/main/reporter.py"
click node_visualize "https://github.com/pranjulkaran/llm-evaluation/blob/main/visualize.py"
click node_remediation "https://github.com/pranjulkaran/llm-evaluation/blob/main/remediation_exporter.py"
click node_storage "https://github.com/pranjulkaran/llm-evaluation/blob/main/storage.py"
click node_schemas "https://github.com/pranjulkaran/llm-evaluation/blob/main/schemas.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_main,node_user toneBlue
class node_benchmarks,node_ingest,node_perturb toneAmber
class node_topology,node_hypothesis,node_epistemic toneMint
class node_reporter,node_visualize,node_remediation toneRose
class node_config,node_storage,node_schemas,node_model toneIndigo
```

## Components

### Run orchestration

- [Run harness](https://github.com/pranjulkaran/llm-evaluation/blob/main/main.py): `main.py`

### Evaluation pipeline

- [Benchmark loader](https://github.com/pranjulkaran/llm-evaluation/blob/main/benchmarks.py): `benchmarks.py`
- [Baseline evaluation](https://github.com/pranjulkaran/llm-evaluation/blob/main/layer0_ingest.py): `layer0_ingest.py`
- [Prompt perturbations](https://github.com/pranjulkaran/llm-evaluation/blob/main/layer1_perturb.py): `layer1_perturb.py`

### Failure analysis

- [Failure topology](https://github.com/pranjulkaran/llm-evaluation/blob/main/layer2_topology.py): `layer2_topology.py`
- [Cluster verification](https://github.com/pranjulkaran/llm-evaluation/blob/main/layer2_5_hypothesis.py): `layer2_5_hypothesis.py`
- [Epistemic audit](https://github.com/pranjulkaran/llm-evaluation/blob/main/layer3_epistemic.py): `layer3_epistemic.py`

### Reporting and outputs

- [Vulnerability report](https://github.com/pranjulkaran/llm-evaluation/blob/main/reporter.py): `reporter.py`
- [Diagnostic visualizations](https://github.com/pranjulkaran/llm-evaluation/blob/main/visualize.py): `visualize.py`
- [Remediation export](https://github.com/pranjulkaran/llm-evaluation/blob/main/remediation_exporter.py): `remediation_exporter.py`

### Shared data and state

- [Run configuration](https://github.com/pranjulkaran/llm-evaluation/blob/main/config.py): `config.py`
- [SQLite diagnostic store](https://github.com/pranjulkaran/llm-evaluation/blob/main/storage.py): `storage.py`
- [Evaluation data models](https://github.com/pranjulkaran/llm-evaluation/blob/main/schemas.py): `schemas.py`

### Other components

- **CLI user**
- **Target LLM**

## Connections

- CLI user → Run harness: runs CLI (evidence: `main.py`)
- Run harness → Run configuration: loads settings (evidence: `main.py`)
- Run harness → Benchmark loader: loads tasks (evidence: `main.py`)
- Run harness → Baseline evaluation: evaluates tasks (evidence: `main.py`)
- Run harness → Cluster verification: verifies clusters (evidence: `main.py`)
- Run harness → Epistemic audit: audits stability (evidence: `main.py`)
- Run harness → Vulnerability report: generates report (evidence: `main.py`)
- Run harness → Remediation export: exports patches (evidence: `main.py`)
- Run harness → Prompt perturbations: runs perturbations (evidence: `main.py`)
- Run harness → Failure topology: maps failures (evidence: `main.py`)
- Run harness → Diagnostic visualizations: plots results (evidence: `main.py`)
- Baseline evaluation → Target LLM: requests inference (evidence: `layer0_ingest.py`)
- Baseline evaluation → SQLite diagnostic store: saves records (evidence: `layer0_ingest.py`)
- Prompt perturbations → Target LLM: requests inference
- Vulnerability report → SQLite diagnostic store: reads stats (evidence: `reporter.py`)
- Vulnerability report → SQLite diagnostic store: saves run metadata (evidence: `reporter.py`)
- Remediation export → Evaluation data models: uses record types (evidence: `remediation_exporter.py`)
- Baseline evaluation → Evaluation data models: creates records (evidence: `layer0_ingest.py`)
- Failure topology → Evaluation data models: analyzes records (evidence: `layer2_topology.py`)
- Epistemic audit → Evaluation data models: produces metrics (evidence: `layer3_epistemic.py`)
- Diagnostic visualizations → Evaluation data models: renders records (evidence: `visualize.py`)
