# yuhanwang315/g2lora architecture

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

- Interactive diagram: https://gitdiagram.com/yuhanwang315/g2lora
- Repository: https://github.com/yuhanwang315/g2lora

## Overview

G2LoRA is a graph–language model for few-shot continual learning, documented for class-, domain-, and task-incremental experiments (CIL, DIL, TIL). The user launches an experiment through `main.py` with a dataset, model, and continual-learning settings; the runtime then prepares graph/text data and task splits before training and evaluation. Its model combines graph and text encoders with LoRA-based adaptation. The map includes documented capabilities, but internal links not shown in the excerpts or reference index are dashed and unverified.

Main entry points: [`G2LoRA/models/GLM/GTAlign.py`](https://github.com/yuhanwang315/g2lora/blob/main/G2LoRA/models/GLM/GTAlign.py) (GTAlign training), [`main.py`](https://github.com/yuhanwang315/g2lora/blob/main/main.py) (Experiment entry), [`G2LoRA/models_GTAlign/graphclip.py`](https://github.com/yuhanwang315/g2lora/blob/main/G2LoRA/models_GTAlign/graphclip.py) (GraphCLIP model), [`G2LoRA/experiment.py`](https://github.com/yuhanwang315/g2lora/blob/main/G2LoRA/experiment.py) (Run orchestration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_run["Experiment workflow"]
  node_entry["Experiment entry<br/>[main.py]"]
  node_settings["Experiment settings<br/>[args.py]"]
  node_experiment["Run orchestration<br/>[experiment.py]"]
  node_cil["Class incremental"]
  node_dil["Domain incremental"]
  node_til["Task incremental"]
end

subgraph group_data["Graph data"]
  node_dataset["Graph/text dataset<br/>[data_loader.py]"]
  node_task_split["Continual task splits<br/>[data_spliter.py]"]
  node_graph_parse["Graph preparation<br/>[process.py]"]
end

subgraph group_model["GTAlign model"]
  node_model_driver["GTAlign training<br/>[GTAlign.py]"]
  node_graphclip["GraphCLIP model<br/>[graphclip.py]"]
  node_graph_encoder["Graph encoders<br/>[gt.py]"]
  node_til_encoder["Task graph encoder<br/>[gt_til.py]"]
  node_text_encoder["Text backbone<br/>[BertLayer.py]"]
  node_attention["LoRA attention<br/>[attention_lora.py]"]
  node_adapter["LoRA adapters<br/>[adapter.py]"]
  node_gnn_backbones["GNN backbones<br/>[SGC.py]"]
  node_lm_backbones["Language backbones<br/>[BERT.py]"]
end

subgraph group_support["Training support"]
  node_base["Training lifecycle<br/>[base.py]"]
  node_metrics["Metrics<br/>[metric.py]"]
  node_prompts["Prompt definitions<br/>[prompts.py]"]
end

node_user(("Researcher"))

node_user -->|"launches"| node_entry
node_entry -.->|"configures"| node_settings
node_entry -.->|"dispatches"| node_experiment
node_experiment -.->|"loads data"| node_dataset
node_experiment -.->|"creates tasks"| node_task_split
node_dataset -.->|"prepares graphs"| node_graph_parse
node_task_split -.->|"supplies task batches"| node_model_driver
node_model_driver -->|"trains and evaluates"| node_graphclip
node_model_driver -.->|"extends lifecycle"| node_base
node_graphclip -->|"constructs"| node_graph_encoder
node_graphclip -->|"constructs for TIL"| node_til_encoder
node_graphclip -.->|"uses"| node_text_encoder
node_graph_encoder -->|"uses"| node_attention
node_graph_encoder -->|"uses"| node_adapter
node_til_encoder -->|"uses"| node_attention
node_til_encoder -->|"uses"| node_adapter
node_model_driver -.->|"selects backbone"| node_gnn_backbones
node_model_driver -.->|"selects backbone"| node_lm_backbones
node_model_driver -.->|"reports scores"| node_metrics
node_model_driver -.->|"uses prompts"| node_prompts
node_entry -->|"runs setting"| node_cil
node_entry -->|"runs setting"| node_dil
node_entry -->|"runs setting"| node_til

click node_entry "https://github.com/yuhanwang315/g2lora/blob/main/main.py"
click node_settings "https://github.com/yuhanwang315/g2lora/blob/main/G2LoRA/models/utils/args.py"
click node_experiment "https://github.com/yuhanwang315/g2lora/blob/main/G2LoRA/experiment.py"
click node_dataset "https://github.com/yuhanwang315/g2lora/blob/main/G2LoRA/data/data_loader.py"
click node_task_split "https://github.com/yuhanwang315/g2lora/blob/main/G2LoRA/data/data_spliter.py"
click node_graph_parse "https://github.com/yuhanwang315/g2lora/blob/main/G2LoRA/models/utils/process.py"
click node_model_driver "https://github.com/yuhanwang315/g2lora/blob/main/G2LoRA/models/GLM/GTAlign.py"
click node_base "https://github.com/yuhanwang315/g2lora/blob/main/G2LoRA/models/base.py"
click node_graphclip "https://github.com/yuhanwang315/g2lora/blob/main/G2LoRA/models_GTAlign/graphclip.py"
click node_graph_encoder "https://github.com/yuhanwang315/g2lora/blob/main/G2LoRA/models_GTAlign/gt.py"
click node_til_encoder "https://github.com/yuhanwang315/g2lora/blob/main/G2LoRA/models_GTAlign/gt_til.py"
click node_text_encoder "https://github.com/yuhanwang315/g2lora/blob/main/G2LoRA/models_GTAlign/BertLayer.py"
click node_attention "https://github.com/yuhanwang315/g2lora/blob/main/G2LoRA/models_GTAlign/attention_lora.py"
click node_adapter "https://github.com/yuhanwang315/g2lora/blob/main/G2LoRA/models_GTAlign/adapter.py"
click node_gnn_backbones "https://github.com/yuhanwang315/g2lora/blob/main/G2LoRA/backbones/GNN/SGC.py"
click node_lm_backbones "https://github.com/yuhanwang315/g2lora/blob/main/G2LoRA/backbones/LM/BERT.py"
click node_metrics "https://github.com/yuhanwang315/g2lora/blob/main/G2LoRA/common/metric.py"
click node_prompts "https://github.com/yuhanwang315/g2lora/blob/main/G2LoRA/common/prompts.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_entry,node_settings,node_experiment,node_cil,node_dil,node_til toneBlue
class node_dataset,node_task_split,node_graph_parse toneAmber
class node_model_driver,node_graphclip,node_graph_encoder,node_til_encoder,node_text_encoder,node_attention,node_adapter,node_gnn_backbones,node_lm_backbones toneMint
class node_base,node_metrics,node_prompts toneRose
class node_user toneIndigo
```

## Components

### Experiment workflow

- [Experiment entry](https://github.com/yuhanwang315/g2lora/blob/main/main.py): `main.py`
- [Experiment settings](https://github.com/yuhanwang315/g2lora/blob/main/G2LoRA/models/utils/args.py): `G2LoRA/models/utils/args.py`
- [Run orchestration](https://github.com/yuhanwang315/g2lora/blob/main/G2LoRA/experiment.py): `G2LoRA/experiment.py`
- **Class incremental**
- **Domain incremental**
- **Task incremental**

### Graph data

- [Graph/text dataset](https://github.com/yuhanwang315/g2lora/blob/main/G2LoRA/data/data_loader.py): `G2LoRA/data/data_loader.py`
- [Continual task splits](https://github.com/yuhanwang315/g2lora/blob/main/G2LoRA/data/data_spliter.py): `G2LoRA/data/data_spliter.py`
- [Graph preparation](https://github.com/yuhanwang315/g2lora/blob/main/G2LoRA/models/utils/process.py): `G2LoRA/models/utils/process.py`

### GTAlign model

- [GTAlign training](https://github.com/yuhanwang315/g2lora/blob/main/G2LoRA/models/GLM/GTAlign.py): `G2LoRA/models/GLM/GTAlign.py`
- [GraphCLIP model](https://github.com/yuhanwang315/g2lora/blob/main/G2LoRA/models_GTAlign/graphclip.py): `G2LoRA/models_GTAlign/graphclip.py`
- [Graph encoders](https://github.com/yuhanwang315/g2lora/blob/main/G2LoRA/models_GTAlign/gt.py): `G2LoRA/models_GTAlign/gt.py`
- [Task graph encoder](https://github.com/yuhanwang315/g2lora/blob/main/G2LoRA/models_GTAlign/gt_til.py): `G2LoRA/models_GTAlign/gt_til.py`
- [Text backbone](https://github.com/yuhanwang315/g2lora/blob/main/G2LoRA/models_GTAlign/BertLayer.py): `G2LoRA/models_GTAlign/BertLayer.py`
- [LoRA attention](https://github.com/yuhanwang315/g2lora/blob/main/G2LoRA/models_GTAlign/attention_lora.py): `G2LoRA/models_GTAlign/attention_lora.py`
- [LoRA adapters](https://github.com/yuhanwang315/g2lora/blob/main/G2LoRA/models_GTAlign/adapter.py): `G2LoRA/models_GTAlign/adapter.py`
- [GNN backbones](https://github.com/yuhanwang315/g2lora/blob/main/G2LoRA/backbones/GNN/SGC.py): `G2LoRA/backbones/GNN/SGC.py`
- [Language backbones](https://github.com/yuhanwang315/g2lora/blob/main/G2LoRA/backbones/LM/BERT.py): `G2LoRA/backbones/LM/BERT.py`

### Training support

- [Training lifecycle](https://github.com/yuhanwang315/g2lora/blob/main/G2LoRA/models/base.py): `G2LoRA/models/base.py`
- [Metrics](https://github.com/yuhanwang315/g2lora/blob/main/G2LoRA/common/metric.py): `G2LoRA/common/metric.py`
- [Prompt definitions](https://github.com/yuhanwang315/g2lora/blob/main/G2LoRA/common/prompts.py): `G2LoRA/common/prompts.py`

### Other components

- **Researcher**

## Connections

- Researcher → Experiment entry: launches (evidence: `README.md`)
- Experiment entry → Experiment settings: configures
- Experiment entry → Run orchestration: dispatches
- Run orchestration → Graph/text dataset: loads data
- Run orchestration → Continual task splits: creates tasks
- Graph/text dataset → Graph preparation: prepares graphs
- Continual task splits → GTAlign training: supplies task batches
- GTAlign training → GraphCLIP model: trains and evaluates (evidence: `G2LoRA/models/GLM/GTAlign.py`)
- GTAlign training → Training lifecycle: extends lifecycle
- GraphCLIP model → Graph encoders: constructs (evidence: `G2LoRA/models_GTAlign/graphclip.py`)
- GraphCLIP model → Task graph encoder: constructs for TIL (evidence: `G2LoRA/models_GTAlign/graphclip.py`)
- GraphCLIP model → Text backbone: uses (evidence: `G2LoRA/models_GTAlign/graphclip.py`)
- Graph encoders → LoRA attention: uses (evidence: `G2LoRA/models_GTAlign/gt.py`)
- Graph encoders → LoRA adapters: uses (evidence: `G2LoRA/models_GTAlign/gt.py`)
- Task graph encoder → LoRA attention: uses (evidence: `G2LoRA/models_GTAlign/gt_til.py`)
- Task graph encoder → LoRA adapters: uses (evidence: `G2LoRA/models_GTAlign/gt_til.py`)
- GTAlign training → GNN backbones: selects backbone
- GTAlign training → Language backbones: selects backbone
- GTAlign training → Metrics: reports scores
- GTAlign training → Prompt definitions: uses prompts
- Experiment entry → Class incremental: runs setting (evidence: `README.md`)
- Experiment entry → Domain incremental: runs setting (evidence: `README.md`)
- Experiment entry → Task incremental: runs setting (evidence: `README.md`)
