Skip to navigation

Overview

View as Markdown

Structured Data Models (sdm) is an open source PyTorch library for pretrained foundation models on structured data. You give a model labeled example rows at inference time, and it predicts new rows in a single forward pass, with no task-specific training.

Run Your First Prediction

This example classifies breast tumors from 30 numerical features with Kumo Tabular. It runs on a CPU, needs no Hugging Face account, and downloads about 115 MB of weights on first use.

pip install structured-data-models
import torch
from sklearn.datasets import load_breast_cancer
import sdm
from sdm.evaluation import to_class_indices
device = "cuda" if torch.cuda.is_available() else "cpu"
# 1. Load a table and declare column semantic types
df = load_breast_cancer(as_frame=True).frame
table = sdm.TableTensor.from_pandas(
df=df,
stypes=sdm.infer_stypes(df, overrides={"target": "categorical"}),
device=device,
)
context, query = table[:300], table[300:]
# 2. Load pretrained Kumo Tabular (weights download on first use)
model = sdm.models.KumoTabular(task="classification", size="small", device=device)
# 3. Predict query rows from labeled context rows, with no training
probs = model(
x_context=context.drop_columns("target"),
y_context=context["target"],
x_query=query.drop_columns("target"),
num_estimators=8,
generator=torch.Generator(device=device).manual_seed(0),
)
print(probs.to_pandas().head(3))
# 4. Score the predictions
scores, labels = to_class_indices(probs, query["target"])
accuracy = (scores.argmax(dim=-1) == labels).float().mean()
print(f"Accuracy: {accuracy:.3f}")
Expected output
0 1
0 0.999958 0.000042
1 0.000192 0.999808
2 0.999905 0.000095
Accuracy: 0.974

Each output column holds the probability of one class, named by its label. The model used 300 labeled rows as context and predicted the other 269. To run regression, reuse context across batches, and move to a GPU, continue with the Quickstart.

Model Portfolio

NVIDIA publishes four Kumo foundation models in the NVIDIA Kumo Structured collection. Kumo Tabular and Kumo Relational run in SDM; Kumo Forecast and Kumo Anomaly run in Kumo-TS. All four download their weights from Hugging Face on first use.

ModelKumo TabularKumo RelationalKumo ForecastKumo Anomaly
TaskClassification, regressionClassification, regressionMultivariate forecastingAnomaly detection
Labels neededLabeled context rowsLabeled context rowsPast values of the target seriesNone
InputOne table: context rows with targets, query rows withoutTask rows plus related tables, key relationships, and one task linkDataFrame with a timestamp, a target, and optional numeric covariates (at least 512 rows)DataFrame of numeric sensor columns
OutputClass probabilities, or 999 quantiles for regressionClass probabilities, or 999 quantiles for regressionFuture timestamps and a <target>_forecast columnInput columns plus Anomaly (0 or 1) and an MAE score
Parameters27.46M to 215.68M (small, medium, large)29.93M to 30.94MSee the model cardSee the model card
Weights licenseOpenMDW-1.1OpenMDW-1.1, with BSD-3-Clause noticeApache-2.0Apache-2.0
Entry pointsdm.models.KumoTabularsdm.models.KumoRelationalperform_forecastingperform_anomaly_analysis_with_diffusion
LibrarySDM (pip install structured-data-models)SDM (pip install structured-data-models)Kumo-TS, Kumo-Forecast packageKumo-TS, Kumo-Anomaly package

SDM also includes reference implementations of other published tabular models, TabICLv2 and TabFM, which are useful as baselines. Check each model’s weights license in the model overview; some are non-commercial.

Which Model Should I Use?

Answer two questions to find the model that fits your data.

Is each prediction about a point in an ordered time series?

The same guidance as a table:

If your data looks likeUseWhy
One row per example, features in columns, a label to predictKumo TabularSingle-table classification or regression from labeled context rows.
Entities plus event or transaction tables linked by IDs (users and orders, patients and visits)Kumo RelationalReads related rows through key relationships, so you do not hand-build aggregate features.
Already flattened into one wide tableKumo TabularUse Kumo Relational when the flattening loses information you care about.
Ordered measurements over time, and you want future valuesKumo ForecastRows are time steps; forecast_horizon sets how many steps to predict.
Ordered measurements over time, and you want unusual points flaggedKumo AnomalyUnsupervised: no labels, returns a score and a 0 or 1 flag per time step.

How SDM Works

The models in SDM are foundation models for structured data. Each one is pretrained once and is task agnostic: adding a prediction task means passing new rows, not training and maintaining another model.

Your tables from pandas, Arrow, or cuDF are loaded into a TableTensor with a semantic type per column. Its rows split into context rows with known targets and query rows with unknown targets, which go into a pretrained foundation model. Inside the model, a recipe preprocesses the data, an ensemble of frozen estimators set by num_estimators runs, and the recipe postprocesses the outputs. Predictions return as probabilities or quantiles for each query row.

Your tables from pandas, Arrow, or cuDF are loaded into a TableTensor with a semantic type per column. Its rows split into context rows with known targets and query rows with unknown targets, which go into a pretrained foundation model. Inside the model, a recipe preprocesses the data, an ensemble of frozen estimators set by num_estimators runs, and the recipe postprocesses the outputs. Predictions return as probabilities or quantiles for each query row.

Every model that runs in SDM follows the same workflow:

  1. Load your data from pandas, Arrow, or cuDF as a TableTensor, which records a semantic type for each column.
  2. Split its rows into context rows, whose outcome you already know, and query rows you want predicted.
  3. Pass both to a pretrained model. For Kumo Relational, also pass the linked tables and their keys as RelatedTables. The model reads the context and predicts the query rows in one forward pass, much like an LLM answers from examples in its prompt, and its weights never change.
  4. Read the predictions, returned as a TableTensor that converts back to pandas.

In-Context Learning explains how the models reason over context and how they are pretrained.

  • No training pipeline. There is no training run, hyperparameter search, or retraining schedule. When your data changes, pass the new rows as context.
  • Accurate on small, messy data. Pretraining gives the models a strong prior about how tables behave, so they predict well from a few hundred labeled rows and tolerate missing values.
  • Swap models freely. Kumo Tabular, Kumo Relational, and baselines such as TabICLv2 share one interface, so you can compare them on the same data. Kumo Forecast and Kumo Anomaly apply the same pretrained approach to time series.
  • Defaults you can tune. Each model ships a recipe for preprocessing and postprocessing, and averages several randomized passes (num_estimators) for stability. You can adjust both.
Need a hosted endpoint instead?

Kumo Tabular and Kumo Relational are also available as NVIDIA NIM microservices. Use the Structured Data Models Client tab to send requests to a deployed endpoint without loading weights in your process.

Next Steps