# quantumdeepak/llm-fine-tuning-and-multi-agent architecture

> Architecture diagram of the GitHub repository quantumdeepak/llm-fine-tuning-and-multi-agent, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/quantumdeepak/llm-fine-tuning-and-multi-agent
- Repository: https://github.com/quantumdeepak/llm-fine-tuning-and-multi-agent

## Overview

##### Project Type and Purpose
- The project focuses on fine-tuning large language models (LLMs) and orchestrating multi-agent pipelines. It also includes modules to handle PDF extraction, knowledge graph construction, handling of research papers, and comparison/summarization.
- The “Download LLM” and “LLM” directories contain scripts for setup, model retrieval, fine-tuning, and environment configuration.
- Additional directories (like “Ollama_pdf_handle”, “Papers”, “Summarise_compare”, and “Testing_vllm”) indicate components performing tasks such as PDF metadata extraction, knowledge graph building, research paper analysis, and validation/evaluation.

##### File Structure for Key Components
- LLM/Fine-tuning Module:
- Found in directories “Download LLM” and “LLM”, with files like Install_llm.py, fine_tune.py, hf_model.py, setup_model.py, and main.py.
- Likely responsible for setting up language model environments, downloading or preparing pretrained models, and fine-tuning operations.

- Multi-Agent Pipeline:
- The naming (“multi_agent_1.py” in Ollama_pdf_handle and related agent systems logs) implies there is an orchestration aspect where multiple agents work together (possibly to process documents, build graphs, or interact with the LLM).

- PDF Extraction and Knowledge Graphs:
- In “Ollama_pdf_handle” you see scripts for extracting metadata, processing PDFs (pdf_to_text.py), building a knowledge graph (building_knowlage_graph.py, chat_knowlage_graph.py), and visualization (knowledge_graph.html).
- The presence of multiple JSON databases and cache files further indicates data processing for research paper metadata.

- Research Papers and Summarisation/Comparison:
- The “Papers” and “Summarise_compare” directories include scripts focused on processing research papers and performing comparison or summary analysis. They might use the LLM(s) for generating insights on these papers.

- Testing and Evaluation of LLM (vLLM):
- The “Testing_vllm” directory presents scripts for evaluation, model comparison, logging inference and fine-tuning progress, as well as handling performance metrics.

- Supporting Components:
- There are configuration files (e.g., config.py, config.json) and shell scripts (setup_env.sh) which handle environment variables, dependency management, and possibly deployment settings.

– Data flow from raw inputs (PDFs, research papers) to processing modules.
– Interaction between the LLM module and the agents.
– Feedback loops from the Testing/Evaluation module back to fine-tuning or data processing.
– Core processing modules (LLM tuning, PDF extraction).
– Orchestration or multi-agent components.
– Supporting or configuration components.
- Shared resources (data caches, configuration files) as a common repository that all modules may refer to.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% LLM Fine-Tuning Module
    subgraph "LLM Fine-Tuning Module"
        A["Download LLM"]:::core
        B["LLM"]:::core
        A -->|"supports"| B
    end

    %% Multi-Agent Orchestrator
    subgraph "Multi-Agent Orchestrator"
        C["Multi-Agent Orchestrator"]:::orchestrator
    end

    %% PDF Extraction & Knowledge Graph Module
    subgraph "PDF Extraction & Knowledge Graph Module"
        D["PDF & KG Extraction"]:::extraction
    end

    %% Research Papers & Summarisation Module
    subgraph "Research Papers & Summarisation Module"
        E["Papers Processing"]:::research
        F["Summarisation/Comparison"]:::research
        E -->|"supplies_data"| F
    end

    %% Testing & Evaluation Module
    subgraph "Testing & Evaluation Module"
        G["Testing/Evaluation"]:::testing
    end

    %% Supporting Setup & Configuration
    subgraph "Supporting Setup & Configuration"
        H["LLM Setup/Config"]:::setup
        I["PDF Module Config"]:::setup
    end

    %% Interconnections between Modules
    B -->|"provides_model"| C
    C -->|"orchestrates_PDF"| D
    C -->|"orchestrates_papers"| E
    D -->|"KG_input"| F
    G -->|"performance_feedback"| B

    %% Connections to Supporting Setup & Configuration
    B -->|"uses_config"| H
    C -->|"uses_config"| H
    D -->|"uses_config"| I
    E -->|"uses_config"| I
    F -->|"uses_config"| I
    G -->|"uses_config"| H

    %% Click Events
    click A "https://github.com/quantumdeepak/llm-fine-tuning-and-multi-agent/tree/main/Download LLM"
    click B "https://github.com/quantumdeepak/llm-fine-tuning-and-multi-agent/tree/main/LLM"
    click C "https://github.com/quantumdeepak/llm-fine-tuning-and-multi-agent/blob/main/Ollama_pdf_handle/multi_agent_1.py"
    click D "https://github.com/quantumdeepak/llm-fine-tuning-and-multi-agent/blob/main/Ollama_pdf_handle/pdf_to_text.py"
    click E "https://github.com/quantumdeepak/llm-fine-tuning-and-multi-agent/tree/main/Papers"
    click F "https://github.com/quantumdeepak/llm-fine-tuning-and-multi-agent/tree/main/Summarise_compare"
    click G "https://github.com/quantumdeepak/llm-fine-tuning-and-multi-agent/tree/main/Testing_vllm"
    click H "https://github.com/quantumdeepak/llm-fine-tuning-and-multi-agent/blob/main/LLM/config.py"
    click I "https://github.com/quantumdeepak/llm-fine-tuning-and-multi-agent/blob/main/Ollama_pdf_handle/config.json"

    %% Styles
    classDef core fill:#ffcccc,stroke:#cc0000,stroke-width:2px;
    classDef orchestrator fill:#ccffcc,stroke:#009900,stroke-width:2px;
    classDef extraction fill:#ccccff,stroke:#0000cc,stroke-width:2px;
    classDef research fill:#ffcc99,stroke:#cc6600,stroke-width:2px;
    classDef testing fill:#99ccff,stroke:#0066cc,stroke-width:2px;
    classDef setup fill:#dddddd,stroke:#888888,stroke-width:2px;
```
