Enhanced reimplementation of TabPFN with TabPFN-3 features: Randomized Feature Tokens, NaN handling, regression, ensembling, KV caching, synthetic prior training, and more.
Python
0
2 commits
updated May 19, 2026
Enhanced reimplementation of TabPFN β upgraded from nanoTabPFN toward TabPFN-3.0 parity.
nanoTabPFN-plus adalah reimplementasi edukatif dan fungsional TabPFN yang mengintegrasikan semua fitur utama TabPFN-3:
| Feature | nanoTabPFN (original) | nanoTabPFN-plus |
|---|---|---|
| Randomized Feature Tokens | β | β |
| NaN / Missing value handling | β | β |
| Regression support | β | β |
| Many-class (>10 classes) | β | β |
| Ensembling (n=32+) | β | β |
| KV Caching (faster inference) | β | β |
| Row chunking (scalable to 1M rows) | β | β |
| Temperature calibration | β | β |
| Feature subsampling (high-dim) | β | β |
| DAG-aware synthetic prior | Basic | β SCM-based |
| Multi-task loss (classification + regression) | β | β |
Input (X_train, y_train, X_test)
β
βΌ
βββββββββββββββββββββββββββββββββββ
β RandomizedFeatureTokenEncoder β β NaN handling + per-feature tokens
β AdvancedTargetEncoder β β multi-class + regression + unknown token
ββββββββββββββββ¬βββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββ
β CachedTransformerLayer Γ N β β dual attention (rowβcol) + KV cache
ββββββββββββββββ¬βββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββ
β MultiTaskDecoder β β classification / regression / calibration
βββββββββββββββββββββββββββββββββββ
β
βΌ
Predictions (probs / mean+std)
pip install torch numpy scikit-learn networkx
from model import NanoTabPFNPlusModel
from inference import TabPFN3Classifier
from sklearn.datasets import load_breast_cancer
from sklearn.model_selection import train_test_split
# Load data
X, y = load_breast_cancer(return_X_y=True)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.5)
# Create model
model = NanoTabPFNPlusModel(
embedding_size=128,
num_attention_heads=4,
mlp_hidden_size=256,
num_layers=4,
num_outputs=10,
max_features=500
)
# Create classifier with ensembling
classifier = TabPFN3Classifier(model, device='cpu', n_ensemble=8)
classifier.fit(X_train, y_train)
probs = classifier.predict_proba(X_test)
preds = probs.argmax(axis=1)
from prior import SyntheticTabularPrior
from train import train
prior = SyntheticTabularPrior(
max_rows=1000,
max_cols=100,
num_classes=10,
missing_rate=0.1,
nonlinear_prob=0.5
)
model, history = train(
model=model,
prior=prior,
steps=5000,
batch_size=16,
lr=4e-3
)
| File | Description |
|---|---|
model.py | Core architecture (encoders, transformer, decoder) |
inference.py | Classifier & regressor with ensembling + chunking |
prior.py | SCM-based synthetic dataset generator |
train.py | Training loop with multi-task loss |
benchmark.py | Evaluation against XGBoost, CatBoost, RandomForest |
examples/ | Usage examples |
Apache 2.0 β bebas dipakai untuk proyek komersial maupun non-komersial.
If you use this in research, please cite the original nanoTabPFN and TabPFN papers:
@article{hollmann2025tabpfn,
title={Accurate predictions on small data with a tabular foundation model},
author={Hollmann, Noah and M{\"u}ller, Samuel and Purucker, Lennart and others},
journal={Nature},
year={2025}
}
Based on nanoTabPFN by AutoML Group Freiburg. Upgraded toward TabPFN-3 feature parity.
2 commits
Python
100.0%
Enhanced reimplementation of TabPFN with TabPFN-3 features: Randomized Feature Tokens, NaN handling, regression, ensembling, KV caching, synthetic prior training, and more.
Python
0
2 commits
updated May 19, 2026
Enhanced reimplementation of TabPFN β upgraded from nanoTabPFN toward TabPFN-3.0 parity.
nanoTabPFN-plus adalah reimplementasi edukatif dan fungsional TabPFN yang mengintegrasikan semua fitur utama TabPFN-3:
| Feature | nanoTabPFN (original) | nanoTabPFN-plus |
|---|---|---|
| Randomized Feature Tokens | β | β |
| NaN / Missing value handling | β | β |
| Regression support | β | β |
| Many-class (>10 classes) | β | β |
| Ensembling (n=32+) | β | β |
| KV Caching (faster inference) | β | β |
| Row chunking (scalable to 1M rows) | β | β |
| Temperature calibration | β | β |
| Feature subsampling (high-dim) | β | β |
| DAG-aware synthetic prior | Basic | β SCM-based |
| Multi-task loss (classification + regression) | β | β |
Input (X_train, y_train, X_test)
β
βΌ
βββββββββββββββββββββββββββββββββββ
β RandomizedFeatureTokenEncoder β β NaN handling + per-feature tokens
β AdvancedTargetEncoder β β multi-class + regression + unknown token
ββββββββββββββββ¬βββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββ
β CachedTransformerLayer Γ N β β dual attention (rowβcol) + KV cache
ββββββββββββββββ¬βββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββ
β MultiTaskDecoder β β classification / regression / calibration
βββββββββββββββββββββββββββββββββββ
β
βΌ
Predictions (probs / mean+std)
pip install torch numpy scikit-learn networkx
from model import NanoTabPFNPlusModel
from inference import TabPFN3Classifier
from sklearn.datasets import load_breast_cancer
from sklearn.model_selection import train_test_split
# Load data
X, y = load_breast_cancer(return_X_y=True)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.5)
# Create model
model = NanoTabPFNPlusModel(
embedding_size=128,
num_attention_heads=4,
mlp_hidden_size=256,
num_layers=4,
num_outputs=10,
max_features=500
)
# Create classifier with ensembling
classifier = TabPFN3Classifier(model, device='cpu', n_ensemble=8)
classifier.fit(X_train, y_train)
probs = classifier.predict_proba(X_test)
preds = probs.argmax(axis=1)
from prior import SyntheticTabularPrior
from train import train
prior = SyntheticTabularPrior(
max_rows=1000,
max_cols=100,
num_classes=10,
missing_rate=0.1,
nonlinear_prob=0.5
)
model, history = train(
model=model,
prior=prior,
steps=5000,
batch_size=16,
lr=4e-3
)
| File | Description |
|---|---|
model.py | Core architecture (encoders, transformer, decoder) |
inference.py | Classifier & regressor with ensembling + chunking |
prior.py | SCM-based synthetic dataset generator |
train.py | Training loop with multi-task loss |
benchmark.py | Evaluation against XGBoost, CatBoost, RandomForest |
examples/ | Usage examples |
Apache 2.0 β bebas dipakai untuk proyek komersial maupun non-komersial.
If you use this in research, please cite the original nanoTabPFN and TabPFN papers:
@article{hollmann2025tabpfn,
title={Accurate predictions on small data with a tabular foundation model},
author={Hollmann, Noah and M{\"u}ller, Samuel and Purucker, Lennart and others},
journal={Nature},
year={2025}
}
Based on nanoTabPFN by AutoML Group Freiburg. Upgraded toward TabPFN-3 feature parity.
2 commits
Python
100.0%