# lu-wayne/panda architecture

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

- Interactive diagram: https://gitdiagram.com/lu-wayne/panda
- Repository: https://github.com/lu-wayne/panda

## Overview

This repository implements multimodal, multi-domain fake-news detection, with PANDA described in the README as its proposed model. The principal workflow is selecting a dataset and model, loading text/image examples, producing a detection result, and evaluating training runs. The tree does not contain the README-named `model/PANDA.py`, and `run.py` was not sampled, so the precise runtime wiring and PANDA module boundaries cannot be verified; the model group therefore reflects documented capabilities at the existing `model/` path.

Main entry points: [`model`](https://github.com/lu-wayne/panda/tree/main/model) (PANDA adaptation), [`utils`](https://github.com/lu-wayne/panda/tree/main/utils) (Dataset loaders), [`run.py`](https://github.com/lu-wayne/panda/blob/main/run.py) (Run orchestrator), [`main.py`](https://github.com/lu-wayne/panda/blob/main/main.py) (CLI configuration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Experiment entry"]
  node_entrypoint["CLI configuration<br/>[main.py]"]
  node_runner["Run orchestrator<br/>[run.py]"]
end

subgraph group_data["Data handling"]
  node_preparation["Dataset preparation"]
  node_loaders["Dataset loaders"]
end

subgraph group_models["Detection models"]
  node_text["Text encoders<br/>[bert.py]"]
  node_image["Image encoders<br/>[models_mae.py]"]
  node_clip["LongCLIP backbone"]
  node_baselines["Model variants"]
  node_panda["PANDA adaptation"]
  node_dmpg["Domain prompts"]
  node_pad["Transfer distance"]
  node_selector["Neighbor selection"]
  node_attention["Domain fusion"]
  node_classifier["Fake-news prediction"]
end

subgraph group_evaluation["Training and evaluation"]
  node_trainer["Model training<br/>[run.py]"]
  node_metrics["Validation and testing<br/>[run.py]"]
  node_result["Detection result"]
end

node_user(("Researcher"))

node_user -->|"configures run"| node_entrypoint
node_entrypoint -->|"starts"| node_runner
node_preparation -->|"prepares datasets"| node_loaders
node_runner -->|"loads examples"| node_loaders
node_loaders -->|"provides text"| node_text
node_loaders -->|"provides images"| node_image
node_runner -->|"runs training"| node_trainer
node_trainer -->|"validates model"| node_metrics
node_metrics -->|"reports metrics"| node_result
node_text -->|"encodes text"| node_panda
node_image -->|"encodes images"| node_panda
node_clip -.->|"provides backbone"| node_panda
node_panda -->|"uses prompts"| node_dmpg
node_panda -->|"measures transfer"| node_pad
node_panda -->|"selects neighbors"| node_selector
node_panda -->|"fuses domains"| node_attention
node_panda -->|"predicts"| node_classifier
node_baselines -.->|"includes alternatives"| node_classifier
node_classifier -->|"returns prediction"| node_result

click node_entrypoint "https://github.com/lu-wayne/panda/blob/main/main.py"
click node_runner "https://github.com/lu-wayne/panda/blob/main/run.py"
click node_preparation "https://github.com/lu-wayne/panda/tree/main/data_pre"
click node_loaders "https://github.com/lu-wayne/panda/tree/main/utils"
click node_text "https://github.com/lu-wayne/panda/blob/main/model/bert.py"
click node_image "https://github.com/lu-wayne/panda/blob/main/models_mae.py"
click node_clip "https://github.com/lu-wayne/panda/tree/main/LongCLIP/model"
click node_baselines "https://github.com/lu-wayne/panda/tree/main/model"
click node_panda "https://github.com/lu-wayne/panda/tree/main/model"
click node_dmpg "https://github.com/lu-wayne/panda/tree/main/model"
click node_pad "https://github.com/lu-wayne/panda/tree/main/model"
click node_selector "https://github.com/lu-wayne/panda/tree/main/model"
click node_attention "https://github.com/lu-wayne/panda/tree/main/model"
click node_classifier "https://github.com/lu-wayne/panda/tree/main/model"
click node_trainer "https://github.com/lu-wayne/panda/blob/main/run.py"
click node_metrics "https://github.com/lu-wayne/panda/blob/main/run.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_entrypoint,node_runner toneBlue
class node_preparation,node_loaders toneAmber
class node_text,node_image,node_clip,node_baselines,node_panda,node_dmpg,node_pad,node_selector,node_attention,node_classifier toneMint
class node_trainer,node_metrics,node_result toneRose
class node_user toneIndigo
```

## Components

### Experiment entry

- [CLI configuration](https://github.com/lu-wayne/panda/blob/main/main.py): `main.py`
- [Run orchestrator](https://github.com/lu-wayne/panda/blob/main/run.py): `run.py`

### Data handling

- [Dataset preparation](https://github.com/lu-wayne/panda/tree/main/data_pre): `data_pre`
- [Dataset loaders](https://github.com/lu-wayne/panda/tree/main/utils): `utils`

### Detection models

- [Text encoders](https://github.com/lu-wayne/panda/blob/main/model/bert.py): `model/bert.py`
- [Image encoders](https://github.com/lu-wayne/panda/blob/main/models_mae.py): `models_mae.py`
- [LongCLIP backbone](https://github.com/lu-wayne/panda/tree/main/LongCLIP/model): `LongCLIP/model`
- [Model variants](https://github.com/lu-wayne/panda/tree/main/model): `model`
- [PANDA adaptation](https://github.com/lu-wayne/panda/tree/main/model): `model`
- [Domain prompts](https://github.com/lu-wayne/panda/tree/main/model): `model`
- [Transfer distance](https://github.com/lu-wayne/panda/tree/main/model): `model`
- [Neighbor selection](https://github.com/lu-wayne/panda/tree/main/model): `model`
- [Domain fusion](https://github.com/lu-wayne/panda/tree/main/model): `model`
- [Fake-news prediction](https://github.com/lu-wayne/panda/tree/main/model): `model`

### Training and evaluation

- [Model training](https://github.com/lu-wayne/panda/blob/main/run.py): `run.py`
- [Validation and testing](https://github.com/lu-wayne/panda/blob/main/run.py): `run.py`
- **Detection result**

### Other components

- **Researcher**

## Connections

- Researcher → CLI configuration: configures run
- CLI configuration → Run orchestrator: starts
- Dataset preparation → Dataset loaders: prepares datasets
- Run orchestrator → Dataset loaders: loads examples
- Dataset loaders → Text encoders: provides text
- Dataset loaders → Image encoders: provides images
- Run orchestrator → Model training: runs training
- Model training → Validation and testing: validates model
- Validation and testing → Detection result: reports metrics
- Text encoders → PANDA adaptation: encodes text
- Image encoders → PANDA adaptation: encodes images
- LongCLIP backbone → PANDA adaptation: provides backbone
- PANDA adaptation → Domain prompts: uses prompts
- PANDA adaptation → Transfer distance: measures transfer
- PANDA adaptation → Neighbor selection: selects neighbors
- PANDA adaptation → Domain fusion: fuses domains
- PANDA adaptation → Fake-news prediction: predicts
- Model variants → Fake-news prediction: includes alternatives
- Fake-news prediction → Detection result: returns prediction
