Causal-Aware Masked Graph Transformer for Coffee Bean Roasting Endpoint Estimation
Authors
Alessandro Conti, Francesca Romano, Giulia FerrariFiles
Abstract
Coffee-roasting endpoint estimation is difficult because controllable heat and airflow interact with delayed thermal, acoustic, and color responses under changing bean origins and production scales. This study develops a causal-aware masked graph transformer that represents each batch as a temporal process graph, blocks future-dependent and process-inadmissible attention paths, and penalizes group-dependent endpoint losses. The model encodes intervention, chamber, bean-state, and endpoint nodes, applies phase-aware pooling, and jointly predicts remaining time, terminal-temperature deviation, and endpoint acceptability. Online recommendations are issued only when calibrated confidence remains stable within a confirmation window. The evaluation used 1,248 pilot and production roasts from six green-bean groups with synchronized temperature, heat-input, airflow, exhaust, crack-event, and color trajectories. Against recurrent, temporal-convolutional, vanilla-transformer, and graph-attention baselines, the proposed model obtained a 5.8 s endpoint-time mean absolute error, a 1.14 °C terminal-temperature error, and 96.8% acceptable-endpoint accuracy. Under complete origin holdout, endpoint-time error increased by 9.7% relative to the blocked test split, compared with 22.4% for the strongest non-causal graph baseline. The expected calibration error was 0.031. Ablation evidence further indicated that causal masking, intervention-stable optimization, and phase-aware pooling contributed complementary improvements. These results show that process-directed masking can improve endpoint prediction and confidence quality within the evaluated operating envelope, supporting operator-facing roasting recommendations while preserving online information constraints.
