> ## Documentation Index
> Fetch the complete documentation index at: https://docs.priorlabs.ai/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> TabPFN-3 and later versions support up to 1,000,000 rows, subject to feature count and checkpoint/API limits.
> For large datasets, use per-estimator subsampling, e.g. inference_config={"SUBSAMPLE_SAMPLES": 100_000}, in TabPFNClassifier or TabPFNRegressor from tabpfn or tabpfn_client.
> Pass raw pandas DataFrames to fit and predict. Categorical strings/categories, raw text, and missing feature values are handled automatically; no manual integer/one-hot encoding, imputation, scaling, or outlier removal is needed.

# Batched and differentiable inference

> Used in Fine-Tuning. Fit the model to preprocessed inputs from torch

> [!NOTE]
>
> Looking for usage documentation? Check out [Fine tuning](https://docs.priorlabs.ai/capabilities/fine-tuning.md).

## `TabPFNRegressor.fit_from_preprocessed`

[ View source ](https://github.com/PriorLabs/TabPFN/blob/f02b3b5941717472eafd078c15ae2043676b3fcf/src/tabpfn/regressor.py#L1114)

Used in Fine-Tuning. Fit the model to preprocessed inputs from torch
dataloader inside a training loop a Dataset provided by
get\_preprocessed\_datasets. This function always uses the "batched" fit\_mode.

```python theme={null}
TabPFNRegressor.fit_from_preprocessed(
    X_preprocessed: list[torch.Tensor],
    y_preprocessed: list[torch.Tensor],
    cat_ix: list[list[list[int]]],
    configs: list[list[EnsembleConfig]],
    *,
    performance_options: PerformanceOptions,
    no_refit: bool = True,
) -> TabPFNRegressor
```

**Parameters**

| Parameter | Type | Default | Description |
| - | - | - | - |
| `X_preprocessed` | `list[torch.Tensor]` | Required | The input features obtained from the preprocessed Dataset The list contains one item for each ensemble predictor. use tabpfn.utils.collate\_for\_tabpfn\_dataset to use this function with batch sizes of more than one dataset (see examples/tabpfn\_finetune.py) |
| `y_preprocessed` | `list[torch.Tensor]` | Required | The target variable obtained from the preprocessed Dataset |
| `cat_ix` | `list[list[list[int]]]` | Required | categorical indices obtained from the preprocessed Dataset |
| `configs` | `list[list[EnsembleConfig]]` | Required | Ensemble configurations obtained from the preprocessed Dataset |
| `performance_options` | `PerformanceOptions` | Required | Performance and memory options forwarded to the model on each forward call inside the resulting executor. Compilation is enabled if either these options or the estimator's `enable_torch_compile` parameter enables it. |
| `no_refit` | `bool` | `True` | if `True`, the classifier will not be reinitialized when calling fit multiple times. |

**Returns**

| Type | Description |
| - | - |
| `TabPFNRegressor` | — |

***

## `TabPFNRegressor.fit_with_differentiable_input`

[ View source ](https://github.com/PriorLabs/TabPFN/blob/f02b3b5941717472eafd078c15ae2043676b3fcf/src/tabpfn/regressor.py#L1197)

Fit the model with differentiable input.

Mirror of [`TabPFNClassifier.fit_with_differentiable_input`](https://docs.priorlabs.ai/api-reference/python/tabpfn/classifier/advanced#fit-with-differentiable-input). Lets
gradients flow from a downstream loss back through `X` (and `y`,
if it carries grads) into upstream torch modules. Use this instead
of [`fit`](https://docs.priorlabs.ai/api-reference/python/tabpfn/regressor/fitting-and-prediction#fit) when `differentiable_input=True`.

```python theme={null}
TabPFNRegressor.fit_with_differentiable_input(
    X: torch.Tensor,
    y: torch.Tensor,
) -> Self
```

**Parameters**

| Parameter | Type | Default | Description |
| - | - | - | - |
| `X` | `torch.Tensor` | Required | The input data as a torch tensor. |
| `y` | `torch.Tensor` | Required | The target variable as a torch tensor. |

**Returns**

| Type | Description |
| - | - |
| `Self` | self |

***

## `TabPFNRegressor.predict_batched`

[ View source ](https://github.com/PriorLabs/TabPFN/blob/f02b3b5941717472eafd078c15ae2043676b3fcf/src/tabpfn/regressor.py#L1814)

Predict for several independent datasets in one pass.

Each triple is preprocessed exactly as [`fit()`](https://docs.priorlabs.ai/api-reference/python/tabpfn/regressor/fitting-and-prediction#fit) + [`predict()`](https://docs.priorlabs.ai/api-reference/python/tabpfn/regressor/fitting-and-prediction#predict) does,
then compatible model-input shapes are fused. Heterogeneous
post-preprocessing shapes run in separate groups. This is equivalent to
independent prediction and leaves `self` unchanged.

Datasets need not share a target scale (each is decoded with its own
bar distribution) but must share raw array shapes. Fitted transforms may
produce different shapes; these are grouped internally without padding.

```python theme={null}
TabPFNRegressor.predict_batched(
    X_train_list: list[XType],
    y_train_list: list[YType],
    X_test_list: list[XType],
    *,
    output_type: OutputType = "mean",
    quantiles: list[float] | None = None,
) -> list[RegressionResultType]
```

> [accordion] Type aliases
>
> ```python theme={null}
> OutputType = Literal["mean", "median", "mode", "quantiles", "full", "main"]
> ```

**Parameters**

| Parameter | Type | Default | Description |
| - | - | - | - |
| `X_train_list` | `list[XType]` | Required | Training features, one array per dataset (all same shape). |
| `y_train_list` | `list[YType]` | Required | Training targets, one array per dataset. |
| `X_test_list` | `list[XType]` | Required | Test features, one array per dataset (all same shape). |
| `output_type` | `OutputType` | `"mean"` | As in [`predict`](https://docs.priorlabs.ai/api-reference/python/tabpfn/regressor/fitting-and-prediction#predict), applied to every dataset. |
| `quantiles` | `list[float] \| None` | `None` | As in [`predict`](https://docs.priorlabs.ai/api-reference/python/tabpfn/regressor/fitting-and-prediction#predict). |

**Returns**

| Type | Description |
| - | - |
| `list[RegressionResultType]` | One entry per dataset, in input order, each being what [`predict`](https://docs.priorlabs.ai/api-reference/python/tabpfn/regressor/fitting-and-prediction#predict) would return for that dataset. |

**Raises**

`ValueError`

If the input lists have unequal or zero length, or the
training (or test) arrays do not all share one shape.

`TabPFNValidationError`

If `output_type` or `quantiles` are invalid.

`NotImplementedError`

If `tuning_config` is configured on the
estimator -- the calibrated ensemble temperature is per-dataset
state and cannot be applied correctly across a shared batch, so
score those datasets individually with [`predict`](https://docs.priorlabs.ai/api-reference/python/tabpfn/regressor/fitting-and-prediction#predict). Also
raised for `inference_precision=torch.float64`, which the
fused forward does not support.

**Note**

Constant-target datasets are answered analytically and take no part
in the fused forward.

***

## `TabPFNRegressor.forward`

[ View source ](https://github.com/PriorLabs/TabPFN/blob/f02b3b5941717472eafd078c15ae2043676b3fcf/src/tabpfn/regressor.py#L2272)

Forward pass for [`TabPFNRegressor`](https://docs.priorlabs.ai/api-reference/python/tabpfn/regressor/configuration#constructor) Inference Engine.
Used in fine-tuning and prediction. Called directly
in FineTuning training loop or by predict() function
with the `use_inference_mode` flag explicitly set to `True`.

Iterates over outputs of InferenceEngine.

```python theme={null}
TabPFNRegressor.forward(
    X: list[torch.Tensor] | XType,
    *,
    use_inference_mode: bool = False,
) -> tuple[torch.Tensor | None, list[torch.Tensor], list[np.ndarray]]
```

**Parameters**

| Parameter | Type | Default | Description |
| - | - | - | - |
| `X` | `list[torch.Tensor] \| XType` | Required | list\[torch.Tensor] in fine-tuning, [`XType`](https://github.com/PriorLabs/TabPFN/blob/f02b3b5941717472eafd078c15ae2043676b3fcf/src/tabpfn/constants.py#L25) in normal predictions. |
| `use_inference_mode` | `bool` | `False` | Flag for inference mode., default at `False` since |

**Returns**

| Type | Description |
| - | - |
| `tuple[torch.Tensor \| None, list[torch.Tensor], list[np.ndarray]]` | A tuple containing:     - Averaged logits over the ensemble (for fine-tuning).     - Raw outputs from each estimator in the ensemble.     - Borders used for each estimator. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.