This landing page highlights the most helpful resources for people discovering t81lib or wanting
to understand the balanced ternary engine without digging through specs immediately.
Try the compact, end-to-end PTQ + QAT notebook that measures size, latency, and perplexity on Phi-3-mini:
examples/ternary_phi3_ptq_qat_demo.ipynb.
Featured demo — Try Phi-3-mini PTQ + QAT
If you are arriving from PyTorch or Hugging Face, use t81 as the single entry point and alias it once:
python3 -m venv .venv
source .venv/bin/activate
pip install ".[torch]"import t81 as t8
tensor = t8.torch.TernaryTensor.from_float(weight, threshold=0.45)
output = tensor.matmul_input(input_tensor, bias=bias)From here: t8.nn.Linear for drop-in layers, t8.convert/t8.gguf for scripted conversion, and t81 convert/t81 gguf for CLI workflows.
- Landing & Quick Start —
README.mdcontains the hero content, badges, and a comprehensive quick start section for builds, subprojects, pip/pipx consumers, CLI helpers, and the new “Start here” router. - Architecture guide —
ARCHITECTURE.mdwalks through the component layers and data flow. - Normative spec —
docs/t81lib-spec-v0.1.0.mddefines the API guarantees forlimb,bigint, and helpers. - Design notes —
docs/design/limb-design.md,docs/design/bigint-design.md,docs/design/montgomery-design.mdexplain internal choices, algorithms, and invariants. - Examples —
examples/hosts runnable demos that mirror the README snippets. - Quantization reports —
examples/quantization_config_report.pyenumerates synthetic parameter sweeps (dims, thresholds, sample counts) so you can compare multi-module accuracy/latency/size numbers before touching a checkpoint. - PyTorch bridge —
t81.torch/t81.nnexpose the customt81.tritdtype,TernaryTensor, and GEMM-backed helpers; seeexamples/demo_llama_conversion.py,examples/scaling_laws_ternary.py, andexamples/ternary_sparse_preview.pyfor runnable workflows. - Python API reference —
docs/python-api.mdlays out how MkDocs plusmkdocstringsauto-generate the binding reference. - Python cookbook —
docs/python-cookbook.mdgathers recipes that mixt81lib.pack_dense_matrix,t81.torch.TernaryTensor, and the CLI helpers. - Python entry points —
docs/python-api.mdanddocs/python-cookbook.mdnow include a quick table showing which module to import for each workflow. - Python install paths —
docs/python-install.mdexplains pip/pipx builds, validation tips, and CLI helper installs. - PyTorch how-to —
docs/torch.mdwalks throught81.torch,t81.nn, conversion helpers, and how the CLI scripts mirror the Python flows. - CLI reference —
docs/references/cli-usage.mdlists the unifiedt81 convert/t81 ggufhelpers (with legacyt81-convert/t81-ggufaliases) plust81-qatplus the common flags for exporting GGUF bundles and running QAT. - Hardware & energy reference —
docs/references/hardware-emulation.mdconnectst81.hardware.TernaryEmulatorwith the Python quantization helpers plus the newscripts/quantize_measure.pyautomation that chainst81 convert→ measurement. - Python demos — the
examples/scripts/notebooks trackt81.torch+t81.nnworkflows; addexamples/ternary_qat_inference_comparison.pyto kick off a minit81.trainerQAT loop, print the ternary threshold schedule, and comparetorch.matmulvs.t81lib.gemm_ternarylatency so you can prototype entirely inside Python before launching the CLI helpers. - CLI automation & energy benchmarking —
scripts/quantize_measure.pyandscripts/quantize_energy_benchmark.pychaint81 convert/t81 ggufruns with latency/energy measurement so you can report quantization impact directly from command-line workflows. - Use cases & demos —
docs/use-cases.mdandexamples/README.mdcapture the canonical scripts, notebooks, and research stories. - Hardware simulation —
docs/hardware.mddetailst81.hardware.TernaryEmulator, fuzzy helpers, and the visualizer notebook. - GPU backends —
docs/gpu.mdexplains the CUDA/ROCm build flags and tensor metadata routing. - API overview —
docs/api-overview.mdsummarizes the numeric containers and helpers exposed via<t81/t81lib.hpp>. - Tests & benchmarks —
tests/documents the unit/property coverage whilebench/shows throughput patterns. - Phase 1 hardening checklist —
docs/quantization-hardening.mddefines the arithmetic/quantization stabilization gates and reproducible validation flow. - Docs sitemap — the
docs/diagrams/docs-sitemap.mermaid.mdmind map visualizes the content hierarchy referenced on this page.
- Review
CONTRIBUTING.mdbefore opening a PR—workflows, invariants, and branch expectations are documented there. - Check
CHANGELOG.mdto understand recent breaking changes or stabilization notes. - Run
cmake -S . -B build -DT81LIB_BUILD_TESTS=ON+ctestafter local changes to keep deterministic behavior intact.
Use this portal when pitching the library internally or prepping release notes. The combination of
README.md, ARCHITECTURE.md, and docs/ creates a cohesive narrative that balances hands-on examples,
design rationale, and testing expectations.