Skip to main content

TabICL: A Tabular Foundation Model for In-Context Learning on Large Data

Project description

test

TabICL: A Tabular Foundation Model for In-Context Learning on Large Data

TabICL is a tabular foundation model like TabPFN. Currently, TabICL is only for classification tasks.

Architecture

TabICL processes tabular data through three sequential stages:

  1. Column-wise Embedding: Creates distribution-aware embeddings for each feature
  2. Row-wise Interaction: Captures interactions between features within each row
  3. Dataset-wise In-Context Learning: Learns patterns from labeled examples to make predictions
The architecture of TabICL

Installation

pip install tabicl

Usage

Basic Usage

from tabicl import TabICLClassifier

clf = TabICLClassifier()
clf.fit(X_train, y_train)  # this is cheap
clf.predict(y_test)  # in-context learning happens here

The code above will automatically download the pre-trained checkpoint (~100MB) from Hugging Face Hub on first use and choose a GPU if available.

Advanced Configuration

TabICL offers a set of parameters to customize its behavior. The following example shows all available parameters with their default values and brief descriptions:

from tabicl import TabICLClassifier

clf = TabICLClassifier(
  n_estimators=32,                  # number of ensemble members
  norm_methods=["none", "power"],   # normalization methods to try
  feat_shuffle_method="latin",      # feature permutation strategy
  class_shift=True,                 # whether to apply cyclic shifts to class labels
  outlier_threshold=4.0,            # z-score threshold for outlier detection and clipping
  softmax_temperature=0.9,          # controls prediction confidence
  average_logits=True,              # whether ensemble averaging is done on logits or probabilities
  use_hierarchical=True,            # enable hierarchical classification for datasets with many classe
  batch_size=8,                     # process this many ensemble members together (reduce RAM usage)
  use_amp=True,                     # use automatic mixed precision for faster inference
  model_path=None,                  # where the model checkpoint is stored
  allow_auto_download=True,         # whether automatic download to the specified path is allowed
  device='cpu',                     # specify device for inference
  random_state=42,                  # random seed for reproducibility
  verbose=False                     # print detailed information during inference
)

Memory-Efficient Inference

TabICL includes memory management to handle large datasets:

  • Memory Profiling: Built-in memory estimators for different components of the model
  • Batch Size Estimation: Dynamically determines optimal batch sizes based on available GPU memory
  • CPU Offloading: Automatically offloads intermediate results to CPU when beneficial
  • OOM Recovery: Recovers gracefully from out-of-memory errors by reducing batch size

Preprocessing

If the input X to TabICL is a pandas DataFrame, TabICL will automatically:

  • Detect and ordinal encode categorical columns (including string, object, category, and boolean types)
  • Create a separate category for missing values in categorical features
  • Perform mean imputation for missing numerical values (encoded as NaN)

If the input X is a numpy array, TabICL assumes that ordinal encoding and missing value imputation have already been performed.

For both input types, TabICL applies additional preprocessing:

  • Outlier detection and removal
  • Feature scaling and normalization
  • Feature shuffling for ensemble diversity

Key Features and Considerations:

  • Number of samples:
    • TabICL is pretrained on datasets with up to 60K samples.
    • TabICL can handle datasets beyond 100K samples thanks to memory-efficient inference.
    • TabPFN (v2) is on average better than TabICL on small datasets with <10K samples, while TabICL is better on larger datasets.
    • Classical methods may catch up with TabICL at around 40K samples but they are much slower due to extensive hyperparameter tuning.
Ranking vs. number of samples
  • Number of features:

    • TabICL is pretrained on datasets with up to 100 features.
    • TabICL can accommodate any number of features theoretically.
  • Number of classes:

    • TabICL is pretrained on datasets with up to 10 classes, so it natively supports a maximum of 10 classes.
    • However, TabICL can handle any number of classes thanks to its in-built hierarchical classification.
  • Inference speed:

    • Like TabPFN, fit() does minimal work while predict() runs the full model
    • At the same n_estimators, TabICL is usually 1x-5x faster than TabPFN
    • TabICL benefits more from larger n_estimators, hence the default of 32
    • Automatic mixed precision (AMP) provides further speed improvements on compatible GPUs
  • No tuning required: TabICL produces good predictions without hyperparameter tuning, unlike classical methods that require extensive tuning for optimal performance.

Performance

TabICL has achieved excellent results on the TALENT benchmark.

Performance on TALENT

Code Availability

This repository currently only contains the inference code for TabICL. The pretraining code will probably be released in the future.

Citation

If you use TabICL for research purposes, please cite our paper:

@article{qu2025tabicl,
  title={TabICL: A Tabular Foundation Model for In-Context Learning on Large Data},
  author={Qu, Jingang and Holzm{\"u}ller, David and Varoquaux, Ga{\"e}l and Morvan, Marine Le},
  journal={arXiv preprint arXiv:2502.05564},
  year={2025}
}

Contributors

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tabicl-0.0.1.tar.gz (40.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tabicl-0.0.1-py3-none-any.whl (48.8 kB view details)

Uploaded Python 3

File details

Details for the file tabicl-0.0.1.tar.gz.

File metadata

  • Download URL: tabicl-0.0.1.tar.gz
  • Upload date:
  • Size: 40.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for tabicl-0.0.1.tar.gz
Algorithm Hash digest
SHA256 f351e41d4fa338eaff7cdfb3abba745dbb9b966c6b7a7596a6d180c07e81551c
MD5 255455a61a4672845ea6e9ca6520d739
BLAKE2b-256 d26883c7f1f7b3f3e215b1787cba6dd81c6d0d9057d8768622302825cc1757b1

See more details on using hashes here.

File details

Details for the file tabicl-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: tabicl-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 48.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for tabicl-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d262acc8f1a4022c9d84e4eed4cfe815c114e5aa7e785fe8825d21091b4e8eb8
MD5 29ccc6e71f58e2b466a78ef7e4ea4d0a
BLAKE2b-256 d97d54a31c9499b99cb513da385b4819015a7d071d7e47bc4c18437fc4ce0180

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page