메뉴
BL
MarkTechPost 41일 전

랜덤포레스트·캣부스트 능가하는 테이블 데이터 AI 'TabPFN'

IMP
8/10
핵심 요약

전통적인 트리 기반 머신러닝 모델(랜덤포레스트, 캣부스트 등)이 장악하던 테이블 데이터(정형 데이터) 분석 분야에서, 사전 학습된 파운데이션 모델인 'TabPFN'이 뛰어난 정확도를 입증했습니다. 이 모델은 대규모 언어 모델(LLM)처럼 문맥 내 학습(In-context learning)을 활용해 별도의 파인튜닝 없이도 빠르고 정확한 예측을 제공합니다. 또한, 예측 결과를 더 작은 모델로 증류(Distillation)하여 실제 서비스 환경에 빠르게 배포할 수 있는 실용성까지 갖추고 있어 데이터 실무자들에게 매우 중요한 대안으로 떠오르고 있습니다.

번역된 본문

인공지능 애플리케이션, 기술, 데이터 과학, 에디터 추천, 지식 그래프, 머신러닝, 스탭 튜토리얼

행과 열로 저장된 구조화된 정보인 테이블 데이터(Tabular data)는 의료 기록부터 금융 거래에 이르기까지 대부분의 실제 머신러닝 문제에서 핵심적인 역할을 합니다. 수년 동안 랜덤 포레스트(Random Forest), XGBoost, CatBoost와 같은 의사결정나무(Decision tree) 기반 모델은 이러한 작업을 위한 기본 선택지가 되어 왔습니다. 이 모델들의 강점은 혼합된 데이터 유형을 처리하고, 복잡한 특성 상호작용을 포착하며, 무거운 전처리 과정 없이도 강력한 성능을 제공한다는 데 있습니다.

딥러닝이 컴퓨터 비전이나 자연어 처리 분야를 혁신하는 동안, 테이블 데이터 세트에서는 지속적으로 이러한 트리 기반 접근 방식의 성능을 뛰어넘지 못하는 어려움을 겪어왔습니다. 하지만 이 오랜 추세는 이제 의문에 부딪히게 되었습니다. 최근 등장한 새로운 접근 방식인 TabPFN은 전통적인 '데이터 세트 맞춤형 학습'을 피하는, 전혀 다른 방식으로 테이블 문제를 해결합니다.

TabPFN은 매번 데이터를 처음부터 학습하는 대신 사전 학습된 모델(Pretrained model)을 사용해 직접 예측을 수행하며, 실질적으로 학습 과정의 상당 부분을 추론(Inference) 시점으로 옮겨옵니다. 이 글에서는 이 아이디어를 자세히 살펴보고, 샘플 데이터 세트를 통해 TabPFN과 기존의 트리 기반 모델인 랜덤 포레스트 및 CatBoost를 비교하여 정확도, 학습 시간, 추론 속도 측면에서 그 성능을 평가해 보겠습니다.

TabPFN이란 무엇인가? TabPFN은 구조화된 데이터를 전통적인 머신러닝과는 완전히 다른 방식으로 처리하기 위해 설계된 테이블용 파운데이션 모델(Foundation model)입니다. 모든 데이터 세트에 대해 새로운 모델을 학습시키는 대신, TabPFN은 인과적 과정(Causal processes)을 통해 생성된 수백만 개의 합성(Synthetic) 테이블 작업으로 사전 학습되었습니다. 덕분에 지도 학습(Supervised learning) 문제를 해결하기 위한 일반적인 전략을 학습할 수 있습니다.

사용자가 데이터 세트를 제공하면, 트리 기반 모델처럼 반복적인 학습을 거치지 않고 이미 학습된 내용을 활용해 직접 예측을 수행합니다. 본질적으로 이는 대규모 언어 모델(LLM)이 텍스트에 대해 작동하는 방식과 유사하게, 테이블 데이터에 일종의 '문맥 내 학습(In-context learning)'을 적용하는 것입니다.

최신 버전인 TabPFN-2.5는 더 크고 복잡한 데이터 세트를 지원하는 동시에 성능을 크게 개선하여 이 아이디어를 더욱 확장했습니다. 표준 벤치마크에서 하이퍼파라미터 튜닝을 마친 XGBoost 및 CatBoost와 같은 트리 기반 모델의 성능을 능가하며, AutoGluon과 같은 강력한 앙상블 시스템과도 필적하는 성능을 보여주는 것으로 입증되었습니다. 동시에 하이퍼파라미터 튜닝과 수동 작업의 필요성을 크게 줄여줍니다.

실제 비즈니스 환경(Real-world deployment)에서의 실용성을 높이기 위해 TabPFN은 '증류 접근법(Distillation approach)'도 도입했습니다. 이를 통해 TabPFN의 예측 결과를 신경망이나 트리 앙상블과 같은 더 작은 모델로 변환할 수 있으며, 대부분의 정확도를 유지하면서도 훨씬 더 빠른 추론을 가능하게 합니다.

트리 기반 모델과 TabPFN 비교 의존성 설정하기

pip install tabpfn-client scikit-learn catboost

import time import numpy as np from sklearn.datasets import make_classification from sklearn.model_selection import train_test_split from sklearn.metrics import accuracy_score

Models

from sklearn.ensemble import RandomForestClassifier from catboost import CatBoostClassifier from tabpfn_client import TabPFNClassifier

모델을 실행하려면 TabPFN API 키가 필요합니다. 해당 키는 https://ux.priorlabs.ai/home 에서 발급받을 수 있습니다.

import os from getpass import getpass os.environ['TABPFN_TOKEN'] = getpass('Enter TABPFN Token: ')

데이터 세트 생성 실험을 위해 scikit-learn의 make_classification을 사용하여 합성 이진 분류 데이터 세트를 생성합니다. 이 데이터 세트는 5,000개의 샘플과 20개의 특성(Feature)을 포함하고 있으며, 그 중 10개는 정보성(Informative, 실제로 타겟 예측에 기여함)이고 5개는 중복(Redundant, 정보성 특성에서 파생됨)입니다. 이러한 설정은 모든 특성이 동일하게 유용하지 않고 일부는 노이즈를 유발하는 실제적인 테이블 데이터 시나리오를 시뮬레이션하는 데 도움이 됩니다.

원문 보기
원문 보기 (영어)
Artificial Intelligence Applications Technology Data Science Editors Pick Knowledge Graphs Machine Learning Staff Tutorials Tabular data—structured information stored in rows and columns—is at the heart of most real-world machine learning problems, from healthcare records to financial transactions. Over the years, models based on decision trees, such as Random Forest , XGBoost , and CatBoost , have become the default choice for these tasks. Their strength lies in handling mixed data types, capturing complex feature interactions, and delivering strong performance without heavy preprocessing. While deep learning has transformed areas like computer vision and natural language processing, it has historically struggled to consistently outperform these tree-based approaches on tabular datasets. That long-standing trend is now being questioned. A newer approach, TabPFN , introduces a different way of tackling tabular problems—one that avoids traditional dataset-specific training altogether. Instead of learning from scratch each time, it relies on a pretrained model to make predictions directly, effectively shifting much of the learning process to inference time. In this article, we take a closer look at this idea and put it to the test by comparing TabPFN with established tree-based models like Random Forest and CatBoost on a sample dataset, evaluating their performance in terms of accuracy, training time, and inference speed. What is TabPFN? TabPFN is a tabular foundation model designed to handle structured data in a completely different way from traditional machine learning. Instead of training a new model for every dataset, TabPFN is pretrained on millions of synthetic tabular tasks generated from causal processes. This allows it to learn a general strategy for solving supervised learning problems. When you give it your dataset, it doesn’t go through iterative training like tree-based models—instead, it performs predictions directly by leveraging what it has already learned. In essence, it applies a form of in-context learning to tabular data, similar to how large language models work for text. The latest version, TabPFN-2.5, significantly expands this idea by supporting larger and more complex datasets, while also improving performance. It has been shown to outperform tuned tree-based models like XGBoost and CatBoost on standard benchmarks and even match strong ensemble systems like AutoGluon. At the same time, it reduces the need for hyperparameter tuning and manual effort. To make it practical for real-world deployment, TabPFN also introduces a distillation approach , where its predictions can be converted into smaller models like neural networks or tree ensembles—retaining most of the accuracy while enabling much faster inference. Comparing TabPFN with Tree based models Setting up the dependencies Copy Code Copied Use a different Browser pip install tabpfn-client scikit-learn catboost Copy Code Copied Use a different Browser import time import numpy as np from sklearn.datasets import make_classification from sklearn.model_selection import train_test_split from sklearn.metrics import accuracy_score # Models from sklearn.ensemble import RandomForestClassifier from catboost import CatBoostClassifier from tabpfn_client import TabPFNClassifier To run the model, you require the TabPFN API Key. You can get the same from https://ux.priorlabs.ai/home Copy Code Copied Use a different Browser import os from getpass import getpass os.environ['TABPFN_TOKEN'] = getpass('Enter TABPFN Token: ') Creating the dataset For our experiment, we generate a synthetic binary classification dataset using make_classification from scikit-learn. The dataset contains 5,000 samples and 20 features, out of which 10 are informative (actually contribute to predicting the target) and 5 are redundant (derived from the informative ones). This setup helps simulate a realistic tabular scenario where not all features are equally useful, and some introduce noise or correlation. We then split the data into training (80%) and testing (20%) sets to evaluate model performance on unseen data. Using a synthetic dataset allows us to have full control over the data characteristics while ensuring a fair and reproducible comparison between TabPFN and traditional tree-based models. Copy Code Copied Use a different Browser X, y = make_classification( n_samples=5000, n_features=20, n_informative=10, n_redundant=5, random_state=42 ) X_train, X_test, y_train, y_test = train_test_split( X, y, test_size=0.2, random_state=42 ) Testing Random Forest We start with a Random Forest classifier as a baseline, using 200 trees. Random Forest is a robust ensemble method that builds multiple decision trees and aggregates their predictions, making it a strong and reliable choice for tabular data without requiring heavy tuning. After training on the dataset, the model achieves an accuracy of 95.5% , which is a solid performance given the synthetic nature of the data. However, this comes with a training time of 9.56 seconds, reflecting the cost of building hundreds of trees. On the positive side, inference is relatively fast at 0.0627 seconds, since predictions only involve passing data through the already constructed trees. This result serves as a strong baseline to compare against more advanced methods like CatBoost and TabPFN. Copy Code Copied Use a different Browser rf = RandomForestClassifier(n_estimators=200) start = time.time() rf.fit(X_train, y_train) rf_train_time = time.time() - start start = time.time() rf_preds = rf.predict(X_test) rf_infer_time = time.time() - start rf_acc = accuracy_score(y_test, rf_preds) print(f"RandomForest → Acc: {rf_acc:.4f}, Train: {rf_train_time:.2f}s, Infer: {rf_infer_time:.4f}s") Testing CatBoost Next, we train a CatBoost classifier, a gradient boosting model specifically designed for tabular data. It builds trees sequentially, where each new tree corrects the errors of the previous ones. Compared to Random Forest, CatBoost is typically more accurate because of this boosting approach and its ability to model complex patterns more effectively. On our dataset, CatBoost achieves an accuracy of 96.7% , outperforming Random Forest and demonstrating its strength as a state-of-the-art tree-based method. It also trains slightly faster, taking 8.15 seconds, despite using 500 boosting iterations. One of its biggest advantages is inference speed—predictions are extremely fast at just 0.0119 seconds, making it well-suited for production scenarios where low latency is critical. This makes CatBoost a strong benchmark before comparing against newer approaches like TabPFN. Copy Code Copied Use a different Browser cat = CatBoostClassifier( iterations=500, depth=6, learning_rate=0.1, verbose=0 ) start = time.time() cat.fit(X_train, y_train) cat_train_time = time.time() - start start = time.time() cat_preds = cat.predict(X_test) cat_infer_time = time.time() - start cat_acc = accuracy_score(y_test, cat_preds) print(f"CatBoost → Acc: {cat_acc:.4f}, Train: {cat_train_time:.2f}s, Infer: {cat_infer_time:.4f}s") Testing TabPFN Finally, we evaluate TabPFN, which takes a fundamentally different approach compared to traditional models. Instead of learning from scratch on the dataset, it leverages a pretrained model and simply conditions on the training data during inference. The .fit() step mainly involves loading the pretrained weights, which is why it is extremely fast. On our dataset, TabPFN achieves the highest accuracy of 98.8% , outperforming both Random Forest and CatBoost. The fit time is just 0.47 seconds, significantly faster than the tree-based models since no actual training is performed. However, this shift comes with a trade-off—inference takes 2.21 seconds, which is much slower than CatBoost and Random Forest. This is because TabPFN processes both the training and test data together during prediction, effectively performing the “learning” step at inference time. Overall, TabPFN demonstrates a