File size: 2,980 Bytes
f229192
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
---
language: en
tags:
  - graph-neural-network
  - molecular-property-prediction
  - quantum-chemistry
  - cheminformatics
  - pytorch
  - SMILES
  - attention-mechanism
  - GNN
license: mit
library_name: pytorch
datasets:
  - QuantumChem/QuantumChem_200k
metrics:
  - mae
  - r2
---

# MSGAT: Multi-Scale Graph Attention Network

A lightweight graph neural network (**242K parameters**) for predicting 10 quantum-chemical properties from molecular SMILES strings.

## Model Details

- **Architecture**: Edge-aware multi-head attention + MPNN + cross-scale fusion
- **Parameters**: 242,407
- **Hidden dim**: 64, 4 attention heads, 3 layers
- **Node features**: 58-dim (atomic number, degree, charge, Hs, hybridization, aromaticity)
- **Bond features**: 12-dim (bond type, conjugation, ring, stereo)
- **Training data**: [QuantumChem/QuantumChem_200k](https://huggingface.co/datasets/QuantumChem/QuantumChem_200k)

## Properties Predicted

| Property | Unit | MAE | R² |
|---|---|---|---|
| Sigma at 780 nm | GM | 10.10 | 0.953 |
| Max sigma | GM | 10.19 | 0.957 |
| ISC energy | eV | 0.0055 | 0.933 |
| Toxicity score | — | 0.017 | 0.924 |
| SA score | — | 0.0069 | 0.967 |
| Boiling point | °C | 5.77 | 0.984 |
| logP | — | 0.057 | 0.993 |
| Aromaticity | — | 0.0077 | 0.998 |
| Solubility | ug/ml | 71,953 | 0.053 |
| Molecular weight | g/mol | 1.61 | 0.806 |

Mean R² across 9/10 properties (excl. solubility): **0.946**

## Usage

```python
import torch
import torch.nn as nn

# Load the model
model_state = torch.load("msgat_model.pt", weights_index=None)
norm_stats = torch.load("norm_stats.pt")

# Reconstruct model architecture (see model.py in the repo)
from model import create_model  # clone https://github.com/devansh0703/MSGAT
model = create_model()
model.load_state_dict(model_state)
model.eval()

# mean/std for inverse transform (shape: [10])
mean = norm_stats["mean"]
std = norm_stats["std"]
```

### Inverse normalization

The model outputs z-score normalized predictions. To get raw values:

```python
# solubility uses log1p before normalization — must invert with expm1
raw = preds * std + mean
sol_idx = 8  # solubility index in active props
raw[:, sol_idx] = torch.expm1(raw[:, sol_idx])
```

## Files

| File | Description |
|---|---|
| `msgat_model.pt` | Trained model state dict (242K params) |
| `norm_stats.pt` | Z-score normalization stats (mean, std) for the 10 active properties |

## Training

```bash
git clone https://github.com/devansh0703/MSGAT
cd MSGAT
pip install torch rdkit-pypi datasets pandas tqdm matplotlib
python train.py  # train/val split
python train_final.py  # full data retrain
```

## Citation

```bibtex
@article{raulo2025msgat,
  title={MSGAT: Multi-Scale Graph Attention Network for Efficient Molecular Property Prediction},
  author={Raulo, Devansh},
  year={2025}
}
```

## Acknowledgements

Dataset: [QuantumChem/QuantumChem_200k](https://huggingface.co/datasets/QuantumChem/QuantumChem_200k) by Zeng et al.