tern_tc_t27

The t27 finetune of tern-tc-9m: the same 9M ternary body, tuned on the t27 spec corpus to write function bodies that the specs' own tests then judge.

This README is generated from model_card.t27 -- the spec owns every fact stated here.

Quickstart

git clone https://huggingface.co/playra/tern-tc-9m-t27 && cd tern-tc-9m-t27

sh scripts/verify.sh
# last line: ALL CHECKS DONE

One command checks the whole package: every file hash, the C engine build, and the cross-engine greedy receipt from the Receipt section. With python3 and torch present it also runs the PyTorch parity harness including the teacher-forced C comparison; without torch those parts skip and the C checks still stand alone.

What this is

No general coding ability is claimed. Every number in this card is measured by the t27 selfcheck protocol on this checkpoint's bytes; the model writes t27-shaped bodies and is not a coding assistant.

The base model this checkpoint was tuned from is playra/tern-tc-9m (sha256 3102abdf35057924e077a86db4fdac726e4fe1f6574df47f39a638ba99a3ce9c); its card documents the architecture, the container, the training corpus and the FPGA board receipt. This card covers only what changed.

Architecture

Decoder-only transformer: RMSNorm, RoPE, grouped-query attention (5 query heads to 1 KV head), SwiGLU, tied embeddings. Identical to tern-tc-9m; no architecture change, weights only.

layers 6
d_model 320
attention 5 query heads / 1 KV head, head_dim 64 (GQA)
d_ff (SwiGLU) 864
vocab 8192
context 2048
parameters 9,076,800 (6,451,200 ternary + 2,625,600 fp32)

Container (TC02)

3d8397ef4e388d0cadd1725f64d45ddd4ca0811cf8fbedc4a6a3b2fe92cd45cc -- 16,953,800 bytes. Little-endian TC02, byte-for-byte the layout documented in the base card; the same C engine (c_infer/tc_infer.c) and the same PyTorch loader read it unchanged.

Tokenizer

GPT-2 byte-level BPE, vocab 8192, fill-in-the-middle special ids 0-5 -- the same 8K tokenizer the base model trained with.

81355717cd63d2d92f2d1553eee8e072c05cf49b41990d03b20e7898df0ed9d8

Finetune

Initialised from the published base checkpoint (the sha above), then tuned on nothing but the t27 spec corpus: 337 steps x 65,536 tokens over a 7,368,311-token corpus, i.e. just under three epochs. The base's pretraining corpus and licenses are documented in the base package's manifest, which this package does not duplicate.

  • data: the t27 spec corpus: every .t27 source of the t27/trinity spec corpus, framed as fill-in-the-middle (prefix to the body's opening brace, suffix after the closing brace)
  • tokens seen: 22,085,632 (337 steps x 65,536) over a 7,368,311-token corpus
  • validation (286,148 tokens): bpb 0.6105, loss 1.1268
  • peak LR 0.0008065, warmup 67 steps, decay from step 269, seed 0
  • hardware: NVIDIA GeForce RTX 4090 (one pod hour slot; the finetune itself ran 40 seconds)
  • run receipts: results/ft_t27/ (summary.json, log.jsonl, train.log, exactly as the trainer wrote them)

Receipt: cross-engine greedy

Greedy from BOS, the walk ends at EOS: 204 264 397 226 21 277 0.

Greedy decode from BOS in the C engine terminates at EOS (id 0) after six content tokens: 204 264 397 226 21 277 0. Decoded with the shipped tokenizer the ids read '', a newline, four spaces, 'return 0;'. The same ids come out of PyTorch on CPU and on the MPS GPU; teacher-forced C vs PyTorch CPU agrees on argmax at 7/7 positions, max |dNLL| 2.5e-2 (the same ternary matvec summation-order effect the base card documents at 1.9e-2). No FPGA run was made on this checkpoint -- the board receipt in the base card is for the base bytes; this package's receipt is cross-engine on the published bytes.

Selfcheck receipts

Judge: t27c test-report: a candidate body must compile and pass the spec's own test blocks. Pass means the merge gate, not proven correctness.

Hard-30 pool (the 30 strict items the model did worst on):

decode passes samples
flat 0 150
identifier-masked 3 150
selfcheck loop (generate, judge, repeat) 3 of 30 items 149

Strict set: 391 items whose tests catch constant mutants of the original body. Full selfcheck loop, 30 rounds, 8,083 samples: 4 items pass end-to-end (1.0%), won by four different mask-rule arms; 283 of 391 (72%) produced at least one compiling body. The wall is semantics, not grammar: the model speaks t27 for nearly three quarters of the strict items and solves one percent.

All verifier-side levers (seeded six-arm loop plus draft repair postprocess), strict set, 15 rounds, 5,846 samples: 3 of 391 items pass (0.8%), 268 of 391 (69%) compile. At the same 15 rounds the unlevered baseline loop reached 2 and 261. In both runs every one of the 391 items produced at least one parseable body within its first ten judged slots: the remaining wall is compile and semantics, not grammar. The two runs are not seed-paired; the +1 is reported as non-negative under noise, not as a win.

Context, different models: on the same strict set with the same finetune recipe, a 100M fp32 pair model reached 7.4% pass@10 and its ternary pair 2.3% (SOURCE-CLAIM: the paired 100M bench of 2026-09-25, internal bench docs, not public; read 2026-09-29). This 9M finetune is not in that table; no cross-model comparison is claimed for it.

The judge (t27c) and the corpus are public; the loop harness lives in the IGLA coder repository, which is not yet public. The generation half of every receipt above is reproducible from this package alone: these weights, this engine, this tokenizer.

Verify it yourself

A continuous-verification repository watches this package: gHashTag/tern-tc-9m-t27-verify. On every push there and once a week, a GitHub runner downloads the published bytes from the hub and runs this package's own scripts/verify.sh on them -- the same hashes, C engine, cross-engine receipt and PyTorch parity harness the quickstart below shows.

make -C c_infer && ./c_infer/tc_infer c_infer/model.bin --greedy --max 8
# ids printed: 204 264 397 226 21 277 0

python3 scripts/infer_check.py --bin c_infer/model.bin --expect 204,264,397,226,21,277,0
# last line:  VERDICT: PASS

Files

file what it is
c_infer/model.bin the finetuned checkpoint, TC02 container
c_infer/tc_infer.c, c_infer/Makefile the C99 reference engine (unchanged from the base package)
model.py the PyTorch definition (loads the TC02 bytes back into tensors)
scripts/infer_check.py the parity harness; --expect pins the receipt ids
scripts/verify.sh the end-to-end check the quickstart runs
scripts/decode_ids.py decode token ids with the shipped tokenizer
scripts/export_tc_bin.py the TC02 writer (documents the container)
results/data8k/tokenizer.json the 8192-token tokenizer
results/ft_t27/* the finetune run receipts (summary, log, train.log)
model_card.t27 the source of truth this README is generated from
sha256sums.txt every file above, hashed

License

APACHE-2.0 (see LICENSE).

Spec tests: 6 blocks, 45 asserts, all hold at render time.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for playra/tern-tc-9m-t27

Finetuned
(1)
this model

Space using playra/tern-tc-9m-t27 1