Skip to main content

ternary-forge

Native balanced-ternary arithmetic, a ternary neural network, a ternary VM, and a trit-packing file format — in pure Python/NumPy.

Binary is not a law of nature. It is an industrial accident. This repository is a fork in the road.

Results

What Number Where
Ternary MLP on MNIST 93.20% (float baseline: 92.28%) examples/train_mnist.py
Weight storage 1.58 bits/weight (float32: 32) examples/train_mnist.py
Trit packing 5 trits/byte, 99.06% of Shannon optimum examples/pack_demo.py
VM 8-register balanced-ternary ISA, native NEG and SHL3 examples/run_vm.py

Install

pip install -e '.[dev]'

Run the proof

python -m pytest -q                  # 11 tests
python examples/train_mnist.py       # ternary vs float MNIST
python examples/run_vm.py            # ternary assembly programs
python examples/pack_demo.py         # 40 KB .trit file, roundtrip

The argument

See docs/BINARY_ACCIDENT.md for the citable case: Setun (1958), the 5500FP (2026), Ternary Weight Networks (2016), and the three results above as evidence.

What this is not

  • Not a wrapper around PyTorch. The MLP is hand-written NumPy.
  • Not a binary emulator pretending to be ternary. The VM’s NEG is one instruction that flips trits.
  • Not a toy. The packing format is exhaustive-tested over all 243 five-trit states.

License

MIT

Metadata

Release files for ternary-forge 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ternary-forge 1.1.1
File Size Uploaded Provenance Actions
ternary_forge-1.1.1.tar.gz 11.4 kB With provenance Details for ternary_forge-1.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ternary-forge 1.1.1
File Interpreter ABI Platform Actions
ternary_forge-1.1.1-py3-none-any.whl Python 3 none any Details for ternary_forge-1.1.1-py3-none-any.whl

Total release size: 22.1 kB

Release files / ternary_forge-1.1.1.tar.gz

Download URL ternary_forge-1.1.1.tar.gz
Size 11.4 kB
Tags Source
SHA-256 checksum
How to use checksums
0771736f82ef99fd0f779cac196b42862dcc4bd4776210f4b11589beccbb8f1d
BLAKE2b-256 checksum
How to use checksums
3894b0bc5242e2c309176c12ac58c1344cbfe264731a96ac3d8dfa35fa53ccf8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.

Transparency log

Release files / ternary_forge-1.1.1-py3-none-any.whl

Download URL ternary_forge-1.1.1-py3-none-any.whl
Size 10.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1687b222dd06125a7fa62e70afd00d0fd29714d80f4bdba3a25cfb1708dc80c5
BLAKE2b-256 checksum
How to use checksums
ba55209b0dd041f4693fe03cc35c660955fea5253550260ac11b43a1ee71740a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.

Transparency log

Security for ternary-forge 1.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for ternary_forge-1.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.1.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page