# pseboek/llm_benchmark architecture

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

- Interactive diagram: https://gitdiagram.com/pseboek/llm_benchmark
- Repository: https://github.com/pseboek/llm_benchmark

## Overview

LLM Model Scout discovers local and catalogued model candidates, ranks them for local hardware, and supports a human-approved queue → download → benchmark → reassessment workflow. Benchmark results and source status are persisted in SQLite and surfaced through reports and a historical Streamlit dashboard. The README documents these product stages; source excerpts establish several calls, while some CLI and benchmark wiring is supported only by README statements and SOURCE INDEX references.

Main entry points: [`src/main.py`](https://github.com/pseboek/llm_benchmark/blob/main/src/main.py) (CLI workflow), [`src/pipeline.py`](https://github.com/pseboek/llm_benchmark/blob/main/src/pipeline.py) (Source orchestration), [`ollama_benchmark.py`](https://github.com/pseboek/llm_benchmark/blob/main/ollama_benchmark.py) (Ollama measurements), [`src/database.py`](https://github.com/pseboek/llm_benchmark/blob/main/src/database.py) (Scout history)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_discovery["Discovery"]
  node_cli["CLI workflow<br/>[main.py]"]
  node_pipeline["Source orchestration<br/>[pipeline.py]"]
  node_dedup["Candidate normalization<br/>[discovery.py]"]
  node_ollama_source["Ollama inventory<br/>[ollama.py]"]
  node_hf_source["Hugging Face adapter<br/>[huggingface.py]"]
  node_aa_source["Artificial Analysis adapter"]
  node_swe_source["SWE-bench adapter<br/>[swebench.py]"]
  node_http["HTTP utilities<br/>[http.py]"]
end

subgraph group_evaluation["Evaluation"]
  node_scoring["Ranking and champion deltas<br/>[scoring.py]"]
  node_adaptive["Adaptive evaluation<br/>[adaptive.py]"]
  node_grading["Response quality grading<br/>[grading.py]"]
end

subgraph group_benchmarking["Benchmarking"]
  node_benchmark_queue["Candidate review queue<br/>[benchmark_queue.py]"]
  node_download_queue["Approved download plan<br/>[download_queue.py]"]
  node_benchmark_plan["Benchmark task planning<br/>[benchmark_plan.py]"]
  node_runner["Benchmark execution<br/>[runner.py]"]
  node_ollama_benchmark["Ollama measurements"]
  node_telemetry["Hardware telemetry<br/>[telemetry.py]"]
end

subgraph group_persistence["Persistence"]
  node_database[("Scout history<br/>[database.py]")]
end

subgraph group_presentation["Reporting"]
  node_report["Reports and comparison<br/>[report.py]"]
  node_dashboard["Historical dashboard<br/>[dashboard.py]"]
end

node_user(("Scout operator"))
node_ollama_service{{"Ollama service"}}
node_hf_service{{"Hugging Face"}}
node_aa_service{{"Artificial Analysis"}}
node_swe_service{{"SWE-bench"}}

node_user -->|"invokes"| node_cli
node_cli -->|"starts discovery"| node_pipeline
node_pipeline -->|"loads candidates"| node_ollama_source
node_pipeline -->|"loads candidates"| node_hf_source
node_pipeline -->|"loads candidates"| node_aa_source
node_pipeline -->|"loads candidates"| node_swe_source
node_pipeline -->|"deduplicates"| node_dedup
node_ollama_source -->|"queries tags"| node_ollama_service
node_hf_source -->|"requests JSON"| node_http
node_aa_source -->|"requests JSON"| node_http
node_swe_source -->|"configures endpoint"| node_http
node_hf_source -->|"fetches models"| node_hf_service
node_aa_source -->|"fetches models"| node_aa_service
node_swe_source -->|"fetches leaderboard"| node_swe_service
node_cli -->|"scores candidates"| node_scoring
node_scoring -->|"normalizes names"| node_dedup
node_cli -->|"runs adaptive mode"| node_adaptive
node_cli -->|"creates review queue"| node_benchmark_queue
node_cli -->|"manages download approval"| node_download_queue
node_cli -->|"creates task plan"| node_benchmark_plan
node_cli -->|"runs approved plan"| node_runner
node_runner -->|"executes measurements"| node_ollama_benchmark
node_ollama_benchmark -->|"sends generation requests"| node_ollama_service
node_ollama_benchmark -->|"grades responses"| node_grading
node_ollama_benchmark -->|"captures hardware metrics"| node_telemetry
node_cli -->|"persists candidates and runs"| node_database
node_ollama_benchmark -->|"stores benchmark results"| node_database
node_cli -->|"generates report"| node_report
node_report -->|"ranks and compares"| node_scoring
node_cli -->|"opens dashboard"| node_dashboard
node_database -->|"serves history"| node_dashboard
node_database -->|"supplies history"| node_report

click node_cli "https://github.com/pseboek/llm_benchmark/blob/main/src/main.py"
click node_pipeline "https://github.com/pseboek/llm_benchmark/blob/main/src/pipeline.py"
click node_dedup "https://github.com/pseboek/llm_benchmark/blob/main/src/discovery.py"
click node_ollama_source "https://github.com/pseboek/llm_benchmark/blob/main/src/sources/ollama.py"
click node_hf_source "https://github.com/pseboek/llm_benchmark/blob/main/src/sources/huggingface.py"
click node_aa_source "https://github.com/pseboek/llm_benchmark/blob/main/src/sources/artificial_analysis.py"
click node_swe_source "https://github.com/pseboek/llm_benchmark/blob/main/src/sources/swebench.py"
click node_http "https://github.com/pseboek/llm_benchmark/blob/main/src/sources/http.py"
click node_scoring "https://github.com/pseboek/llm_benchmark/blob/main/src/scoring.py"
click node_adaptive "https://github.com/pseboek/llm_benchmark/blob/main/src/adaptive.py"
click node_benchmark_queue "https://github.com/pseboek/llm_benchmark/blob/main/src/benchmark_queue.py"
click node_download_queue "https://github.com/pseboek/llm_benchmark/blob/main/src/download_queue.py"
click node_benchmark_plan "https://github.com/pseboek/llm_benchmark/blob/main/src/benchmark_plan.py"
click node_runner "https://github.com/pseboek/llm_benchmark/blob/main/benchmark/runner.py"
click node_ollama_benchmark "https://github.com/pseboek/llm_benchmark/blob/main/ollama_benchmark.py"
click node_grading "https://github.com/pseboek/llm_benchmark/blob/main/src/grading.py"
click node_telemetry "https://github.com/pseboek/llm_benchmark/blob/main/src/telemetry.py"
click node_database "https://github.com/pseboek/llm_benchmark/blob/main/src/database.py"
click node_report "https://github.com/pseboek/llm_benchmark/blob/main/src/report.py"
click node_dashboard "https://github.com/pseboek/llm_benchmark/blob/main/dashboard.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_pipeline,node_dedup,node_ollama_source,node_hf_source,node_aa_source,node_swe_source,node_http toneBlue
class node_scoring,node_adaptive,node_grading toneAmber
class node_benchmark_queue,node_download_queue,node_benchmark_plan,node_runner,node_ollama_benchmark,node_telemetry toneMint
class node_database toneRose
class node_report,node_dashboard,node_user,node_ollama_service,node_hf_service,node_aa_service,node_swe_service toneIndigo
```

## Components

### Discovery

- [CLI workflow](https://github.com/pseboek/llm_benchmark/blob/main/src/main.py): `src/main.py`
- [Source orchestration](https://github.com/pseboek/llm_benchmark/blob/main/src/pipeline.py): `src/pipeline.py`
- [Candidate normalization](https://github.com/pseboek/llm_benchmark/blob/main/src/discovery.py): `src/discovery.py`
- [Ollama inventory](https://github.com/pseboek/llm_benchmark/blob/main/src/sources/ollama.py): `src/sources/ollama.py`
- [Hugging Face adapter](https://github.com/pseboek/llm_benchmark/blob/main/src/sources/huggingface.py): `src/sources/huggingface.py`
- [Artificial Analysis adapter](https://github.com/pseboek/llm_benchmark/blob/main/src/sources/artificial_analysis.py): `src/sources/artificial_analysis.py`
- [SWE-bench adapter](https://github.com/pseboek/llm_benchmark/blob/main/src/sources/swebench.py): `src/sources/swebench.py`
- [HTTP utilities](https://github.com/pseboek/llm_benchmark/blob/main/src/sources/http.py): `src/sources/http.py`

### Evaluation

- [Ranking and champion deltas](https://github.com/pseboek/llm_benchmark/blob/main/src/scoring.py): `src/scoring.py`
- [Adaptive evaluation](https://github.com/pseboek/llm_benchmark/blob/main/src/adaptive.py): `src/adaptive.py`
- [Response quality grading](https://github.com/pseboek/llm_benchmark/blob/main/src/grading.py): `src/grading.py`

### Benchmarking

- [Candidate review queue](https://github.com/pseboek/llm_benchmark/blob/main/src/benchmark_queue.py): `src/benchmark_queue.py`
- [Approved download plan](https://github.com/pseboek/llm_benchmark/blob/main/src/download_queue.py): `src/download_queue.py`
- [Benchmark task planning](https://github.com/pseboek/llm_benchmark/blob/main/src/benchmark_plan.py): `src/benchmark_plan.py`
- [Benchmark execution](https://github.com/pseboek/llm_benchmark/blob/main/benchmark/runner.py): `benchmark/runner.py`
- [Ollama measurements](https://github.com/pseboek/llm_benchmark/blob/main/ollama_benchmark.py): `ollama_benchmark.py`
- [Hardware telemetry](https://github.com/pseboek/llm_benchmark/blob/main/src/telemetry.py): `src/telemetry.py`

### Persistence

- [Scout history](https://github.com/pseboek/llm_benchmark/blob/main/src/database.py): `src/database.py`

### Reporting

- [Reports and comparison](https://github.com/pseboek/llm_benchmark/blob/main/src/report.py): `src/report.py`
- [Historical dashboard](https://github.com/pseboek/llm_benchmark/blob/main/dashboard.py): `dashboard.py`

### Other components

- **Scout operator**
- **Ollama service**
- **Hugging Face**
- **Artificial Analysis**
- **SWE-bench**

## Connections

- Scout operator → CLI workflow: invokes (evidence: `README.md`)
- CLI workflow → Source orchestration: starts discovery (evidence: `src/main.py`)
- Source orchestration → Ollama inventory: loads candidates (evidence: `src/pipeline.py`)
- Source orchestration → Hugging Face adapter: loads candidates (evidence: `src/pipeline.py`)
- Source orchestration → Artificial Analysis adapter: loads candidates (evidence: `src/pipeline.py`)
- Source orchestration → SWE-bench adapter: loads candidates (evidence: `src/pipeline.py`)
- Source orchestration → Candidate normalization: deduplicates (evidence: `src/pipeline.py`)
- Ollama inventory → Ollama service: queries tags (evidence: `src/sources/ollama.py`)
- Hugging Face adapter → HTTP utilities: requests JSON (evidence: `src/sources/huggingface.py`)
- Artificial Analysis adapter → HTTP utilities: requests JSON (evidence: `src/sources/artificial_analysis.py`)
- SWE-bench adapter → HTTP utilities: configures endpoint (evidence: `src/sources/swebench.py`)
- Hugging Face adapter → Hugging Face: fetches models (evidence: `src/sources/huggingface.py`)
- Artificial Analysis adapter → Artificial Analysis: fetches models (evidence: `src/sources/artificial_analysis.py`)
- SWE-bench adapter → SWE-bench: fetches leaderboard (evidence: `src/sources/swebench.py`)
- CLI workflow → Ranking and champion deltas: scores candidates (evidence: `src/main.py`)
- Ranking and champion deltas → Candidate normalization: normalizes names (evidence: `src/scoring.py`)
- CLI workflow → Adaptive evaluation: runs adaptive mode (evidence: `src/main.py`)
- CLI workflow → Candidate review queue: creates review queue (evidence: `src/main.py`)
- CLI workflow → Approved download plan: manages download approval (evidence: `src/main.py`)
- CLI workflow → Benchmark task planning: creates task plan (evidence: `src/main.py`)
- CLI workflow → Benchmark execution: runs approved plan (evidence: `src/main.py`)
- Benchmark execution → Ollama measurements: executes measurements (evidence: `README.md`)
- Ollama measurements → Ollama service: sends generation requests (evidence: `README.md`)
- Ollama measurements → Response quality grading: grades responses (evidence: `ollama_benchmark.py`)
- Ollama measurements → Hardware telemetry: captures hardware metrics (evidence: `ollama_benchmark.py`)
- CLI workflow → Scout history: persists candidates and runs (evidence: `src/main.py`)
- Ollama measurements → Scout history: stores benchmark results (evidence: `README.md`)
- CLI workflow → Reports and comparison: generates report (evidence: `src/main.py`)
- Reports and comparison → Ranking and champion deltas: ranks and compares (evidence: `src/report.py`)
- CLI workflow → Historical dashboard: opens dashboard (evidence: `README.md`)
- Scout history → Historical dashboard: serves history (evidence: `README.md`)
- Scout history → Reports and comparison: supplies history (evidence: `README.md`)
