# saizwasser/nivilst-llm-release-v1 architecture

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

- Interactive diagram: https://gitdiagram.com/saizwasser/nivilst-llm-release-v1
- Repository: https://github.com/saizwasser/nivilst-llm-release-v1

## Overview

NivilST-LLM is a Windows-oriented workstation for training and using small language models, with optional emotion modulation and feedback-based tuning. Its main workflow prepares text, trains a base model and personality fine-tune, then supports chat, emotion training, feedback tuning, monitoring, and GGUF interchange. The README documents several UI-driven and optional integrations; unsampled implementation details are not inferred beyond those documented relationships.

Main entry points: [`nivilst_llm/ui.py`](https://github.com/saizwasser/nivilst-llm-release-v1/blob/main/nivilst_llm/ui.py) (Terminal UI), [`nivilst_llm/model.py`](https://github.com/saizwasser/nivilst-llm-release-v1/blob/main/nivilst_llm/model.py) (Transformer Model), [`nivilst_llm/train.py`](https://github.com/saizwasser/nivilst-llm-release-v1/blob/main/nivilst_llm/train.py) (Base Training), [`nivilst_llm/prepare_data.py`](https://github.com/saizwasser/nivilst-llm-release-v1/blob/main/nivilst_llm/prepare_data.py) (Data Preparation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workstation["Workstation"]
  node_ui["Terminal UI<br/>[ui.py]"]
  node_monitor["Live Monitor<br/>[monitor.py]"]
  node_data["Training Corpora"]
  node_feedbackdata["Chat Feedback<br/>[ui.py]"]
end

subgraph group_training["Model Training"]
  node_prep["Data Preparation<br/>[prepare_data.py]"]
  node_base["Base Training<br/>[train.py]"]
  node_personality["Personality Fine-Tune<br/>[train.py]"]
  node_feedback["Feedback Training<br/>[rlhf.py]"]
end

subgraph group_emotion["Emotion System"]
  node_neuro["Emotion Modulator<br/>[neuro.py]"]
  node_neurotrain["Emotion Training<br/>[train_neuro.py]"]
  node_emotiondata["Emotion Data Converter"]
end

subgraph group_interchange["Model Interchange"]
  node_archive["Model Archive<br/>[modelle.py]"]
  node_export["GGUF Export<br/>[export_gguf.py]"]
  node_import["GGUF Import<br/>[gguf_import.py]"]
end

subgraph group_runtime["Runtime Internals"]
  node_model["Transformer Model<br/>[model.py]"]
  node_generation["Text Generation<br/>[generate.py]"]
  node_device["Device Selection<br/>[device.py]"]
  node_optimizer["DML Optimizer<br/>[optim.py]"]
  node_hw["Hardware Tuning<br/>[hw_tune.py]"]
end

node_user(("Workstation User"))
node_lmstudio["LM Studio"]

node_user -->|"operates"| node_ui
node_user -->|"provides text"| node_data
node_ui -->|"starts preparation"| node_prep
node_prep -->|"reads corpora"| node_data
node_prep -->|"prepares tokens"| node_base
node_prep -->|"prepares tokens"| node_personality
node_ui -->|"starts training"| node_base
node_ui -->|"starts fine-tune"| node_personality
node_base -->|"trains"| node_model
node_personality -->|"fine-tunes"| node_model
node_ui -->|"chats with"| node_generation
node_generation -->|"runs inference"| node_model
node_ui -->|"records ratings"| node_feedbackdata
node_feedback -->|"reads feedback"| node_feedbackdata
node_ui -->|"starts tuning"| node_feedback
node_feedback -->|"updates weights"| node_model
node_ui -->|"starts emotion training"| node_neurotrain
node_neurotrain -->|"loads frozen base"| node_model
node_neurotrain -->|"trains module"| node_neuro
node_neuro -->|"modulates blocks"| node_model
node_emotiondata -->|"formats emotion data"| node_neuro
node_ui -->|"observes progress"| node_monitor
node_monitor -->|"loads checkpoints"| node_model
node_base -->|"selects hardware"| node_device
node_personality -->|"selects hardware"| node_device
node_base -->|"optimizes weights"| node_optimizer
node_personality -->|"optimizes weights"| node_optimizer
node_neurotrain -->|"uses profile"| node_hw
node_hw -->|"benchmarks device"| node_device
node_ui -->|"manages models"| node_archive
node_ui -->|"starts export"| node_export
node_export -->|"loads weights"| node_model
node_export -->|"exports GGUF"| node_lmstudio
node_ui -->|"starts import"| node_import
node_import -->|"builds checkpoint"| node_model
node_lmstudio -.->|"provides GGUF"| node_import

click node_ui "https://github.com/saizwasser/nivilst-llm-release-v1/blob/main/nivilst_llm/ui.py"
click node_monitor "https://github.com/saizwasser/nivilst-llm-release-v1/blob/main/nivilst_llm/monitor.py"
click node_data "https://github.com/saizwasser/nivilst-llm-release-v1/tree/main/nivilst_llm/data"
click node_prep "https://github.com/saizwasser/nivilst-llm-release-v1/blob/main/nivilst_llm/prepare_data.py"
click node_base "https://github.com/saizwasser/nivilst-llm-release-v1/blob/main/nivilst_llm/train.py"
click node_personality "https://github.com/saizwasser/nivilst-llm-release-v1/blob/main/nivilst_llm/train.py"
click node_model "https://github.com/saizwasser/nivilst-llm-release-v1/blob/main/nivilst_llm/model.py"
click node_generation "https://github.com/saizwasser/nivilst-llm-release-v1/blob/main/nivilst_llm/generate.py"
click node_device "https://github.com/saizwasser/nivilst-llm-release-v1/blob/main/nivilst_llm/device.py"
click node_optimizer "https://github.com/saizwasser/nivilst-llm-release-v1/blob/main/nivilst_llm/optim.py"
click node_neuro "https://github.com/saizwasser/nivilst-llm-release-v1/blob/main/nivilst_llm/neuro.py"
click node_neurotrain "https://github.com/saizwasser/nivilst-llm-release-v1/blob/main/nivilst_llm/train_neuro.py"
click node_emotiondata "https://github.com/saizwasser/nivilst-llm-release-v1/blob/main/nivilst_llm/convert_emotion_dataset.py"
click node_feedback "https://github.com/saizwasser/nivilst-llm-release-v1/blob/main/nivilst_llm/rlhf.py"
click node_feedbackdata "https://github.com/saizwasser/nivilst-llm-release-v1/blob/main/nivilst_llm/ui.py"
click node_hw "https://github.com/saizwasser/nivilst-llm-release-v1/blob/main/nivilst_llm/hw_tune.py"
click node_archive "https://github.com/saizwasser/nivilst-llm-release-v1/blob/main/nivilst_llm/modelle.py"
click node_export "https://github.com/saizwasser/nivilst-llm-release-v1/blob/main/nivilst_llm/export_gguf.py"
click node_import "https://github.com/saizwasser/nivilst-llm-release-v1/blob/main/nivilst_llm/gguf_import.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_ui,node_monitor,node_data,node_feedbackdata,node_user toneBlue
class node_prep,node_base,node_personality,node_feedback toneAmber
class node_neuro,node_neurotrain,node_emotiondata toneMint
class node_archive,node_export,node_import toneRose
class node_model,node_generation,node_device,node_optimizer,node_hw,node_lmstudio toneIndigo
```

## Components

### Workstation

- [Terminal UI](https://github.com/saizwasser/nivilst-llm-release-v1/blob/main/nivilst_llm/ui.py): `nivilst_llm/ui.py`
- [Live Monitor](https://github.com/saizwasser/nivilst-llm-release-v1/blob/main/nivilst_llm/monitor.py): `nivilst_llm/monitor.py`
- [Training Corpora](https://github.com/saizwasser/nivilst-llm-release-v1/tree/main/nivilst_llm/data): `nivilst_llm/data`
- [Chat Feedback](https://github.com/saizwasser/nivilst-llm-release-v1/blob/main/nivilst_llm/ui.py): `nivilst_llm/ui.py`

### Model Training

- [Data Preparation](https://github.com/saizwasser/nivilst-llm-release-v1/blob/main/nivilst_llm/prepare_data.py): `nivilst_llm/prepare_data.py`
- [Base Training](https://github.com/saizwasser/nivilst-llm-release-v1/blob/main/nivilst_llm/train.py): `nivilst_llm/train.py`
- [Personality Fine-Tune](https://github.com/saizwasser/nivilst-llm-release-v1/blob/main/nivilst_llm/train.py): `nivilst_llm/train.py`
- [Feedback Training](https://github.com/saizwasser/nivilst-llm-release-v1/blob/main/nivilst_llm/rlhf.py): `nivilst_llm/rlhf.py`

### Emotion System

- [Emotion Modulator](https://github.com/saizwasser/nivilst-llm-release-v1/blob/main/nivilst_llm/neuro.py): `nivilst_llm/neuro.py`
- [Emotion Training](https://github.com/saizwasser/nivilst-llm-release-v1/blob/main/nivilst_llm/train_neuro.py): `nivilst_llm/train_neuro.py`
- [Emotion Data Converter](https://github.com/saizwasser/nivilst-llm-release-v1/blob/main/nivilst_llm/convert_emotion_dataset.py): `nivilst_llm/convert_emotion_dataset.py`

### Model Interchange

- [Model Archive](https://github.com/saizwasser/nivilst-llm-release-v1/blob/main/nivilst_llm/modelle.py): `nivilst_llm/modelle.py`
- [GGUF Export](https://github.com/saizwasser/nivilst-llm-release-v1/blob/main/nivilst_llm/export_gguf.py): `nivilst_llm/export_gguf.py`
- [GGUF Import](https://github.com/saizwasser/nivilst-llm-release-v1/blob/main/nivilst_llm/gguf_import.py): `nivilst_llm/gguf_import.py`

### Runtime Internals

- [Transformer Model](https://github.com/saizwasser/nivilst-llm-release-v1/blob/main/nivilst_llm/model.py): `nivilst_llm/model.py`
- [Text Generation](https://github.com/saizwasser/nivilst-llm-release-v1/blob/main/nivilst_llm/generate.py): `nivilst_llm/generate.py`
- [Device Selection](https://github.com/saizwasser/nivilst-llm-release-v1/blob/main/nivilst_llm/device.py): `nivilst_llm/device.py`
- [DML Optimizer](https://github.com/saizwasser/nivilst-llm-release-v1/blob/main/nivilst_llm/optim.py): `nivilst_llm/optim.py`
- [Hardware Tuning](https://github.com/saizwasser/nivilst-llm-release-v1/blob/main/nivilst_llm/hw_tune.py): `nivilst_llm/hw_tune.py`

### Other components

- **Workstation User**
- **LM Studio**

## Connections

- Workstation User → Terminal UI: operates (evidence: `README.md`)
- Workstation User → Training Corpora: provides text (evidence: `README.md`)
- Terminal UI → Data Preparation: starts preparation (evidence: `README.md`)
- Data Preparation → Training Corpora: reads corpora (evidence: `nivilst_llm/prepare_data.py`)
- Data Preparation → Base Training: prepares tokens (evidence: `README.md`)
- Data Preparation → Personality Fine-Tune: prepares tokens (evidence: `README.md`)
- Terminal UI → Base Training: starts training (evidence: `README.md`)
- Terminal UI → Personality Fine-Tune: starts fine-tune (evidence: `README.md`)
- Base Training → Transformer Model: trains (evidence: `nivilst_llm/train.py`)
- Personality Fine-Tune → Transformer Model: fine-tunes (evidence: `nivilst_llm/train.py`)
- Terminal UI → Text Generation: chats with (evidence: `README.md`)
- Text Generation → Transformer Model: runs inference (evidence: `nivilst_llm/generate.py`)
- Terminal UI → Chat Feedback: records ratings (evidence: `README.md`)
- Feedback Training → Chat Feedback: reads feedback (evidence: `nivilst_llm/rlhf.py`)
- Terminal UI → Feedback Training: starts tuning (evidence: `README.md`)
- Feedback Training → Transformer Model: updates weights (evidence: `nivilst_llm/rlhf.py`)
- Terminal UI → Emotion Training: starts emotion training (evidence: `README.md`)
- Emotion Training → Transformer Model: loads frozen base (evidence: `nivilst_llm/train_neuro.py`)
- Emotion Training → Emotion Modulator: trains module (evidence: `nivilst_llm/train_neuro.py`)
- Emotion Modulator → Transformer Model: modulates blocks (evidence: `nivilst_llm/neuro.py`)
- Emotion Data Converter → Emotion Modulator: formats emotion data (evidence: `nivilst_llm/convert_emotion_dataset.py`)
- Terminal UI → Live Monitor: observes progress (evidence: `README.md`)
- Live Monitor → Transformer Model: loads checkpoints (evidence: `nivilst_llm/monitor.py`)
- Base Training → Device Selection: selects hardware (evidence: `nivilst_llm/train.py`)
- Personality Fine-Tune → Device Selection: selects hardware (evidence: `nivilst_llm/train.py`)
- Base Training → DML Optimizer: optimizes weights (evidence: `nivilst_llm/train.py`)
- Personality Fine-Tune → DML Optimizer: optimizes weights (evidence: `nivilst_llm/train.py`)
- Emotion Training → Hardware Tuning: uses profile (evidence: `nivilst_llm/train_neuro.py`)
- Hardware Tuning → Device Selection: benchmarks device (evidence: `nivilst_llm/hw_tune.py`)
- Terminal UI → Model Archive: manages models (evidence: `README.md`)
- Terminal UI → GGUF Export: starts export (evidence: `README.md`)
- GGUF Export → Transformer Model: loads weights (evidence: `nivilst_llm/export_gguf.py`)
- GGUF Export → LM Studio: exports GGUF (evidence: `README.md`)
- Terminal UI → GGUF Import: starts import (evidence: `README.md`)
- GGUF Import → Transformer Model: builds checkpoint (evidence: `nivilst_llm/gguf_import.py`)
- LM Studio → GGUF Import: provides GGUF (evidence: `README.md`)
