nlp-ui-small
Small (~9M param) classifiers that power nlp-ui's
offline data-profiling pipeline: column field-role classification (16 roles) and
dataset layout classification (5 layouts). Same question shapes as TypeSafe Jev
(choice with probabilities + confidence), none of the API calls.
Checkpoints (subfolders, download only what you need)
| Folder | Params | fp32 | Best at |
|---|---|---|---|
fieldrole/ |
~8.7M | ~35 MB | column roles (16-way) |
layout/ |
~10k | ~40 KB | dataset layouts (5-way) |
Each folder holds model.safetensors, model.onnx, plus vocab.json /
config.json for the field-role encoder.
Use (ONNX, no torch needed)
import json, numpy as np, onnxruntime as ort
from tokenize import split_key # see repo: python/features.py
vocab = json.load(open("fieldrole/vocab.json"))
sess = ort.InferenceSession("fieldrole/model.onnx", providers=["CPUExecutionProvider"])
# tokens: int64[1,12] key-token ids, kind: int64[1] value-kind id,
# numeric: float32[1,64] (48 ngram counts/8 + 12 flags + 4 scalars)
logits = sess.run(None, {"tokens": t, "kind": k, "numeric": n})[0]
probs = np.exp(logits) / np.exp(logits).sum()
Or serve behind HTTP and consume from nlp-ui via the remote-classifier
adapter (same choice/probabilities/confidence contract as Jev).
Training
Transformer encoder (d=320, 6 layers) + scalar fusion head, trained with
AdamW and label smoothing on the seeded synthetic corpus in
python/data.py (tens of thousands of column profiles). See
python/train_small.py. Held-out metrics are printed at train time.
Honest limits
- Synthetic-trained: profiles outside the generator's scalar ranges are the
main failure mode; abstain below your confidence floor (
minRoleConfidence). - 16-option single questions only; split 50+ option sets coarse-to-fine.
- Refit temperature on your own labeled columns before trusting probabilities.