--- license: mit library_name: pytorch pipeline_tag: graph-ml tags: - process-mining - predictive-process-monitoring - foundation-model - graph-neural-network - graph-transformer - gps - event-log datasets: - Polifemus/event-log-mixer --- # Process-Graph-FM — graph foundation model for event logs 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**. ## Models `EventGraphFM` (`model.py`): `GINEConv` local message passing + `GPSConv` global attention, edge features (2), 7 numeric node features. | checkpoint | params | d_model / layers / heads | pretraining | val next-activity acc | BPIC 2015-1 zero-shot | FT test acc | FT top3 | FT macro-F1 | |---|---:|---|---|---:|---:|---:|---:|---:| | `gfm-sc27/` | 27.28M | 512 / 8 / 8 | v4, 6 epochs (~0.13B positions) | 0.6048 | 0.3102 | **0.4527** | **0.6135** | **0.1936** | | `gfm-sc80/` | 88.14M | 768 / 12 / 8 | v4, 18 epochs (~0.38B positions) | 0.6017 | 0.3226 | 0.4354 | 0.6018 | 0.1945 | Zero-shot here is the plain global-head evaluation (no unseen-to-UNK mapping). With unseen-to-UNK: gfm-sc80 0.2975; sequence sc80 0.3810. Each folder has `model.pt` (state dict), `config.json`, `vocab.json` (global ids) and `metrics.json`. ## Results (BPIC 2015-1, held out) ### gfm-sc80 vs sequence sc80 — equal corpus and budget | metric | graph `gfm-sc80` | sequence `sc80` | delta | |---|---:|---:|---:| | pretraining val next-activity acc | 0.6017 | **0.6563** | −5.5pp | | zero-shot test acc (plain) | 0.3226 | **0.3600** | −3.7pp | | zero-shot test acc (unseen-to-UNK) | 0.2975 | **0.3810** | −8.4pp | | fine-tuned test acc | 0.4354 | 0.4336 | +0.0018 | | fine-tuned top3 | 0.6018 | 0.6280 | -0.0262 | | fine-tuned macro-F1 | 0.1945 | 0.1861 | +0.0084 | **Honest reading (gfm-sc80)**: at equal corpus and budget the 80M graph model does **not** beat the sequence model on zero-shot transfer, and its fine-tuned accuracy is higher than sc80 (+0.0018). Its pretraining validation is also lower. The fine-tuning required a lower learning rate (1e-4 instead of 3e-4) because the 80M graph diverged at the recipe used for sc27/sc80; this is documented rather than hidden. One seed, under-budget: the result is evidence, not a graph-vs-sequence law. ### gfm-sc27 vs sequence sc27 — equal corpus and budget | metric | graph `gfm-sc27` | sequence `sc27` | delta | |---|---:|---:|---:| | pretraining val next-activity acc | 0.6048 | **0.6451** | −4.0pp | | zero-shot test acc | **0.3102** | 0.3068 | +0.34pp | | fine-tuned test acc | **0.4527** | 0.4296 | +2.3pp | | fine-tuned top3 | **0.6135** | 0.5865 | +2.7pp | | fine-tuned macro-F1 | **0.1936** | 0.1877 | +0.6pp | ## Late fusion graph + sequence (validation-selected) | base models | weights (val-acc) | test acc | top3 | macro-F1 | |---|---|---:|---:|---:| | sc80 v4 + gfm-sc80 | seq 0.60 / graph 0.40 | 0.4671 | 0.6551 | 0.2154 | | **sc80-v5-rmix14 + gfm-sc80** | **seq 0.65 / graph 0.35** | **0.4832** | **0.6584** | **0.2265** | | sc80-v5-rmix14 + gfm-sc80 (val-F1 weights) | seq 0.70 / graph 0.30 | **0.4855** | 0.6578 | 0.2248 | The best result uses the sequence ablation checkpoint `process-fm/scaling/ablation/sc80-v5-rmix14` (fine-tuned 0.4695) and `gfm-sc80`; weights are selected on validation, the test split is untouched. It improves +1.4pp over the best single and +5.0pp over the v4 sequence model. Artifacts: `fusion.json` in this repository; full grids in the study repository (`out/mix_sc80_gfm80.json`, `out/mix_sc80rmix14_gfm80.json`, `out/mix_sc80_gfm80_v6.json`). ## Usage ```python import json import torch from model import EventGraphFM cfg = json.load(open("gfm-sc80/config.json")) state = torch.load("gfm-sc80/model.pt", map_location="cpu", weights_only=True) model = EventGraphFM( n_act=cfg["n_act"], n_res=cfg["n_res"], n_logs=cfg["n_logs"], d_model=cfg["d_model"], n_layers=cfg["n_layers"], n_heads=cfg["n_heads"], dropout=cfg["dropout"], edge_dim=cfg["edge_dim"], num_dim=cfg["num_dim"], ) model.load_state_dict(state) model.eval() # forward(gact, gres, num, log_id, edge_index, edge_attr, batch_vec, mask_flag) # gact/gres: global ids (activities 4..776, resources 2..2739, UNK=1) # edge_index/edge_attr: typed directly-follows graph; build it with the project code ``` 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-sc80/vocab.json`; log ids are conditioning inputs. ## Data & licensing 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. ## Related repositories - [`Polifemus/process-fm`](https://huggingface.co/Polifemus/process-fm) — sequence foundation models and scaling suite. - [`Polifemus/prefix-next-activity`](https://huggingface.co/Polifemus/prefix-next-activity) — GNN vs fine-tuned transformer study. - [`Polifemus/event-log-mixer`](https://huggingface.co/datasets/Polifemus/event-log-mixer) — synthetic event-log corpus. ## Citation ```bibtex @misc{process-graph-fm, title = {Process-Graph-FM: A GPS Graph Foundation Model for Event Logs}, author = {Polidori, Filippo}, year = {2026}, howpublished = {\url{https://huggingface.co/Polifemus/process-graph-fm}} } ```