dhenneberger1 commited on
Commit
4bde3ce
·
verified ·
1 Parent(s): 3371f0f

Add fp16 RT-J checkpoints + model card

Browse files
README.md ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-nc-sa-4.0
3
+ base_model: stanford-star/rt-j
4
+ tags:
5
+ - relational-deep-learning
6
+ - relational-databases
7
+ - tabular
8
+ - tabular-classification
9
+ - tabular-regression
10
+ - foundation-model
11
+ - in-context-learning
12
+ - fp16
13
+ - relational-transformer
14
+ datasets:
15
+ - stanford-star/the-join
16
+ - stanford-star/relbench
17
+ ---
18
+
19
+ # RT-J — fp16 checkpoints
20
+
21
+ Half-precision conversions of [stanford-star/rt-j](https://huggingface.co/stanford-star/rt-j),
22
+ the Relational Transformer foundation model for in-context learning over
23
+ relational databases. Produced and consumed by the
24
+ [RelativeDB](https://github.com/RelativeDB) native inference engine
25
+ (`cpp/rt_quantize --type f16`). Weights stay **f16-resident** at inference:
26
+ the engine's CPU (Accelerate / portable SIMD) and Metal/MPS kernels convert
27
+ to fp32 inside the GEMM, halving weight memory and DRAM traffic vs. fp32
28
+ with **no measurable accuracy loss** (drift vs. the PyTorch reference is
29
+ identical to the fp32 checkpoint on the golden batch).
30
+
31
+ Sibling repos: [rt-j-int8](https://huggingface.co/RelativeDB/rt-j-int8) ·
32
+ [rt-j-int4](https://huggingface.co/RelativeDB/rt-j-int4)
33
+
34
+ | File | Task head | Size |
35
+ |---|---|---|
36
+ | `classification/model.f16.safetensors` | classification / ranking (logits — apply sigmoid) | 172 MB |
37
+ | `regression/model.f16.safetensors` | regression / forecasting (normalized values) | 172 MB |
38
+
39
+ ## Format
40
+
41
+ Plain safetensors: every transformer-block projection (`wq/wk/wv/wg`, `wo`,
42
+ `ffn.w1/w2/w3` — ~99% of parameters) is stored as `F16` (IEEE half,
43
+ round-to-nearest). The value/col-name encoders, decoder head, norms, biases
44
+ and mask embeddings stay fp32. Any safetensors reader can load these files.
45
+
46
+ ## Accuracy
47
+
48
+ Golden batch (B=5, S=16) vs. the PyTorch reference, identical on CPU and
49
+ Metal/MPS: `yhat` max abs. error 3.9e-3 — the same as the fp32 checkpoint
50
+ (upstream weights are bf16, so f16 storage adds no error above fp32
51
+ op-ordering drift).
52
+
53
+ ## Usage (RelativeDB native engine)
54
+
55
+ ```bash
56
+ ./build/rt_test testdata classification/model.f16.safetensors --quantized --device mps
57
+
58
+ # via the Java / Python / Rust bindings: place the .f16 file next to the fp32
59
+ # checkpoint (or point at a directory containing it) and opt in with
60
+ export RELATIVEDB_RT_QUANTIZED=f16
61
+ ```
62
+
63
+ The C ABI (`rt_model_load`) accepts these files directly — the format is
64
+ auto-detected from the tensor dtypes. f16 checkpoints currently run on the
65
+ CPU and Metal/MPS backends (CUDA is fp32-only).
66
+
67
+ ## Reproduce
68
+
69
+ ```bash
70
+ cmake -B build -S cpp && cmake --build build -j
71
+ ./build/rt_quantize <rt-j>/classification/model.safetensors classification/model.f16.safetensors --type f16
72
+ ./build/rt_quantize <rt-j>/regression/model.safetensors regression/model.f16.safetensors --type f16
73
+ ```
74
+
75
+ ## License & attribution
76
+
77
+ Derivative of [stanford-star/rt-j](https://huggingface.co/stanford-star/rt-j)
78
+ (Stanford STAR lab), redistributed under the same **CC-BY-NC-SA-4.0**
79
+ license. Architecture and training details are described in the upstream
80
+ model card; only the weight storage format differs here.
classification/config.json ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "codename": "rt-j-clf",
3
+ "name": "RT-J Classifier",
4
+ "task_type": "clf",
5
+ "checkpoint_file": "model.f16.safetensors",
6
+ "embedding_model": "all-MiniLM-L12-v2",
7
+ "d_text": 384,
8
+ "model": {
9
+ "num_blocks": 12,
10
+ "d_model": 512,
11
+ "d_text": 384,
12
+ "num_heads": 8,
13
+ "d_ff": 2048,
14
+ "materialize_attn_masks": true
15
+ },
16
+ "provenance": {
17
+ "run_id": "pjbmgvu2",
18
+ "swa_step": 58000,
19
+ "project": "2026-04-17",
20
+ "recipe": "real_mixed_v6_5_486t"
21
+ }
22
+ }
classification/model.f16.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f28ce4de905ce995e850b4ba1a00aeb68c1e2d69245d35110cfac7d2d332658f
3
+ size 172430356
regression/config.json ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "codename": "rt-j-reg",
3
+ "name": "RT-J Regressor",
4
+ "task_type": "reg",
5
+ "checkpoint_file": "model.f16.safetensors",
6
+ "embedding_model": "all-MiniLM-L12-v2",
7
+ "d_text": 384,
8
+ "model": {
9
+ "num_blocks": 12,
10
+ "d_model": 512,
11
+ "d_text": 384,
12
+ "num_heads": 8,
13
+ "d_ff": 2048,
14
+ "materialize_attn_masks": true
15
+ },
16
+ "provenance": {
17
+ "run_id": "fsuj4wdl",
18
+ "swa_step": 18000,
19
+ "project": "2026-04-17",
20
+ "recipe": "real_mixed_v6_5_486t"
21
+ }
22
+ }
regression/model.f16.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1e918aecaae8cf60ed9f886eee9974580a39841748179b6a116d73c220864c8d
3
+ size 172430356