TL;DR
Real-world forecasting usually doesn't look like neat, evenly spaced stock tickers; it looks like messy, timestamped transaction logs scattered across interconnected database tables. Instead of training a brand-new model from scratch every time you want to predict a different outcome (like customer churn vs. item sales), this paper introduces a self-supervised recipe called QCRP that pretrains one standard graph neural network on an entire database's history. Once frozen, this single model acts as a universal crystal ball for that database—handling diverse forecasting tasks across different entity types using cheap, lightweight adapters or even zero-shot queries.
What Problem Does This Paper Address?
Classical time-series models expect clean, uniformly sampled arrays. In practice, enterprise data lives in relational databases filled with asynchronous events—users clicking, products getting reviewed, accounts transacting—linked by foreign keys. Relational Deep Learning (RDL) handles this by treating database rows as nodes in a temporal graph and running graph neural networks (GNNs) over them.
Here is the catch: even though customers, products, and transactions all share the exact same evolving history, standard RDL pipelines train completely separate, isolated models for every target variable, time horizon, and "root" entity table (e.g., one model for user churn, another from scratch for item sales). Meanwhile, existing self-supervised pretraining methods either reconstruct masked graph structures (which ignores the arrow of time) or predict fixed future statistics for only one entity type at a time. The authors ask: Can we pretrain a conventional RDL model once on a database's history and reuse it everywhere across that database?
Methods
Enter Query-Conditioned Relational Pretraining (QCRP), a framework that decouples what happened in the past from what we want to know about the future.
Instead of inventing a massive new foundation model architecture, QCRP wraps around standard RDL backbones (like GraphSAGE or RelGNN) using three clever pieces:
- A Temporal Query Grammar: Rather than predicting a rigid, fixed list of future stats, QCRP generates a rich variety of self-supervised forecasting tasks using a structured query specification—defining a relational path (e.g.,
product -> review), time horizon (30 days), filter (verified = true), and aggregation (count). A lightweight query encoder turns this specification into a task embedding. - Compute-Saving Factorization: Sampling historical neighborhoods in a massive database graph is computationally expensive. QCRP computes an entity's historical representation strictly prior to cutoff time $t$ just once per minibatch, then pairs it with dozens of different query embeddings through a shared conditional predictor. Adding more pretraining tasks costs almost nothing.
- Multi-Root Block Interleaving: To make one encoder work for both users and products, training alternates in blocks (e.g., 5,000 gradient steps on user queries, then 5,000 on product queries), forcing the shared weights to understand the database from multiple vantage points.
At inference time, the GNN encoder is completely frozen. You can either slap a tiny two-layer MLP on top of its embeddings for a labeled task, or feed a new structured query into the frozen predictor for zero-shot forecasting.
Datasets
The authors evaluate on two large-scale, multi-entity temporal databases from RelBench:
- Rel-Amazon (e-commerce reviews and products; 91-day forecast horizon)
- Rel-HM (H&M fashion retail transactions; 7-day forecast horizon)
Across these, they test six official entity-level tasks covering regression (User Lifetime Value, Item Lifetime Value, Sales) and binary classification (User Churn, Item Churn). Because standard benchmarks suffer from "task scarcity" (too few targets to truly test generalization), the authors also construct 14 held-out grammar-defined tasks on Rel-Amazon that are strictly excluded from the pretraining pool.
Key Insights and Ideas
- Predicting the future beats reconstructing the past: Standard graph self-supervision (masked autoencoding and contrastive learning) consistently flops on forecasting tasks compared to QCRP. To learn representations useful for forecasting, pretraining must explicitly supervise future time windows.
- Specialists aren't necessary: A single unified model (
QCRP_multi) trained across both users and items matches—and on half the tasks, slightly beats—isolated specialist models trained dedicatedly on a single entity type. - Standard backbones have hidden mileage: You don't necessarily need bespoke, heavyweight foundation model architectures to get broad transferability; a conventional GNN pretrained with rich enough future queries becomes a database-wide generalist.
Key Results
- Crushing Pretraining Baselines: Using frozen GraphSAGE embeddings with a simple MLP probe, QCRP outperforms prior future-statistic pretraining (TVE) on all 6 benchmark tasks. The standout improvement is on Amazon Item-LTV, where
QCRP_rootdrops Mean Absolute Error (MAE) to 46.203 compared to 54.544 for TVE—and even beats end-to-end supervised training from scratch (47.210). - Competitive with State-of-the-Art: Scaling up to a RelGNN backbone, a single frozen
QCRP_multicheckpoint per database achieves an average rank of 2.33 across published leaderboard baselines (second only to RT-PluRel, which requires task-specific fine-tuning), while setting the overall best Amazon User-LTV score (13.83 MAE).
- Generalization & Zero-Shot: On the 14 unseen Rel-Amazon tasks, fitting an MLP on frozen QCRP embeddings reaches 81.7 mean AUC, beating TVE (79.2) and matching full supervised training from scratch (81.6). Using the zero-shot query interface without any task fitting yields 68.9 AUC (vs. 48.8 when query fields are shuffled)—proving the query conditioning genuinely works, even if uneven across tasks.
Limitations and Future Work
- Benchmark Bottlenecks: Current relational benchmarks offer very few tasks and only a single prediction horizon per database (91 days for Amazon, 7 days for H&M), limiting how well researchers can stress-test generalization across diverse time scales.
- Missing Explicit Time-Series Signals: While QCRP summarizes relational neighborhoods prior to a cutoff, it doesn't explicitly model classic temporal structures like seasonality, periodicity, or lagged target trajectories. Marrying database-native graph representations with explicit time-series dynamics is a natural next frontier.
Summary updated