tejasvaidhya's picture
Copy of tejasvaidhya/tabloop-block-sweep-small
89917da verified
|
Raw History Blame Contribute Delete
6.68 kB
---
license: other
library_name: tabloop
tags:
- tabular-classification
- in-context-learning
- looped-transformer
- tabicl
---
# Tab-Loop block sweep (small scale, stage 1)
Checkpoints of the **block-count sweep**: how many *distinct* ICL blocks a looped tabular foundation model needs. Every run uses the
TabICLv2 stage-1 classification recipe at a reduced budget (32 tables per step, 200K steps); only the ICL stack changes.
Notation: **(nβŠ—k)** = n distinct ICL blocks applied k times in sequence (nΒ·k block applications).
**Looped** = (nβŠ—12/n): n tied blocks, loop count k sampled during training. **Untied** = (nβŠ—1): n ordinary blocks, run once.
- **12 block applications at 3.20 EFLOP:** looped n = 1, 2, 3, 4, 6 against untied n = 1, 2, 3, 4, 6 (trained longer, so each
matches the looped run's compute) and the untied 12-block baseline.
- **24 block applications at 4.45 EFLOP:** looped (4βŠ—6) and untied (24βŠ—1).
Every looped model is within 0.001 of the untied 12-block model on held-out loss with 2–7Γ— fewer parameters, while untied models with the same
parameters as a looped one fall clearly behind, even when given its full compute.
![block sweep](figures/fig_tierb_blocks_paper.png)
## Runs
Held-out log loss: 1,024 fixed synthetic tables from the training prior (seed 4242), final checkpoint. Looped models are read at
their training-mean depth k = 12/n (k = 6 for (4βŠ—6)); best test depth in the last column. Lite Elo: TabArena-Lite, 38
classification datasets, one board holding all of these models (95 % CI β‰ˆ Β±60–90).
### 12 block applications, 3.20 EFLOP
| Folder | Model | Params | Loops in training | Steps | TFLOP/step | Held-out loss | Best test depth | Lite Elo |
|---|---|---|---|---|---|---|---|---|
| `base_12x1` | (12βŠ—1) untied 12 | 27.55M | 1 | 200,000 | 16.01 | 0.4711 | β€” | 1335 |
| `loop_1x12` | (1βŠ—12) looped | 3.96M | U{8..16} | 200,000 | 16.01 | 0.4718 | k=16: 0.4714 | 1323 |
| `loop_2x6` | (2βŠ—6) looped | 6.11M | U{4..8} | 200,000 | 16.01 | 0.4709 | k=8: 0.4705 | 1256 |
| `loop_3x4` | (3βŠ—4) looped | 8.25M | U{3,4,5} | 200,000 | 16.01 | 0.4704 | k=5: 0.4700 | 1292 |
| `loop_4x3` | (4βŠ—3) looped | 10.40M | U{2,3,4} | 200,000 | 16.01 | 0.4709 | k=4: 0.4705 | 1307 |
| `loop_6x2` | (6βŠ—2) looped | 14.69M | U{1,2,3} | 200,000 | 16.01 | 0.4722 | k=3: 0.4717 | 1263 |
| `ctrl_1x1` | (1βŠ—1) untied 1 | 3.96M | 1 | 311,100 | 10.29 | 0.5004 | β€” | 1182 |
| `ctrl_2x1` | (2βŠ—1) untied 2 | 6.11M | 1 | 296,200 | 10.81 | 0.4861 | β€” | 1226 |
| `ctrl_3x1` | (3βŠ—1) untied 3 | 8.25M | 1 | 282,600 | 11.33 | 0.4801 | β€” | 1221 |
| `ctrl_4x1` | (4βŠ—1) untied 4 | 10.40M | 1 | 270,200 | 11.85 | 0.4779 | β€” | 1265 |
| `ctrl_6x1` | (6βŠ—1) untied 6 | 14.69M | 1 | 248,400 | 12.89 | 0.4756 | β€” | 1315 |
Equal-data reads: each untied control also has its **200K-step checkpoint** (same 6.4M tables as the looped runs, mid-schedule):
held-out 0.5146 / 0.5035 / 0.4954 / 0.4897 / 0.4841 and Lite Elo 1137 / 1161 / 1153 / 1228 / 1293 for 1 / 2 / 3 / 4 / 6 blocks.
### 24 block applications, 4.45 EFLOP
| Folder | Model | Params | Loops in training | Steps | TFLOP/step | Held-out loss | Best test depth | Lite Elo |
|---|---|---|---|---|---|---|---|---|
| `loop_4x6` | (4βŠ—6) looped | 10.40M | U{4..8} | 200,000 | 22.25 | 0.4665 | k=7–8: 0.4663 | 1382 |
| `untied_24x1_s` | (24βŠ—1) untied 24, stabilised | 53.29M | 1 | 200,000 | 22.25 | 0.4672 | β€” | 1307 |
| `untied_24x1` | (24βŠ—1) untied 24, shared recipe | 53.29M | 1 | 200,000 | 22.25 | 0.4756 | β€” | 1335 |
`untied_24x1` uses the shared recipe and has a loss spike at 85–130K steps (attention-scale runaway in its first ICL block).
`untied_24x1_s` reruns it with Muon LR 5.7e-4, AdamW LR 7e-5 and gradient clip 1 (shared: 8e-4 / 1e-4 / 10); everything else is
identical. All other runs use the shared recipe.
![loss vs block applications](figures/fig_tierc_appl.png)
## Recipe (all runs)
- **Model:** TabICLv2 architecture at full width: column stage 3 blocks (embed 128, 128 inducing points), row stage 3 blocks
(4 CLS tokens), ICL blocks of width 512, 8 heads, MLP ratio 2 (2.145M parameters per block; 1.82M outside the ICL stack).
Looped models re-add the stage input before every block application after the first and back-propagate through every loop.
- **Data:** TabICLv2 stage-1 `graph_scm` prior with the unpredictable-table filters; 2–100 features, 2–10 classes, 1,024 rows,
30–90 % in context. 32 tables per step, fresh tables every step.
- **Optimiser:** Muon 8e-4 (matrices) / AdamW 1e-4, weight decay 0.1, gradient clip 10, 4K-step warmup, cosine decay over the
run's own length. bf16 with fp32 column attention.
- **Compute:** TFLOP per step (forward + backward, all micro-batches) measured with PyTorch's FLOP counter:
9.773 + 0.520 Γ— block applications. Untied controls get extra steps so that steps Γ— TFLOP/step = 3.20 EFLOP.
- **Same tables:** the runs read one shared cache of generated steps, so they see identical tables in identical order, except
`loop_4x6` and `untied_24x1`, which were trained on locally generated streams from the same prior.
- One seed per run (training seed 43).
Full configs: `configs/small_base.yaml` (base) and `configs/runs.tsv` (per-run overrides). Each checkpoint also stores its
resolved config.
## Files
- `checkpoints/<run>/step-XXXXXX.ckpt`: every 10K steps plus the final step (optimizer and RNG state removed;
`{"step", "model", "config"}`). 14 runs, 324 checkpoints, 19 GB.
- `results/heldout_loss.tsv`: held-out log loss and accuracy of every checkpoint; finals also at test depths k = 1–10
(1–16 for `loop_1x12`).
- `results/block_sweep_table.csv`: the table above with sources.
- `figures/`: block-sweep figure, loss vs block applications, Lite Elo, depth sweep, the compute version of panel (a).
- `example.py`: download a checkpoint and classify a table.
## Usage
The checkpoints are native [TabLoop](https://github.com/tejasvaidhyadev/Tabloop) checkpoints (trained at commit `8830f27`).
```bash
git clone https://github.com/tejasvaidhyadev/Tabloop && git -C Tabloop checkout 8830f27
pip install torch scikit-learn huggingface_hub
PYTHONPATH=Tabloop python example.py --run loop_4x3 --loops 3
```
```python
from tabloop.evaluation.classifier import TabLoopClassifier
clf = TabLoopClassifier.from_checkpoint("checkpoints/loop_4x6/step-200000.ckpt", loops=6) # any k for looped models
clf.fit(X_train, y_train)
proba = clf.predict_proba(X_test)
```
Breast-cancer check (30 % test split, seed 0): `loop_4x3` k=3 accuracy 0.959 / AUC 0.995; `loop_4x6` k=6 0.971 / 0.995;
`base_12x1` 0.965 / 0.995; `untied_24x1_s` 0.965 / 0.995.