# sumanth369msb/llm-as-a-judge architecture

> Architecture diagram of the GitHub repository sumanth369msb/llm-as-a-judge, 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/sumanth369msb/llm-as-a-judge
- Repository: https://github.com/sumanth369msb/llm-as-a-judge

## Overview

This is a configurable LLM-as-a-judge quality-control framework. Its main workflow runs batch evaluation with either custom rubrics or Ragas, compares scores with human baselines at a calibration gate, then optionally simulates or accepts production traffic for asynchronous shadow evaluation and drift reporting. The graph preserves the provider-routing and pluggable observability branches. Some runtime wiring is documented in the README or pipeline entry point; unsampled implementation details are not inferred.

Main entry points: [`scripts/run_pipeline.py`](https://github.com/sumanth369msb/llm-as-a-judge/blob/main/scripts/run_pipeline.py) (Pipeline runner), [`src/phase_3_online_evals/custom_online_evals/online_evaluator.py`](https://github.com/sumanth369msb/llm-as-a-judge/blob/main/src/phase_3_online_evals/custom_online_evals/online_evaluator.py) (Shadow evaluator), [`src/phase_1_evaluation/custom_judges/evaluate_custom_judge.py`](https://github.com/sumanth369msb/llm-as-a-judge/blob/main/src/phase_1_evaluation/custom_judges/evaluate_custom_judge.py) (Custom batch judge), [`src/phase_3_online_evals/langsmith_online_evals/__init__.py`](https://github.com/sumanth369msb/llm-as-a-judge/blob/main/src/phase_3_online_evals/langsmith_online_evals/__init__.py) (Observability backend factory)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_pipeline["Pipeline and calibration"]
  node_pipeline["Pipeline runner<br/>[run_pipeline.py]"]
  node_calibration["Calibration gate<br/>[calibrate_delta.py]"]
  node_human_baseline["Human baseline<br/>[human_baseline.csv]"]
end

subgraph group_evaluation["Evaluation engines"]
  node_custom_batch["Custom batch judge"]
  node_ragas["Ragas evaluator<br/>[evaluate_ragas.py]"]
  node_faith_prompt["Faithfulness rubric"]
  node_relevancy_prompt["Relevancy rubric"]
end

subgraph group_providers["Judge providers"]
  node_llm_client["Provider client and fallback<br/>[llm_client.py]"]
  node_llm_services{{"LLM provider APIs"}}
end

subgraph group_online["Online evaluation and observability"]
  node_online_evaluator["Shadow evaluator"]
  node_backend_factory["Observability backend factory<br/>[__init__.py]"]
  node_backend_interface["Backend interface<br/>[base.py]"]
  node_native_backend["Native drift backend<br/>[native_backend.py]"]
  node_sqlite[("Shadow evaluation store")]
  node_langsmith_backend["LangSmith backend"]
  node_langsmith_service{{"LangSmith service"}}
end

node_operator(("Pipeline operator"))
node_online_actor(("Production request handler"))

node_operator -->|"runs pipeline"| node_pipeline
node_pipeline -->|"selects engine"| node_custom_batch
node_pipeline -->|"selects engine"| node_ragas
node_custom_batch -->|"formats rubric"| node_faith_prompt
node_custom_batch -->|"formats rubric"| node_relevancy_prompt
node_custom_batch -->|"requests judgments"| node_llm_client
node_llm_client -->|"calls provider"| node_llm_services
node_pipeline -->|"checks scores"| node_calibration
node_pipeline -->|"reads baseline"| node_human_baseline
node_pipeline -->|"starts simulation"| node_online_evaluator
node_online_actor -->|"enqueues traffic"| node_online_evaluator
node_online_evaluator -->|"formats rubric"| node_faith_prompt
node_online_evaluator -->|"formats rubric"| node_relevancy_prompt
node_online_evaluator -->|"requests judgments"| node_llm_client
node_online_evaluator -->|"selects backend"| node_backend_factory
node_backend_factory -->|"implements strategy"| node_backend_interface
node_backend_factory -->|"constructs backend"| node_native_backend
node_backend_factory -->|"constructs backend"| node_langsmith_backend
node_native_backend -->|"reads and writes"| node_sqlite
node_langsmith_backend -->|"sends traces"| node_langsmith_service
node_pipeline -->|"requests drift report"| node_online_evaluator
node_ragas -.->|"evaluates with models"| node_llm_services

click node_pipeline "https://github.com/sumanth369msb/llm-as-a-judge/blob/main/scripts/run_pipeline.py"
click node_custom_batch "https://github.com/sumanth369msb/llm-as-a-judge/blob/main/src/phase_1_evaluation/custom_judges/evaluate_custom_judge.py"
click node_ragas "https://github.com/sumanth369msb/llm-as-a-judge/blob/main/src/phase_1_evaluation/ragas/evaluate_ragas.py"
click node_faith_prompt "https://github.com/sumanth369msb/llm-as-a-judge/blob/main/prompts/faithfulness_judge_prompt.py"
click node_relevancy_prompt "https://github.com/sumanth369msb/llm-as-a-judge/blob/main/prompts/relevancy_judge_prompt.py"
click node_llm_client "https://github.com/sumanth369msb/llm-as-a-judge/blob/main/src/llm_client.py"
click node_calibration "https://github.com/sumanth369msb/llm-as-a-judge/blob/main/src/phase_2_calibration/calibration/calibrate_delta.py"
click node_human_baseline "https://github.com/sumanth369msb/llm-as-a-judge/blob/main/data/human_baseline.csv"
click node_online_evaluator "https://github.com/sumanth369msb/llm-as-a-judge/blob/main/src/phase_3_online_evals/custom_online_evals/online_evaluator.py"
click node_backend_factory "https://github.com/sumanth369msb/llm-as-a-judge/blob/main/src/phase_3_online_evals/langsmith_online_evals/__init__.py"
click node_backend_interface "https://github.com/sumanth369msb/llm-as-a-judge/blob/main/src/phase_3_online_evals/langsmith_online_evals/base.py"
click node_native_backend "https://github.com/sumanth369msb/llm-as-a-judge/blob/main/src/phase_3_online_evals/langsmith_online_evals/native_backend.py"
click node_langsmith_backend "https://github.com/sumanth369msb/llm-as-a-judge/blob/main/src/phase_3_online_evals/langsmith_online_evals/langsmith_backend.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_pipeline,node_calibration,node_human_baseline toneBlue
class node_custom_batch,node_ragas,node_faith_prompt,node_relevancy_prompt toneAmber
class node_llm_client,node_llm_services,node_online_actor toneMint
class node_online_evaluator,node_backend_factory,node_backend_interface,node_native_backend,node_sqlite,node_langsmith_backend,node_langsmith_service toneRose
class node_operator toneIndigo
```

## Components

### Pipeline and calibration

- [Pipeline runner](https://github.com/sumanth369msb/llm-as-a-judge/blob/main/scripts/run_pipeline.py): `scripts/run_pipeline.py`
- [Calibration gate](https://github.com/sumanth369msb/llm-as-a-judge/blob/main/src/phase_2_calibration/calibration/calibrate_delta.py): `src/phase_2_calibration/calibration/calibrate_delta.py`
- [Human baseline](https://github.com/sumanth369msb/llm-as-a-judge/blob/main/data/human_baseline.csv): `data/human_baseline.csv`

### Evaluation engines

- [Custom batch judge](https://github.com/sumanth369msb/llm-as-a-judge/blob/main/src/phase_1_evaluation/custom_judges/evaluate_custom_judge.py): `src/phase_1_evaluation/custom_judges/evaluate_custom_judge.py`
- [Ragas evaluator](https://github.com/sumanth369msb/llm-as-a-judge/blob/main/src/phase_1_evaluation/ragas/evaluate_ragas.py): `src/phase_1_evaluation/ragas/evaluate_ragas.py`
- [Faithfulness rubric](https://github.com/sumanth369msb/llm-as-a-judge/blob/main/prompts/faithfulness_judge_prompt.py): `prompts/faithfulness_judge_prompt.py`
- [Relevancy rubric](https://github.com/sumanth369msb/llm-as-a-judge/blob/main/prompts/relevancy_judge_prompt.py): `prompts/relevancy_judge_prompt.py`

### Judge providers

- [Provider client and fallback](https://github.com/sumanth369msb/llm-as-a-judge/blob/main/src/llm_client.py): `src/llm_client.py`
- **LLM provider APIs**

### Online evaluation and observability

- [Shadow evaluator](https://github.com/sumanth369msb/llm-as-a-judge/blob/main/src/phase_3_online_evals/custom_online_evals/online_evaluator.py): `src/phase_3_online_evals/custom_online_evals/online_evaluator.py`
- [Observability backend factory](https://github.com/sumanth369msb/llm-as-a-judge/blob/main/src/phase_3_online_evals/langsmith_online_evals/__init__.py): `src/phase_3_online_evals/langsmith_online_evals/__init__.py`
- [Backend interface](https://github.com/sumanth369msb/llm-as-a-judge/blob/main/src/phase_3_online_evals/langsmith_online_evals/base.py): `src/phase_3_online_evals/langsmith_online_evals/base.py`
- [Native drift backend](https://github.com/sumanth369msb/llm-as-a-judge/blob/main/src/phase_3_online_evals/langsmith_online_evals/native_backend.py): `src/phase_3_online_evals/langsmith_online_evals/native_backend.py`
- **Shadow evaluation store**
- [LangSmith backend](https://github.com/sumanth369msb/llm-as-a-judge/blob/main/src/phase_3_online_evals/langsmith_online_evals/langsmith_backend.py): `src/phase_3_online_evals/langsmith_online_evals/langsmith_backend.py`
- **LangSmith service**

### Other components

- **Pipeline operator**
- **Production request handler**

## Connections

- Pipeline operator → Pipeline runner: runs pipeline (evidence: `README.md`)
- Pipeline runner → Custom batch judge: selects engine (evidence: `scripts/run_pipeline.py`)
- Pipeline runner → Ragas evaluator: selects engine (evidence: `README.md`)
- Custom batch judge → Faithfulness rubric: formats rubric (evidence: `src/phase_1_evaluation/custom_judges/evaluate_custom_judge.py`)
- Custom batch judge → Relevancy rubric: formats rubric (evidence: `src/phase_1_evaluation/custom_judges/evaluate_custom_judge.py`)
- Custom batch judge → Provider client and fallback: requests judgments (evidence: `src/phase_1_evaluation/custom_judges/evaluate_custom_judge.py`)
- Provider client and fallback → LLM provider APIs: calls provider (evidence: `src/llm_client.py`)
- Pipeline runner → Calibration gate: checks scores (evidence: `scripts/run_pipeline.py`)
- Pipeline runner → Human baseline: reads baseline (evidence: `scripts/run_pipeline.py`)
- Pipeline runner → Shadow evaluator: starts simulation (evidence: `scripts/run_pipeline.py`)
- Production request handler → Shadow evaluator: enqueues traffic (evidence: `README.md`)
- Shadow evaluator → Faithfulness rubric: formats rubric (evidence: `src/phase_3_online_evals/custom_online_evals/online_evaluator.py`)
- Shadow evaluator → Relevancy rubric: formats rubric (evidence: `src/phase_3_online_evals/custom_online_evals/online_evaluator.py`)
- Shadow evaluator → Provider client and fallback: requests judgments (evidence: `src/phase_3_online_evals/custom_online_evals/online_evaluator.py`)
- Shadow evaluator → Observability backend factory: selects backend (evidence: `src/phase_3_online_evals/custom_online_evals/online_evaluator.py`)
- Observability backend factory → Backend interface: implements strategy (evidence: `src/phase_3_online_evals/langsmith_online_evals/__init__.py`)
- Observability backend factory → Native drift backend: constructs backend (evidence: `src/phase_3_online_evals/langsmith_online_evals/__init__.py`)
- Observability backend factory → LangSmith backend: constructs backend (evidence: `src/phase_3_online_evals/langsmith_online_evals/__init__.py`)
- Native drift backend → Shadow evaluation store: reads and writes (evidence: `src/phase_3_online_evals/langsmith_online_evals/native_backend.py`)
- LangSmith backend → LangSmith service: sends traces (evidence: `README.md`)
- Pipeline runner → Shadow evaluator: requests drift report (evidence: `scripts/run_pipeline.py`)
- Ragas evaluator → LLM provider APIs: evaluates with models (evidence: `README.md`)
