# crh225/plumb architecture

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

- Interactive diagram: https://gitdiagram.com/crh225/plumb
- Repository: https://github.com/crh225/plumb

## Overview

Plumb-4B is both a one-pass typed-decision model and the training/evaluation pipeline that produces its rounds. The user-facing path accepts evidence and typed questions through the Python runtime or HTTP service, then returns calibrated option probabilities. The broader pipeline generates and verifies teacher questions, combines them with human-labelled replay, screens/mines training data, trains and calibrates a model, and benchmarks it; unattended runs and a live dashboard support operation. Some training and dashboard implementations were not excerpted, so those relationships are included only where the README documents them.

Main entry points: [`training/build_train.py`](https://github.com/crh225/plumb/blob/main/training/build_train.py) (Training set assembly), [`training/lora.py`](https://github.com/crh225/plumb/blob/main/training/lora.py) (LoRA training), [`jevk5/runtime.py`](https://github.com/crh225/plumb/blob/main/jevk5/runtime.py) (Typed decision runtime), [`run-bench.sh`](https://github.com/crh225/plumb/blob/main/run-bench.sh) (Public benchmark runner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inference["Decision runtime"]
  node_api["HTTP decision API<br/>[server.py]"]
  node_runtime["Typed decision runtime<br/>[runtime.py]"]
  node_weights[("Published model weights")]
  node_ollama["Ollama integration"]
end

subgraph group_training_data["Training data"]
  node_teacher["Teacher generation and verification<br/>[teacher.py]"]
  node_replay["Human-labelled replay<br/>[build_replay.py]"]
  node_hard_replay["Hard replay datasets"]
  node_gate["Training set assembly<br/>[build_train.py]"]
  node_overlap["Benchmark overlap scan<br/>[scan_overlap.py]"]
  node_exact_audit["Exact-text audit<br/>[audit_exact.py]"]
  node_mining["Hard-question mining<br/>[mine_hard.py]"]
end

subgraph group_model_training["Model training"]
  node_batching["Training batching<br/>[batching.py]"]
  node_lora["LoRA training<br/>[lora.py]"]
  node_temperature["Temperature fitting<br/>[fit_temperature.py]"]
end

subgraph group_evaluation["Evaluation and operations"]
  node_benchmark["Public benchmark runner<br/>[run-bench.sh]"]
  node_scores[("Round results")]
  node_supervisor["Unattended round supervisor<br/>[supervise.sh]"]
  node_dashboard["Live dashboard"]
end

node_user(("Decision caller"))
node_teacher_llm(("Teacher LLM"))
node_datasets[("Public datasets")]
node_ollama_service["Ollama service"]

node_user -->|"calls"| node_runtime
node_user -->|"posts decisions"| node_api
node_api -->|"calls decide"| node_runtime
node_runtime -->|"loads weights"| node_weights
node_runtime -->|"returns probabilities"| node_user
node_teacher_llm -->|"answers questions"| node_teacher
node_datasets -->|"supplies labels"| node_replay
node_datasets -->|"supplies labels"| node_hard_replay
node_teacher -->|"provides agreed items"| node_gate
node_replay -->|"provides replay"| node_gate
node_hard_replay -->|"provides hard dev"| node_gate
node_gate -->|"screens training set"| node_overlap
node_gate -->|"audits text"| node_exact_audit
node_overlap -.->|"clears benchmark items"| node_mining
node_gate -->|"selects hard items"| node_mining
node_mining -->|"provides training set"| node_lora
node_gate -->|"provides training set"| node_lora
node_lora -->|"uses batches"| node_batching
node_lora -->|"uses model runtime"| node_runtime
node_lora -->|"provides trained model"| node_temperature
node_temperature -->|"writes runtime calibration"| node_runtime
node_temperature -->|"calibrates round"| node_benchmark
node_lora -->|"evaluates round"| node_benchmark
node_benchmark -->|"writes scores"| node_scores
node_supervisor -->|"keeps generating"| node_teacher
node_supervisor -->|"starts rounds"| node_benchmark
node_supervisor -->|"updates live view"| node_dashboard
node_user -->|"posts decision"| node_ollama_service
node_ollama_service -->|"dispatches endpoint"| node_ollama

click node_api "https://github.com/crh225/plumb/blob/main/jevk5/server.py"
click node_runtime "https://github.com/crh225/plumb/blob/main/jevk5/runtime.py"
click node_teacher "https://github.com/crh225/plumb/blob/main/training/teacher.py"
click node_replay "https://github.com/crh225/plumb/blob/main/training/build_replay.py"
click node_hard_replay "https://github.com/crh225/plumb/blob/main/training/build_hard_replay.py"
click node_gate "https://github.com/crh225/plumb/blob/main/training/build_train.py"
click node_overlap "https://github.com/crh225/plumb/blob/main/training/scan_overlap.py"
click node_exact_audit "https://github.com/crh225/plumb/blob/main/training/audit_exact.py"
click node_mining "https://github.com/crh225/plumb/blob/main/training/mine_hard.py"
click node_batching "https://github.com/crh225/plumb/blob/main/training/batching.py"
click node_lora "https://github.com/crh225/plumb/blob/main/training/lora.py"
click node_temperature "https://github.com/crh225/plumb/blob/main/training/fit_temperature.py"
click node_benchmark "https://github.com/crh225/plumb/blob/main/run-bench.sh"
click node_scores "https://github.com/crh225/plumb/tree/main/results"
click node_supervisor "https://github.com/crh225/plumb/blob/main/supervise.sh"
click node_dashboard "https://github.com/crh225/plumb/tree/main/dashboard"

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_api,node_runtime,node_weights,node_ollama toneBlue
class node_teacher,node_replay,node_hard_replay,node_gate,node_overlap,node_exact_audit,node_mining,node_datasets toneAmber
class node_batching,node_lora,node_temperature toneMint
class node_benchmark,node_scores,node_supervisor,node_dashboard toneRose
class node_user,node_teacher_llm,node_ollama_service toneIndigo
```

## Components

### Decision runtime

- [HTTP decision API](https://github.com/crh225/plumb/blob/main/jevk5/server.py): `jevk5/server.py`
- [Typed decision runtime](https://github.com/crh225/plumb/blob/main/jevk5/runtime.py): `jevk5/runtime.py`
- **Published model weights**
- **Ollama integration**

### Training data

- [Teacher generation and verification](https://github.com/crh225/plumb/blob/main/training/teacher.py): `training/teacher.py`
- [Human-labelled replay](https://github.com/crh225/plumb/blob/main/training/build_replay.py): `training/build_replay.py`
- [Hard replay datasets](https://github.com/crh225/plumb/blob/main/training/build_hard_replay.py): `training/build_hard_replay.py`
- [Training set assembly](https://github.com/crh225/plumb/blob/main/training/build_train.py): `training/build_train.py`
- [Benchmark overlap scan](https://github.com/crh225/plumb/blob/main/training/scan_overlap.py): `training/scan_overlap.py`
- [Exact-text audit](https://github.com/crh225/plumb/blob/main/training/audit_exact.py): `training/audit_exact.py`
- [Hard-question mining](https://github.com/crh225/plumb/blob/main/training/mine_hard.py): `training/mine_hard.py`

### Model training

- [Training batching](https://github.com/crh225/plumb/blob/main/training/batching.py): `training/batching.py`
- [LoRA training](https://github.com/crh225/plumb/blob/main/training/lora.py): `training/lora.py`
- [Temperature fitting](https://github.com/crh225/plumb/blob/main/training/fit_temperature.py): `training/fit_temperature.py`

### Evaluation and operations

- [Public benchmark runner](https://github.com/crh225/plumb/blob/main/run-bench.sh): `run-bench.sh`
- [Round results](https://github.com/crh225/plumb/tree/main/results): `results`
- [Unattended round supervisor](https://github.com/crh225/plumb/blob/main/supervise.sh): `supervise.sh`
- [Live dashboard](https://github.com/crh225/plumb/tree/main/dashboard): `dashboard`

### Other components

- **Decision caller**
- **Teacher LLM**
- **Public datasets**
- **Ollama service**

## Connections

- Decision caller → Typed decision runtime: calls (evidence: `README.md`)
- Decision caller → HTTP decision API: posts decisions (evidence: `README.md`)
- HTTP decision API → Typed decision runtime: calls decide (evidence: `jevk5/server.py`)
- Typed decision runtime → Published model weights: loads weights (evidence: `README.md`)
- Typed decision runtime → Decision caller: returns probabilities (evidence: `README.md`)
- Teacher LLM → Teacher generation and verification: answers questions (evidence: `README.md`)
- Public datasets → Human-labelled replay: supplies labels (evidence: `README.md`)
- Public datasets → Hard replay datasets: supplies labels (evidence: `README.md`)
- Teacher generation and verification → Training set assembly: provides agreed items (evidence: `README.md`)
- Human-labelled replay → Training set assembly: provides replay (evidence: `README.md`)
- Hard replay datasets → Training set assembly: provides hard dev (evidence: `README.md`)
- Training set assembly → Benchmark overlap scan: screens training set (evidence: `README.md`)
- Training set assembly → Exact-text audit: audits text (evidence: `README.md`)
- Benchmark overlap scan → Hard-question mining: clears benchmark items
- Training set assembly → Hard-question mining: selects hard items (evidence: `README.md`)
- Hard-question mining → LoRA training: provides training set (evidence: `README.md`)
- Training set assembly → LoRA training: provides training set (evidence: `README.md`)
- LoRA training → Training batching: uses batches (evidence: `training/lora.py`)
- LoRA training → Typed decision runtime: uses model runtime (evidence: `training/lora.py`)
- LoRA training → Temperature fitting: provides trained model (evidence: `README.md`)
- Temperature fitting → Typed decision runtime: writes runtime calibration (evidence: `training/fit_temperature.py`)
- Temperature fitting → Public benchmark runner: calibrates round (evidence: `README.md`)
- LoRA training → Public benchmark runner: evaluates round (evidence: `README.md`)
- Public benchmark runner → Round results: writes scores (evidence: `README.md`)
- Unattended round supervisor → Teacher generation and verification: keeps generating (evidence: `README.md`)
- Unattended round supervisor → Public benchmark runner: starts rounds (evidence: `README.md`)
- Unattended round supervisor → Live dashboard: updates live view (evidence: `README.md`)
- Decision caller → Ollama service: posts decision (evidence: `README.md`)
- Ollama service → Ollama integration: dispatches endpoint (evidence: `README.md`)
