tejasvaidhya's picture
Copy of tejasvaidhya/tabiclv2-replication-stage2-stage3
7c2d684 verified
|
Raw History Blame Contribute Delete
4.44 kB
---
license: apache-2.0
library_name: tabicl
pipeline_tag: tabular-classification
tags:
- tabular
- in-context-learning
- tabicl
- foundation-model
---
# TabICLv2 replication, stages 2 and 3
The from-scratch replication of the TabICLv2 tabular foundation model (classification only, `max_classes=10`) after the
second and third pretraining stages. Stock architecture: column, row and a 12-block in-context-learning (ICL) stage,
**27.6M parameters**. Stage 1 (500K steps, all 100 checkpoints) is in
[`tejasvaidhya/tabiclv2-replication-stage1-500k`](https://huggingface.co/tejasvaidhya/tabiclv2-replication-stage1-500k);
this repository continues that lineage:
stage 1, 500K steps → **stage 2, 40K steps** → **stage 3, 10K steps** (`tabiclv2-replication-stage3-10k.ckpt` = final model)
Training and evaluation code and the original checkpoints are by Ayush Kaushal (Nolano AI), first released with a subset of
snapshots at [`ayushkaushal4/tabiclv2-replication`](https://huggingface.co/ayushkaushal4/tabiclv2-replication). This
repository holds every saved checkpoint of stages 2 and 3, with optimizer state removed. The weights of the final model are
identical to that release's `stage3/step-10000.ckpt`.
## Recipe
| | stage 2 | stage 3 |
|---|---|---|
| initialised from | stage-1 final, 500K (fresh optimizer) | stage-2 final, 40K (fresh optimizer) |
| steps × tables per step | 40,000 × 64 | 10,000 × 64 |
| rows per table | 400–10,240, log-uniform, 80% in context | 400–60,000, log-uniform, 80% in context |
| optimizer, peak LR | Muon 1e-4, aux AdamW 1e-4 | Muon 2e-5, aux AdamW 2e-5 |
| schedule | 800 warmup steps, cosine | 200 warmup steps, cosine |
| gradient clip | 10 | 1.0 |
| other | weight decay 0.1 (plain), bf16 autocast with fp32 ssmax | as stage 2; activation checkpointing above 20K rows; nothing frozen |
| wall time (1× H100) | ~2 days | ~2.3 days |
Data: synthetic tables from the TabICLv2 prior (stage-2 and stage-3 curricula), generated on a separate CPU node.
## Quality
Final stage-3 model against the released `tabicl-classifier-v2`, same evaluation harness (from the original release):
| benchmark | this model | released TabICLv2 |
|---|---|---|
| TabArena-Lite, Elo | 1537.6 | 1557.7 |
| TALENT, 181 classification datasets, mean accuracy | 0.8400 (W/T/L 50/30/101) | 0.8426 |
| large-dataset suite (15–48K rows), mean accuracy | 0.9133 | 0.9204 |
TabArena-Lite Elo (38 classification datasets) on the leaderboard of the looped-transformer study, where all entries share one
board: stage 1 (500K) 1389 (95% CI +72 / −69); stage 2 at 20K steps 1463 (+55 / −64). Elo depends on which entries are on a
board, so these values are not comparable with the table above.
## Files
- `tabiclv2-replication-stage3-10k.ckpt`: final model, end of stage 3 (`state_dict`, `config`, `curr_step`), 110 MB
- `tabiclv2-replication-stage2-40k.ckpt`: end of stage 2
- `checkpoints/stage2/step-02000.ckpt … step-40000.ckpt`: all 22 stage-2 checkpoints, every 2K steps
- `checkpoints/stage3/step-00250.ckpt … step-10000.ckpt`: all 40 stage-3 checkpoints, every 250 steps
- `inference.py`: minimal loader and demo
All checkpoints have the optimizer state removed. Step numbers count from the start of each stage.
## Usage
```bash
pip install "tabicl==2.1.1" pandas scikit-learn huggingface_hub # the version used for the reported numbers
python inference.py # demo on breast cancer: accuracy 0.971, ROC AUC 0.995
python inference.py --ckpt tabiclv2-replication-stage2-40k.ckpt # end of stage 2: accuracy 0.965, ROC AUC 0.995
python inference.py --ckpt checkpoints/stage3/step-05000.ckpt # any intermediate checkpoint
```
```python
from inference import load_classifier
clf = load_classifier().fit(X_train, y_train) # or load_classifier("checkpoints/stage2/step-20000.ckpt")
proba = clf.predict_proba(X_test)
```
## Recipe deviations from the official scripts (from the original release; documented, not endorsed)
- bf16 autocast with fp32 stability islands, instead of tf32
- plain weight decay 0.1 instead of 0.01
- ssmax, embeddings, norms and heads on an auxiliary AdamW group instead of one Muon group
- warmup 2% instead of 1%; cosine floor 0 instead of 1e-7
- min_features 2 instead of 1; micro-batch 8 instead of 4
- stage-2/3 in-context fraction exactly 0.80 instead of 0.79–0.81
Research artifacts, not a supported product.