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

# Locked folds

> How Autofit validates experiments, how to supply your own folds, and why the folds never change during a session.

Every experiment in a session is scored on the same validation rows. Autofit fixes them when the session starts and refuses any experiment that tries to change them.

## Default folds

By default, Autofit splits the rows into 8 shuffled folds, stratified by class for classification. Each fold is predicted by a model trained on the other 7, so every row gets one out-of-fold prediction. The score is the metric over those predictions.

You choose the folds at setup:

| Option | What it does | When to use it |
| - | - | - |
| 8 folds (default) | One round of 8 shuffled folds. | Independent rows. |
| Repeated folds | Several rounds, each with a new shuffle. The score is the mean over rounds. | Small tables, where one split gives a noisy score. Each round costs one more set of fits. |
| First fold only | Scores one of the 8 folds. | Large tables, to save time and TabPFN tokens. Scores are noisier. |
| Your own `fold` column | Uses the folds you define. | Grouped rows or rows ordered in time. See below. |

The fold seed is fixed, so two sessions on the same table with the same settings use the same folds.

## Your own folds

When rows are not independent, shuffled folds overstate the score. Two common cases:

* **Grouped rows.** A customer has several rows. If one row trains the model and another validates it, the model has seen that customer.
* **Rows ordered in time.** A model validated on rows from before its training rows uses the future.

Add a `fold` column to a copy of your CSV. Claude can write it for you at setup.

* Each non-negative value is one validation fold. A row with fold `2` is predicted by a model trained on all rows whose fold is not `2`.
* A row with a negative value only trains. It is never validated.

Autofit reads the column, removes it before every fit and prediction, and validates on each non-negative value. New rows you predict later need no `fold` column.

> [tab] Grouped rows
>
> Give all rows of one group the same fold, for example with scikit-learn's `StratifiedGroupKFold` (classification) or `GroupKFold` (regression) on the group column. Each group is then validated by a model that never saw it.

> [tab] Rows ordered in time
>
> Give the most recent period fold `0` and every earlier row `-1`. The model trains on the past and is scored on the latest period, as it will be used.
>
> Leave a gap when a label looks ahead. If each row's target is the next day's return, drop the day between the training and validation periods so no training label overlaps the validation period.
>
> One validation fold gives a noisier score than 8 folds.

## Why the folds never change

If one experiment used other validation rows, its score would not be comparable with the others. Autofit saves the setup when the session starts. An experiment that passes other fold settings fails with an error before it fits anything.

## Fitting inside the fold

Every experiment is a scikit-learn pipeline that ends in TabPFN. Autofit fits the whole pipeline on the training rows of each fold, then predicts the validation rows. A target encoding, a scaler or a group statistic inside the pipeline therefore learns only from the training rows of that fold. The agent's instructions forbid hardcoding statistics it saw in the data outside the pipeline.

This protects against leakage through the pipeline. It does not protect against a leaking column in your data, such as a payment total recorded after a loan defaults. Drop those at setup. See [Frame a task](https://docs.priorlabs.ai/autofit/frame-a-task).

## Next

* [Ensembling](https://docs.priorlabs.ai/autofit/how-it-works/ensembling.md): how the out-of-fold predictions are blended.
* [Score on a test set](https://docs.priorlabs.ai/autofit/use-the-result.md#score-on-a-test-set): get a score outside the session's folds.


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