Add Process-Graph-FM model card
Browse files
README.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
library_name: pytorch
|
| 4 |
+
pipeline_tag: graph-ml
|
| 5 |
+
tags:
|
| 6 |
+
- process-mining
|
| 7 |
+
- predictive-process-monitoring
|
| 8 |
+
- foundation-model
|
| 9 |
+
- graph-neural-network
|
| 10 |
+
- graph-transformer
|
| 11 |
+
- gps
|
| 12 |
+
- event-log
|
| 13 |
+
datasets:
|
| 14 |
+
- Polifemus/event-log-mixer
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
# Process-Graph-FM — graph foundation model for event logs
|
| 18 |
+
|
| 19 |
+
A graph foundation model for **predictive process monitoring**: instead of flattening a case prefix into a sequence, it treats the prefix as a graph of events with typed directly-follows edges, and learns next-activity / next-resource prediction with a **GPS-style graph transformer**.
|
| 20 |
+
|
| 21 |
+
## Model
|
| 22 |
+
|
| 23 |
+
- `EventGraphFM` (`model.py`): `GINEConv` local message passing + `GPSConv` global attention, 8 layers, d_model 512, 8 heads, edge features (2), 7 numeric node features.
|
| 24 |
+
- **27.28M parameters**, pretrained causally on corpus v4 (18 real + 300 synthetic logs, 308 seen logs) for 6 epochs (under-budget, ~0.13B positions).
|
| 25 |
+
- Checkpoint: `gfm-sc27/model.pt` + `config.json` + `vocab.json` + `metrics.json`.
|
| 26 |
+
|
| 27 |
+
## Results (BPIC 2015-1, held out)
|
| 28 |
+
|
| 29 |
+
| metric | graph `gfm-sc27` | sequence `sc27` | delta |
|
| 30 |
+
|---|---:|---:|---:|
|
| 31 |
+
| pretraining val next-activity acc | 0.6048 | **0.6451** | −4.0pp |
|
| 32 |
+
| zero-shot test acc | **0.3102** | 0.3068 | +0.34pp |
|
| 33 |
+
| fine-tuned test acc | **0.4527** | 0.4296 | +2.3pp |
|
| 34 |
+
| fine-tuned top3 | **0.6135** | 0.5865 | +2.7pp |
|
| 35 |
+
| fine-tuned macro-F1 | **0.1936** | 0.1877 | +0.6pp |
|
| 36 |
+
|
| 37 |
+
**Honest reading**: at equal budget the graph model loses on pretraining validation but transfers better to the held-out log, both zero-shot and after fine-tuning. This is one seed and a short, under-budget run: a provisional result, not a demonstrated graph-vs-sequence law. A 300M graph run was not feasible locally and remains future work.
|
| 38 |
+
|
| 39 |
+
## Usage
|
| 40 |
+
|
| 41 |
+
```python
|
| 42 |
+
import json
|
| 43 |
+
import torch
|
| 44 |
+
from model import EventGraphFM
|
| 45 |
+
|
| 46 |
+
cfg = json.load(open("gfm-sc27/config.json"))
|
| 47 |
+
state = torch.load("gfm-sc27/model.pt", map_location="cpu", weights_only=True)
|
| 48 |
+
model = EventGraphFM(
|
| 49 |
+
n_act=cfg["n_act"], n_res=cfg["n_res"], n_logs=cfg["n_logs"],
|
| 50 |
+
d_model=cfg["d_model"], n_layers=cfg["n_layers"], n_heads=cfg["n_heads"],
|
| 51 |
+
dropout=cfg["dropout"], edge_dim=cfg["edge_dim"], num_dim=cfg["num_dim"],
|
| 52 |
+
)
|
| 53 |
+
model.load_state_dict(state)
|
| 54 |
+
model.eval()
|
| 55 |
+
|
| 56 |
+
# forward(gact, gres, num, log_id, edge_index, edge_attr, batch_vec, mask_flag)
|
| 57 |
+
# gact/gres: global ids (activities 4..776, resources 2..2739, UNK=1)
|
| 58 |
+
# edge_index/edge_attr: typed directly-follows graph; build it with the project code
|
| 59 |
+
```
|
| 60 |
+
|
| 61 |
+
The graph construction (DFG edges, edge types, numeric node features, masking) follows the ProcessGraph-FM project code. The global activity/resource ids are in `gfm-sc27/vocab.json`; log ids are conditioning inputs.
|
| 62 |
+
|
| 63 |
+
## Data & licensing
|
| 64 |
+
|
| 65 |
+
Weights and code are released under **MIT**. Raw event logs are not redistributed and keep their original licenses (mostly 4TU General Terms of Use; BPIC 2018 is CC0). The synthetic half of the corpus is available at [`Polifemus/event-log-mixer`](https://huggingface.co/datasets/Polifemus/event-log-mixer) under MIT.
|
| 66 |
+
|
| 67 |
+
## Related repositories
|
| 68 |
+
|
| 69 |
+
- [`Polifemus/process-fm`](https://huggingface.co/Polifemus/process-fm) — sequence foundation models and scaling suite.
|
| 70 |
+
- [`Polifemus/prefix-next-activity`](https://huggingface.co/Polifemus/prefix-next-activity) — GNN vs fine-tuned transformer study.
|
| 71 |
+
- [`Polifemus/event-log-mixer`](https://huggingface.co/datasets/Polifemus/event-log-mixer) — synthetic event-log corpus.
|
| 72 |
+
|
| 73 |
+
## Citation
|
| 74 |
+
|
| 75 |
+
```bibtex
|
| 76 |
+
@misc{process-graph-fm,
|
| 77 |
+
title = {Process-Graph-FM: A GPS Graph Foundation Model for Event Logs},
|
| 78 |
+
author = {Polidori, Filippo},
|
| 79 |
+
year = {2026},
|
| 80 |
+
howpublished = {\url{https://huggingface.co/Polifemus/process-graph-fm}}
|
| 81 |
+
}
|
| 82 |
+
```
|