# lilingxiao-bupt/qd-llm architecture

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

- Interactive diagram: https://gitdiagram.com/lilingxiao-bupt/qd-llm
- Repository: https://github.com/lilingxiao-bupt/qd-llm

## Overview

QD-LLM is a text-classification research system for emotion, hiding detection, and thematic analysis. Its documented workflow uses LLM knowledge to distill a compact quantum model, trains and evaluates that model, and also reports real-quantum-hardware deployment. The excerpts show dataset parsing, model construction, training, evaluation, and a standalone circuit-to-QASM script; they do not establish how the training pipeline connects to the hardware artifacts. Hardware integration is therefore left unlinked.

Main entry points: [`QD_LLM_main_Infer.py`](https://github.com/lilingxiao-bupt/qd-llm/blob/main/QD_LLM_main_Infer.py) (Training driver), [`real_device_baihua/real device.py`](https://github.com/lilingxiao-bupt/qd-llm/blob/main/real_device_baihua/real%20device.py) (Circuit generation), [`QNLP_network.py`](https://github.com/lilingxiao-bupt/qd-llm/blob/main/QNLP_network.py) (Quantum circuits), [`QD_LLM_dataLoader.py`](https://github.com/lilingxiao-bupt/qd-llm/blob/main/QD_LLM_dataLoader.py) (Dataset parsing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_task_data["Task datasets"]
  node_loader["Dataset parsing"]
end

subgraph group_model["Distilled model"]
  node_teacher["LLM teacher<br/>[QNLP_network.py]"]
  node_embedding["Text embedding<br/>[QNLP_network.py]"]
  node_quantum_network["Quantum circuits<br/>[QNLP_network.py]"]
  node_classifier["RNN classifier<br/>[QNLP_network.py]"]
end

subgraph group_training["Training and evaluation"]
  node_driver["Training driver"]
  node_evaluation["Metrics and evaluation"]
  node_checkpoints["Model checkpoints"]
end

subgraph group_hardware["Quantum deployment"]
  node_device_script["Circuit generation<br/>[real device.py]"]
  node_qasm["Circuit QASM"]
  node_qasm_copy["Circuit QASM copy"]
end

node_user(("Research user"))
node_quafu(("Quantum hardware"))

node_user -.->|"runs training"| node_driver
node_loader -->|"reads examples"| node_task_data
node_driver -->|"constructs"| node_teacher
node_driver -->|"constructs"| node_embedding
node_driver -->|"constructs"| node_classifier
node_driver -->|"evaluates"| node_evaluation
node_driver -->|"saves and loads"| node_checkpoints
node_driver -->|"uses module"| node_quantum_network
node_device_script -->|"writes circuit"| node_qasm
node_device_script -.->|"deploys circuit"| node_quafu
node_quantum_network -.->|"hardware execution"| node_quafu

click node_task_data "https://github.com/lilingxiao-bupt/qd-llm/tree/main/Dataset"
click node_loader "https://github.com/lilingxiao-bupt/qd-llm/blob/main/QD_LLM_dataLoader.py"
click node_driver "https://github.com/lilingxiao-bupt/qd-llm/blob/main/QD_LLM_main_Infer.py"
click node_teacher "https://github.com/lilingxiao-bupt/qd-llm/blob/main/QNLP_network.py"
click node_embedding "https://github.com/lilingxiao-bupt/qd-llm/blob/main/QNLP_network.py"
click node_quantum_network "https://github.com/lilingxiao-bupt/qd-llm/blob/main/QNLP_network.py"
click node_classifier "https://github.com/lilingxiao-bupt/qd-llm/blob/main/QNLP_network.py"
click node_evaluation "https://github.com/lilingxiao-bupt/qd-llm/blob/main/QD_LLM_main_Infer.py"
click node_checkpoints "https://github.com/lilingxiao-bupt/qd-llm/blob/main/QD_LLM_main_Infer.py"
click node_device_script "https://github.com/lilingxiao-bupt/qd-llm/blob/main/real_device_baihua/real%20device.py"
click node_qasm "https://github.com/lilingxiao-bupt/qd-llm/blob/main/real_device_baihua/qembedding1_used_in_model_2class.qasm"
click node_qasm_copy "https://github.com/lilingxiao-bupt/qd-llm/blob/main/real_device_baihua/qembedding1_used_in_model_2class%20(2).qasm"

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_task_data,node_loader,node_user toneBlue
class node_teacher,node_embedding,node_quantum_network,node_classifier toneAmber
class node_driver,node_evaluation,node_checkpoints toneMint
class node_device_script,node_qasm,node_qasm_copy toneRose
class node_quafu toneIndigo
```

## Components

### Data preparation

- [Task datasets](https://github.com/lilingxiao-bupt/qd-llm/tree/main/Dataset): `Dataset`
- [Dataset parsing](https://github.com/lilingxiao-bupt/qd-llm/blob/main/QD_LLM_dataLoader.py): `QD_LLM_dataLoader.py`

### Distilled model

- [LLM teacher](https://github.com/lilingxiao-bupt/qd-llm/blob/main/QNLP_network.py): `QNLP_network.py`
- [Text embedding](https://github.com/lilingxiao-bupt/qd-llm/blob/main/QNLP_network.py): `QNLP_network.py`
- [Quantum circuits](https://github.com/lilingxiao-bupt/qd-llm/blob/main/QNLP_network.py): `QNLP_network.py`
- [RNN classifier](https://github.com/lilingxiao-bupt/qd-llm/blob/main/QNLP_network.py): `QNLP_network.py`

### Training and evaluation

- [Training driver](https://github.com/lilingxiao-bupt/qd-llm/blob/main/QD_LLM_main_Infer.py): `QD_LLM_main_Infer.py`
- [Metrics and evaluation](https://github.com/lilingxiao-bupt/qd-llm/blob/main/QD_LLM_main_Infer.py): `QD_LLM_main_Infer.py`
- [Model checkpoints](https://github.com/lilingxiao-bupt/qd-llm/blob/main/QD_LLM_main_Infer.py): `QD_LLM_main_Infer.py`

### Quantum deployment

- [Circuit generation](https://github.com/lilingxiao-bupt/qd-llm/blob/main/real_device_baihua/real%20device.py): `real_device_baihua/real device.py`
- [Circuit QASM](https://github.com/lilingxiao-bupt/qd-llm/blob/main/real_device_baihua/qembedding1_used_in_model_2class.qasm): `real_device_baihua/qembedding1_used_in_model_2class.qasm`
- [Circuit QASM copy](https://github.com/lilingxiao-bupt/qd-llm/blob/main/real_device_baihua/qembedding1_used_in_model_2class%20(2).qasm): `real_device_baihua/qembedding1_used_in_model_2class (2).qasm`

### Other components

- **Research user**
- **Quantum hardware**

## Connections

- Research user → Training driver: runs training
- Dataset parsing → Task datasets: reads examples (evidence: `QD_LLM_dataLoader.py`)
- Training driver → LLM teacher: constructs (evidence: `QD_LLM_main_Infer.py`)
- Training driver → Text embedding: constructs (evidence: `QD_LLM_main_Infer.py`)
- Training driver → RNN classifier: constructs (evidence: `QD_LLM_main_Infer.py`)
- Training driver → Metrics and evaluation: evaluates (evidence: `QD_LLM_main_Infer.py`)
- Training driver → Model checkpoints: saves and loads (evidence: `QD_LLM_main_Infer.py`)
- Training driver → Quantum circuits: uses module (evidence: `QD_LLM_main_Infer.py`)
- Circuit generation → Circuit QASM: writes circuit (evidence: `real_device_baihua/real device.py`)
- Circuit generation → Quantum hardware: deploys circuit
- Quantum circuits → Quantum hardware: hardware execution
