The Relational Transformer: what survives when the schema changes

2026 · notes from working through the paper · paper: Ranjan et al., ICLR 2026

RelGNN ended as the best model for one schema. Feed it a database it has never seen and it doesn't predict badly; it cannot run. This paper asks what's left when you delete every parameter that knows your schema, and the answer is a 22-million-parameter model that reads unseen databases better than a 27-billion-parameter language model burning a hundred thousand times the compute. The ablations then confess something uncomfortable about why.

A bar chart: RT with 22 million parameters at 90.3 percent of fully-supervised AUROC, versus Gemma3 with 27 billion parameters at 83.7 percent.
Percentage of fully-supervised AUROC, with no training on the target database. The 22M model beats the 27B one, and the giant pays roughly 100,000× more compute per prediction, because it must also chew through the database printed out as text.

Same method as last time: rebuild every idea from scratch and find out where it breaks. This one took longer than the previous paper, because the method has two genuinely separate halves and the ablations are the intellectual payoff rather than an appendix.

The toy, and its twin

Everything runs on TinyShop: two customers, three transactions, two products. Here it is in full.

customers entity
cust_idnamesignup
c1AliceNov 2
c2BobJan 20
products resource
prod_idnameprice
p1iPhone999
p2AirPods199
transactions event · 2 FK
txn_idcust_idprod_iddate
t1c1p1Jan 3
t2c1p2Feb 10
t3c2p1Mar 7
churn-task stapled on · not part of the database
rowcust_iddatechurn
T1c1Nov 30yes
T2c1Dec 31no
T3c1Jan 31no
T4c2Jan 31yes
T5c1Feb 28[MASK]

bold = primary key shaded ↗ = foreign key churn = no purchase in the month that followed

Check the purple table against the shop and every label is verifiable. Alice bought nothing in December, so her Nov 30 row says yes, churned; she bought on Jan 3 and Feb 10, so the next two say no. Bob's one row: end of January, and his only purchase is Mar 7, so yes. The last row is the question we're asking, and it is a masked cell in a table. Hold that thought; it is the whole design.

And the twin, TinyLibrary. Same structure, people and events and things, and not one shared column name. This is the on-screen version of "a database the model has never seen."

members never seen
member_idnamejoined
m1CarolDec 1
m2DanFeb 4
books never seen
book_idtitlefee
b1Dune3
b2Emma2
loans 2 FK
loan_idmember_idbook_iddue
l1m1b1Jan 14
l2m2b2Feb 20
The four chapters:
  1. The model that can't leave home
  2. Every cell is a token
  3. Four masks and no positions
  4. The verdict: what actually transfers

Chapter one

The model that can't leave home

Feed TinyLibrary to a schema-specific model like RelGT. The very first encoder, the one that stamps each token with its table, is a lookup with exactly three entries: customers, transactions, products. The word members isn't in it.

TinyShop's graph beside TinyLibrary's, with an arrow into a RelGT tokenizer box whose type lookup has only three entries; a red X marks lookup failure on 'members'.
Not wrong: unable to run. Every model in that family has this property: train it on one database and it can never leave home.

What we're actually asking for

In language, one pretrained model does your email, your code, your homework, and nobody retrains it per task; you describe the task in the input and the same frozen weights handle it. Notice what moved: the task used to live in the weights, and now it lives in the input. That single sentence is the most important design idea in the paper.

Databases are the hard case for this. A language model succeeds partly because it has read the internet: ask about Paris and it remembers Paris. Your company's database is proprietary. Alice's purchase history appears in no pretraining corpus. There is no Paris to remember. So if a pretrained model is going to help on your database, whatever it learned must be deeper than facts: some pattern that a shop, a Formula One season and a library all share. Does such a pattern even exist? That's the real scientific question, and chapter four settles it with evidence.

The goal, stated precisely: zero-shot relational learning: predict new targets, on a new database, with a new schema, with no weight updates. Everything the model knows about your database has to fit through one channel: the context window.

Three routes that fail

Route one: just retrain per database. The industry default, and it isn't stupid, just expensive, and it transfers nothing. Your rel-f1 model spent millions of steps learning things like recent behaviour predicts future behaviour, which is obviously not about Formula One. But it lives smeared across weights shaped like the rel-f1 schema, so the library relearns it from zero. The requirement this failure hands us is brutal and precise: no parameter may be tied to any table, column, or task. The paper's word is schema-agnostic, and the test is: could these exact frozen weights accept a database they've never seen and produce a prediction?

Route two: serialise the database to text and ask a language model. This one genuinely runs on any schema; text is text. So before looking at how well it does, we need a judge. Here is the pettiest baseline imaginable: to predict whether Alice churns, take Alice's own past churn labels and answer their average. It's called EntityMean and it has zero parameters.

The purple churn task table with Bob's row highlighted, and the computation EntityMean(Bob) = 1/1 = 1.0.
Bob has one past row, a yes, so EntityMean says he churns. A brand-new customer with no history gets the global average. No training, no GPU, no dignity, and any model with billions of parameters had better beat it.
Table 1's mean AUROC row: language models at 63.3, 62.4 and 64.6, EntityMean at 66.7, RT at 69.7.
Across ten classification tasks on six real databases: Gemma3-27B scores 64.6 mean AUROC; EntityMean scores 66.7. The 27-billion-parameter model loses to the zero-parameter average-repeater, while burning ~100,000× the compute. On regression it collapses to R² below −9, nine times further from the mean than just answering the mean.

R² vocabulary, since it recurs: 1 is perfect, 0 means you did no better than always guessing the global average, and negative means worse than that.

Route three: flatten the database into one table and use a tabular foundation model. Those do transfer: they dodge route one's trap by refusing to learn any column's identity, treating a table as anonymous streams of numbers. Hold onto that idea; the paper steals a piece of it. But they read exactly one table.

TinyShop's three tables joined into one wide flat table, with Alice's repeated fields tinted red and the churn label duplicated with question marks.
Join and glue, and Alice's signup date is copied into every one of her rows, ten thousand times for a real customer. Worse: the question lives at the customer level, so which row is "Alice"? All of them and none. Her three purchases, in an order, with gaps, become disconnected rows that no longer know they're siblings. The relational structure was the signal, and joining destroyed it.

Three dead routes, four requirements:

  1. No parameter tied to any table, column, or task.
  2. The task is specified in the input, so one frozen model serves every question.
  3. We need the meaning of names, that price of product and fee of book rhyme, without paying 27 billion parameters for it.
  4. The pointer structure stays first-class. Never joined away.

Which leaves the design question. Every input representation we've used was built from schema-shaped pieces: whole rows, typed nodes. What is the smallest piece of any database that looks the same in every database?

Zooming into the products table to a single cell, 999, which becomes the triple 999, price, product.
Not the table; every database has different ones. Not the row; its width and meaning are schema. Go smaller. A single cell: a value, plus the two words the schema hands you for free. 999, price, of product. Every cell in every database has exactly this shape.

Chapter two

Every cell is a token

The purple table, and one task to rule them all

For some questions the answer is already a cell: a missing age, a missing category. Hide it, guess it; that's autocomplete. But the questions businesses pay for, like will Alice churn next month, have answers in no table at all, because they're about the future. So build them a table. One row per question: which entity, as of which date, and what the answer turned out to be.

Yes, the label is computed from the future. That's legal: it's the answer sheet, not the input. The law we keep is that the model's input never crosses the question's date.

Two masked cells, a customer's signup date and a task row's churn cell, collapsing into one card reading masked token prediction: hide a cell, predict it.
Hide Alice's signup date: autocomplete. Hide the churn cell in her February task row: forecasting. Same operation. Every task (pretraining, zero-shot, autocomplete, churn, sales) becomes the single move: fill in the masked cell.

And the quiet consequence, which becomes chapter four's loaded gun: because the task table is just another table wired in by a foreign key, the model's input for Alice's February question naturally includes her older task rows. Her past answers ride along in the context.

The atom becomes a vector

A cell is a value and two names. To feed a transformer, that triple has to become one vector, and the paper builds it in two halves.

The value half. Cells come in four flavours (numbers, booleans, dates, text) and get four encoders, per datatype, not per column. That distinction is everything: a per-column encoder is welded to one schema; a per-datatype encoder works on any database that ever contained a number.

The normalisation r = (v − mu) / sigma computed on TinyShop's price column: (999 − 599)/400 = +1.0 and (199 − 599)/400 = −1.0.
Is 999 big? Depends entirely on the column: huge for a coffee, small for a house. So measure it on the column's own ruler. Every number in every database now speaks the same dimensionless language: how unusual am I, for my column? Dates get one twist: they're normalised on a single global ruler so times can be compared across columns and tables.
The phrase 'price of product' passing through a frozen MiniLM box into a 384-dimensional vector, with 'fee of book' and 'cost of item' as near neighbours on a 2-D map.
The name half, and the fix for the crash that opened this piece. Glue the two words into a phrase and push it through a small frozen language model. Frozen meaning pretrained by someone else and never updated here. It's a dictionary, not a student. price of product, fee of book, cost of item: neighbours, in every database, forever. And it costs 22M parameters, not 27B.

x = W_d · r + W · E_schema(c, t) W_d one small matrix per DATATYPE (4 of them) r the normalised value E_schema the frozen phrase embedding (384-dim) W ONE shared matrix masked cell: x = m_d + W · E_schema(c, t) (value half swapped for a learned mask vector)

The token equation x = W_d r + W E_schema(c,t) annotated on the 999 cell, beside a parameter audit card reading schema-tied parameters: 0.
Four tiny translators, one shared matrix, one frozen dictionary. Count the parameters that care which schema you're on: zero. And the masked token says exactly two things: I am a churn cell of the task table, and I am missing. That token is the question mark the whole context exists to answer.

The dog that didn't bark

A language model stamps each token with its position, because sentences have an order. The RelGT glued five stamps onto every token. This paper adds none.

Shuffling TinyShop's rows, swapping its columns and reordering its tables, each marked 'same database'.
Shuffle the rows. Is it a different shop? Swap two columns? Reorder the tables? The data is identical. A database is a set of facts, not a sequence. Any position stamp would invent an ordering the data never had, and the model would learn superstitions about it, then drag them to the next database.
Context cells scattered loosely, with 999 and iPhone drifting apart under a red question 'same row??'.
But strip positions and attention sees a bag of vectors: nothing says 999 and iPhone come from the same row. RelGT solved this by stuffing structure into each token. This paper does something sneakier: the structure moves out of the tokens entirely, into the wiring of attention: who may look at whom.

A supplement, if the sampler went past too fast

The model never sees the whole database; rel-amazon has 41 million rows. It sees a context window: a budget of cells (1,024 in the paper) crawled outward from the masked task row, with two deliberate asymmetries. Parents, the rows your foreign keys point at, are followed always, because a transaction row is almost nothing without its customer and its product. Children are subsampled to a width, because a customer may have ten thousand transactions and the returns diminish. A temporal filter drops anything after the question's date.

There is more in Algorithm 1 than this box holds: the dedup rules, why parents need no time filter, what the width knob actually buys. If you want it walked line by line, ask and I'll write it up.

Chapter three

Four masks and no positions

Attention, in one breath: every token asks a question with its query, offers an answer with its key, the match becomes a score, scores go through a softmax, and each token walks away with a weighted blend of everyone's values. The only new word is mask. Take the score table and, before the softmax, overwrite the forbidden pairs with −∞.

Scores [2,1,0,−1] softmaxing to [0.64, 0.24, 0.09, 0.03], then with two entries set to minus infinity giving [0.88, 0, 0.12, 0].
Why −∞? Because the softmax exponentiates, and e−∞ is exactly zero. Not small: zero. The forbidden tokens get none, and the survivors re-balance to sum to one. Attention now has an off switch, wired per pair of tokens.

Language models use one famous mask: each word sees only the past. This paper's entire trick is to use four masks, and let the database schema write them. Every token already knows three things for free (its column, its table, its row) and those three facts do all the work positions ever did.

An 8×8 attention grid with yellow cells marking column attention, and the masked churn cell's link to a past churn answer circled.
Mask 1: column attention. You may look at tokens from your own column. What does a column-restricted layer learn? What values in this column look like: their range, their rhythm. And notice what the schema just did: the question mark is wired directly to Alice's past answers. Keep your hand on that wire.
The same 8×8 grid with green cells marking feature attention, own row plus parent rows, beside a sketch of a task row gluing to a customer row.
Mask 2: feature attention. Your own row, plus the rows your row points at. Recognise it? It's a join, except nobody materialised a joined table; the mask performs it inside attention, fresh, every layer. This is also the answer to the bag problem: 999 and iPhone share a row, so they see each other.
The grid with blue cells marking neighbour attention, Alice's row glowing with arrows from her children, and a card reading 'this IS message passing, the GNN reborn as a mask'.
Mask 3: neighbour attention. The reverse direction: the rows that point at you. An entity updating itself by aggregating over its children. You've met this. It's message passing. The GraphSAGE step, reborn as one mask among four.
The four mask grids as a souvenir strip: column in yellow, feature in green, neighbour in blue, full attention in red.
Mask 4: full attention, i.e. no mask at all. Why keep it? Reach. The three local masks move information one relationship at a time, exactly like a GNN moves one edge per layer. Full attention goes anywhere in one step.

One block is: column attention, add and normalise; feature, add and normalise; neighbour, add and normalise; full, add and normalise; then a feed-forward network. Stack twelve. The authors tried all six orderings of the three relational masks, and running them in parallel: differences within noise. What matters is that each constraint exists, not when it runs.

12 blocks · d = 256 · 22M parameters · 1,024-cell context 50k steps · ~2 hours on 8 A100s one objective (fill the masked cell) for pretraining, fine-tuning AND inference

The four mask grids stamped with theory's verdicts: column redundant, neighbour simulable, feature special, full essential.
Now ask a theorist which masks are logically necessary. Column attention? Redundant: a full head can learn to imitate it. Neighbour? Also simulable. Feature is genuinely special, and full is what gives the architecture its reach. So theory's ranking: full essential, column dead weight. Lock in whether you believe it.

Chapter four

The verdict: what actually transfers

Read the setup before trusting any number. Pretraining is leave-one-database-out: six databases, pretrain on five, target unseen. And a control in the appendix kills the obvious objection: the column-name overlap between pretraining and target schemas is essentially zero, at most 4.3%. Whatever transfers, it isn't lexical memorisation.

Table 1's mean row with RT at 69.7 in the unseen-database column and 71.9 with continued pretraining, plus the rel-avito row where EntityMean scores 44.7 and RT 59.5.
RT is 69.7, in the strict unseen-database column, the only method above the repeater's 66.7 (71.9 with continued pretraining on the target database, never the task). But one cell matters more than the mean: on rel-avito ad clicks EntityMean scores 44.7, below a coin flip, because past clicking actively misleads about future clicking. RT gets 59.5. Where averaging works, RT rides it; where averaging fails, RT survives it.

On the Formula One podium task, on a database RT met at inference time, EntityMean gets 85.0 and RT gets 89.3. Gemma-27B actually beats both at 91.4, and it's worth noting why: Formula One is famous, and its data is plausibly in the giant's training corpus. Watch what happens to that advantage when the data isn't famous.

Table 10's mean strips with RelGT and RT columns circled: 76.2 vs 77.2 on classification, 9.4 vs 33.2 on regression, and driver-top3 83.5 vs 91.9.
The moment this post owes the previous one: fully supervised fine-tuning, where schema-specific models were supposed to be untouchable. RelGT 76.2 classification, RT 77.2, close, and RelGT still wins several tasks. But regression: RelGT 9.4, RT 33.2. And on the podium task (1,400 training examples, the smallest in the benchmark) 83.5 vs 91.9. Where data is scarce, the pretraining head start is worth eight points. (Caveat the authors flag: baselines ran per-task tuned setups; RT ran one config for everything.)

The detective story

So it works. Now the question loaded since chapter one: why does a model pretrained on shops and forums predict Formula One? Four suspects: schema semantics, in-context learning from other entities' labels, the entity's own past labels, and the architecture itself. The authors interrogate each by deleting it and measuring the damage.

Table 4's context ablations: full context 70.1/22.8, minus other labels 70.6, minus column names 69.5/20.5, minus self labels 53.8 and −5.5 flashed red.
Remove other entities' labels: 70.6, nothing, better if anything. In-context learning acquitted. Shuffle the column and table names: 69.5, a real but mild bruise; semantics matter but aren't the engine. Remove the entity's own past labels: 53.8, and regression falls to −5.5. The full model's edge over a coin flip was 20 points; this keeps under 4 of them.

There's the confession. What transfers, above all, is the ability to read an entity's past answers and forecast the next one: time-series forecasting, learned once, applied to any schema. The label counts cross-examine cleanly: Formula One driver reliability averages 19 self labels per window and scores 82.0; the podium task 17 labels, 89.1; clinical trial study-outcome has zero self labels (a study's outcome is asked once) and scores 54.5.

Two rebuttals before writing it off as a dressed-up average. The rel-avito cell above, where averaging is worse than chance and RT still gets 59.5. And the cleanest version of the question: delete self labels and fine-tune anyway: transfer from pretraining survives, positive but modest, 26.7 against 33. The magic is mostly the labels; not only the labels.

Table 5's mean R² row: all four masks 22.8, minus column 11.9 in red, minus feature 18.8, minus neighbour 22.0, minus full 23.7 in green marked UP.
And theory's bet, graded. All four masks: 22.8. Remove column attention, the theoretically redundant one, and the mean halves to 11.9. Remove full attention, theory's king: 23.7. It goes up.

The honest reading, flagged as speculation: what generalises to an unseen schema is the disciplined operations: compare within a column, join a row to its parents. Unrestricted attention learns pretraining-specific shortcuts that mean nothing on a new database. The constraints are the transfer. Scope it carefully though: after fine-tuning all four columns blur back together, and on classification the differences were minor all along. The upset is a zero-shot regression story.

The paper's own final ranking of what drives zero-shot transfer:

  1. Time-series forecasting from the entity's own past labels
  2. Column attention, generalising to new value distributions
  3. Feature attention, generalising to new entity types
  4. Schema semantics from table and column names
  5. In-context learning from other entities' task rows

Honest limits

Could you have invented it?

A cell is the only schema-proof atom: a value and two names, the names read by a frozen language model so unseen columns still mean something. Staple the task on as another table and every question becomes fill in the masked cell. Drop positions, because a database has no order. Then put the structure back as constraints on who may look at whom: same column, same row and parents, children, everyone. Five moves, each forced by the last.

And the finding I keep turning over: the theoretically indispensable component was dead weight, and the theoretically redundant one was load-bearing. Restricting what a model is allowed to look at turned out to be the thing that travels.


Paper: Relational Transformer: Toward Zero-Shot Foundation Models for Relational Data, Ranjan et al., ICLR 2026. Figures are stills I built while working through it; the prequel notes are here. Corrections very welcome: surajprasad8977@gmail.com.