arXiv(opens in a new tab)cs.LGOct 2026Cited by 1 paper on PaperVantage

Manuscript Offprint

arXiv:2610.17867

RT-J: Large-Scale Pretraining of Relational Transformers for Context-Efficient Predictions

Rishabh Ranjan, Vignesh Kothapalli, Harshvardhan Agarwal, Charilaos Kanatsoulis, Roshan Upendra, Tom Palczewski, Carlos Guestrin, Jure Leskovec

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

Abstract

Foundation models for tables and relational databases are increasingly used for predictive tasks across various scientific and industrial domains. However, adapting existing models to unseen datasets requires tens of thousands of examples. Here we introduce RT-J, an 85M-parameter relational foundation model (RFM) that makes accurate predictions even with hundreds of in-context examples or fewer. To achieve this, we first assemble THE JOIN, a large collection of 639 web-crawled databases with 6,023 LLM-generated forecasting tasks. We pretrain with long contexts of up to 8,192 database cells, using in-context examples from a novel lightweight random-walk retriever. Finally, we leverage context tuning and ensembling to scale up test-time compute. On in-context regression tasks from RelBench, RT-J requires 10×10\times fewer examples on average to match strong feature engineering pipelines with LLM-agent or RDBLearn featurizers and TabICLv2 or LightGBM predictors. Overall, our work pushes the frontier for context-efficient predictions on relational data and highlights the importance of real-world semantics, context engineering and large-scale pretraining for RFMs.

1 Introduction

Foundation models have transformed how machine learning systems are adapted to new tasks [1, 2]. In language and vision, pretrained models can often solve new tasks using only a small number of examples in context [3, 4]. Yet this capability remains largely out of reach for relational data, even though relational databases and data warehouses store much of the world's structured enterprise, scientific, and operational data [5, 6]. Today, strong relational predictors typically require task-specific training [7–9], or substantial labeled data [10–16]. This limits predictive modeling precisely in the settings where it is most valuable, including cases where labeled examples are scarce, and users need rapid ad hoc predictions for decision-making.

Tabular foundation models (TFMs) like TabPFN [17, 18] and TabICL [19, 20] provide in-context learning for single-table prediction, and systems such as RDBLearn [21] extend them to relational databases by aggregating relational neighborhoods into engineered features. Such an approach can be effective with many labeled examples, but it flattens the database and removes the explicit relational structure needed to effectively reason over entities, relationships, and cross-table dependencies. Natively relational architectures like RelGT [8] and RelGNN [7] operate directly on multi-table databases by representing rows as nodes and primary–foreign-key links as edges, but require training for each schema and task. More recent schema-agnostic relational foundation models (RFMs), such

Correspondence to: <ranjanr,vigneshk,guestrin,jure>@cs.stanford.edu

40th Conference on Neural Information Processing Systems (NeurIPS 2026).

1 Sampled DB + task from THE JOIN

Figure

2 Temporally masked DB rows

Figure

3 Random walks for example retrieval

Figure

6 Multi-token prediction (MTP)

5 RT-J context with mask tokens

Figure

4 Local BFS for relational context

Figure 1: RT-J pretraining recipe. (1) We sample a database and prediction task from THE JOIN. The task specifies the target table and column. (2) We sample a target row from the target table. Rows after the target row's timestamp are dropped; kept target-table rows form the candidate in-context examples. (3) From the target row, many parallel random walks rank candidate examples by visit count, on the fly. (4) We process candidate examples in descending visit-count order, using each as the root of a local bounded-width breadth-first-search (BFS) over primary–foreign key links. The context size and BFS hyperparameters are sampled randomly. (5) The collected rows form the context window for the relational transformer (RT), which treats cells as tokens. The target table rows in the context enable in-context learning. The target cell is always masked; non-target cells may be masked optionally. (6) RT-J predicts all masked cells and is trained against their ground-truth values.

as Griffin [22], KumoRFM [10, 11], and relational transformers (RTs) [23], pretrain across many databases and adapt to unseen ones at inference time. However, these models have not yet been tailored for strong prediction with only a few labeled examples. See Appendix C for related work.

This inability is not primarily an architectural limitation, but a mismatch between existing RFM training recipes and inference with limited in-context examples. RT [23] provides a natural starting point because it operates directly over database cells, schema metadata, and relational links. However, the original RT recipe was not designed to turn the architecture into a strong in-context learner. There are three main gaps. First, publicly available real world relational pretraining data remains scarce [24, 25]. Second, existing pretraining recipes target zero-shot or fine-tuning regimes, which precludes in-context learning. Third, standard context construction either ignores relational structure or expands local neighborhoods naively, without preferentially retrieving rows relevant to the target.

In this paper, we show that a pretrained RT can become a strong context-efficient predictor when the recipe for training, data, context retrieval and test-time compute is designed for this regime. Our goal is not to introduce a new backbone architecture, but to identify the ingredients that turn an RT model into an effective in-context learner for relational databases. First, we develop a pretraining recipe (Figure 1) built on stochastic context sizes and hyperparameters, which exposes the model to long and diverse contexts. Second, to train with high-quality in-context examples, we propose a lightweight random-walk retriever (Figure 1) that fills the context window with rows selected for both relational proximity to the target and likelihood of carrying useful predictive signal. Third, we leverage context tuning and context ensembling to scale test-time compute. With this recipe, we first obtain RT-PluRel, an 86M-parameter RT model pretrained on synthetic PluRel data [26]. With task-specific fine-tuning,

RelBench regression ↓ (9 task avg.)

Figure

Figure 2: In-context regression. Examples are matched. RT-J at train context size of 8192 cells fits around 225 examples on average. At all example counts, RT-J is > 2 nMAE points better than the best baseline; at all performance levels, RT-J needs ≳10×\gtrsim 10\times fewer examples.

RT-PluRel ranked first among all system and model submissions on the RelArena- α\alpha [27] leaderboard (Appendix A). Finally, to improve generalization to real data, we assemble THE JOIN, the largest open pretraining corpus of real-world relational data to date, comprising 6K LLM-generated forecasting tasks and 11K autocomplete tasks across 639 diverse web-crawled databases. We refer to the model obtained by continued pretraining (CPT) of RT-PluRel on THE JOIN with our recipe as RT-J. Compared to the original RT pretraining [23], our pretraining used 11×11\times more total tokens with up to 8×8\times larger contexts and a 4×4\times larger model, amounting to roughly 70×70\times more pretraining FLOPs.

Together, these ingredients make RT-J far more context-efficient than strong feature-engineering pipelines (Figure 2). We compare RT-J against pipelines that compose an LLM agent or RDBLearn featurizer with a TabICLv2 or LightGBM predictor, each given the same examples as in RT-J's context. Other RFMs such as KumoRFM [10, 11], Griffin [22] and RDB-PFN [28] do not support this regime, hence could not be compared against (Appendix B). On RelBench regression, RT-J fits 225 examples on average at its max training context size of 8192 database cells, and achieves a normalized mean absolute error (nMAE) which the strongest baseline matches only with roughly 10×10\times as many examples. Moreover, with only 15 examples, RT-J already beats the best error any pipeline reaches with 225 examples. At matched example counts, RT-J leads at every context size by 2.3–5.0 nMAE points. On classification, RT-J leads by 3.1 AUROC points when examples are scarcest, and the strongest pipeline catches up only at the largest context size. We attribute this efficiency to RT-J processing the raw relational context natively, which feature-engineering pipelines flatten into a feature table via aggregation techniques.

Our results demonstrate that context-efficient relational prediction can be attained with a pretraining recipe matched to this regime and scaling up along the axes of data, context and test-time compute. Overall, this is a step toward RFMs that work for databases the way LLMs work for text. In essence, pretrained once, reused across domains, and adapted to new tasks with only a few examples.

References (57)