Views
No views yet
{-1, 0, +1}.| Inference representation | Validation loss | Perplexity |
|---|---|---|
| Float control | 1.344198 | 3.8351 |
| Ternary weights, ordinary activations | 1.535463 | 4.6435 |
| Ternary weights, four-bit residual activations | 1.800118 | 6.0504 |
| Ternary weights/Q/K/V, two-bit integer attention, three ternary residual planes, ReLU, integer RMSNorm (dynamic token scales) | 2.160526 | 8.6757 |
| Strict ternary-operand endpoint: the same low-bit path with factorizable per-head QKV scales | 2.250638 | 9.4938 |
uv environment;float, ternary_weights, ternary_activations, ternary_forward, and
population-coded ternary modes;artifact-manifest.json before
uploading and fails if any local file is absent from the resulting Hub commit:1uv run ternary-publish-hf \
2 artifacts/tinystories-28m/ternary-weights-one-pass \
3 --path-in-repo tinystories-28m/ternary-weights-one-pass \
4 --ipv4-only1uv run ternary-publish-hf \
2 artifacts/tinystories-28m/integer-rmsnorm-screen \
3 --metadata-folder \
4 --path-in-repo tinystories-28m/experiments/integer-rmsnorm-screen \
5 --receipt artifacts/tinystories-28m/publication-receipts/metadata--integer-rmsnorm-screen.json \
6 --ipv4-only1uv run ternary-completion-audit \
2 artifacts/tinystories-28m \
3 artifacts/tinystories-28m/publication-receipts \
4 --output artifacts/tinystories-28m/completion-audit/audit.jsonuv manages the Python interpreter and virtual environment:1uv sync --extra dev
2uv run pytestuv run ternary-data download1uv run ternary-data prepare \
2 --max-train-stories 50000 \
3 --max-validation-stories 20001uv run ternary-data prepare \
2 --full \
3 --output-dir data/full \
4 --tokenizer-from data/processed/tokenizer.json1uv run ternary-data prepare \
2 --output-dir data/smoke \
3 --max-train-stories 200 \
4 --max-validation-stories 50 \
5 --vocab-size 512download writes size-checked Parquet shards under data/raw. prepare uses
data/huggingface for its local Arrow cache, then writes a tokenizer, uint16
token streams, and metadata under the selected output directory.uv run ternary-train --config configs/smoke.toml1uv run ternary-train --config configs/tiny.toml --mode float --run-name baseline
2uv run ternary-train --config configs/tiny.toml --mode ternary_weights --run-name weights
3uv run ternary-train --config configs/tiny.toml --mode ternary_activations --run-name activations
4uv run ternary-train --config configs/tiny.toml --mode ternary_forward --run-name strictuv run ternary-train --config configs/full.toml --mode float --run-name float1uv run ternary-calibrate-projection \
2 --checkpoint artifacts/full-stage-a/ternary_weights/checkpoint.pt \
3 --config configs/full.toml \
4 --output artifacts/coat/ternary-weights-projection.pt
5
6uv run ternary-evaluate \
7 --checkpoint artifacts/full-stage-a/ternary_weights/checkpoint.pt \
8 --config configs/full.toml \
9 --mode coat_a4 \
10 --projection artifacts/coat/ternary-weights-projection.pt
11
12uv run ternary-evaluate \
13 --checkpoint artifacts/full-stage-a/ternary_weights/checkpoint.pt \
14 --config configs/full.toml \
15 --mode coat_ternary \
16 --projection artifacts/coat/ternary-weights-projection.ptcoat_* modes refuse to run without a calibrated projection. hadamard_* modes
use a fixed normalized Hadamard matrix as the data-independent control.1uv run ternary-evaluate \
2 --checkpoint artifacts/coat-pilot/coat_a4/checkpoint.pt \
3 --config configs/full.toml \
4 --mode coat_a4 \
5 --projection artifacts/coat/ternary-weights-projection.pt \
6 --attention-quantization score_int2 \
7 --attention-clip 8
8
9# Choices: float, score_int2, prob_int2, score_prob_int2, prob_binary1uv run ternary-train \
2 --config configs/full.toml \
3 --mode population_ternary \
4 --population-lanes 4 \
5 --max-steps 1000 \
6 --run-name p4scripts/run_stage_a.sh1uv run ternary-train --config configs/counter_smoke.toml
2uv run ternary-train --config configs/stochastic_smoke.tomlint8 evidence counter per parameter; the
stochastic optimizer stores no per-parameter update state. Both constrain the
underlying learnable tensors to scaled ternary values after every update.1# On the pod after copying the repository to /workspace:
2scripts/remote_bootstrap.sh
3scripts/remote_benchmark.sh
4
5# Start the complete Stage A matrix only after reviewing benchmark throughput:
6scripts/remote_run_stage_a.sh
7
8# Run the matched 2-bit attention PTQ and 500-step QAT matrix:
9scripts/remote_attention_pilot.sh
10
11# Run the ternary-QKV, gating, distillation, and integer-LUT pilot:
12scripts/remote_gated_attention_pilot.sh
13
14# Progressively reduce every residual boundary to exactly three codes:
15scripts/remote_fully_ternary_pilot.sh
16
17# After the 27.4M strict control completes, run the matched refinement chain:
18scripts/remote_finalize_strict.sh
19scripts/remote_attention_clip_refinement.sh
20scripts/remote_shared_qkv_scale_refinement.sh
21scripts/remote_softmax1_refinement.sh
22scripts/remote_relu_hardening.sh
23scripts/remote_binary_qk_fallback.sh
24scripts/remote_integer_rmsnorm_screen.sh
25
26# Or launch one locked watcher before the baseline finishes:
27scripts/remote_refinement_pipeline.sh
28
29# This fails closed unless every stage and checksum-complete run succeeded:
30ternary-overnight-summary artifacts/tinystories-28m \
31 --json-output artifacts/tinystories-28m/overnight-summary/summary.json \
32 --markdown-output artifacts/tinystories-28m/overnight-summary/summary.mdSUCCESS only after exhaustive
validation, generations, packed export, checksums, and artifact audit. The
summary command also verifies recorded checkpoint lineage and independently
re-audits complete SHA-256 manifests before ranking exhaustive validation
results. The full runner resumes any existing per-mode checkpoint. Copy
artifacts/ back to the local repository before stopping or deleting a pod.1scripts/sync_to_runpod.sh HOST PORT PRIVATE_KEY
2scripts/sync_from_runpod.sh HOST PORT PRIVATE_KEY1uv run ternary-evaluate \
2 --checkpoint artifacts/smoke/checkpoint.pt \
3 --config configs/smoke.toml
4
5uv run ternary-generate \
6 --checkpoint artifacts/smoke/checkpoint.pt \
7 --tokenizer data/smoke/tokenizer.json \
8 --prompt "Once upon a time" \
9 --max-new-tokens 80--qkv-quantization binary_qk_ternary_v. It encodes Q/K as exact signs and
V as ternary codes; use --qkv-scale-granularity learned_head for the
factorizable deployment path. This is stricter than the source paper's
eight-bit Route·V path and intentionally omits its optional dense/context bias.--device cpu, --device mps, or --device cuda to override automatic device
selection. Checkpoints include the resolved model and training configuration.1uv run ternary-packed-benchmark \
2 --device cpu \
3 --batch 256 \
4 --in-features 1024 \
5 --out-features 10241uv run ternary-triton-benchmark \
2 --rows 16384 \
3 --in-features 256 \
4 --out-features 10241uv run ternary-export \
2 --checkpoint artifacts/full-stage-a/ternary_weights/checkpoint.pt \
3 --output artifacts/full-stage-a/ternary_weights/model-2bit.ptternary-deployment-v2 artifact packs ternary operands at two bits, stores
learned positive Q/K/V head scales as INT16 fixed-point values, preserves
non-floating buffers, and includes a machine-readable inference-contract
checklist. A packed checkpoint is therefore not automatically labeled
end-to-end integer. Exact fixed-point RMSNorm is now available through the
opt-in integer_reference runtime and export override, but remaining
requantization and sampling boundaries are reported in the export metadata.