# daoyuanli2816/can-i-finetune-this architecture

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

- Interactive diagram: https://gitdiagram.com/daoyuanli2816/can-i-finetune-this
- Repository: https://github.com/daoyuanli2816/can-i-finetune-this
- Video tour (about a minute): https://gitdiagram.com/daoyuanli2816/can-i-finetune-this/video

## Overview

canifinetune helps a user plan and execute single-GPU LLM fine-tuning: inspect a memory estimate and configuration suggestions, generate a runnable recipe, measure a bounded local training run, and compare results with the plan. The graph includes documented evidence and reporting capabilities. Some subsystem connections are documented in the README or SOURCE INDEX; unsampled implementation details are not expanded into speculative call chains.

Main entry points: [`src/canifinetune/estimator/memory.py`](https://github.com/daoyuanli2816/can-i-finetune-this/blob/main/src/canifinetune/estimator/memory.py) (Memory estimate), [`src/canifinetune/cli.py`](https://github.com/daoyuanli2816/can-i-finetune-this/blob/main/src/canifinetune/cli.py) (CLI commands), [`src/canifinetune/training/runtime.py`](https://github.com/daoyuanli2816/can-i-finetune-this/blob/main/src/canifinetune/training/runtime.py) (Training runtime), [`src/canifinetune/demo.py`](https://github.com/daoyuanli2816/can-i-finetune-this/blob/main/src/canifinetune/demo.py) (Local demo)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_cli["CLI commands<br/>[cli.py]"]
  node_demo["Local demo<br/>[demo.py]"]
  node_demo_ui["Demo interface<br/>[demo.js]"]
end

subgraph group_planning["Planning"]
  node_metadata["Model metadata<br/>[model_metadata.py]"]
  node_formulas["Memory formulas<br/>[formulas.py]"]
  node_estimator["Memory estimate<br/>[memory.py]"]
  node_calibration["Calibration<br/>[calibration.py]"]
  node_recommender["Config recommendations<br/>[recommender.py]"]
  node_recipes["Recipe generator<br/>[generator.py]"]
end

subgraph group_execution["Training and measurement"]
  node_runtime["Training runtime<br/>[runtime.py]"]
  node_data["Training data<br/>[data.py]"]
  node_smoke["Smoke training<br/>[smoke.py]"]
  node_bench["Training benchmark<br/>[runner.py]"]
end

subgraph group_evidence["Evidence and reporting"]
  node_evidence["Evidence records<br/>[evidence.py]"]
  node_reports["Markdown reports<br/>[markdown.py]"]
  node_html_reports["HTML reports<br/>[html.py]"]
end

subgraph group_shared["Shared foundations"]
  node_config["Training config<br/>[configuration.py]"]
  node_gpu["GPU probe<br/>[gpu.py]"]
  node_logging["Logging and JSON<br/>[logging.py]"]
end

node_user(("User"))
node_gpu_device(("NVIDIA GPU"))

node_user -->|"runs commands"| node_cli
node_user -->|"opens demo"| node_demo
node_cli -->|"estimates"| node_estimator
node_cli -->|"recommends"| node_recommender
node_cli -->|"generates recipes"| node_recipes
node_cli -->|"runs benchmarks"| node_bench
node_cli -->|"calibrates"| node_calibration
node_cli -->|"handles evidence"| node_evidence
node_cli -->|"runs smoke test"| node_smoke
node_demo -->|"serves interface"| node_demo_ui
node_demo -->|"estimates"| node_estimator
node_demo -->|"resolves model"| node_metadata
node_estimator -->|"resolves metadata"| node_metadata
node_estimator -->|"calculates budget"| node_formulas
node_estimator -->|"uses configuration"| node_config
node_estimator -->|"applies calibration"| node_calibration
node_recommender -->|"evaluates options"| node_estimator
node_recipes -->|"includes estimate"| node_estimator
node_recipes -->|"builds configuration"| node_config
node_runtime -->|"validates settings"| node_config
node_runtime -->|"loads training data"| node_data
node_runtime -->|"checks device"| node_gpu
node_gpu -->|"probes"| node_gpu_device
node_bench -.->|"measures training"| node_runtime
node_smoke -.->|"exercises runtime"| node_runtime
node_bench -.->|"compares plan"| node_estimator
node_calibration -->|"informs estimates"| node_estimator
node_reports -->|"renders evidence"| node_evidence
node_html_reports -->|"renders HTML"| node_reports
node_bench -.->|"reports results"| node_reports
node_estimator -.->|"logs activity"| node_logging

click node_cli "https://github.com/daoyuanli2816/can-i-finetune-this/blob/main/src/canifinetune/cli.py"
click node_demo "https://github.com/daoyuanli2816/can-i-finetune-this/blob/main/src/canifinetune/demo.py"
click node_demo_ui "https://github.com/daoyuanli2816/can-i-finetune-this/blob/main/src/canifinetune/web/demo.js"
click node_config "https://github.com/daoyuanli2816/can-i-finetune-this/blob/main/src/canifinetune/configuration.py"
click node_metadata "https://github.com/daoyuanli2816/can-i-finetune-this/blob/main/src/canifinetune/estimator/model_metadata.py"
click node_formulas "https://github.com/daoyuanli2816/can-i-finetune-this/blob/main/src/canifinetune/estimator/formulas.py"
click node_estimator "https://github.com/daoyuanli2816/can-i-finetune-this/blob/main/src/canifinetune/estimator/memory.py"
click node_calibration "https://github.com/daoyuanli2816/can-i-finetune-this/blob/main/src/canifinetune/estimator/calibration.py"
click node_recommender "https://github.com/daoyuanli2816/can-i-finetune-this/blob/main/src/canifinetune/estimator/recommender.py"
click node_recipes "https://github.com/daoyuanli2816/can-i-finetune-this/blob/main/src/canifinetune/recipes/generator.py"
click node_runtime "https://github.com/daoyuanli2816/can-i-finetune-this/blob/main/src/canifinetune/training/runtime.py"
click node_data "https://github.com/daoyuanli2816/can-i-finetune-this/blob/main/src/canifinetune/training/data.py"
click node_smoke "https://github.com/daoyuanli2816/can-i-finetune-this/blob/main/src/canifinetune/training/smoke.py"
click node_bench "https://github.com/daoyuanli2816/can-i-finetune-this/blob/main/src/canifinetune/bench/runner.py"
click node_gpu "https://github.com/daoyuanli2816/can-i-finetune-this/blob/main/src/canifinetune/utils/gpu.py"
click node_evidence "https://github.com/daoyuanli2816/can-i-finetune-this/blob/main/src/canifinetune/evidence.py"
click node_reports "https://github.com/daoyuanli2816/can-i-finetune-this/blob/main/src/canifinetune/reports/markdown.py"
click node_html_reports "https://github.com/daoyuanli2816/can-i-finetune-this/blob/main/src/canifinetune/reports/html.py"
click node_logging "https://github.com/daoyuanli2816/can-i-finetune-this/blob/main/src/canifinetune/utils/logging.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_demo,node_demo_ui,node_user toneBlue
class node_metadata,node_formulas,node_estimator,node_calibration,node_recommender,node_recipes toneAmber
class node_runtime,node_data,node_smoke,node_bench toneMint
class node_evidence,node_reports,node_html_reports toneRose
class node_config,node_gpu,node_logging,node_gpu_device toneIndigo
```

## Components

### User interface

- [CLI commands](https://github.com/daoyuanli2816/can-i-finetune-this/blob/main/src/canifinetune/cli.py): `src/canifinetune/cli.py`
- [Local demo](https://github.com/daoyuanli2816/can-i-finetune-this/blob/main/src/canifinetune/demo.py): `src/canifinetune/demo.py`
- [Demo interface](https://github.com/daoyuanli2816/can-i-finetune-this/blob/main/src/canifinetune/web/demo.js): `src/canifinetune/web/demo.js`

### Planning

- [Model metadata](https://github.com/daoyuanli2816/can-i-finetune-this/blob/main/src/canifinetune/estimator/model_metadata.py): `src/canifinetune/estimator/model_metadata.py`
- [Memory formulas](https://github.com/daoyuanli2816/can-i-finetune-this/blob/main/src/canifinetune/estimator/formulas.py): `src/canifinetune/estimator/formulas.py`
- [Memory estimate](https://github.com/daoyuanli2816/can-i-finetune-this/blob/main/src/canifinetune/estimator/memory.py): `src/canifinetune/estimator/memory.py`
- [Calibration](https://github.com/daoyuanli2816/can-i-finetune-this/blob/main/src/canifinetune/estimator/calibration.py): `src/canifinetune/estimator/calibration.py`
- [Config recommendations](https://github.com/daoyuanli2816/can-i-finetune-this/blob/main/src/canifinetune/estimator/recommender.py): `src/canifinetune/estimator/recommender.py`
- [Recipe generator](https://github.com/daoyuanli2816/can-i-finetune-this/blob/main/src/canifinetune/recipes/generator.py): `src/canifinetune/recipes/generator.py`

### Training and measurement

- [Training runtime](https://github.com/daoyuanli2816/can-i-finetune-this/blob/main/src/canifinetune/training/runtime.py): `src/canifinetune/training/runtime.py`
- [Training data](https://github.com/daoyuanli2816/can-i-finetune-this/blob/main/src/canifinetune/training/data.py): `src/canifinetune/training/data.py`
- [Smoke training](https://github.com/daoyuanli2816/can-i-finetune-this/blob/main/src/canifinetune/training/smoke.py): `src/canifinetune/training/smoke.py`
- [Training benchmark](https://github.com/daoyuanli2816/can-i-finetune-this/blob/main/src/canifinetune/bench/runner.py): `src/canifinetune/bench/runner.py`

### Evidence and reporting

- [Evidence records](https://github.com/daoyuanli2816/can-i-finetune-this/blob/main/src/canifinetune/evidence.py): `src/canifinetune/evidence.py`
- [Markdown reports](https://github.com/daoyuanli2816/can-i-finetune-this/blob/main/src/canifinetune/reports/markdown.py): `src/canifinetune/reports/markdown.py`
- [HTML reports](https://github.com/daoyuanli2816/can-i-finetune-this/blob/main/src/canifinetune/reports/html.py): `src/canifinetune/reports/html.py`

### Shared foundations

- [Training config](https://github.com/daoyuanli2816/can-i-finetune-this/blob/main/src/canifinetune/configuration.py): `src/canifinetune/configuration.py`
- [GPU probe](https://github.com/daoyuanli2816/can-i-finetune-this/blob/main/src/canifinetune/utils/gpu.py): `src/canifinetune/utils/gpu.py`
- [Logging and JSON](https://github.com/daoyuanli2816/can-i-finetune-this/blob/main/src/canifinetune/utils/logging.py): `src/canifinetune/utils/logging.py`

### Other components

- **User**
- **NVIDIA GPU**

## Connections

- User → CLI commands: runs commands (evidence: `README.md`)
- User → Local demo: opens demo (evidence: `README.md`)
- CLI commands → Memory estimate: estimates (evidence: `src/canifinetune/cli.py`)
- CLI commands → Config recommendations: recommends (evidence: `src/canifinetune/cli.py`)
- CLI commands → Recipe generator: generates recipes (evidence: `src/canifinetune/cli.py`)
- CLI commands → Training benchmark: runs benchmarks (evidence: `src/canifinetune/cli.py`)
- CLI commands → Calibration: calibrates (evidence: `src/canifinetune/cli.py`)
- CLI commands → Evidence records: handles evidence (evidence: `src/canifinetune/cli.py`)
- CLI commands → Smoke training: runs smoke test (evidence: `src/canifinetune/cli.py`)
- Local demo → Demo interface: serves interface (evidence: `README.md`)
- Local demo → Memory estimate: estimates (evidence: `src/canifinetune/demo.py`)
- Local demo → Model metadata: resolves model (evidence: `src/canifinetune/demo.py`)
- Memory estimate → Model metadata: resolves metadata (evidence: `src/canifinetune/estimator/memory.py`)
- Memory estimate → Memory formulas: calculates budget (evidence: `src/canifinetune/estimator/memory.py`)
- Memory estimate → Training config: uses configuration (evidence: `src/canifinetune/estimator/memory.py`)
- Memory estimate → Calibration: applies calibration (evidence: `src/canifinetune/estimator/memory.py`)
- Config recommendations → Memory estimate: evaluates options (evidence: `src/canifinetune/estimator/recommender.py`)
- Recipe generator → Memory estimate: includes estimate (evidence: `src/canifinetune/recipes/generator.py`)
- Recipe generator → Training config: builds configuration (evidence: `src/canifinetune/recipes/generator.py`)
- Training runtime → Training config: validates settings (evidence: `src/canifinetune/training/runtime.py`)
- Training runtime → Training data: loads training data (evidence: `src/canifinetune/training/runtime.py`)
- Training runtime → GPU probe: checks device (evidence: `src/canifinetune/training/runtime.py`)
- GPU probe → NVIDIA GPU: probes (evidence: `src/canifinetune/utils/gpu.py`)
- Training benchmark → Training runtime: measures training
- Smoke training → Training runtime: exercises runtime
- Training benchmark → Memory estimate: compares plan (evidence: `README.md`)
- Calibration → Memory estimate: informs estimates (evidence: `src/canifinetune/estimator/calibration.py`)
- Markdown reports → Evidence records: renders evidence (evidence: `src/canifinetune/reports/markdown.py`)
- HTML reports → Markdown reports: renders HTML (evidence: `src/canifinetune/reports/html.py`)
- Training benchmark → Markdown reports: reports results (evidence: `README.md`)
- Memory estimate → Logging and JSON: logs activity
