# ryota-kawamura/generative-ai-with-llms architecture

> Architecture diagram of the GitHub repository ryota-kawamura/generative-ai-with-llms, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ryota-kawamura/generative-ai-with-llms
- Repository: https://github.com/ryota-kawamura/generative-ai-with-llms

## Overview

##### Project Type and Purpose
- This is an educational content repository, organized as a sequence of weekly labs and quizzes delivered as Jupyter Notebooks and Markdown.
- Purpose: teach generative AI concepts and workflows by walking students through hands-on labs (dialogue summarization, fine-tuning, RLHF).

##### File Structure
- Top‐level files:
- .gitignore – standard VCS ignore rules
- README.md – course overview and links
- Week-directories (Week-1, Week-2, Week-3):
- Lab notebooks (*.ipynb)
- Quiz materials (*.md)
- images folder (illustrations used in notebooks)
- Week-2 includes a data folder with CSV training results
- No backend code, no microservices: it’s a content repo for teaching.

##### Extract Insights from the README
- Weekly learning objectives map to lab content in notebooks
- Labs call out external LLM frameworks/APIs (e.g., Hugging Face transformers, OpenAI API) though not shown in the file tree
- Focus areas: data gathering, fine-tuning, RLHF pipelines

##### Main Components
a. Content Repository
– GitHub repo hosting notebooks, data, images, README
b. Student/Developer Environment
– Local machine or cloud notebook runtime (e.g., Jupyter, Colab)
– Python environment with dependencies (transformers, torch, RL libraries)
c. Data Assets
– dialogue-summary-training-results.csv for Week-2
– any additional datasets students fetch during labs
d. External Services
– LLM model providers (Hugging Face Hub, OpenAI API)
– Storage: optionally GitHub for version control, cloud storage if labs push/pull large artifacts
e. Outputs / Artifacts
– Fine-tuned model checkpoints (Week-2, Week-3)
– Evaluation metrics, summary reports

##### Relationships & Interactions
- Student Environment → pulls notebooks & data from Content Repository
- Notebook code → loads local data assets; invokes LLM APIs or local transformer models
- Notebook code → writes outputs (model checkpoints, CSV logs) back to local filesystem (and optionally to cloud storage)
- Content Repository ← students commit updated notebooks or results

##### Architectural Patterns & Design Principles
- Modular organization by week (module-per-domain)
- Single‐repository monolith for versioned educational content
- Reproducible data & compute pipelines encapsulated in notebooks
- Clear separation of:
- Content (Markdown, images)
- Code (notebooks)
- Data (CSV)
- Configuration (environment dependencies)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Content Repository
    subgraph "Content Repository"
        direction TB
        GitIgnore[".gitignore"]:::content
        Readme["README.md"]:::content
        subgraph "Week-1 Module (Dialogue Summarization)" 
            direction TB
            Week1Lab["Lab_1_summarize_dialogue.ipynb"]:::content
            Week1Quiz["Week-1_Quiz.md"]:::content
            Week1Images["images/"]:::content
        end
        subgraph "Week-2 Module (Fine-Tuning)"
            direction TB
            Week2Lab["Lab_2_fine_tune_generative_ai_model.ipynb"]:::content
            Week2Quiz["Week-2_Quiz.md"]:::content
            Week2Data["data/"]:::data
            CSV["dialogue-summary-training-results.csv"]:::data
            Week2Images["images/"]:::content
        end
        subgraph "Week-3 Module (RLHF / Detoxify)"
            direction TB
            Week3Lab["Lab_3_fine_tune_model_to_detoxify_summaries.ipynb"]:::content
            Week3Quiz["Week-3_Quiz.md"]:::content
            Week3Images["images/"]:::content
        end
    end

    %% Student Environment
    StudentEnv["Student/Developer Environment\n(Jupyter / Colab)"]:::compute

    %% Data Assets
    LocalData["Local Data Assets"]:::data

    %% External Services
    ExternalAPIs["External LLM APIs\n(Hugging Face, OpenAI)"]:::external

    %% Artifacts
    Artifacts["Model Checkpoints & Reports"]:::artifact

    %% Relationships
    GitIgnore -->|version control| Readme
    Readme -->|describes| Week1Lab
    Readme --> Week2Lab
    Readme --> Week3Lab

    GitIgnore -->|git clone / pull| StudentEnv
    Readme -->|git clone / pull| StudentEnv

    StudentEnv -->|execute notebooks| Week1Lab
    StudentEnv -->|execute notebooks| Week2Lab
    StudentEnv -->|execute notebooks| Week3Lab

    Week2Lab -->|reads/writes| LocalData
    LocalData -->|contains| CSV

    StudentEnv -->|calls APIs| ExternalAPIs
    StudentEnv -->|generates| Artifacts

    Artifacts -->|optional push| GitIgnore
    Artifacts -->|optional push| Readme

    %% Click Events
    click GitIgnore "https://github.com/ryota-kawamura/generative-ai-with-llms/blob/main/.gitignore"
    click Readme "https://github.com/ryota-kawamura/generative-ai-with-llms/blob/main/README.md"
    click Week1Lab "https://github.com/ryota-kawamura/generative-ai-with-llms/blob/main/Week-1/Lab_1_summarize_dialogue.ipynb"
    click Week1Quiz "https://github.com/ryota-kawamura/generative-ai-with-llms/blob/main/Week-1/Week-1_Quiz.md"
    click Week1Images "https://github.com/ryota-kawamura/generative-ai-with-llms/tree/main/Week-1/images/"
    click Week2Lab "https://github.com/ryota-kawamura/generative-ai-with-llms/blob/main/Week-2/Lab_2_fine_tune_generative_ai_model.ipynb"
    click Week2Quiz "https://github.com/ryota-kawamura/generative-ai-with-llms/blob/main/Week-2/Week-2_Quiz.md"
    click Week2Data "https://github.com/ryota-kawamura/generative-ai-with-llms/tree/main/Week-2/data/"
    click CSV "https://github.com/ryota-kawamura/generative-ai-with-llms/blob/main/Week-2/data/dialogue-summary-training-results.csv"
    click Week2Images "https://github.com/ryota-kawamura/generative-ai-with-llms/tree/main/Week-2/images/"
    click Week3Lab "https://github.com/ryota-kawamura/generative-ai-with-llms/blob/main/Week-3/Lab_3_fine_tune_model_to_detoxify_summaries.ipynb"
    click Week3Quiz "https://github.com/ryota-kawamura/generative-ai-with-llms/blob/main/Week-3/Week-3_Quiz.md"
    click Week3Images "https://github.com/ryota-kawamura/generative-ai-with-llms/tree/main/Week-3/images/"

    %% Styles
    classDef content fill:#D0E8FF,stroke:#037FD2,color:#037FD2;
    classDef data fill:#E0F2D8,stroke:#4A7C15,color:#4A7C15;
    classDef compute fill:#FFE4B5,stroke:#E08B00,color:#E08B00;
    classDef external fill:#E8D0FF,stroke:#7F3FBF,color:#7F3FBF;
    classDef artifact fill:#F5F5F5,stroke:#666666,color:#333333;
```
