/ Модель

Характеристики

Лицензия
MIT
Библиотека
pytorch
Опубликована
14 окт 2026

prefix-next-activity

Языковая модель3 профессии

Набор GNN- и Transformer-моделей предсказывает следующую активность бизнес-процесса по префиксу журнала событий.

0скачиваний за 30 дней1лайквеса обновлены2 ноя 2026

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

Polifemus/prefix-next-activity — репозиторий моделей для предсказания следующей активности в мониторинге бизнес-процессов по префиксам журналов событий BPI Challenge. В него входят PrefixGNN, обучаемые с нуля для отдельных журналов, и дообученные на конкретном журнале варианты EventTransformer. Для трансформера указаны архитектура encoder с 8 слоями и 8 головами, длина последовательности 256 и около 27 млн параметров; GNN использует три слоя GINEConv и содержит около 160 тыс. параметров.

Модели предназначены для прогнозирования следующего события по истории случая. В README описаны временное разделение данных по случаям, результаты на семи журналах BPI и сравнение с базовыми методами. Заявленные показатели относятся к указанным журналам и протоколу оценки; чекпойнты привязаны к словарю конкретного журнала, для нового журнала требуется дообучение. Вероятности формально не откалиброваны. Репозиторий использует PyTorch и распространяется по лицензии MIT.

Сценарии применения

  • предсказание следующего события в случае бизнес-процесса
  • мониторинг хода обработки заявок по журналам событий
  • оценка вероятной активности в процессах BPI Challenge
  • сравнение GNN и трансформера для предиктивного мониторинга процессов

Ограничения

Чекпойнты привязаны к словарю и журналу событий, на котором они обучены; для нового журнала требуется дообучение. Вероятности не откалиброваны, а для fine-tuned моделей указан один seed; качество зависит от временного сдвига данных.

Для каких профессий подходит3

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

Next-Activity Prediction on BPI Event Logs — GNN and Fine-Tuned Transformer Models

This repository contains the models from a controlled study of next-activity prediction in predictive process monitoring on seven BPI Challenge event logs. Two model families were trained and compared with simple baselines:

  1. PrefixGNN — a graph neural network over the directly-follows graph of each case prefix, trained from scratch per log.
  2. EventTransformer — a ~27M-parameter transformer foundation model pretrained with masked event modeling on a multi-log corpus (12→18 logs), then fine-tuned per log ("FT" checkpoints).

All comparisons use the same honest protocol: temporal, case-level splits; model/ensemble selection on the validation set only; the first-order argmax baseline included. Headline finding: the fine-tuned transformer beats the GNN on the medium/large logs and on a held-out log (pure transfer), and a validation-selected ensemble of both is never worse than the GNN alone.

Models in this repository

foldermodellogtest accuracymacro-F1notes
gnn-bpi2012/PrefixGNNBPIC 20120.77420.6372best single model on this log
gnn-bpi2017/PrefixGNNBPIC 20170.81510.6365kept for reference; superseded by ft-bpi2017
ft-bpi2017/EventTransformer (FT)BPIC 20170.82100.6632+0.6pp acc / +2.7pp F1 over GNN
ft-bpi2018/EventTransformer (FT)BPIC 20180.87180.5347+0.6pp acc / +3.3pp F1 over GNN
ft-bpi2015_1/EventTransformer (FT)BPIC 2015 (municipality 1)0.42770.1863held-out log: pure transfer, +1.1pp acc over GNN

Note on the HF pipeline tag — this repository spans two model families: the gnn-* checkpoints are graph neural networks over directly-follows graphs; the ft-* checkpoints are standard sequence transformers. graph-ml reflects the graph-based half and the project's process-mining roots — check which checkpoint you download (see the table above).

Two inference scripts are provided: inference.py (GNN, requires torch-geometric) and fm_inference.py (fine-tuned transformers, requires only torch + numpy).

Quickstart

pip install -r requirements.txt

# graph models (BPIC 2012 / 2017 demos)
python inference.py

# fine-tuned transformer models (BPIC 2017 / 2018 / 2015-1 demos)
python fm_inference.py
# GNN
from inference import load_model, predict
model, vocab = load_model("gnn-bpi2012")
events = [
    {"activity": "A_SUBMITTED",       "resource": "112", "timestamp": "2011-09-30 22:38:44"},
    {"activity": "A_PARTLYSUBMITTED", "resource": "112", "timestamp": "2011-09-30 22:38:44"},
    {"activity": "A_PREACCEPTED",     "resource": "112", "timestamp": "2011-09-30 22:39:37"},
]
predict(model, vocab, events, amount=20000.0, top_k=3)

# transformer
from fm_inference import load_model, predict
model, vocab = load_model("ft-bpi2017")
predict(model, vocab, events=events, top_k=3)

events is the running case prefix (activity / resource / timestamp per event, monotonic timestamps); amount is the optional case-level requested amount. Prefixes longer than 100 events are truncated to the most recent 100; unknown activities/resources map to UNK.

Protocol (same for every model and log)

  • One event per activity (COMPLETE lifecycle events where applicable); cases sorted by timestamp.
  • Temporal, case-level split 70/15/15 by case start date; every prefix of every case is an example (95%+ of the logs' prefixes), truncated to the last 100 events.
  • Model selection and ensemble weights chosen on validation only; test sets used once for final reporting. (The literature reports example leakage in many NAO papers when prefixes of the same case span train/test — the split here is per-case, so this cannot happen.)
  • Baselines included everywhere: majority class, MLP over the last 10 activities, first-order argmax P(a | last activity) (a strong count-based baseline in recent work).
  • Ensembles are convex combinations of per-model probabilities with weights searched on validation (grid, step 0.05).

Model architectures

PrefixGNN (from scratch, per log): GINEConv × 3 message passing over the bidirectional directly-follows chain of the prefix; activity embedding 32d + resource 16d + 7 numeric features (elapsed time since previous event / since case start, hour sin/cos, weekday, log-amount, position); readout = MLP(concat(mean-pool, max-pool, last-event embedding)); ~160k parameters.

EventTransformer (pretrained once, fine-tuned per log): transformer encoder, d_model 512, 8 layers, 8 heads, len 256, ~27M parameters; token = activity embedding 64d + resource 32d + log-id embedding 16d + 6 numeric features (same times/amount as above). Pretraining = masked next-event modeling over windows (256/64) sampled from a 12→18-log corpus, 40 epochs (~20M trainable events). Fine-tuning per log = new local classification head initialized from the global head, full bidirectional attention, 30 epochs, early stopping on validation accuracy (patience 5), lr 3e-4 cosine.

Results — all evaluated logs (test sets)

Accuracy (macro-F1) · best single model and best validation-selected ensemble in bold:

logcases / events / classesmajorityargmax-1MLP-last10GNNFM fine-tunedbest ensemble (val-selected)
BPIC 201213.1k / 164k / 230.13030.57260.76360.7742 (0.637)0.7619 (0.611)0.7768 (gnn+distill+argmax)
BPIC 201446.6k / 467k / 390.18390.36370.47280.5368 (0.351)0.5272 (0.356)0.5414 (gnn+ft+zs)
BPIC 2015-1 (held out)1.2k / 52k / 3980.02340.15240.35040.4169 (0.179)0.4277 (0.186)0.4571 (gnn+ft+zs)
BPIC 201731.5k / 475k / 240.10350.75540.81210.8151 (0.637)0.8210 (0.663)0.8210 (ft)
BPIC 201843.8k / 2.51M / 410.19310.66140.84190.8655 (0.502)0.8718 (0.535)0.8794 (gnn+ft+argmax)
BPIC 2019251.7k / 1.60M / 420.28310.49310.75620.7906 (0.467)0.7757 (0.477)0.8032 (gnn+ft+zs)
Traffic fines150.4k / 561k / 110.30910.83470.88340.8837 (0.697)0.8835 (0.691)0.8836 (tie with GNN)

What replicates across logs

  • The ensemble never loses: a validation-selected mix of GNN + fine-tuned transformer (see ft-* and gnn-* checkpoints) matches or beats the GNN alone on all seven logs, by up to +4.0pp (BPIC 2015-1) and +1.3pp (BPIC 2019).
  • The fine-tuned transformer wins outright on BPIC 2017 (+0.6pp acc / +2.7pp F1), BPIC 2018 (+0.6pp / +3.3pp) and on the held-out BPIC 2015-1 (+1.1pp / +0.8pp — the only log of the seven never seen during pretraining: this is the cleanest evidence that the multi-log pretraining transfers).
  • Where the GNN still wins: small/short-case logs (BPIC 2012) and very short-case, single-domain logs (BPIC 2014, traffic fines — where the transformer ties). Raw log size does not predict which family wins; case structure does.
  • The argmax baseline is remarkably strong on short/skewed cases (0.83 on traffic fines, 0.66 on BPIC 2018) and helps the ensemble only on BPIC 2012 and 2018 — on the other logs the learned models (and their ensembles) stay clearly ahead (e.g. +30pp on BPIC 2019).
  • Auxiliary findings: early-stopping patience 5 was verified against full-30-epoch runs (no hidden gains); warm restarts degrade (the fine-tuned models are already at their optimum); the causally-pretrained transformer is a better zero-shot model with causal attention but fine-tunes better with full bidirectional attention.

Selective prediction (GNN checkpoints)

By abstaining on low-confidence predictions, accuracy on the predicted subset approaches 1:

confidence thresholdBPIC 2012: coverage / accuracyBPIC 2017: coverage / accuracy
0.8042.8% / 96.99%63.5% / 96.18%
0.9035.1% / 99.46%48.4% / 99.23%
0.9529.6% / 99.91%41.5% / 99.86%

Files

pathcontent
inference.py / fm_inference.pystandalone inference (GNN / transformer), with demos
gnn-bpi2012/, gnn-bpi2017/model.pt + config.json + vocab.json (+ selection.json)
ft-bpi2017/, ft-bpi2018/, ft-bpi2015_1/model.pt (fp32, ~107MB) + config.json + vocab.json (local vocabulary + global embedding maps)

The transformer checkpoints are the best-validation fine-tuned weights; the packaged predictions were verified to be identical to the training-time evaluation outputs (100% argmax agreement on 447k test prefixes).

Related repositories

Limitations

  • Checkpoints are tied to their log's vocabulary and domain; for a new log, re-run the fine-tuning (the code paths are log-parametric, the vocabulary is not).
  • Temporal drift exists inside these logs; expect future-period accuracy to be closer to the temporal test results reported here than to random-split numbers seen in the literature.
  • Single training seed per fine-tuned model (the GNN results were additionally verified across 3–4 seeds; see macro-F1 spread in the BPIC 2017 study).
  • Probabilities are not formally calibrated.
  • The pretraining corpus included the cases of the logs used here except BPIC 2015-1 and traffic fines (which are the held-out transfer tests). "Zero-shot" in the tables means "no task-specific fine-tuning", not "unseen log" unless explicitly marked.

Data & licensing

Only trained artifacts are published in this repository (model weights, the small vocabularies of anonymized activity/resource labels each model needs, and metrics). The raw event logs are not redistributed; they remain under their own licenses and must be cited when reused:

datasetused forlicense (verified 2026-10-14)
BPIC 2012 (gnn-bpi2012)training/report4TU General Terms of Use
BPIC 2017 (gnn-bpi2017, ft-bpi2017)training/report4TU General Terms of Use
BPIC 2015, municipality 1 (ft-bpi2015_1, held out)transfer test4TU General Terms of Use
BPIC 2018 (ft-bpi2018)training/reportCC0
BPIC 2014, BPIC 2019, traffic fines, BPIC 2013/2020, sepsis, helpdesk (pretraining corpus and report tables)pretraining/report4TU General Terms of Use (2019: CC BY 4.0)

The "4TU General Terms of Use" permit download and use of the datasets, which must be properly acknowledged (author, year, title, DOI), and do not transfer IP rights; the BPIC logs are anonymized by their publishers. Model weights released here are our own trained artifacts (derived works), published under MIT. If you use these models or numbers, please cite both this repository and the underlying datasets (see References).

The pretraining corpora include synthetic logs generated by our DFG mixer; only model weights and vocabularies are published here, not the raw event logs. The synthetic mixer corpus is released separately under MIT in Polifemus/event-log-mixer.

🇮🇹 Sintesi in italiano

Questo repository pubblica i modelli di uno studio controllato di next-activity prediction (process mining predittivo) su sette log BPI. Due famiglie a confronto — una GNN (message passing sulla catena directly-follows del prefisso) e un transformer da ~27M parametri pretrainato su un corpus multi-log con masked event modeling e poi fine-tunato per log — più baseline (majority, MLP, primo-ordine argmax) e ensemble a pesi scelti solo su validation.

Risultati chiave (tutti su test, protocollo temporale per caso):

  • Il transformer fine-tunato batte la GNN su BPIC 2017 (+0.6pp), BPIC 2018 (+0.6pp acc, +3.3pp F1) e sul log tenuto fuori BPIC 2015-1 (+1.1pp: trasferimento puro).
  • L'ensemble validation-selected non è mai peggiore della GNN su nessuno dei 7 log (fino a +4.0pp).
  • La GNN resta migliore su log a casi corti (BPIC 2012, 2014, multe). La dimensione grezza non decide chi vince: conta la struttura dei casi, non la scala.
  • L'argmax di primo ordine è forte sui log a casi corti/sbilanciati ma aggiunge all'ensemble solo su BPIC 2012 e 2018.
  • Controlli metodologici: split per caso (niente leakage da prefissi dello stesso caso), selezione su validation, patience 5 verificata contro run a 30 epoche intere, warm restart inutile.

Modelli: gnn-bpi2012, gnn-bpi2017 (GNN), ft-bpi2017, ft-bpi2018, ft-bpi2015_1 (transformer). Demo: python inference.py e python fm_inference.py.

Citation

@misc{prefix-next-activity,
  title  = {Next-Activity Prediction on BPI Event Logs: GNN and Fine-Tuned Transformer Models},
  author = {Polidori, Filippo},
  year   = {2026},
  howpublished = {\url{https://huggingface.co/Polifemus/prefix-next-activity}}
}

Author

Filippo Polidori (Polifemus, github.com/Polifemu).

References

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · pytorch

Нельзя запустить

Графовые модели пока не поддерживаются.

Ревизия весов
2d901ea

0 моделей