FirePFN / README.md
LeCramHan's picture
Update README.md
c831669 verified
|
Raw History Blame Contribute Delete
4.95 kB
---
license: other
license_name: bsd-3-clause-and-openmdw-1.1
license_link: LICENSE.md
pipeline_tag: tabular-classification
library_name: pytorch
tags:
- tabular
- tabular-classification
- in-context-learning
- prior-data-fitted-network
- foundation-model
base_model: nvidia/Kumo-Tabular
---
# FirePFN
FirePFN is a tabular foundation model for classification by in-context learning: you pass a
labeled training table and the model predicts the test rows in a single forward pass, with no
training or hyperparameter tuning per dataset. Its cost grows linearly with the number of
training rows, so it handles tables with millions of rows on one GPU.
- **Code:** <https://github.com/LUH-AI/FirePFN>
- **License:** BSD-3-Clause for the FirePFN parameters, OpenMDW-1.1 for the embedded NVIDIA
Kumo-Tabular encoder (see [License](#license))
## Model
| | |
|---|---|
| Parameters | 55.7M, of which 10.0M are the frozen Kumo-Tabular encoder |
| File | `fire-pfn.ckpt`, 223 MB, float32 weights (inference runs in bf16) |
| Task | classification; up to 10 classes directly, more via error-correcting output codes |
| Training data | synthetic tables only (TabICLv2 `graph_scm` prior); no real-world data |
Architecture:
- **Row embedding:** NVIDIA's pretrained Kumo-Tabular table encoder (large classifier,
revision `v1.0.1`), kept frozen.
- **Backbone:** 6 blocks that mix the context rows, in the pattern
`ssm, ssm, attn, ssm, deltanet, attn`: bidirectional Mamba-3 SSM, gated linear attention and
Gated DeltaNet.
- **Prediction:** test rows read the context through a cross-attention with a length-aware
temperature; a decoder outputs the class probabilities.
Training ran in two stages: stage 1 from scratch for 1000 epochs, then stage 2 with context
lengths up to 32,768 rows, run as three 250-epoch cosine learning-rate cycles, each continuing
from the previous cycle's final model. The released checkpoint is the final model of the third
cycle.
## Usage
Requires a CUDA GPU (the backbone uses Triton kernels).
```bash
pip install torch # >= 2.9.1, CUDA build
pip install mamba-ssm # >= 2.3.2, with the Mamba-3 kernels
pip install git+https://github.com/LUH-AI/FirePFN
```
```python
from huggingface_hub import hf_hub_download
from firepfn import FirePFNClassifier
ckpt = hf_hub_download("LUH-AI/FirePFN", "fire-pfn.ckpt")
clf = FirePFNClassifier(model_path=ckpt)
clf.fit(X_train, y_train)
proba = clf.predict_proba(X_test)
```
`X` can be a NumPy array or a pandas DataFrame with numeric features; missing values (NaN) are
allowed. The defaults follow the paper's evaluation protocol: at most 200 features (selected by
ANOVA F-score), at most 100,000 context rows (a stratified random subset of larger training sets;
`max_context_rows=None` uses every row), one ensemble member, softmax temperature 1.0. See the
`FIREPFNClassifier` docstring for ensembling and many-class strategies.
For DataFrames with categorical or string columns, wrap the classifier:
```python
from firepfn.encoding import make_dataframe_classifier
clf = make_dataframe_classifier(FIREPFNClassifier(model_path=ckpt))
clf.fit(X_train_df, y_train)
proba = clf.predict_proba(X_test_df)
```
Categorical columns with more than 500 distinct values are target-encoded (except date/time-like
and entity-ID-like columns); all other non-numeric columns are ordinal-encoded.
The checkpoint can be loaded with `torch.load(..., weights_only=True)`. It holds the
`state_dict`, the complete model `config` and a `meta` dictionary with its provenance and
license.
## Evaluation
The GitHub repository contains the evaluation code (TabArena and runtime scaling), the per-split
results of this checkpoint (with the default settings above) and 12 baselines on TabArena,
TALENT, BeyondArena and RamanBench, and the scripts that produce the paper's tables and plots.
## Limitations
- **Classification only.** There is no regression head.
- **GPU required.** It does not run on CPU.
- **Small run-to-run differences.** Predicted probabilities can differ slightly between processes
(up to about 1e-2), because the Triton kernels choose their configuration by timing and bf16
rounding then differs. Within one process, results are deterministic.
- **Synthetic training data.** The model was trained only on synthetic data. Check its
predictions on your own data before relying on them, particularly in high-stakes settings.
## License
The checkpoint contains parameters under two licenses (details in [LICENSE.md](LICENSE.md)):
- **FirePFN parameters** (everything except `table_encoder.*`): BSD 3-Clause License,
[LICENSE-BSD-3-Clause.txt](LICENSE-BSD-3-Clause.txt).
- **Kumo-Tabular encoder** (`table_encoder.*`, NVIDIA, unmodified and frozen): OpenMDW License
Agreement 1.1, [LICENSE-OpenMDW-1.1.txt](LICENSE-OpenMDW-1.1.txt). If you redistribute these
parameters, keep that license text and NVIDIA's copyright notice with them.