TabPFN icon indicating copy to clipboard operation
TabPFN copied to clipboard

How to fine-tune the TabPFN model?

Open setipsh opened this issue 11 months ago • 5 comments

I am using the TabPFN model for a classification task and would like to fine-tune the already trained pre-trained model to better adapt it to my specific dataset. I have reviewed the documentation and code, but I still have some questions about the specific steps and parameter settings for fine-tuning. Does fine-tuning TabPFN involve gradient updates? How many training epochs are needed? During the fine-tuning process, which parameters are the most important?

setipsh avatar Jan 13 '25 02:01 setipsh

Dear setipsh, We have fine-tuning not running in the current code-base. I will tag this Issue with a todo, to re-enable finetuning in our codebase. It was removed when cleaning up our code and improving code quality. Hope to get this in soon!

noahho avatar Jan 13 '25 10:01 noahho

+1 from me, very interested in having fine tuning available for V2. Many thanks!

iivalchev avatar Jan 20 '25 08:01 iivalchev

Dear @noahho could you mention what happens under the hood when a user calls .train? Also, is the model supposed to be backpropagable if we simply do inference with a torch tensor as input?

JuanFMontesinos avatar Jan 22 '25 00:01 JuanFMontesinos

Dear setipsh, We have fine-tuning not running in the current code-base. I will tag this Issue with a todo, to re-enable finetuning in our codebase. It was removed when cleaning up our code and improving code quality. Hope to get this in soon!

when this finetunig code be released? we want to try it on our materials dataset

usccolumbia avatar Feb 24 '25 00:02 usccolumbia

when this finetunig code be released? we want to try it on our materials dataset

Hey, if you are still looking for fine-tuning code, you can check out this repo. This repo is about fine-tuning TabPFN on one downstream tabular dataset.

anuragg1209 avatar Mar 09 '25 12:03 anuragg1209

Fine tuning was recently enabled again! See the examples:

  • https://github.com/PriorLabs/TabPFN/blob/main/examples/finetune_classifier.py
  • https://github.com/PriorLabs/TabPFN/blob/main/examples/finetune_regressor.py Feel free to open a new issue if you have any trouble.

oscarkey avatar Aug 15 '25 09:08 oscarkey

Fine tuning was recently enabled again! See the examples:

* https://github.com/PriorLabs/TabPFN/blob/main/examples/finetune_classifier.py

* https://github.com/PriorLabs/TabPFN/blob/main/examples/finetune_regressor.py
  Feel free to open a new issue if you have any trouble.

Hi oscarkey,

This might be a dumb question, after finetuning is complete according to the example you've mentioned (specifically the classifier) how do you save the finetuned model and then later use it?

TaoVonQi avatar Oct 17 '25 16:10 TaoVonQi

no dumb questions! I think you should be able to use:

tabpfn.model_loading.save_tabpfn_model(my_ft_classifier, "checkpoint_name.pt")
loaded_classifier = TabPFNClassifier(model_path="checkpoint_name.pt")

If this doesn't work, open a new issue and we'll look into it :)

oscarkey avatar Oct 20 '25 10:10 oscarkey