SAVRN
Search Contact SAVRN

Open-weight model · Tabular classification

MetaTree

by Yufan Zhuang yzhuang/MetaTree

Model is avaliable at https://huggingface.co/yzhuang/MetaTree 1. Install metatreelib: 2.

Parameters151M
Context256
Weights302.7 MB
Licensemit
AccessOpen weights
Monthly Downloads80

Runs On

What it takes to serve MetaTree (151M parameters): the memory its weights need at each precision, and the cheapest way to rent enough data-center GPUs to hold them.

PrecisionWeightsMemory neededCheapest setupPer hourAlso fits
16-bit 0.3 GB 0.4 GB 1x MI300X (192 GB)
Vultr
$1.85 1x H100 $1.99 · 1x MI325X $2.00
8-bit 0.2 GB 0.2 GB 1x MI300X (192 GB)
Vultr
$1.85 1x H100 $1.99 · 1x MI325X $2.00
4-bit 0.1 GB 0.1 GB 1x MI300X (192 GB)
Vultr
$1.85 1x H100 $1.99 · 1x MI325X $2.00

Memory is the weights at that precision plus 20% for the runtime and a short context; a long context needs more. Prices are the lowest on-demand hourly rates in the SAVRN Index, read Sep 18, 2026.

Model Card

By Yufan Zhuang, published under mit, revision 6707faaf97af.

Model is avaliable at https://huggingface.co/yzhuang/MetaTree 1. Install metatreelib: 2. Use MetaTree on your datasets to generate a decision tree model We show a complete example of using MetaTree at notebook If you have any questions related to the code or the paper, feel free to reach out to us at [email protected]. If you find our paper and code useful, please cite us

Read Yufan Zhuang's full model card

Learning a Decision Tree Algorithm with Transformers (Zhuang et al. 2024).

MetaTree is a transformer-based decision tree algorithm. It learns from classical decision tree algorithms (greedy algorithm CART, optimal algorithm GOSDT), for better generalization capabilities.

Quickstart -- use MetaTree to generate decision tree models

Model is avaliable at https://huggingface.co/yzhuang/MetaTree

  1. Install metatreelib:
pip install metatreelib
# Alternatively,  
# clone then pip install -e .
# pip install git+https://github.com/EvanZhuang/MetaTree
  1. Use MetaTree on your datasets to generate a decision tree model
from metatree.model_metatree import LlamaForMetaTree as MetaTree
from metatree.decision_tree_class import DecisionTree, DecisionTreeForest
from metatree.run_train import preprocess_dimension_patch
from transformers import AutoConfig
import imodels # pip install imodels 

# Initialize Model
model_name_or_path = "yzhuang/MetaTree"

config = AutoConfig.from_pretrained(model_name_or_path)
model = MetaTree.from_pretrained(
    model_name_or_path,
    config=config,
)
decision_tree_forest = DecisionTreeForest()

# Load Datasets
X, y, feature_names = imodels.get_clean_dataset('fico', data_source='imodels')

print("Dataset Shapes X={}, y={}, Num of Classes={}".format(X.shape, y.shape, len(set(y))))

train_idx, test_idx = sklearn.model_selection.train_test_split(range(X.shape[0]), test_size=0.3, random_state=seed)

# Dimension Subsampling
feature_idx = np.random.choice(X.shape[1], 10, replace=False)
X = X[:, feature_idx]

test_X, test_y = X[test_idx], y[test_idx]

# Sample Train and Test Data
subset_idx = random.sample(train_idx, 256)
train_X, train_y = X[subset_idx], y[subset_idx]

input_x = torch.tensor(train_X, dtype=torch.float32)
input_y = torch.nn.functional.one_hot(torch.tensor(train_y)).float()

batch = {"input_x": input_x, "input_y": input_y, "input_y_clean": input_y}
batch = preprocess_dimension_patch(batch, n_feature=10, n_class=10)
model.depth = 2
outputs = model.generate_decision_tree(batch['input_x'], batch['input_y'], depth=model.depth)
decision_tree_forest.add_tree(DecisionTree(auto_dims=outputs.metatree_dimensions, auto_thresholds=outputs.tentative_splits, input_x=batch['input_x'], input_y=batch['input_y'], depth=model.depth))

print("Decision Tree Features: ", [x.argmax(dim=-1) for x in outputs.metatree_dimensions])
print("Decision Tree Threasholds: ", outputs.tentative_splits)
  1. Inference with the decision tree model
tree_pred = decision_tree_forest.predict(torch.tensor(test_X, dtype=torch.float32))

accuracy = accuracy_score(test_y, tree_pred.argmax(dim=-1).squeeze(0))
print("MetaTree Test Accuracy: ", accuracy)

Example Usage

We show a complete example of using MetaTree at notebook

Questions?

If you have any questions related to the code or the paper, feel free to reach out to us at [email protected].

Citation

If you find our paper and code useful, please cite us:

@misc{zhuang2024learning,
      title={Learning a Decision Tree Algorithm with Transformers}, 
      author={Yufan Zhuang and Liyuan Liu and Chandan Singh and Jingbo Shang and Jianfeng Gao},
      year={2024},
      eprint={2402.03774},
      archivePrefix={arXiv},
      primaryClass={cs.LG}
}

Configuration

Architecture
LlamaForMetaTree
Context length (tokens)
256
Layers
12
Hidden size
768
Feed-forward size
3,072
Attention heads
12
Key/value heads
12
Vocabulary size
32,000
RoPE base
10000
Stored precision
float32
Model type
llama

Identity and Version

Repository
yzhuang/MetaTree
Publisher
Yufan Zhuang
Task
Tabular classification
Modality
Tabular
Library
transformers
Parameters
151M parameters
Languages
Not stated by the source
Revision
6707faaf97af130ebbc5b7985713387c32dde527
First published
2024-02-05
Last updated
2024-08-15

Files and Weights

5 files, 302.7 MB in total. The weights are 1 file totalling 302.7 MB in safetensors.

Weights1 file · 302.7 MB
Configuration2 files · 1.0 KB
Documentation1 file · 3.5 KB
Repository1 file · 1.5 KB
Every file
FileTypeSizeSHA-256
model.safetensorsWeights302.7 MB 55bf1637016a
config.jsonConfiguration872 B
generation_config.jsonConfiguration133 B
README.mdDocumentation3.5 KB
.gitattributesRepository1.5 KB

License and Download

License
mit
Access
Open weights, no gate
Download size
302.7 MB
Download from Yufan Zhuang

Released by Yufan Zhuang through its official repository on Hugging Face. Read the license.

Built From

  • Described by arXiv:2402.03774

Memory Requirements

PrecisionWeights in memory
As published302.7 MB
16-bit0.3 GB
8-bit0.2 GB
4-bit0.1 GB

Weights only, from the published parameter count; the key-value cache and runtime add to this.

Questions About MetaTree

How much GPU memory does MetaTree need?

About 0.4 GB at 16-bit and 0.1 GB at 4-bit: the weights (151M parameters) plus a working margin. A long context needs more.

What is the cheapest GPU to run MetaTree on?

At 16-bit, 1x MI300X from $1.85 an hour; at 4-bit, 1x MI300X from $1.85 an hour, at the lowest on-demand prices the SAVRN Index lists.

Can I use MetaTree commercially?

Yes. MetaTree is released under MIT License. The MIT License is a short permissive license. It permits commercial use, modification and redistribution, provided the copyright notice and permission notice are included.

What is MetaTree's context length?

256 tokens, from the maximum position embeddings in its published configuration.

Similar Models

Model · Tabular classification

DigitalEduTransformers

SnowFlash383935

Модель для соревнования DigitalEdu с использованием трансформеров. 9 эпох. Пример вывода: [False, True]

Open weights gpl-3.0 101M parameters transformers

RT-PluRel is a Relational Transformer checkpoint pair for in-context / few-shot entity prediction over multi-table relational databases (no per-task gradient training). Same architecture and file layout as stanford-star/rt-j — drop-in replacement. Architecture: ~85.6M blocks, dmodel 512, 8 heads, dff 2048 · text columns embedded with all-MiniLM-L12-v2 (dtext 384). Each folder contains model.safetensors (weights) and config.json (dims + text-embedding model). The paper/ subdirectory preserves the earlier RT-PluRel release:.pt checkpoints (12 blocks, dmodel 256, dff 1024) pretrained on synthetic relational databases generated by PluRel, plus the continued-pretraining and fine-tuned RelBench…

Open weights cc-by-nc-sa-4.0 86M parameters pytorch

Model · Tabular classification

mitra-classifier

Autogluon

Mitra classifier is a tabular foundation model that is pre-trained on purely synthetic datasets sampled from a mix of random classifiers. Mitra is based on a 12-layer Transformer of 72 M parameters, pre-trained by incorporating an in-context learning paradigm. To use Mitra classifier, install AutoGluon by running: A minimal example showing how to perform inference using the Mitra classifier: A minimal example showing how to perform fine-tuning using the Mitra classifier: This project is licensed under the Apache-2.0 License. Amazon Science blog: Mitra: Mixed synthetic priors for enhancing tabular foundation models

Open weights apache-2.0 76M parameters

Model · Tabular classification

mitra-classifier-2

Autogluon

Mitra-v2 classifier is a tabular foundation model that is pre-trained on purely synthetic datasets sampled from a mix of random classifiers, including the new Hybrid SCM prior. It is the second generation of the Mitra classifier (autogluon/mitra-classifier), pre-trained with a 10x longer context, three times as many features, and an improved optimizer. On the TabArena and TALENT benchmarks it delivers state-of-the-art accuracy at the level of TabFM and EXAONE Tabular, while surpassing TabPFN-3 by a wide margin. The regression model is at autogluon/mitra-regressor-2, and the inference and fine-tuning code with our evaluation results is at autogluon/mitra-finetune. Mitra-v2 is based on a…

Open weights apache-2.0 76M parameters

Model · Tabular classification

mitra-classifier-1.1

Autogluon

Mitra classifier is a tabular foundation model that is pre-trained on purely synthetic datasets sampled from a mix of random classifiers. Mitra is based on a 12-layer Transformer of 72 M parameters, pre-trained by incorporating an in-context learning paradigm. To use Mitra classifier, install AutoGluon by running: A minimal example showing how to perform inference using the Mitra classifier: A minimal example showing how to perform fine-tuning using the Mitra classifier: This project is licensed under the Apache-2.0 License. Amazon Science blog: Mitra: Mixed synthetic priors for enhancing tabular foundation models

Open weights apache-2.0 76M parameters