Skip to content

Search is only available in production builds. Try building and previewing the site to test it out locally.

Train your first model

This guide takes you from a fresh project to a trained model whose loss curve you can read. Everything happens in Developer mode so you can see each artifact (prior · model · run) as you go. If you’d rather skip the parts and let the wizard pick for you, follow Getting started instead.

Before you start

  • A PFN Studio account (sign up)
  • Persona set to Developer (avatar menu → Mode → Developer)
  • ~15 minutes of CPU time — the default settings train a Small brain end-to-end on a laptop

1. Create a project

From /welcomeStart your first projectClone a template.

Pick do-pfn-studio (the reference template — Robertson et al. 2025). Clicking Clone drops you on the new project’s overview page. You’ll see four tabs along the side:

  • Priors — the data-generating function the model trains on
  • Models — the network architecture (transformer config, head layout)
  • Evals — the metrics you score against
  • Runs — a training execution: prior × model × hyperparams

A freshly cloned do-pfn-studio project comes pre-wired with one of each. You can train it as-is; the steps below explain what you’d change if you wanted to.

2. Inspect the prior

Open the Priors tab and click do-pfn-prior. The prior page shows:

  • YAML (left) — the declarative spec the trainer reads. kind, parameters, compatible_task_types
  • Sample (right) — three synthetic batches drawn from the prior, so you can see what the model will train on before you commit

For Do-PFN the prior samples random structural causal models (DAGs of equations) and returns observation/intervention pairs. If you want a deeper view of the math, read Do-PFN prior spec.

3. Inspect the model

Open the Models tab and click do-pfn-model. You’ll see:

  • A transformer config (depth, width, heads)
  • A compatible_task_types: ['causal_intervention'] list — the trainer will reject any prior whose compatible_task_types doesn’t overlap

You don’t need to change anything for this walkthrough. The defaults are sized for laptop CPU training (~15 min total).

4. Configure the run

Open the Runs tab. There’s already a seed run called train-do-pfn (mode: train). Click it to inspect its YAML:

slug: train-do-pfn
mode: train # train | inference_only
prior_ref: do-pfn-prior
model_ref: do-pfn-model
hyperparams:
epochs: 30 # short for the walkthrough; 300+ for a real run
batch_size: 16
lr: 3e-4
seed: 42

Defaults are fine. If you bump epochs for a longer run, expect proportionally more CPU time.

5. Train

Hit Train at the top right of the run page.

PFN Studio’s CPU worker picks up the job and starts streaming logs into the run’s Logs tab. You’ll see:

  • The trainer initialise the prior, model, and dataloader
  • Epoch-by-epoch loss values
  • Validation metrics every N epochs

The loss curve appears in the Charts tab as soon as the first epoch finishes. A healthy Do-PFN training curve looks like: sharp drop in the first ~5 epochs, then gradual convergence. If you see flat-line or NaN-spike, see Troubleshooting training.

6. Check the result

When the run finishes:

  • Status flips to completed
  • Checkpoint appears in the run’s right-hand panel with a download link
  • Evals auto-run against the held-out test set — you’ll see PEHE, RMSE, R² etc. on the run page

You can now:

What if I want a different prior or model?

You can replace the seed prior / model with anything from the Marketplace, or write your own:

  • Custom prior — see Import priors for the directory layout. A prior is just a Python class + a prior.yaml declaring its hyperparameters
  • Custom model — see Developer mode for the model spec. It’s a transformer config + a head module loaded from the pfnstudio_core registry

Next steps