# priorlabs/tabpfn-rel architecture

> Architecture diagram of the GitHub repository priorlabs/tabpfn-rel, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/priorlabs/tabpfn-rel
- Repository: https://github.com/priorlabs/tabpfn-rel

## Overview

TabPFN-Rel turns a relational prediction task into entity-level predictions: callers create a predictive context and query, choose a hosted or local model, and fit and predict through the public estimator. The model builds relational features, adds optional calendar, history, and text signals, selects training contexts, and fits a TabPFN backend; regression may use a two-stage hurdle model. The excerpts show the main orchestration and feature/context behavior. Some model methods are incomplete in the excerpts, so uncertain internal links are omitted.

Main entry points: [`src/tabpfn_rel/model.py`](https://github.com/priorlabs/tabpfn-rel/blob/main/src/tabpfn_rel/model.py) (RelArena model), [`src/tabpfn_rel/features.py`](https://github.com/priorlabs/tabpfn-rel/blob/main/src/tabpfn_rel/features.py) (Feature pipeline), [`src/tabpfn_rel/estimator.py`](https://github.com/priorlabs/tabpfn-rel/blob/main/src/tabpfn_rel/estimator.py) (TabPFNRel API), [`src/tabpfn_rel/tfm.py`](https://github.com/priorlabs/tabpfn-rel/blob/main/src/tabpfn_rel/tfm.py) (TFM recipes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Public prediction API"]
  node_estimator["TabPFNRel API<br/>[estimator.py]"]
end

subgraph group_prep["Relational feature preparation"]
  node_dfs["Deep feature synthesis<br/>[model.py]"]
  node_featurepipe["Feature pipeline<br/>[features.py]"]
  node_calendar["Calendar features<br/>[features.py]"]
  node_history["History lags<br/>[features.py]"]
  node_text["Anchor text<br/>[features.py]"]
end

subgraph group_modeling["Model fitting"]
  node_relmodel["RelArena model<br/>[model.py]"]
  node_contexts["Context selection<br/>[context.py]"]
  node_hurdle["Hurdle regression<br/>[hurdle.py]"]
end

subgraph group_inference["Inference backends"]
  node_tfm["TFM recipes<br/>[tfm.py]"]
end

node_caller(("Task caller"))
node_context["Predictive context"]
node_query["Prediction query"]
node_local["Local TabPFN"]
node_hosted["Hosted TabPFN API"]

node_caller -->|"defines task"| node_context
node_caller -->|"defines query"| node_query
node_caller -->|"fits and predicts"| node_estimator
node_estimator -->|"fits context"| node_context
node_estimator -->|"forwards query"| node_query
node_relmodel -->|"builds features"| node_dfs
node_relmodel -->|"augments features"| node_featurepipe
node_featurepipe -->|"adds calendar"| node_calendar
node_featurepipe -->|"adds lags"| node_history
node_featurepipe -->|"attaches text"| node_text
node_relmodel -->|"selects contexts"| node_contexts
node_contexts -->|"fits TFM"| node_tfm
node_relmodel -->|"fits regression stages"| node_hurdle
node_tfm -->|"constructs local estimator"| node_local
node_tfm -->|"constructs API estimator"| node_hosted

click node_estimator "https://github.com/priorlabs/tabpfn-rel/blob/main/src/tabpfn_rel/estimator.py"
click node_relmodel "https://github.com/priorlabs/tabpfn-rel/blob/main/src/tabpfn_rel/model.py"
click node_dfs "https://github.com/priorlabs/tabpfn-rel/blob/main/src/tabpfn_rel/model.py"
click node_featurepipe "https://github.com/priorlabs/tabpfn-rel/blob/main/src/tabpfn_rel/features.py"
click node_calendar "https://github.com/priorlabs/tabpfn-rel/blob/main/src/tabpfn_rel/features.py"
click node_history "https://github.com/priorlabs/tabpfn-rel/blob/main/src/tabpfn_rel/features.py"
click node_text "https://github.com/priorlabs/tabpfn-rel/blob/main/src/tabpfn_rel/features.py"
click node_contexts "https://github.com/priorlabs/tabpfn-rel/blob/main/src/tabpfn_rel/context.py"
click node_hurdle "https://github.com/priorlabs/tabpfn-rel/blob/main/src/tabpfn_rel/hurdle.py"
click node_tfm "https://github.com/priorlabs/tabpfn-rel/blob/main/src/tabpfn_rel/tfm.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_estimator toneBlue
class node_dfs,node_featurepipe,node_calendar,node_history,node_text toneAmber
class node_relmodel,node_contexts,node_hurdle,node_hosted toneMint
class node_tfm,node_caller toneRose
class node_context,node_query,node_local toneIndigo
```

## Components

### Public prediction API

- [TabPFNRel API](https://github.com/priorlabs/tabpfn-rel/blob/main/src/tabpfn_rel/estimator.py): `src/tabpfn_rel/estimator.py`

### Relational feature preparation

- [Deep feature synthesis](https://github.com/priorlabs/tabpfn-rel/blob/main/src/tabpfn_rel/model.py): `src/tabpfn_rel/model.py`
- [Feature pipeline](https://github.com/priorlabs/tabpfn-rel/blob/main/src/tabpfn_rel/features.py): `src/tabpfn_rel/features.py`
- [Calendar features](https://github.com/priorlabs/tabpfn-rel/blob/main/src/tabpfn_rel/features.py): `src/tabpfn_rel/features.py`
- [History lags](https://github.com/priorlabs/tabpfn-rel/blob/main/src/tabpfn_rel/features.py): `src/tabpfn_rel/features.py`
- [Anchor text](https://github.com/priorlabs/tabpfn-rel/blob/main/src/tabpfn_rel/features.py): `src/tabpfn_rel/features.py`

### Model fitting

- [RelArena model](https://github.com/priorlabs/tabpfn-rel/blob/main/src/tabpfn_rel/model.py): `src/tabpfn_rel/model.py`
- [Context selection](https://github.com/priorlabs/tabpfn-rel/blob/main/src/tabpfn_rel/context.py): `src/tabpfn_rel/context.py`
- [Hurdle regression](https://github.com/priorlabs/tabpfn-rel/blob/main/src/tabpfn_rel/hurdle.py): `src/tabpfn_rel/hurdle.py`

### Inference backends

- [TFM recipes](https://github.com/priorlabs/tabpfn-rel/blob/main/src/tabpfn_rel/tfm.py): `src/tabpfn_rel/tfm.py`

### Other components

- **Task caller**
- **Predictive context**
- **Prediction query**
- **Local TabPFN**
- **Hosted TabPFN API**

## Connections

- Task caller → Predictive context: defines task (evidence: `README.md`)
- Task caller → Prediction query: defines query (evidence: `README.md`)
- Task caller → TabPFNRel API: fits and predicts (evidence: `README.md`)
- TabPFNRel API → Predictive context: fits context (evidence: `src/tabpfn_rel/estimator.py`)
- TabPFNRel API → Prediction query: forwards query (evidence: `src/tabpfn_rel/estimator.py`)
- RelArena model → Deep feature synthesis: builds features (evidence: `src/tabpfn_rel/model.py`)
- RelArena model → Feature pipeline: augments features (evidence: `src/tabpfn_rel/model.py`)
- Feature pipeline → Calendar features: adds calendar (evidence: `src/tabpfn_rel/features.py`)
- Feature pipeline → History lags: adds lags (evidence: `src/tabpfn_rel/features.py`)
- Feature pipeline → Anchor text: attaches text (evidence: `src/tabpfn_rel/features.py`)
- RelArena model → Context selection: selects contexts (evidence: `src/tabpfn_rel/model.py`)
- Context selection → TFM recipes: fits TFM (evidence: `src/tabpfn_rel/context.py`)
- RelArena model → Hurdle regression: fits regression stages (evidence: `src/tabpfn_rel/model.py`)
- TFM recipes → Local TabPFN: constructs local estimator (evidence: `src/tabpfn_rel/tfm.py`)
- TFM recipes → Hosted TabPFN API: constructs API estimator (evidence: `src/tabpfn_rel/tfm.py`)
