Skip to content

Support for synthetic data generation #82

Description

@LckyLke

TabFM does zero-shot classification and regression, but there is no way to generate synthetic rows the way TabPFN v2 does (Hollmann et al., Nature 2025). That capability falls out of an in-context classifier almost for free, so I built it on top of TabFMClassifier. This issue is the background for the PR I'm opening alongside it.

The idea is the usual chain-rule factorization. Columns are visited in a seeded random or user-given order and each column is sampled for all rows at once from a TabFMClassifier that treats the current column as the target and the already sampled columns as features. Everything happens at inference time through the existing sklearn API. No model, architecture or weight changes, and only the classification checkpoint is needed.

Numerical columns use hierarchical quantile refinement so the max_classes limit of 10 does not cap resolution. The column is split into n_bins ** n_levels equal-mass bins (100 by default) and the bin index is sampled digit by digit in base n_bins, with sampled digits appended to the conditioning features. Each level trains on all reference rows, so resolution grows exponentially while cost only grows linearly. Within a bin the value is drawn uniformly, same as TabPFN's bar distribution between borders.

I validated against the released v1.0.0 weights. On a small dataset with known structure the age-income correlation comes out at 0.833 vs 0.817 in the real data, group offsets survive, and per-column KS tests give p between 0.78 and 0.98. On iris the correlation matrix is recovered with 12/12 sign agreement and per-species petal lengths match within about 1%. Sampling temperature shrinks the conditional spread monotonically as intended.

The change is purely additive. One new module with an sklearn-style fit/sample API, tests for both backends using tiny random models (no weight downloads), BUILD registration, an example script and a README section. Categorical columns beyond max_classes fall back to top-k with an empirically re-sampled tail. Things not covered yet are extrapolation beyond the observed min/max, causal column ordering and missingness simulation.

The PR has the full implementation, tests for both backends, the example and the docs. Feedback on scope or the approach is very welcome.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions