TabNamer-75M: Training a 75.2M Local Semantic Engine from Scratch
Zero pre-trained weights, +38.6% more active Transformer body than FLAN-T5-small under the same parameter cap, dual title + intent + 576-d embedding outputs from one local encoder pass, and 160/160 exact ONNX parity at 45.0 ms on Apple Silicon.
external_weights_loaded: false)
wf16 vs PyTorch FP32 calibration parity
1. Abstract
Earlier PorkiCoder releases shipped a title-tuned checkpoint of Google's FLAN-T5-small (76,961,152 parameters, 253 MB in ONNX). That model produced strong 2–3 word tab titles, but it carried two structural ceilings: it inherited an untied 32,128-token SentencePiece vocabulary that consumed 42.7% of its parameter budget in lookup tables, and it only emitted a bare title string with no sentence-level intent summary or reusable semantic vector for downstream Living Cards features.
In Round 9 we designed and trained TabNamer-75M completely from random initialization (external_weights_loaded: false) under a strict sub-FLAN parameter ceiling (75,222,144 total parameters). Replacing FLAN's legacy architecture with an asymmetric 10-encoder / 4-decoder RoPE + RMSNorm + SwiGLU graph and a tied 24,576-token case-preserving BPE vocabulary reallocates capacity directly into the Transformer body: 61,066,368 active body parameters (+38.6% over FLAN-T5-small's 44.06M).
After 30,000 steps of scratch UL2 pretraining (1.475B tokens), role-balanced multi-task supervised fine-tuning on 48,243 firewalled coding-agent rows (with auxiliary <intent> supervision), stochastic weight averaging (SWA soup), and gentle on-policy DPO (gentle_soup/epoch-2), we evaluated TabNamer-75M head-to-head against our fine-tuned production FLAN-T5-small incumbent using an identity-blind, position-swapped gemini-4-neon subagent judge. On the 160-message calibration panel (53 sessions), TabNamer-75M won 47–35 (57.3% decisive; 95% CI [45.7%, 68.8%]) overall and 27–16 (62.8%; 95% CI [46.3%, 77.5%]) on user requests, while trailing FLAN-T5 on standalone usefulness (72.5% vs 77.5% on cal-160; 82.1% vs 88.1% on dev-84). Because the pre-registered dual promotion gate (passes_both) remains false, the 180-case confirmation reserve stays sealed.
On the deployment side, naive dynamic INT8 ONNX quantization degraded parity to 148/160 (92.5%) due to SwiGLU activation outliers, and per-row INT8 embedding compression introduced 0.56 logit drift. Switching to weight-only FP16 linear matrices (wf16) with a deduplicated FP16 tied embedding table recovered 160/160 (100.00%) exact parity against PyTorch FP32 at 45.0 ms p50 (53.2 ms p95) on Apple Silicon CPU in a 172.81 MB bundle. PorkiCoder 3.0.0 ships TabNamer-75M as the default local semantic engine powering Living Cards 3.0 and offline Semantic Jump, while keeping fine-tuned FLAN-T5 selectable in Settings.
TabNamer-75M is a from-scratch specialist evaluated on internal English coding-agent session messages (cal-160 and dev-84) with an identity-blind gemini-4-neon subagent judge, not human raters. Head-to-head decisive preference favors TabNamer-75M on cal-160 (57.3%), while standalone usefulness still favors our fine-tuned FLAN-T5-small incumbent on both panels (72.5% vs 77.5% on cal-160; 82.1% vs 88.1% on dev-84). The 180-case confirmation reserve has not been opened. Do not mix these numbers with the earlier August 2026 Terminal-board FLAN study, the Stack Overflow benchmark, or the 6.9M / 18.59M November studies.
2. Architecture: Reallocating the 77M Budget
Tab naming is fundamentally an asymmetric encoding problem: the input carries up to 256 tokens of noisy terminal prompts, file paths, project names, and prior-turn context, while the output is only 2–3 words (up to 32 characters for <title>) or a single concise sentence (for <intent>). Allocating equal depth to encoder and decoder wastes compute on the short generation side, and storing separate input/output embeddings over a 32k general multilingual SentencePiece vocabulary starves the Transformer layers.
| Property | Production FLAN-T5-small (Fine-Tuned) | TabNamer-75M (Round 9, From Scratch) |
|---|---|---|
| Pre-trained weights | Google FLAN-T5-small + PorkiCoder title SFT | None (origin: "random", external_weights_loaded: false) |
| Total parameters | 76,961,152 | 75,222,144 (−2.26%) |
| Active Transformer body | 44,060,000 | 61,066,368 (+38.6%) |
| Encoder / Decoder depth | 6E / 6D | 10E / 4D (asymmetric) |
| Hidden width / Heads / FFN | d=512, 8 heads, d_ff=1024 | d=576, 9 heads, d_ff=1536 (SwiGLU) |
| Positional & Norm layers | Relative bias + LayerNorm | RoPE (θ=10,000) + RMSNorm |
| Tokenizer | 32,128 SentencePiece (untied LM head) | 24,576 case-preserving BPE (tied embeddings) |
| Outputs per local pass | Title string only | <title>, <intent>, beam margin, top-3 candidates, 576-d unit vector |
| Shipped ONNX footprint | 253.0 MB | 172.81 MB (−80.2 MB) |
The encoder accepts structured role and context tags — <title> or <intent>, <role_user> or <role_assistant>, <project>, optional <prior>, and <msg> — and emits both full sequence hidden states (for KV-cached autoregressive decoding) and an L2-normalized mean-pooled 576-d representation (pooled_embed) directly inside the same encoder forward pass. Title decoding uses constrained beam search (W = 4, length penalty 0.65, strictly 2–3 words, ≤32 characters, zero lookup tables) and exposes the normalized score gap between beam 1 and beam 2 (margin) plus the top-3 distinct candidate titles.
3. Four-Stage Scratch Training & Leak Firewall
Every stage ran locally on a single NVIDIA GB10 workstation (thinkstationpgx-023f) with zero external API spend for pretraining or local synthetic labeling:
- Trace Mining & Strict Firewall: We mined 46,635 local files into candidate user requests (3,758 mined rows), assistant emissions (13,425 mined rows), and existing private labeled traces (43,873 rows). Every candidate row passed a deterministic leak firewall checking exact SHA-256 hashes, normalized 12-token prefixes, and session IDs against
dev-84,cal-160, and the sealed 180-case reserve (0 evaluation leaks). - Stage 1 — Scratch UL2 Pretraining (30,000 steps): We trained a custom 24,576-token case-preserving BPE tokenizer on a 1,764,923,384-token (1.765B) code, technical prose, and trace corpus, then pretrained TabNamer-75M from random seed
902026for 30,000 steps (1,474,560,000 tokens seen) under a UL2 denoising mixture: 50% R-Denoiser (15% corruption, mean span 3), 25% X-Denoiser (50% corruption, mean span 12), and 25% S-Denoiser (prefix-to-suffix continuation). Cross-entropy loss fell from ~10.25 at initialization to 2.8717 at step 30,000. - Stage 2 — Role-Balanced Multi-Task SFT + UL2 Replay: We fine-tuned on 48,243 clean firewalled SFT rows (
sft_train_v2.jsonl, combining 47,827 scrubbed v1 rows, 6,987 auxiliary<intent>summaries, and teacher-refreshed labels) with 50/50 user-request and assistant-emission balancing plus UL2 replay to preserve general technical vocabulary. - Stage 3 — SWA Soup & Gentle On-Policy DPO: We averaged intermediate SFT checkpoints into a weight soup (
swa_soup), then ran gentle on-policy SimPO/DPO + NLL preference optimization for 2 epochs (380 steps, seed922026) combining blind Qwen3.8-27B on-policy ranked pairs with deterministic entity-faithfulness hard negatives (mangled acronyms such asGSG → GNSGand ungrounded generic nouns) to producegentle_soup/epoch-2.
4. Identity-Blind Evaluation vs Fine-Tuned FLAN-T5-small
All evaluations used blind_neon_harness.py with an identity-blind gemini-4-neon subagent judge. Every standalone title was scored anonymously in hash-randomized order, and every pairwise comparison ran twice in opposite A/B positions (position-swapped waves); disagreements between the two orderings are counted explicitly as unstable rather than tie-broken. Confidence intervals are 95% session-clustered bootstraps.
4.1 Calibration Panel (n = 160, 53 sessions — gentle_soup/epoch-2 vs Fine-Tuned FLAN-T5)
| Slice | n (sessions) | TabNamer-75M Useful | FLAN-T5 Useful | Mean (75M / FLAN) | Votes (75M / FLAN / Eq / Neither / Unst) | 75M Decisive Win % [95% CI] |
|---|---|---|---|---|---|---|
| All messages | 160 (53) | 116/160 (72.5%) | 124/160 (77.5%) | 7.144 / 7.213 | 47 / 35 / 45 / 19 / 14 | 57.3% [45.7, 68.8] |
| User requests | 80 (37) | 55/80 (68.8%) | 57/80 (71.2%) | 6.997 / 6.891 | 27 / 16 / 17 / 11 / 9 | 62.8% [46.3, 77.5] |
| Assistant emissions | 80 (53) | 61/80 (76.2%) | 67/80 (83.8%) | 7.291 / 7.536 | 20 / 19 / 28 / 8 / 5 | 51.3% [34.7, 69.2] |
4.2 Ordinary Dev Progression (n = 84, 19 sessions — 42 user / 42 assistant)
| Checkpoint | 75M Useful | FLAN Useful | 75M Mean | FLAN Mean | Votes (75M / FLAN / Eq / Neither / Unst) | Decisive Win % [95% CI] |
|---|---|---|---|---|---|---|
sft_step-1500 |
65/84 (77.4%) | 73/84 (86.9%) | 7.185 | 7.568 | 22 / 32 / 19 / 2 / 9 | 40.7% [27.6, 54.2] |
sft_step-3000 |
65/84 (77.4%) | 73/84 (86.9%) | 7.236 | 7.483 | 27 / 31 / 18 / 0 / 8 | 46.6% [35.1, 56.5] |
swa_soup |
67/84 (79.8%) | 70/84 (83.3%) | 7.256 | 7.381 | 19 / 31 / 24 / 1 / 9 | 38.0% [28.1, 48.9] |
gentle_soup/epoch-2 (shipped) |
69/84 (82.1%) | 74/84 (88.1%) | 7.286 | 7.451 | 26 / 31 / 17 / 2 / 8 | 45.6% [33.3, 60.3] |
What the numbers actually say: Going from sft_step-1500 to gentle_soup/epoch-2 lifted standalone dev usefulness monotonically by +4.7 pp (77.4% → 82.1%) and pushed TabNamer-75M ahead of our fine-tuned FLAN-T5-small incumbent on head-to-head decisive preference on the larger 160-message calibration panel (57.3% overall, 62.8% on user requests) — a milestone for a 75.2M model trained with zero pre-trained weights. At the same time, FLAN-T5's massive pretraining corpus still gives it a ~5–6 pp edge in standalone usefulness on rare out-of-distribution nouns (especially assistant emissions on cal-160: 76.2% vs 83.8%). Both models tie verbatim on 32/160 calibration prompts (20%) and 13/84 dev prompts (15.5%).
5. ONNX Export & Why Dynamic INT8 Failed on SwiGLU
Shipping a custom PyTorch architecture inside an Electron desktop app on Apple Silicon requires a deterministic, zero-Python ONNX Runtime bundle (onnxruntime-node@1.24.3). We exported TabNamer-75M into two opset-17 graphs — encoder_model.onnx (emitting encoder hidden states and the L2-normalized 576-d pooled_embed) and decoder_step.onnx (stateless KV-cached single-step decoder) — and tested three quantization strategies against PyTorch FP32 on all 160 calibration prompts:
| Export Format | Exact Match vs PyTorch FP32 (cal-160) | Bundle Size | Apple Silicon CPU Latency | Finding |
|---|---|---|---|---|
| PyTorch FP32 reference | 160/160 (100.00%) | ~301 MB | Baseline | Ground-truth reference |
Dynamic QInt8 (quantize_dynamic) |
148/160 (92.50%) | ~115 MB | ~38 ms | Rejected: 12 title flips caused by SwiGLU activation outliers under per-tensor quantization |
| Per-row Int8 tied embedding | <160/160 | ~158 MB | ~44 ms | Rejected: 0.56 max logit drift on tight beam-4 margins |
Weight-only FP16 (wf16) + FP16 tied emb |
160/160 (100.00%) | 172.81 MB | 45.0 ms p50 / 53.2 ms p95 | Shipped: bit-accurate titles, exact beam margins, 80 MB smaller than FLAN-T5 |
Key engineering lesson: SwiGLU feed-forward blocks exhibit sharp channel outliers that break symmetric per-tensor dynamic INT8 quantization, flipping close beam-search decisions on 7.5% of prompts. Storing linear weights and deduplicated tied embeddings in FP16 while executing matmuls in FP32 (wf16) cuts bundle size by 43% vs FP32, beats FLAN-T5's 253 MB footprint by 80 MB, stays under 54 ms at p95 on CPU, and preserves 100.00% (160/160) exact title parity with PyTorch FP32.
6. From Tab Namer to Local Semantic Engine (PorkiCoder 3.0.0)
Because TabNamer-75M emits a 576-d unit-normalized vector, beam-1-minus-beam-2 confidence margin, top-3 candidates, and an optional <intent> summary from the exact same local encoder pass, PorkiCoder 3.0.0 unlocks eight completely offline Living Cards capabilities without adding a second embedding model or any cloud latency:
- Glance vs Dive Bubble Header: Displays the one-line
<intent>summary at the top of each Living Card speech bubble while keeping full prose expandable underneath. - Beam-Margin Anti-Flicker Hysteresis: Holds the current tab title on low-margin turns (<0.35), blends medium-margin updates (0.35–0.65), and commits cleanly on high-margin transitions (≥0.65).
- Burst Folding & Story Chapters: Folds consecutive turns with cosine similarity ≥0.82 into compact step counts and starts a fresh chapter when similarity drops below 0.58.
- Stuck-Agent LOOPING Radar: Flags a
LOOPINGphase and banner inside the card header when 4+ consecutive turns stay above 0.88 cosine similarity or oscillate back and forth. - Cross-Tab Collision Radar: Compares active tab embeddings within the same repository and surfaces an overlap chip when cosine similarity crosses 0.84.
- Offline Semantic Jump (
Cmd+Shift+K): Embeds the user's query locally in ~15 ms and ranks every live and persisted session chapter (stored as compact int8 quantized vectors) with zero network traffic. - Session-Restore Recap & Right-Click Top-3 Candidate Picker: Surfaces a compact recap chip when reopening persisted tabs and lets users swap titles from the model's top-3 beam candidates on right-click.
7. Ship Decision, Cryptographic Receipts & What Comes Next
Ship decision: PorkiCoder 3.0.0 ships TabNamer-75M (gentle_soup/epoch-2, wf16 ONNX) as the default local semantic engine because it matches or beats fine-tuned FLAN-T5 head-to-head on cal-160 with zero pre-trained weights, shrinks the bundled model by 80 MB, and powers all eight Living Cards 3.0 semantic features completely offline. Because standalone usefulness on rare nouns still favors fine-tuned FLAN-T5 by ~5 pp, PorkiCoder 3.0.0 keeps FLAN-T5 bundled and selectable under Settings → Terminal & Living Cards, and leaves the 180-case confirmation reserve sealed for Round 10 (longer scratch pretraining toward the 3.69B-token target and expanded assistant-emission coverage).