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

# Batch and evaluation types

> Batch data for classifier fine-tuning.

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

## `ClassifierBatch`

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

Batch data for classifier fine-tuning.

```python theme={null}
ClassifierBatch(
    X_context: list[torch.Tensor],
    X_query: list[torch.Tensor],
    y_context: list[torch.Tensor],
    y_query: torch.Tensor,
    cat_indices: list[list[int] | None] | list[list[list[int] | None]],
    configs: list[Any],
)
```

**Fields**

| Name | Type | Default | Description |
| - | - | - | - |
| `X_context` | `list[torch.Tensor]` | Required | Preprocessed training features (list per estimator). |
| `X_query` | `list[torch.Tensor]` | Required | Preprocessed test features (list per estimator). |
| `y_context` | `list[torch.Tensor]` | Required | Preprocessed training targets (list per estimator). |
| `y_query` | `torch.Tensor` | Required | Raw test target tensor. |
| `cat_indices` | `list[list[int] \| None] \| list[list[list[int] \| None]]` | Required | Categorical feature indices (list per estimator). |
| `configs` | `list[Any]` | Required | Preprocessing configurations used for this batch. |

***

## `EvalResult`

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

Container for evaluation results.

```python theme={null}
EvalResult(
    primary: float,
    secondary: dict[str, float] = dict(),
)
```

**Fields**

| Name | Type | Default | Description |
| - | - | - | - |
| `primary` | `float` | Required | The primary metric used for early stopping decisions. |
| `secondary` | `dict[str, float]` | `dict()` | Additional metrics for logging purposes only. |

***

## `RegressorBatch`

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

Batch data for regressor fine-tuning.

```python theme={null}
RegressorBatch(
    X_context: list[torch.Tensor],
    X_query: list[torch.Tensor],
    y_context: list[torch.Tensor],
    y_query: torch.Tensor,
    cat_indices: list[list[int] | None] | list[list[list[int] | None]],
    configs: list[Any],
    raw_space_bardist: FullSupportBarDistribution,
    znorm_space_bardist: FullSupportBarDistribution,
    X_query_raw: torch.Tensor,
    y_query_raw: torch.Tensor,
)
```

**Fields**

| Name | Type | Default | Description |
| - | - | - | - |
| `X_context` | `list[torch.Tensor]` | Required | Preprocessed training features (list per estimator). |
| `X_query` | `list[torch.Tensor]` | Required | Preprocessed test features (list per estimator). |
| `y_context` | `list[torch.Tensor]` | Required | Preprocessed standardized training targets (list per estimator). |
| `y_query` | `torch.Tensor` | Required | Standardized test target tensor. |
| `cat_indices` | `list[list[int] \| None] \| list[list[list[int] \| None]]` | Required | Categorical feature indices (list per estimator). |
| `configs` | `list[Any]` | Required | Preprocessing configurations used for this batch. |
| `raw_space_bardist` | `FullSupportBarDistribution` | Required | Bar distribution in raw (original) target space. |
| `znorm_space_bardist` | `FullSupportBarDistribution` | Required | Bar distribution in z-normalized target space. |
| `X_query_raw` | `torch.Tensor` | Required | Original unprocessed test features. |
| `y_query_raw` | `torch.Tensor` | Required | Original unprocessed test targets. |

***

## `main_process_first`

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

Run the with-block on the main process before all other ranks.

Useful under `torchrun` for work that should happen once and be read
from a shared cache afterwards, such as dataset downloads: the main
process runs the block while the other ranks wait at a barrier, then the
other ranks run it against the warm cache.

Initializes the process group from the torchrun env vars if needed, and
leaves it initialized so that a subsequent `fit()` reuses it. Call
`torch.distributed.destroy_process_group()` at the end of your script.
No-op when running with a single process.

```python theme={null}
main_process_first() -> Iterator[None]
```

**Returns**

| Type | Description |
| - | - |
| `Iterator[None]` | — |


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