TabSTAR: A Foundation Tabular Model With Semantically Target-Aware Representations (arXiv:2505.18125, MIT © Alan Arazi et al.) — deployed on Ascend 910 NPU with torch_npu.
alana89/TabSTAR is a tabular foundation model designed for transfer learning on
tabulated data that contains free-text columns. It unfreezes a pretrained text
encoder (intfloat/e5-small-v2) and takes target tokens as input so the model can
learn task-specific embeddings. Its architecture is free of dataset-specific
parameters:
intfloat/e5-small-v2 (BERT, hidden 384), unfrozen, takes the
verbalized feature strings (Predictive Feature: <col>\nFeature Value: <value>) plus
target tokens (Target Feature: <label>\nFeature Value: <class>).Runtime: torch_npu + FastAPI serving (/v1/classify, /v1/regress). vLLM-Ascend
0.18 is not applicable: the registry has no non-autoregressive tabular-LLM entry and the
model is a custom TabStarModel (model_type tabstar), so inference runs the base model
weights directly on the NPU.
| Component | Version |
|---|---|
| Ascend | 910 (64GB HBM), CANN 8.5.1 |
| torch / torch_npu | 2.9.0 / 2.9.0.post1 |
| transformers | 4.57.6 |
| tabstar | 1.1.16 (vendored, 2 NPU patches) |
| Python | 3.11.14 |
inference.py — TabSTAR engine (loads base weights on NPU, zero-shot predict)server.py — FastAPI service (/health, /v1/classify, /v1/regress)start_serve.sh — one-shot launch (npu:1:8040)download_model.py — idempotent weight download (hf-mirror + sha256 check)npu_smoke.py / test_server.py / verify_npu_vs_cpu.py — validationtabstar/ — vendored tabstar package with NPU patches (patches/tabstar_ascend_npu.patch)pip install -r requirements.txt # peft skrub joblib ...
python3 download_model.py # weights -> /data/.cache/models
bash start_serve.sh # npu:1:8040
python3 test_server.py # classify + regress smoke tests
python3 verify_npu_vs_cpu.py # NPU vs CPU numerical agreementThe service exposes two zero-shot endpoints. Each request carries a small labeled training table (to fit the semantic verbalizer / scalers) plus an unlabeled test table:
curl -s localhost:8040/v1/classify -H 'Content-Type: application/json' \
-d '{"dataset":"imdb","test_size":0.1}'
# convenience demo using the official imdb.csv quickstartor send raw tables:
{
"train": [{"review": "A hilarious comedy", "rating": 7.2, "label": "comedy"}, ...],
"target": "label",
"test": [{"review": "A touching drama", "rating": 6.8}, ...]
}Two small patches to the vendored tabstar package (see patches/tabstar_ascend_npu.patch):
arch/arch.py — force attn_implementation="eager" for the E5-BERT text encoder
(aclnnFlashAttentionScore is historically unstable on torch_npu for this model).preprocessing/feat_types.py — treat pandas str dtype (pandas≥3.0) as a textual
feature in is_numerical_feature (upstream expects object dtype and raises).The rest of the model (eager Transformer blocks, linear/ReLU/softmax heads, scalers) is native NPU-friendly and runs unmodified.
Official quickstart demo — IMDB movie table (Genre_is_Drama, text + numeric columns),
zero-shot (no fine-tuning):
| Metric | Value |
|---|---|
| Classification accuracy (80 rows) | 0.975 |
| NPU vs CPU probability max_abs_diff | 2.3e-3 |
| NPU vs CPU cosine | 0.999999881 |
| NPU vs CPU label agreement | 1.000 |
| NPU latency | ~26 ms/row |
| CPU latency | ~302 ms/row (~11.4× faster on NPU) |
| Serving HTTP (80 rows) | p50 ≈ 683 ms |
| Process HBM | ~1.15 GB (npu:1) |
Weights: alana89/TabSTAR (cc-by-4.0), pulled via hf-mirror.com. Code: MIT © Alan
Arazi et al. (package tabstar 1.1.16, vendored with 2 NPU patches).