Skip to content

R torch TabPFN implementation - #143

Merged
topepo merged 15 commits into
mainfrom
tab-pfn
Oct 8, 2026
Merged

topepo merged 15 commits into
mainfrom
tab-pfn

Conversation

@topepo

@topepo topepo commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

See the slowness note in #144

This also makes the long CI run even longer.

@topepo
topepo marked this pull request as ready for review October 6, 2026 00:21
@topepo topepo mentioned this pull request Oct 6, 2026
@topepo
topepo requested a review from edgararuiz October 6, 2026 17:42

@edgararuiz edgararuiz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also ran roborev review on this branch and these are the items it returned:

Findings

1. Medium

Location: R/tabpfn-fit.R:391

Problem: tabpfn_sample_rows() is not robust: a constant numeric outcome
produces only one quantile breakpoint, causing cut() to fail, while
per-stratum ceiling() can select more than training_set_limit rows (for
example, four classes with a limit of three selects at least four).

Fix: Use an exact-size allocation across strata, reject classification
limits below the number of classes, and handle constant numeric outcomes
without quartile cutting.

2. Medium

Location: R/tabpfn-fit.R:365

Problem: The bridge extracts the first outcome without validating that
outcomes are univariate or complete. A multi-column y is silently truncated,
while one NA in a numeric outcome makes target scaling NA and can fail the
default safepower members or produce invalid predictions.

Fix: Validate processed$outcomes as univariate, then reject or remove
rows with missing outcomes before sampling and target scaling.

3. Medium

Location: R/tabpfn-fit.R:323

Problem: softmax_temperature = 0 passes validation but is later used as a
divisor, producing infinite logits and generally NaN probabilities or
regression predictions.

Fix: Require softmax_temperature to be strictly greater than zero.

4. Medium

Location: R/tabpfn-predict.R:71

Problem: Zero-row new_data is still sent through inference. For
nonconstant regression and classification fits, both model versions evaluate
(num_train + 1):num_train, which is a descending two-element index rather
than an empty test slice, so prediction fails instead of returning zero rows.

Fix: After forging, short-circuit zero-row inputs and construct the
correctly typed empty prediction columns.

5. Medium

Location: R/pretrained-weights.R:107

Problem: The downloader ignores the return value of file.rename() and
reports success even if the completed temporary file could not be installed,
such as when the destination is locked on Windows or created concurrently.

Fix: Check that file.rename() succeeds and that the destination exists;
retry or abort with an actionable error otherwise.

Comment thread R/tabpfn-checkpoint.R Outdated
Comment thread R/tabpfn-checkpoint.R Outdated
Comment thread R/tabpfn-checkpoint.R Outdated
Comment thread R/tabpfn-checkpoint.R Outdated
Comment thread R/tabpfn-fit.R Outdated
@topepo
topepo merged commit e702ab9 into main Oct 8, 2026
13 checks passed
@topepo
topepo deleted the tab-pfn branch October 8, 2026 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants