# baileyclark33/allen-hackathon architecture

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

- Interactive diagram: https://gitdiagram.com/baileyclark33/allen-hackathon
- Repository: https://github.com/baileyclark33/allen-hackathon

## Overview

Nemroute is a tiered Nemotron router and research pipeline: the demo accepts a question, routes it to a tier, obtains an answer, and reports cost and latency. Separate workflows generate and label datasets, tune routing thresholds, freeze evaluation splits, and compare routing strategies. The graph includes the documented optional reference-model capability. Some links rely on the README or SOURCE INDEX; unsampled implementation details are not inferred.

Main entry points: [`src/nemoroute/client.py`](https://github.com/baileyclark33/allen-hackathon/blob/main/src/nemoroute/client.py) (Model client), [`app/streamlit_app.py`](https://github.com/baileyclark33/allen-hackathon/blob/main/app/streamlit_app.py) (Streamlit demo), [`src/nemoroute/labeling/answer.py`](https://github.com/baileyclark33/allen-hackathon/blob/main/src/nemoroute/labeling/answer.py) (Tier answering), [`src/nemoroute/dataset/generate.py`](https://github.com/baileyclark33/allen-hackathon/blob/main/src/nemoroute/dataset/generate.py) (Query generation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_demo["Question routing"]
  node_app["Streamlit demo<br/>[streamlit_app.py]"]
  node_guard["Spend guard<br/>[app_guard.py]"]
  node_registry["Router registry<br/>[registry.py]"]
  node_router["Zero-shot router<br/>[zero_shot.py]"]
end

subgraph group_inference["Model inference"]
  node_answer["Tier answering<br/>[answer.py]"]
  node_client["Model client<br/>[client.py]"]
end

subgraph group_research["Dataset research"]
  node_generation["Query generation<br/>[generate.py]"]
  node_dedup["Query deduplication<br/>[dedup.py]"]
  node_labelpipeline["Labeling pipeline<br/>[pipeline.py]"]
  node_judge["Answer judge<br/>[judge.py]"]
  node_labels["Tier labels<br/>[label.py]"]
  node_tuning["Threshold tuning<br/>[tuning.py]"]
  node_split["Dataset splitting<br/>[split.py]"]
  node_evaluation["Evaluation runner<br/>[run.py]"]
  node_metrics["Evaluation metrics<br/>[system.py]"]
  node_reference["Reference comparison<br/>[reference.py]"]
end

subgraph group_operations["Cost and records"]
  node_config["Configuration<br/>[config.py]"]
  node_pricing["Pricing estimates<br/>[pricing.py]"]
  node_budget["Run budget<br/>[budget.py]"]
  node_usage[("Usage log<br/>[usage_log.py]")]
  node_jsonl["JSONL records<br/>[jsonl.py]"]
end

node_user(("Question asker"))
node_tokenfactory{{"Token Factory API"}}
node_anthropic{{"Anthropic API"}}

node_user -->|"asks"| node_app
node_app -->|"checks spend"| node_guard
node_app -->|"builds router"| node_registry
node_registry -->|"selects"| node_router
node_router -->|"classifies with"| node_client
node_app -->|"requests answer"| node_answer
node_answer -->|"calls model"| node_client
node_client -->|"sends inference"| node_tokenfactory
node_client -.->|"supports provider"| node_anthropic
node_generation -->|"deduplicates"| node_dedup
node_labelpipeline -->|"gets tier answers"| node_answer
node_labelpipeline -->|"grades answers"| node_judge
node_labelpipeline -.->|"computes labels"| node_labels
node_judge -->|"calls judge model"| node_client
node_tuning -->|"uses label rules"| node_labels
node_evaluation -->|"computes outcomes"| node_metrics
node_evaluation -->|"routes queries"| node_router
node_reference -->|"generates answers"| node_answer
node_reference -->|"grades answers"| node_judge
node_client -->|"calculates call cost"| node_pricing
node_client -->|"adds spend"| node_budget
node_client -->|"records calls"| node_usage
node_usage -->|"reads and appends"| node_jsonl
node_generation -->|"generates with model"| node_client
node_generation -->|"persists queries"| node_jsonl
node_evaluation -->|"loads and saves"| node_jsonl
node_config -->|"configures models"| node_client
node_config -->|"provides prices"| node_pricing

click node_app "https://github.com/baileyclark33/allen-hackathon/blob/main/app/streamlit_app.py"
click node_guard "https://github.com/baileyclark33/allen-hackathon/blob/main/src/nemoroute/app_guard.py"
click node_registry "https://github.com/baileyclark33/allen-hackathon/blob/main/src/nemoroute/routers/registry.py"
click node_router "https://github.com/baileyclark33/allen-hackathon/blob/main/src/nemoroute/routers/zero_shot.py"
click node_answer "https://github.com/baileyclark33/allen-hackathon/blob/main/src/nemoroute/labeling/answer.py"
click node_client "https://github.com/baileyclark33/allen-hackathon/blob/main/src/nemoroute/client.py"
click node_generation "https://github.com/baileyclark33/allen-hackathon/blob/main/src/nemoroute/dataset/generate.py"
click node_dedup "https://github.com/baileyclark33/allen-hackathon/blob/main/src/nemoroute/dataset/dedup.py"
click node_labelpipeline "https://github.com/baileyclark33/allen-hackathon/blob/main/src/nemoroute/labeling/pipeline.py"
click node_judge "https://github.com/baileyclark33/allen-hackathon/blob/main/src/nemoroute/labeling/judge.py"
click node_labels "https://github.com/baileyclark33/allen-hackathon/blob/main/src/nemoroute/labeling/label.py"
click node_tuning "https://github.com/baileyclark33/allen-hackathon/blob/main/src/nemoroute/labeling/tuning.py"
click node_split "https://github.com/baileyclark33/allen-hackathon/blob/main/src/nemoroute/split.py"
click node_evaluation "https://github.com/baileyclark33/allen-hackathon/blob/main/src/nemoroute/evaluation/run.py"
click node_metrics "https://github.com/baileyclark33/allen-hackathon/blob/main/src/nemoroute/evaluation/system.py"
click node_reference "https://github.com/baileyclark33/allen-hackathon/blob/main/src/nemoroute/reference.py"
click node_config "https://github.com/baileyclark33/allen-hackathon/blob/main/src/nemoroute/config.py"
click node_pricing "https://github.com/baileyclark33/allen-hackathon/blob/main/src/nemoroute/pricing.py"
click node_budget "https://github.com/baileyclark33/allen-hackathon/blob/main/src/nemoroute/budget.py"
click node_usage "https://github.com/baileyclark33/allen-hackathon/blob/main/src/nemoroute/usage_log.py"
click node_jsonl "https://github.com/baileyclark33/allen-hackathon/blob/main/src/nemoroute/jsonl.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_app,node_guard,node_registry,node_router toneBlue
class node_answer,node_client toneAmber
class node_generation,node_dedup,node_labelpipeline,node_judge,node_labels,node_tuning,node_split,node_evaluation,node_metrics,node_reference,node_tokenfactory,node_anthropic toneMint
class node_config,node_pricing,node_budget,node_usage,node_jsonl toneRose
class node_user toneIndigo
```

## Components

### Question routing

- [Streamlit demo](https://github.com/baileyclark33/allen-hackathon/blob/main/app/streamlit_app.py): `app/streamlit_app.py`
- [Spend guard](https://github.com/baileyclark33/allen-hackathon/blob/main/src/nemoroute/app_guard.py): `src/nemoroute/app_guard.py`
- [Router registry](https://github.com/baileyclark33/allen-hackathon/blob/main/src/nemoroute/routers/registry.py): `src/nemoroute/routers/registry.py`
- [Zero-shot router](https://github.com/baileyclark33/allen-hackathon/blob/main/src/nemoroute/routers/zero_shot.py): `src/nemoroute/routers/zero_shot.py`

### Model inference

- [Tier answering](https://github.com/baileyclark33/allen-hackathon/blob/main/src/nemoroute/labeling/answer.py): `src/nemoroute/labeling/answer.py`
- [Model client](https://github.com/baileyclark33/allen-hackathon/blob/main/src/nemoroute/client.py): `src/nemoroute/client.py`

### Dataset research

- [Query generation](https://github.com/baileyclark33/allen-hackathon/blob/main/src/nemoroute/dataset/generate.py): `src/nemoroute/dataset/generate.py`
- [Query deduplication](https://github.com/baileyclark33/allen-hackathon/blob/main/src/nemoroute/dataset/dedup.py): `src/nemoroute/dataset/dedup.py`
- [Labeling pipeline](https://github.com/baileyclark33/allen-hackathon/blob/main/src/nemoroute/labeling/pipeline.py): `src/nemoroute/labeling/pipeline.py`
- [Answer judge](https://github.com/baileyclark33/allen-hackathon/blob/main/src/nemoroute/labeling/judge.py): `src/nemoroute/labeling/judge.py`
- [Tier labels](https://github.com/baileyclark33/allen-hackathon/blob/main/src/nemoroute/labeling/label.py): `src/nemoroute/labeling/label.py`
- [Threshold tuning](https://github.com/baileyclark33/allen-hackathon/blob/main/src/nemoroute/labeling/tuning.py): `src/nemoroute/labeling/tuning.py`
- [Dataset splitting](https://github.com/baileyclark33/allen-hackathon/blob/main/src/nemoroute/split.py): `src/nemoroute/split.py`
- [Evaluation runner](https://github.com/baileyclark33/allen-hackathon/blob/main/src/nemoroute/evaluation/run.py): `src/nemoroute/evaluation/run.py`
- [Evaluation metrics](https://github.com/baileyclark33/allen-hackathon/blob/main/src/nemoroute/evaluation/system.py): `src/nemoroute/evaluation/system.py`
- [Reference comparison](https://github.com/baileyclark33/allen-hackathon/blob/main/src/nemoroute/reference.py): `src/nemoroute/reference.py`

### Cost and records

- [Configuration](https://github.com/baileyclark33/allen-hackathon/blob/main/src/nemoroute/config.py): `src/nemoroute/config.py`
- [Pricing estimates](https://github.com/baileyclark33/allen-hackathon/blob/main/src/nemoroute/pricing.py): `src/nemoroute/pricing.py`
- [Run budget](https://github.com/baileyclark33/allen-hackathon/blob/main/src/nemoroute/budget.py): `src/nemoroute/budget.py`
- [Usage log](https://github.com/baileyclark33/allen-hackathon/blob/main/src/nemoroute/usage_log.py): `src/nemoroute/usage_log.py`
- [JSONL records](https://github.com/baileyclark33/allen-hackathon/blob/main/src/nemoroute/jsonl.py): `src/nemoroute/jsonl.py`

### Other components

- **Question asker**
- **Token Factory API**
- **Anthropic API**

## Connections

- Question asker → Streamlit demo: asks (evidence: `README.md`)
- Streamlit demo → Spend guard: checks spend (evidence: `app/streamlit_app.py`)
- Streamlit demo → Router registry: builds router (evidence: `app/streamlit_app.py`)
- Router registry → Zero-shot router: selects (evidence: `src/nemoroute/routers/registry.py`)
- Zero-shot router → Model client: classifies with (evidence: `src/nemoroute/routers/registry.py`)
- Streamlit demo → Tier answering: requests answer (evidence: `README.md`)
- Tier answering → Model client: calls model (evidence: `src/nemoroute/labeling/answer.py`)
- Model client → Token Factory API: sends inference (evidence: `README.md`)
- Model client → Anthropic API: supports provider (evidence: `src/nemoroute/client.py`)
- Query generation → Query deduplication: deduplicates (evidence: `src/nemoroute/dataset/generate.py`)
- Labeling pipeline → Tier answering: gets tier answers (evidence: `src/nemoroute/labeling/pipeline.py`)
- Labeling pipeline → Answer judge: grades answers (evidence: `src/nemoroute/labeling/pipeline.py`)
- Labeling pipeline → Tier labels: computes labels
- Answer judge → Model client: calls judge model (evidence: `src/nemoroute/labeling/judge.py`)
- Threshold tuning → Tier labels: uses label rules (evidence: `src/nemoroute/labeling/tuning.py`)
- Evaluation runner → Evaluation metrics: computes outcomes (evidence: `src/nemoroute/evaluation/run.py`)
- Evaluation runner → Zero-shot router: routes queries (evidence: `src/nemoroute/evaluation/run.py`)
- Reference comparison → Tier answering: generates answers (evidence: `src/nemoroute/reference.py`)
- Reference comparison → Answer judge: grades answers (evidence: `src/nemoroute/reference.py`)
- Model client → Pricing estimates: calculates call cost (evidence: `src/nemoroute/client.py`)
- Model client → Run budget: adds spend (evidence: `src/nemoroute/client.py`)
- Model client → Usage log: records calls (evidence: `src/nemoroute/client.py`)
- Usage log → JSONL records: reads and appends (evidence: `src/nemoroute/usage_log.py`)
- Query generation → Model client: generates with model (evidence: `src/nemoroute/dataset/generate.py`)
- Query generation → JSONL records: persists queries (evidence: `src/nemoroute/dataset/generate.py`)
- Evaluation runner → JSONL records: loads and saves (evidence: `src/nemoroute/evaluation/run.py`)
- Configuration → Model client: configures models (evidence: `src/nemoroute/client.py`)
- Configuration → Pricing estimates: provides prices (evidence: `src/nemoroute/pricing.py`)
