# chaithanyasai18/llms-finetuning architecture

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

- Interactive diagram: https://gitdiagram.com/chaithanyasai18/llms-finetuning
- Repository: https://github.com/chaithanyasai18/llms-finetuning

## Overview

This repository supports a domain-specific LLM fine-tuning workflow: prepare or generate cybersecurity and IT-support training data, then adapt models using cloud LoRA or local QLoRA; it also includes an SFT configuration. The graph preserves the generator’s topic-tree and sample-generation stages, and QLoRA’s CLI, model selection, training, and utility layers. Some branches are documented rather than fully sampled, so their links are cited to the README; unsampled implementation details are not inferred.

Main entry points: [`Finetuning/qlora-finetuning/src/qlora_finetuning/core/trainer.py`](https://github.com/chaithanyasai18/llms-finetuning/blob/main/Finetuning/qlora-finetuning/src/qlora_finetuning/core/trainer.py) (QLoRA trainer), [`Synthetic-Data-Generator/pluto/data_engine.py`](https://github.com/chaithanyasai18/llms-finetuning/blob/main/Synthetic-Data-Generator/pluto/data_engine.py) (Sample generation), [`Synthetic-Data-Generator/pluto/topic_tree.py`](https://github.com/chaithanyasai18/llms-finetuning/blob/main/Synthetic-Data-Generator/pluto/topic_tree.py) (Topic tree), [`Finetuning/qlora-finetuning/src/qlora_finetuning/train.py`](https://github.com/chaithanyasai18/llms-finetuning/blob/main/Finetuning/qlora-finetuning/src/qlora_finetuning/train.py) (Training CLI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data generation"]
  node_generator_ui["Generator interface<br/>[app.py]"]
  node_topic_tree["Topic tree<br/>[topic_tree.py]"]
  node_prompts["Prompt templates<br/>[prompts.py]"]
  node_data_engine["Sample generation<br/>[data_engine.py]"]
  node_dataset["Dataset handling<br/>[dataset.py]"]
  node_generated_output["Generated JSONL"]
end

subgraph group_lora["LoRA training"]
  node_lora_prep["Model data preparation"]
  node_lora_pipeline["LoRA pipeline"]
  node_sft_config["SFT configuration<br/>[SFT_config.yaml]"]
end

subgraph group_qlora["QLoRA training"]
  node_qlora_cli["Training CLI<br/>[train.py]"]
  node_qlora_config["Training configuration<br/>[config.py]"]
  node_model_registry["Model registry<br/>[registry.py]"]
  node_trainer["QLoRA trainer<br/>[trainer.py]"]
  node_auth["Service authentication<br/>[auth.py]"]
  node_system["System checks<br/>[system.py]"]
  node_logging["Training logging<br/>[logging.py]"]
  node_model_output["Trained model output"]
end

subgraph group_datasets["Training data"]
  node_dataset_source["Prepared datasets<br/>[dataset.xlsx]"]
end

node_user(("Researcher"))
node_llm_api{{"LLM provider"}}
node_telemetry{{"PostHog telemetry"}}
node_predibase{{"Predibase platform"}}
node_hf{{"Hugging Face Hub"}}
node_wandb{{"Weights &amp; Biases"}}

node_user -->|"uses"| node_generator_ui
node_generator_ui -->|"builds topics"| node_topic_tree
node_generator_ui -->|"generates samples"| node_data_engine
node_topic_tree -->|"formats requests"| node_prompts
node_topic_tree -->|"requests subtopics"| node_llm_api
node_topic_tree -->|"records events"| node_telemetry
node_data_engine -->|"uses paths"| node_topic_tree
node_data_engine -->|"uses template"| node_prompts
node_data_engine -->|"requests samples"| node_llm_api
node_data_engine -->|"adds samples"| node_dataset
node_data_engine -->|"records events"| node_telemetry
node_dataset -->|"saves JSONL"| node_generated_output
node_user -->|"prepares data"| node_lora_prep
node_lora_prep -.->|"supplies data"| node_lora_pipeline
node_user -->|"runs training"| node_lora_pipeline
node_lora_pipeline -->|"trains on"| node_predibase
node_user -->|"configures SFT"| node_sft_config
node_user -->|"starts training"| node_qlora_cli
node_qlora_cli -->|"loads config"| node_qlora_config
node_qlora_cli -->|"selects model"| node_model_registry
node_qlora_cli -->|"orchestrates training"| node_trainer
node_trainer -->|"gets model config"| node_model_registry
node_trainer -->|"uses settings"| node_qlora_config
node_trainer -->|"checks hardware"| node_system
node_trainer -.->|"sets up access"| node_auth
node_trainer -.->|"logs progress"| node_logging
node_trainer -.->|"loads training data"| node_dataset_source
node_trainer -.->|"loads model"| node_hf
node_trainer -.->|"tracks experiment"| node_wandb
node_trainer -->|"saves model"| node_model_output

click node_generator_ui "https://github.com/chaithanyasai18/llms-finetuning/blob/main/Synthetic-Data-Generator/app.py"
click node_topic_tree "https://github.com/chaithanyasai18/llms-finetuning/blob/main/Synthetic-Data-Generator/pluto/topic_tree.py"
click node_prompts "https://github.com/chaithanyasai18/llms-finetuning/blob/main/Synthetic-Data-Generator/pluto/prompts.py"
click node_data_engine "https://github.com/chaithanyasai18/llms-finetuning/blob/main/Synthetic-Data-Generator/pluto/data_engine.py"
click node_dataset "https://github.com/chaithanyasai18/llms-finetuning/blob/main/Synthetic-Data-Generator/pluto/dataset.py"
click node_generated_output "https://github.com/chaithanyasai18/llms-finetuning/tree/main/Synthetic-Data-Generator/data"
click node_dataset_source "https://github.com/chaithanyasai18/llms-finetuning/blob/main/Dataset/dataset.xlsx"
click node_lora_prep "https://github.com/chaithanyasai18/llms-finetuning/tree/main/Finetuning/lora-finetuning/Dataprep_scripts"
click node_lora_pipeline "https://github.com/chaithanyasai18/llms-finetuning/blob/main/Finetuning/lora-finetuning/src/lora_finetuning_pipeline.py"
click node_sft_config "https://github.com/chaithanyasai18/llms-finetuning/blob/main/Finetuning/sft-finetuning/SFT_config.yaml"
click node_qlora_cli "https://github.com/chaithanyasai18/llms-finetuning/blob/main/Finetuning/qlora-finetuning/src/qlora_finetuning/train.py"
click node_qlora_config "https://github.com/chaithanyasai18/llms-finetuning/blob/main/Finetuning/qlora-finetuning/src/qlora_finetuning/core/config.py"
click node_model_registry "https://github.com/chaithanyasai18/llms-finetuning/blob/main/Finetuning/qlora-finetuning/src/qlora_finetuning/models/registry.py"
click node_trainer "https://github.com/chaithanyasai18/llms-finetuning/blob/main/Finetuning/qlora-finetuning/src/qlora_finetuning/core/trainer.py"
click node_auth "https://github.com/chaithanyasai18/llms-finetuning/blob/main/Finetuning/qlora-finetuning/src/qlora_finetuning/utils/auth.py"
click node_system "https://github.com/chaithanyasai18/llms-finetuning/blob/main/Finetuning/qlora-finetuning/src/qlora_finetuning/utils/system.py"
click node_logging "https://github.com/chaithanyasai18/llms-finetuning/blob/main/Finetuning/qlora-finetuning/src/qlora_finetuning/utils/logging.py"
click node_model_output "https://github.com/chaithanyasai18/llms-finetuning/tree/main/Finetuning/qlora-finetuning"

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_generator_ui,node_topic_tree,node_prompts,node_data_engine,node_dataset,node_generated_output toneBlue
class node_lora_prep,node_lora_pipeline,node_sft_config toneAmber
class node_qlora_cli,node_qlora_config,node_model_registry,node_trainer,node_auth,node_system,node_logging,node_model_output toneMint
class node_dataset_source toneRose
class node_user,node_llm_api,node_telemetry,node_predibase,node_hf,node_wandb toneIndigo
```

## Components

### Data generation

- [Generator interface](https://github.com/chaithanyasai18/llms-finetuning/blob/main/Synthetic-Data-Generator/app.py): `Synthetic-Data-Generator/app.py`
- [Topic tree](https://github.com/chaithanyasai18/llms-finetuning/blob/main/Synthetic-Data-Generator/pluto/topic_tree.py): `Synthetic-Data-Generator/pluto/topic_tree.py`
- [Prompt templates](https://github.com/chaithanyasai18/llms-finetuning/blob/main/Synthetic-Data-Generator/pluto/prompts.py): `Synthetic-Data-Generator/pluto/prompts.py`
- [Sample generation](https://github.com/chaithanyasai18/llms-finetuning/blob/main/Synthetic-Data-Generator/pluto/data_engine.py): `Synthetic-Data-Generator/pluto/data_engine.py`
- [Dataset handling](https://github.com/chaithanyasai18/llms-finetuning/blob/main/Synthetic-Data-Generator/pluto/dataset.py): `Synthetic-Data-Generator/pluto/dataset.py`
- [Generated JSONL](https://github.com/chaithanyasai18/llms-finetuning/tree/main/Synthetic-Data-Generator/data): `Synthetic-Data-Generator/data`

### LoRA training

- [Model data preparation](https://github.com/chaithanyasai18/llms-finetuning/tree/main/Finetuning/lora-finetuning/Dataprep_scripts): `Finetuning/lora-finetuning/Dataprep_scripts`
- [LoRA pipeline](https://github.com/chaithanyasai18/llms-finetuning/blob/main/Finetuning/lora-finetuning/src/lora_finetuning_pipeline.py): `Finetuning/lora-finetuning/src/lora_finetuning_pipeline.py`
- [SFT configuration](https://github.com/chaithanyasai18/llms-finetuning/blob/main/Finetuning/sft-finetuning/SFT_config.yaml): `Finetuning/sft-finetuning/SFT_config.yaml`

### QLoRA training

- [Training CLI](https://github.com/chaithanyasai18/llms-finetuning/blob/main/Finetuning/qlora-finetuning/src/qlora_finetuning/train.py): `Finetuning/qlora-finetuning/src/qlora_finetuning/train.py`
- [Training configuration](https://github.com/chaithanyasai18/llms-finetuning/blob/main/Finetuning/qlora-finetuning/src/qlora_finetuning/core/config.py): `Finetuning/qlora-finetuning/src/qlora_finetuning/core/config.py`
- [Model registry](https://github.com/chaithanyasai18/llms-finetuning/blob/main/Finetuning/qlora-finetuning/src/qlora_finetuning/models/registry.py): `Finetuning/qlora-finetuning/src/qlora_finetuning/models/registry.py`
- [QLoRA trainer](https://github.com/chaithanyasai18/llms-finetuning/blob/main/Finetuning/qlora-finetuning/src/qlora_finetuning/core/trainer.py): `Finetuning/qlora-finetuning/src/qlora_finetuning/core/trainer.py`
- [Service authentication](https://github.com/chaithanyasai18/llms-finetuning/blob/main/Finetuning/qlora-finetuning/src/qlora_finetuning/utils/auth.py): `Finetuning/qlora-finetuning/src/qlora_finetuning/utils/auth.py`
- [System checks](https://github.com/chaithanyasai18/llms-finetuning/blob/main/Finetuning/qlora-finetuning/src/qlora_finetuning/utils/system.py): `Finetuning/qlora-finetuning/src/qlora_finetuning/utils/system.py`
- [Training logging](https://github.com/chaithanyasai18/llms-finetuning/blob/main/Finetuning/qlora-finetuning/src/qlora_finetuning/utils/logging.py): `Finetuning/qlora-finetuning/src/qlora_finetuning/utils/logging.py`
- [Trained model output](https://github.com/chaithanyasai18/llms-finetuning/tree/main/Finetuning/qlora-finetuning): `Finetuning/qlora-finetuning`

### Training data

- [Prepared datasets](https://github.com/chaithanyasai18/llms-finetuning/blob/main/Dataset/dataset.xlsx): `Dataset/dataset.xlsx`

### Other components

- **Researcher**
- **LLM provider**
- **PostHog telemetry**
- **Predibase platform**
- **Hugging Face Hub**
- **Weights & Biases**

## Connections

- Researcher → Generator interface: uses (evidence: `README.md`)
- Generator interface → Topic tree: builds topics (evidence: `README.md`)
- Generator interface → Sample generation: generates samples (evidence: `README.md`)
- Topic tree → Prompt templates: formats requests (evidence: `Synthetic-Data-Generator/pluto/topic_tree.py`)
- Topic tree → LLM provider: requests subtopics (evidence: `Synthetic-Data-Generator/pluto/topic_tree.py`)
- Topic tree → PostHog telemetry: records events (evidence: `Synthetic-Data-Generator/pluto/topic_tree.py`)
- Sample generation → Topic tree: uses paths (evidence: `Synthetic-Data-Generator/pluto/data_engine.py`)
- Sample generation → Prompt templates: uses template (evidence: `Synthetic-Data-Generator/pluto/data_engine.py`)
- Sample generation → LLM provider: requests samples (evidence: `Synthetic-Data-Generator/pluto/data_engine.py`)
- Sample generation → Dataset handling: adds samples (evidence: `Synthetic-Data-Generator/pluto/data_engine.py`)
- Sample generation → PostHog telemetry: records events (evidence: `Synthetic-Data-Generator/pluto/data_engine.py`)
- Dataset handling → Generated JSONL: saves JSONL (evidence: `Synthetic-Data-Generator/pluto/dataset.py`)
- Researcher → Model data preparation: prepares data (evidence: `README.md`)
- Model data preparation → LoRA pipeline: supplies data (evidence: `README.md`)
- Researcher → LoRA pipeline: runs training (evidence: `README.md`)
- LoRA pipeline → Predibase platform: trains on (evidence: `README.md`)
- Researcher → SFT configuration: configures SFT (evidence: `README.md`)
- Researcher → Training CLI: starts training (evidence: `Finetuning/qlora-finetuning/src/qlora_finetuning/train.py`)
- Training CLI → Training configuration: loads config (evidence: `Finetuning/qlora-finetuning/src/qlora_finetuning/train.py`)
- Training CLI → Model registry: selects model (evidence: `Finetuning/qlora-finetuning/src/qlora_finetuning/train.py`)
- Training CLI → QLoRA trainer: orchestrates training (evidence: `Finetuning/qlora-finetuning/src/qlora_finetuning/train.py`)
- QLoRA trainer → Model registry: gets model config (evidence: `Finetuning/qlora-finetuning/src/qlora_finetuning/core/trainer.py`)
- QLoRA trainer → Training configuration: uses settings (evidence: `Finetuning/qlora-finetuning/src/qlora_finetuning/core/trainer.py`)
- QLoRA trainer → System checks: checks hardware (evidence: `Finetuning/qlora-finetuning/src/qlora_finetuning/core/trainer.py`)
- QLoRA trainer → Service authentication: sets up access
- QLoRA trainer → Training logging: logs progress
- QLoRA trainer → Prepared datasets: loads training data
- QLoRA trainer → Hugging Face Hub: loads model
- QLoRA trainer → Weights & Biases: tracks experiment
- QLoRA trainer → Trained model output: saves model (evidence: `Finetuning/qlora-finetuning/src/qlora_finetuning/core/trainer.py`)
