Manuscript Offprint

arXiv:2609.35219

Temporal Heterogeneous Graph Pretraining for Relational Deep Learning

Yixin Peng, Er Jin, Diego Collarana, Stefan Decker

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

ABSTRACT

Relational deep learning represents database rows and foreign-key links as a heterogeneous graph, enabling prediction from record attributes and relational context. Two forms of temporal signals play distinct roles in these graphs: record age changes as the prediction cutoff advances, whereas the interval between two observed records remains fixed. Prior work has explored temporal modeling and temporal pretraining for heterogeneous graphs, but typically treats time as a single source of information or focuses on either representation or supervision in isolation. We investigate how explicitly representing both temporal signals affects the benefits of temporal pretraining on downstream tasks. Our framework pairs two complementary temporal encodings: Multi-scale Time Encoding, which captures record age through learnable time scales and type-specific projections, and Rotary Time Encoding, which encodes signed time differences between linked records through rotary transformations during graph propagation. Rather than treating these encodings as architectural additions alone, we train them through three self-supervised objectives: recovering historical relations, forecasting horizon-dependent future relation activity, and contrasting temporally valid historical subgraphs. All model inputs are restricted to information available at their observation cutoffs. We further structure pretraining into two stages: learning neighborhood representations via subgraph contrastive learning, followed by refining these representations through either relation recovery or future activity prediction. We evaluate across five Rel-Bench datasets and 11 classification and regression tasks using representative heterogeneous graph neural network (GNN) and Graph Transformer (GT) backbones. With both temporal encodings, the best evaluated staged schedules for the two backbones outperform direct supervised training using the same encodings by 3.02% and 1.06%, respectively, and controls without pretraining or encodings by 3.24% and 2.37%, respectively.

1 INTRODUCTION

Relational databases store records in linked tables, with predictive signals distributed across both record attributes and relationships. For example, predicting whether a customer will buy again may require combining customer details, product information, and purchase times from several tables. Conventional pipelines assemble these signals through task-specific joins and aggregations (Kanter & Veeramachaneni, 2015). Relational deep learning (RDL) instead represents rows as nodes and foreign-key links as typed edges, allowing graph models to learn directly from attributes and relational neighborhoods (Fey et al., 2024).

Learning from relational graphs requires modeling both heterogeneity and time. Customer and product records describe distinct entity types, while purchase records capture interactions between them. Together, they form a heterogeneous graph with type-specific node attributes and multiple relation types. Time provides two complementary signals about these records and their relationships. Record age measures the time elapsed between a record's observation and the prediction cutoff. A

*Corresponding author: Yixin Peng (peng@dbis.rwth-aachen.de).

signed inter-record interval measures the difference between the observation times of two linked records, capturing their temporal order and distance. For example, as the prediction cutoff advances, a purchase record becomes older, while the interval between the customer's registration and that purchase remains fixed.

Temporal encodings make record age and inter-record intervals explicit in model representations (Xu et al., 2020; Hu et al., 2020c; Yu et al., 2023; Cong et al., 2023; Li et al., 2023; Robinson et al., 2024; Dwivedi et al., 2026). Pretraining guides models to integrate these temporal signals with record attributes and graph structure before adaptation to downstream tasks. Existing pretraining approaches use heterogeneous reconstruction and relation- or schema-based contrastive learning (Hu et al., 2020b; Jiang et al., 2021; Sun et al., 2025), while temporal objectives further target interaction timing or statistics of future records (Ma et al., 2026; Truong et al., 2026). Temporal encodings and pretraining objectives thus serve complementary roles: the former specify how time is represented, and the latter guide what and how the model learns from these representations. This motivates us to study how temporal heterogeneity-aware pretraining can be combined with explicit encodings of both temporal signals. Figure 2 summarizes these design choices across prior methods and our framework.

We address this challenge with a framework that integrates temporal encodings with staged pretraining. Our temporal encodings capture both record age and relative timing: Multi-scale time encoding (TIMEMIX) incorporates record-age information into node inputs through learnable time scales and type-specific projections, while Rotary time encoding (TIMEROPE) adapts prior temporal rotary attention (Peng et al., 2026) to use bounded, signed log-intervals and extends it to GNN message construction.

Building on these encodings, we introduce three complementary pretraining objectives. Temporal Subgraph Contrast (TEMP-SUB) aligns corrupted views of historical neighborhoods through type-aware pooling and relation-preserving augmentations, encouraging representations to remain stable under missing attributes or links. Historical Relation Recovery (REL-HIST) recovers hidden typed links using only the context available when those links were observed, whereas Horizon-aware Relation Activity Prediction (REL-FUTURE) predicts whether an entity will receive links of a specified relation and how many events will occur within a future window. We organize these objectives into a staged pretraining scheme: TEMP-SUB first learns neighborhood representations, which are then refined using either REL-HIST or REL-FUTURE. All model inputs respect their observation cutoffs throughout pretraining. The resulting pretrained model is subsequently fine-tuned for individual tasks within the same database.

We evaluate our framework on five RelBench databases (Robinson et al., 2024) across 11 tasks spanning binary classification, multiclass classification, and regression using representative heterogeneous GNN and GT backbones. Controlled ablations assess the complementary benefits of the temporal encodings and the effectiveness of staged pretraining (Figure 4).

Our contributions are:

• Complementary temporal representations. We establish that jointly encoding record age and inter-record intervals improves aggregate performance over either alone on both backbones, with record age contributing more in component ablations.

• Effective staged pretraining. Our two staged schedules yield positive aggregate transfer in all four backbone–encoding settings. With both encodings, the best schedule on each backbone outperforms either constituent objective alone, demonstrating the value of staging complementary supervision.

• Gains beyond temporal encoding alone. Matched comparisons establish additional mean type gains of 3.02% on the GNN and 1.06% on the GT over supervised training with both encodings. Our best schedules also outperform the evaluated pretraining baselines, including their staged variants.

(a) Relational tables

(b) Temporal heterogeneous graph

Figure

(c) Historical subgraph

Table → node type Row → node Attributes → features FK → typed links Time → tvt_{v}

Figure 1: From relational tables to historical subgraphs for RDL. (a) Customer, purchase, and product tables: id denotes primary keys, c_id and p_id denote foreign keys, and time records purchase observation times. (b) Rows become nodes whose types follow their source tables; foreign-key references become typed edges with corresponding reverse relations for bidirectional message passing. Purchase nodes carry timestamps tvt_v. (c) An illustrative two-hop sample around seed C1, using only information available by cutoff τ=day\tau = day 5. S4 is excluded because its timestamp exceeds τ\tau; S3 and C2 lie outside the two-hop neighborhood.

References (31)