# shuoli90/traq architecture

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

- Interactive diagram: https://gitdiagram.com/shuoli90/traq
- Repository: https://github.com/shuoli90/traq

## Overview

TRAQ is a research system for evaluating trustworthy retrieval-augmented chatbots. Its workflow collects retrieval and model-response evidence, calibrates confidence/coverage thresholds, and evaluates TRAQ variants against baselines; analysis scripts inspect collected outputs. The README also identifies dataset and fine-tuned-model assets, and the tree includes confidence-predictor and Llama-2 fine-tuning components. Several subsystem links are documented rather than visible in the sampled excerpts; unsampled behavior is not assumed.

Main entry points: [`collected_data`](https://github.com/shuoli90/traq/tree/main/collected_data) (Collected evidence), [`run/traq/traq_opensource.py`](https://github.com/shuoli90/traq/blob/main/run/traq/traq_opensource.py) (Open-model TRAQ), [`run/collect/collect_opensource.py`](https://github.com/shuoli90/traq/blob/main/run/collect/collect_opensource.py) (Open-model collection), [`run/traq/traq_chatgpt.py`](https://github.com/shuoli90/traq/blob/main/run/traq/traq_chatgpt.py) (ChatGPT TRAQ)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_collection["Evidence collection"]
  node_datasets[("Source datasets")]
  node_chatgpt_collect["ChatGPT collection<br/>[collect_chatgpt.py]"]
  node_bio_collect["Bio collection"]
  node_open_collect["Open-model collection"]
  node_collected[("Collected evidence")]
end

subgraph group_evaluation["TRAQ evaluation"]
  node_traq_chat["ChatGPT TRAQ<br/>[traq_chatgpt.py]"]
  node_traq_semantic["Semantic TRAQ"]
  node_traq_open["Open-model TRAQ<br/>[traq_opensource.py]"]
end

subgraph group_shared["Shared runtime"]
  node_task_data["Task datasets<br/>[tasks.py]"]
  node_prompt_scoring["Prompt and scoring<br/>[utils.py]"]
  node_open_runtime["Open-model runtime<br/>[opensource.py]"]
  node_pac_bounds["PAC bounds<br/>[pac_utils.py]"]
end

subgraph group_training["Model training"]
  node_confidence["Confidence predictor"]
  node_llama_train["Llama-2 fine-tuning<br/>[fine-tune.py]"]
  node_model_assets[("Fine-tuned models")]
end

subgraph group_analysis["Results analysis"]
  node_analysis["Result analysis<br/>[analysis.py]"]
  node_uncertain_analysis["Uncertainty analysis"]
end

node_user(("Researcher"))

node_user -->|"collects evidence"| node_chatgpt_collect
node_user -->|"collects evidence"| node_bio_collect
node_user -->|"collects evidence"| node_open_collect
node_user -->|"runs evaluation"| node_traq_chat
node_user -->|"runs evaluation"| node_traq_semantic
node_user -->|"runs evaluation"| node_traq_open
node_user -->|"analyzes results"| node_analysis
node_datasets -.->|"supplies data"| node_chatgpt_collect
node_datasets -.->|"supplies data"| node_bio_collect
node_datasets -.->|"supplies data"| node_open_collect
node_chatgpt_collect -->|"loads tasks"| node_task_data
node_chatgpt_collect -->|"uses utilities"| node_prompt_scoring
node_bio_collect -->|"loads tasks"| node_task_data
node_bio_collect -->|"uses utilities"| node_prompt_scoring
node_open_collect -->|"loads tasks"| node_task_data
node_open_collect -->|"uses utilities"| node_prompt_scoring
node_open_collect -->|"generates answers"| node_open_runtime
node_chatgpt_collect -->|"writes evidence"| node_collected
node_bio_collect -->|"writes evidence"| node_collected
node_open_collect -->|"writes evidence"| node_collected
node_traq_chat -->|"loads tasks"| node_task_data
node_traq_chat -->|"uses utilities"| node_prompt_scoring
node_traq_chat -->|"computes bounds"| node_pac_bounds
node_traq_chat -.->|"reads evidence"| node_collected
node_traq_semantic -->|"loads tasks"| node_task_data
node_traq_semantic -->|"uses utilities"| node_prompt_scoring
node_traq_semantic -->|"computes bounds"| node_pac_bounds
node_traq_semantic -.->|"reads evidence"| node_collected
node_traq_open -->|"uses utilities"| node_prompt_scoring
node_traq_open -->|"computes bounds"| node_pac_bounds
node_traq_open -->|"reads evidence"| node_collected
node_traq_open -->|"reuses coverage"| node_traq_chat
node_traq_open -.->|"uses generation"| node_open_runtime
node_confidence -.->|"trains on evidence"| node_collected
node_llama_train -.->|"saves weights"| node_model_assets
node_model_assets -.->|"provides model"| node_traq_open
node_analysis -.->|"analyzes outputs"| node_collected
node_uncertain_analysis -->|"reads uncertainty data"| node_collected

click node_datasets "https://github.com/shuoli90/traq/tree/main/data"
click node_chatgpt_collect "https://github.com/shuoli90/traq/blob/main/run/collect/collect_chatgpt.py"
click node_bio_collect "https://github.com/shuoli90/traq/blob/main/run/collect/collect_chatgpt_bio.py"
click node_open_collect "https://github.com/shuoli90/traq/blob/main/run/collect/collect_opensource.py"
click node_collected "https://github.com/shuoli90/traq/tree/main/collected_data"
click node_traq_chat "https://github.com/shuoli90/traq/blob/main/run/traq/traq_chatgpt.py"
click node_traq_semantic "https://github.com/shuoli90/traq/blob/main/run/traq/traq_chatgpt_semantic.py"
click node_traq_open "https://github.com/shuoli90/traq/blob/main/run/traq/traq_opensource.py"
click node_task_data "https://github.com/shuoli90/traq/blob/main/misc/tasks.py"
click node_prompt_scoring "https://github.com/shuoli90/traq/blob/main/misc/utils.py"
click node_open_runtime "https://github.com/shuoli90/traq/blob/main/misc/opensource.py"
click node_pac_bounds "https://github.com/shuoli90/traq/blob/main/misc/pac_utils.py"
click node_confidence "https://github.com/shuoli90/traq/blob/main/run/conf_pred_ft/confidence_predictor.py"
click node_llama_train "https://github.com/shuoli90/traq/blob/main/run/llama2_ft/fine-tune.py"
click node_model_assets "https://github.com/shuoli90/traq/tree/main/finetuned_models"
click node_analysis "https://github.com/shuoli90/traq/blob/main/submission/analysis.py"
click node_uncertain_analysis "https://github.com/shuoli90/traq/blob/main/submission/analysis_uncertain.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_datasets,node_chatgpt_collect,node_bio_collect,node_open_collect,node_collected toneBlue
class node_traq_chat,node_traq_semantic,node_traq_open toneAmber
class node_task_data,node_prompt_scoring,node_open_runtime,node_pac_bounds toneMint
class node_confidence,node_llama_train,node_model_assets toneRose
class node_analysis,node_uncertain_analysis,node_user toneIndigo
```

## Components

### Evidence collection

- [Source datasets](https://github.com/shuoli90/traq/tree/main/data): `data`
- [ChatGPT collection](https://github.com/shuoli90/traq/blob/main/run/collect/collect_chatgpt.py): `run/collect/collect_chatgpt.py`
- [Bio collection](https://github.com/shuoli90/traq/blob/main/run/collect/collect_chatgpt_bio.py): `run/collect/collect_chatgpt_bio.py`
- [Open-model collection](https://github.com/shuoli90/traq/blob/main/run/collect/collect_opensource.py): `run/collect/collect_opensource.py`
- [Collected evidence](https://github.com/shuoli90/traq/tree/main/collected_data): `collected_data`

### TRAQ evaluation

- [ChatGPT TRAQ](https://github.com/shuoli90/traq/blob/main/run/traq/traq_chatgpt.py): `run/traq/traq_chatgpt.py`
- [Semantic TRAQ](https://github.com/shuoli90/traq/blob/main/run/traq/traq_chatgpt_semantic.py): `run/traq/traq_chatgpt_semantic.py`
- [Open-model TRAQ](https://github.com/shuoli90/traq/blob/main/run/traq/traq_opensource.py): `run/traq/traq_opensource.py`

### Shared runtime

- [Task datasets](https://github.com/shuoli90/traq/blob/main/misc/tasks.py): `misc/tasks.py`
- [Prompt and scoring](https://github.com/shuoli90/traq/blob/main/misc/utils.py): `misc/utils.py`
- [Open-model runtime](https://github.com/shuoli90/traq/blob/main/misc/opensource.py): `misc/opensource.py`
- [PAC bounds](https://github.com/shuoli90/traq/blob/main/misc/pac_utils.py): `misc/pac_utils.py`

### Model training

- [Confidence predictor](https://github.com/shuoli90/traq/blob/main/run/conf_pred_ft/confidence_predictor.py): `run/conf_pred_ft/confidence_predictor.py`
- [Llama-2 fine-tuning](https://github.com/shuoli90/traq/blob/main/run/llama2_ft/fine-tune.py): `run/llama2_ft/fine-tune.py`
- [Fine-tuned models](https://github.com/shuoli90/traq/tree/main/finetuned_models): `finetuned_models`

### Results analysis

- [Result analysis](https://github.com/shuoli90/traq/blob/main/submission/analysis.py): `submission/analysis.py`
- [Uncertainty analysis](https://github.com/shuoli90/traq/blob/main/submission/analysis_uncertain.py): `submission/analysis_uncertain.py`

### Other components

- **Researcher**

## Connections

- Researcher → ChatGPT collection: collects evidence (evidence: `README.md`)
- Researcher → Bio collection: collects evidence (evidence: `README.md`)
- Researcher → Open-model collection: collects evidence (evidence: `README.md`)
- Researcher → ChatGPT TRAQ: runs evaluation (evidence: `README.md`)
- Researcher → Semantic TRAQ: runs evaluation (evidence: `README.md`)
- Researcher → Open-model TRAQ: runs evaluation (evidence: `README.md`)
- Researcher → Result analysis: analyzes results (evidence: `README.md`)
- Source datasets → ChatGPT collection: supplies data (evidence: `README.md`)
- Source datasets → Bio collection: supplies data (evidence: `README.md`)
- Source datasets → Open-model collection: supplies data (evidence: `README.md`)
- ChatGPT collection → Task datasets: loads tasks (evidence: `run/collect/collect_chatgpt.py`)
- ChatGPT collection → Prompt and scoring: uses utilities (evidence: `run/collect/collect_chatgpt.py`)
- Bio collection → Task datasets: loads tasks (evidence: `run/collect/collect_chatgpt_bio.py`)
- Bio collection → Prompt and scoring: uses utilities (evidence: `run/collect/collect_chatgpt_bio.py`)
- Open-model collection → Task datasets: loads tasks (evidence: `run/collect/collect_opensource.py`)
- Open-model collection → Prompt and scoring: uses utilities (evidence: `run/collect/collect_opensource.py`)
- Open-model collection → Open-model runtime: generates answers (evidence: `run/collect/collect_opensource.py`)
- ChatGPT collection → Collected evidence: writes evidence (evidence: `run/collect/collect_chatgpt.py`)
- Bio collection → Collected evidence: writes evidence (evidence: `run/collect/collect_chatgpt_bio.py`)
- Open-model collection → Collected evidence: writes evidence (evidence: `run/collect/collect_opensource.py`)
- ChatGPT TRAQ → Task datasets: loads tasks (evidence: `run/traq/traq_chatgpt.py`)
- ChatGPT TRAQ → Prompt and scoring: uses utilities (evidence: `run/traq/traq_chatgpt.py`)
- ChatGPT TRAQ → PAC bounds: computes bounds (evidence: `run/traq/traq_chatgpt.py`)
- ChatGPT TRAQ → Collected evidence: reads evidence
- Semantic TRAQ → Task datasets: loads tasks (evidence: `run/traq/traq_chatgpt_semantic.py`)
- Semantic TRAQ → Prompt and scoring: uses utilities (evidence: `run/traq/traq_chatgpt_semantic.py`)
- Semantic TRAQ → PAC bounds: computes bounds (evidence: `run/traq/traq_chatgpt_semantic.py`)
- Semantic TRAQ → Collected evidence: reads evidence
- Open-model TRAQ → Prompt and scoring: uses utilities (evidence: `run/traq/traq_opensource.py`)
- Open-model TRAQ → PAC bounds: computes bounds (evidence: `run/traq/traq_opensource.py`)
- Open-model TRAQ → Collected evidence: reads evidence (evidence: `run/traq/traq_opensource.py`)
- Open-model TRAQ → ChatGPT TRAQ: reuses coverage (evidence: `run/traq/traq_opensource.py`)
- Open-model TRAQ → Open-model runtime: uses generation
- Confidence predictor → Collected evidence: trains on evidence
- Llama-2 fine-tuning → Fine-tuned models: saves weights
- Fine-tuned models → Open-model TRAQ: provides model
- Result analysis → Collected evidence: analyzes outputs
- Uncertainty analysis → Collected evidence: reads uncertainty data (evidence: `submission/analysis_uncertain.py`)
