v3.0 · Ternary Transformer by Yuriy

The ternary
transformer.

BitNet-style ternary LLM. Latent FP32 + STE absmean quantization. 31M params, perplexity 5.0 in 10 minutes on a laptop GPU. 1.2 MB packed.

31.1M
Parameters
5.0
Perplexity
1.2 MB
Packed Size
10 min
Training Time

A transformer
that computes in additions.

TernY trains all weights in latent FP32 with STE quantization, then hardens to ternary for inference. No FP32 math at deployment — just add and subtract.

31.1M
Total Parameters
Full model size before packing. 100% trainable.
5.0
Perplexity
After 10 min on RTX 3050 6 GB
1.2 MB
Packed Size
Ternary weights after hardening
d=384
Model Dimension
L=4, heads=6, KV=3, d_ff=1536
20M
Training Tokens
TinyStories + ru-classic corpus

BitNet b1.58
reimagined.

TernY follows the BitNet b1.58 paradigm with key innovations: SubLN normalization, ReLU² activation, and per-channel FP16 scales.

01

BitLinear

Latent FP32 weights with absmean STE quantization to ternary {-1,0,+1}. Per-channel FP16 scale absorbs magnitude. No multiplications — just sign flips and zero-skips.

STE absmean · Per-channel scale
02

SubLN + ReLU²

Double LayerNorm (pre-attention + pre-FFN). Squared ReLU activation removes negative values entirely — natural fit for ternary computation.

SubLN · ReLU²
03

GQA + RoPE

Grouped Query Attention (6Q/3KV) with Rotary Position Embeddings. Tied embedding matrix (FP32). No bias terms. Clean, lean decoder-only.

6Q/3KV · RoPE · Tied embeddings

It speaks
(mostly) English.

Unconditional generations from the 31M model after 10 minutes of training on a laptop RTX 3050.

>>> Once upon a time, there was a little girl named Benpy.
>>> She opened the doors, Lily played the cowle buine and went on the slide.
>>> The sun was warm and the birds sang in the trees.
>>> Tom wanted to play with his friends but they were all busy.
>>> Once upon a time there was a little boy named Max. He liked to play with his dog.
* Sentences follow English grammar with subject-verb agreement and narrative structure. Invented words confirm the model learns syntax before vocabulary.

GOT vs TernY
Two approaches.

Head-to-head comparison between the frozen random ternary approach (GOT v2) and the BitNet-style trained approach (TernY v3).

Metric TernY v3 (BitNet) GOT v2 (Frozen)
ApproachTrain all weights97% frozen random
Trainable params31.1M (100%)83K (2.3%)
Perplexity5.0~28
Loss (2K steps)1.616.90
Training time10 min-
Packed size1.2 MB1.1 MB
Text generationCoherentNone
Scaling lawsWorkPlateau
Domain layer (DL)ConfirmedConfirmed

* TernY v3 trains all weights in latent FP32 with STE quantization. The insight: frozen ternary + per-neuron scale cannot escape the loss plateau. BitNet-style training unlocks true language generation.

12 days
from zero to text.

TernY was built from scratch in under two weeks. Every iteration uncovered something that didn't work — and one thing that did.

Day 1

GOT v1 — Frozen random ternary

97% weights random and frozen. Only per-neuron int8 scale trains. 3.6M params, loss 5.28→2.40. Works on curve fitting, not on language.

Day 3

GOT v2 — Scale-only breakthrough

14M params, BPE 32k tokenizer. Loss 4063→823. But perplexity plateaus at ~28 — frozen ternary hits a fundamental ceiling.

Day 7

Complete rethink — BitNet-style TernY

Abandon frozen random. Train all weights in latent FP32, use absmean STE quantization, per-channel FP16 scale, SubLN, ReLU². Architecture reset.

Day 10

First working text generation

31M model achieves perplexity 5.0 in 10 minutes on RTX 3050. Generates grammatically correct English. The approach is validated.

Day 12+

Scaling up — 64M model training

63.6M params (d=768, L=6, 8Q/4KV). Training on 82M tokens. Expected ~2 hours on RTX 3050. Scaling laws confirmed. 8Q/4KV is for the 64M model only.

What's next
for TernY.

From research prototype to practical deployment. The path forward is clear.

TernY 64M

Complete training of the 64M parameter model on 82M tokens. Target perplexity < 4.0.

In Progress

Benchmark Evaluation

Standard evaluation on MMLU, HellaSwag, and other LM benchmarks. Measure real capability.

Planned

C Codegen for MCU

Port ternary transformer inference to Cortex-M0+. Packed weights, no DSP, no FPU.

Planned

TernY-DL Domain Modules

Scale-delta domain modules (200 binary deltas per domain, ~2.7 KB each). Proven concept — now productize.

Confirmed

Research
output.

Formal publications and codebase references.

TernY: Ternary Transformer by Yuriy

10.5281/zenodo.20725229 (concept DOI)

Full paper covering BitNet-style training, absmean STE quantization, SubLN architecture, domain-layer fine-tuning, and scaling laws for ternary transformers.

Concept DOI

TernY Codebase

10.5281/zenodo.20817123 (restricted)

Complete codebase including training pipeline, tokenizer, packing, domain modules. Restricted access — available upon request.

Code Repository (Restricted)

Built to prove
ternary works.

TernY is an independent research project exploring whether ternary transformers can generate coherent language — and they can.

TernY is a BitNet-style ternary transformer where every weight is {-1, 0, +1}. No FP32 inference. No matrix multiplication — just additions and subtractions. The model is trained end-to-end with latent FP32 weights and Straight-Through Estimator quantization, then hardened to ternary at inference.

“Training all weights in latent space with STE quantization unlocks language generation. Frozen random ternary cannot escape the loss plateau.” — TernY v3 Breakthrough Insight

At 31M parameters, TernY v3 achieves perplexity 5.0 after 10 minutes of training on a laptop RTX 3050. The 64M model is currently training. This is the starting line for practical ternary language models.

Perplexity 5.0 in 10 min
BitNet-style training
All weights trainable
Domain Layer confirmed
31M / 64M models

Interested in TernY?

Licensing, collaboration, early access, or just want to talk ternary language models?