> ## 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

<Info>
  Looking for usage documentation? Check out [Fine tuning](/capabilities/fine-tuning).
</Info>

<div className="python-reference-heading">
  <h2 id="fit-from-preprocessed">
    `TabPFNRegressor.fit_from_preprocessed`
  </h2>

  <a className="python-reference-source" href="https://github.com/PriorLabs/TabPFN/blob/c70b6ef0488858d32244c52222abfc0c5be207d6/src/tabpfn/regressor.py#L1054" aria-label="View source for TabPFNRegressor.fit_from_preprocessed"><span aria-hidden="true">\</></span> View source <span aria-hidden="true">↗</span></a>
</div>

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**

<div className="python-reference-table">
  | Parameter | Type | Default | Description |
  | - | - | - | - |
  | <span id="fit-from-preprocessed--x-preprocessed" /><code className="python-reference-parameter">X\_<wbr />preprocessed</code> | <code className="python-reference-type">list\[torch.Tensor]</code> | 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) |
  | <span id="fit-from-preprocessed--y-preprocessed" /><code className="python-reference-parameter">y\_<wbr />preprocessed</code> | <code className="python-reference-type">list\[torch.Tensor]</code> | Required | The target variable obtained from the preprocessed Dataset |
  | <span id="fit-from-preprocessed--cat-ix" /><code className="python-reference-parameter">cat\_<wbr />ix</code> | <code className="python-reference-type">list\[list\[list\[int]]]</code> | Required | categorical indices obtained from the preprocessed Dataset |
  | <span id="fit-from-preprocessed--configs" /><code className="python-reference-parameter">configs</code> | <code className="python-reference-type">list\[list\[<a href="/api-reference/python/tabpfn/preprocessing/configuration#ensembleconfig">Ensemble<wbr />Config</a>]]</code> | Required | Ensemble configurations obtained from the preprocessed Dataset |
  | <span id="fit-from-preprocessed--performance-options" /><code className="python-reference-parameter">performance\_<wbr />options</code> | <code className="python-reference-type"><a href="https://github.com/PriorLabs/TabPFN/blob/c70b6ef0488858d32244c52222abfc0c5be207d6/src/tabpfn/architectures/interface.py#L58">Performance<wbr />Options</a></code> | Required | Performance and memory options forwarded to the model on each forward call inside the resulting executor. |
  | <span id="fit-from-preprocessed--no-refit" /><code className="python-reference-parameter">no\_<wbr />refit</code> | <code className="python-reference-type">bool</code> | `True` | if `True`, the classifier will not be reinitialized when calling fit multiple times. |
</div>

**Returns**

<div className="python-reference-table python-reference-returns">
  | Type | Description |
  | - | - |
  | <code className="python-reference-type"><a href="/api-reference/python/tabpfn/regressor/configuration#constructor">Tab<wbr />PFN<wbr />Regressor</a></code> | — |
</div>

***

<div className="python-reference-heading">
  <h2 id="fit-with-differentiable-input">
    `TabPFNRegressor.fit_with_differentiable_input`
  </h2>

  <a className="python-reference-source" href="https://github.com/PriorLabs/TabPFN/blob/c70b6ef0488858d32244c52222abfc0c5be207d6/src/tabpfn/regressor.py#L1124" aria-label="View source for TabPFNRegressor.fit_with_differentiable_input"><span aria-hidden="true">\</></span> View source <span aria-hidden="true">↗</span></a>
</div>

Fit the model with differentiable input.

Mirror of [`TabPFNClassifier.fit_with_differentiable_input`](/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`](/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**

<div className="python-reference-table">
  | Parameter | Type | Default | Description |
  | - | - | - | - |
  | <span id="fit-with-differentiable-input--x" /><code className="python-reference-parameter">X</code> | <code className="python-reference-type">torch.Tensor</code> | Required | The input data as a torch tensor. |
  | <span id="fit-with-differentiable-input--y" /><code className="python-reference-parameter">y</code> | <code className="python-reference-type">torch.Tensor</code> | Required | The target variable as a torch tensor. |
</div>

**Returns**

<div className="python-reference-table python-reference-returns">
  | Type | Description |
  | - | - |
  | <code className="python-reference-type"><a href="/api-reference/python/tabpfn/regressor/configuration#constructor">Self</a></code> | self |
</div>

***

<div className="python-reference-heading">
  <h2 id="predict-batched">
    `TabPFNRegressor.predict_batched`
  </h2>

  <a className="python-reference-source" href="https://github.com/PriorLabs/TabPFN/blob/c70b6ef0488858d32244c52222abfc0c5be207d6/src/tabpfn/regressor.py#L1687" aria-label="View source for TabPFNRegressor.predict_batched"><span aria-hidden="true">\</></span> View source <span aria-hidden="true">↗</span></a>
</div>

Predict for several independent datasets in one pass.

Each triple is preprocessed exactly as [`fit()`](/api-reference/python/tabpfn/regressor/fitting-and-prediction#fit) + [`predict()`](/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 title="Type aliases">
  ```python theme={null}
  OutputType = Literal["mean", "median", "mode", "quantiles", "full", "main"]
  ```
</Accordion>

**Parameters**

<div className="python-reference-table">
  | Parameter | Type | Default | Description |
  | - | - | - | - |
  | <span id="predict-batched--x-train-list" /><code className="python-reference-parameter">X\_<wbr />train\_<wbr />list</code> | <code className="python-reference-type">list\[<a href="https://github.com/PriorLabs/TabPFN/blob/c70b6ef0488858d32244c52222abfc0c5be207d6/src/tabpfn/constants.py#L25">X<wbr />Type</a>]</code> | Required | Training features, one array per dataset (all same shape). |
  | <span id="predict-batched--y-train-list" /><code className="python-reference-parameter">y\_<wbr />train\_<wbr />list</code> | <code className="python-reference-type">list\[<a href="https://github.com/PriorLabs/TabPFN/blob/c70b6ef0488858d32244c52222abfc0c5be207d6/src/tabpfn/constants.py#L26">Y<wbr />Type</a>]</code> | Required | Training targets, one array per dataset. |
  | <span id="predict-batched--x-test-list" /><code className="python-reference-parameter">X\_<wbr />test\_<wbr />list</code> | <code className="python-reference-type">list\[<a href="https://github.com/PriorLabs/TabPFN/blob/c70b6ef0488858d32244c52222abfc0c5be207d6/src/tabpfn/constants.py#L25">X<wbr />Type</a>]</code> | Required | Test features, one array per dataset (all same shape). |
  | <span id="predict-batched--output-type" /><code className="python-reference-parameter">output\_<wbr />type</code> | <code className="python-reference-type"><a href="https://github.com/PriorLabs/TabPFN/blob/c70b6ef0488858d32244c52222abfc0c5be207d6/src/tabpfn/regressor.py#L151">Output<wbr />Type</a></code> | `"mean"` | As in [`predict`](/api-reference/python/tabpfn/regressor/fitting-and-prediction#predict), applied to every dataset. |
  | <span id="predict-batched--quantiles" /><code className="python-reference-parameter">quantiles</code> | <code className="python-reference-type">list\[float] \| None</code> | `None` | As in [`predict`](/api-reference/python/tabpfn/regressor/fitting-and-prediction#predict). |
</div>

**Returns**

<div className="python-reference-table python-reference-returns">
  | Type | Description |
  | - | - |
  | <code className="python-reference-type">list\[<a href="https://github.com/PriorLabs/TabPFN/blob/c70b6ef0488858d32244c52222abfc0c5be207d6/src/tabpfn/regressor.py#L171">Regression<wbr />Result<wbr />Type</a>]</code> | One entry per dataset, in input order, each being what [`predict`](/api-reference/python/tabpfn/regressor/fitting-and-prediction#predict) would return for that dataset. |
</div>

**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`](/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.

***

<div className="python-reference-heading">
  <h2 id="forward">
    `TabPFNRegressor.forward`
  </h2>

  <a className="python-reference-source" href="https://github.com/PriorLabs/TabPFN/blob/c70b6ef0488858d32244c52222abfc0c5be207d6/src/tabpfn/regressor.py#L2128" aria-label="View source for TabPFNRegressor.forward"><span aria-hidden="true">\</></span> View source <span aria-hidden="true">↗</span></a>
</div>

Forward pass for [`TabPFNRegressor`](/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**

<div className="python-reference-table">
  | Parameter | Type | Default | Description |
  | - | - | - | - |
  | <span id="forward--x" /><code className="python-reference-parameter">X</code> | <code className="python-reference-type">list\[torch.Tensor] \| <a href="https://github.com/PriorLabs/TabPFN/blob/c70b6ef0488858d32244c52222abfc0c5be207d6/src/tabpfn/constants.py#L25">X<wbr />Type</a></code> | Required | list\[torch.Tensor] in fine-tuning, [`XType`](https://github.com/PriorLabs/TabPFN/blob/c70b6ef0488858d32244c52222abfc0c5be207d6/src/tabpfn/constants.py#L25) in normal predictions. |
  | <span id="forward--use-inference-mode" /><code className="python-reference-parameter">use\_<wbr />inference\_<wbr />mode</code> | <code className="python-reference-type">bool</code> | `False` | Flag for inference mode., default at `False` since |
</div>

**Returns**

<div className="python-reference-table python-reference-returns">
  | Type | Description |
  | - | - |
  | <code className="python-reference-type">tuple\[torch.Tensor \| None, list\[torch.Tensor], list\[<a href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html">np.ndarray</a>]]</code> | A tuple containing:<br />    - Averaged logits over the ensemble (for fine-tuning).<br />    - Raw outputs from each estimator in the ensemble.<br />    - Borders used for each estimator. |
</div>


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