Ternary computing, utilizing a three-state logic system (trits) instead of the conventional binary (bits), offers theoretical advantages in information density and efficiency, with renewed interest driven by AI applications and the limitations of traditional binary scaling.
Mind Map
Click to expand
Click to explore the full interactive mind map • Zoom, pan, and navigate
Recently, people have been thinking about trits.
And I don't mean the Costa Rican ice cream sandwich.
Meaning ternary or base three compute. A three-value logic
scheme different from the two-value binary logic we are so familiar with.
A few months ago, it made the rounds when news broke that Huawei patented
a ternary computing circuit that can do AI.
Ternary logic has been explored for a long time.
Most famously during the 1960s in the Soviet Union with the SETUN computer.
Trits have certain inherent benefits over bits. At least theoretically.
In today's video, a highly requested topic. We explore ternary computing.
## Beginnings Let me give the theoretical pitch for the trit.
Imagine encoding a piece of information into a digital format using a certain base. Here,
"base" means the number of discrete states that each digit can represent.
A binary digit - i.e. a bit - represents two states: (0, 1) or (-1, 1)
A ternary digit - i.e. a "trit" - represents three states.
Usually either a balanced ternary with states (-1, 0,
1) or an unbalanced ternary with states (0, 1, 2).
We can use any base we want. The higher the base, the more information a base-encoded
digit can carry. So we need less digits for the same information.
A 10-digit number encoded in binary requires 40 bits, but only 21 trits.
But higher bases also impose a resource and complexity cost. So the theory goes that the
"optimal" base is one that strikes the right balance between information carry and cost.
Work that out and you find that the most optimal number is the
famous mathematical constant Euler's number with an efficiency of 0.368.
The problem is that Euler’s Number is continuous, so it is impractical in reality.
But base three's efficiency is not far off at 0.366.
By the way, Binary’s efficiency is 0.347,
tied with base 4 as the second most efficient discrete number base.
So in theory, a ternary computer can use fewer components to represent data,
which then means a reduction in the number of wires to connect said components.
Another notable benefit is that ternary has native support for negative numbers.
Binary requires the use of an extra bit for that - which can be tricky to keep track of.
It has also been argued that ternary logic is simpler. For example, comparing 1 and 2
in binary logic takes two steps. First to ask "Is 1 < 2" and then "Is 1 = 2?".
Ternary logic can do it in one step by just outputting "Less", "equal to", or "greater".
And finally, balanced ternary just looks nice to certain types of people (-1, 0, 1).
I know Thanos would approve.
## SETUN
The oldest known effort to produce a ternary computing device dates back to 1840.
This was apparently done by a self-taught inventor named Thomas Fowler. According to
a biography written by his son Hugh, Fowler produced a ternary mechanical calculator.
This calculator was said to be easy to use and received some praise by the era's mathematicians.
It was lost after Fowler's death in 1843 but historians did a
reconstruction 150 years later based on a detailed written description.
A few ternary research studies were done in the 1950s in the United States. However,
the most famous effort - and the only one that actually went into
production - took place in the Soviet Union: the SETUN.
The whole thing began at Moscow State University in late 1955, because of a
petty feud. The university was supposed to receive a M-2 computer from the Laboratory
of Electrical Systems in the Institute of Energy at the Soviet Academy of Sciences.
However, the M-2 computer team's lead, I.S. Bruk, disliked MSU's
director - the Soviet mathematician Sergey Sobolev - because the latter
had not voted for him in a previous academic election. So he blocked it.
Rebuffed, the MSU lab members consulted with Sobolev on what to do,
and he simply told the lab to produce their own small
general-purpose computer with an eye for eventual use in labs and offices.
The student team began on SETUN at the end of 1955. The name comes from a river in Moscow.
## Going Ternary
So far so good. But how did SETUN become a ternary computer?
In the second half of the 1950s, vacuum tubes in the Soviet Union were not of high quality. Many
tube-based computers of the day weren't being used because their fragile tubes kept shorting out.
And while the solid-state transistor did exist, it had not yet reached the Soviet Union.
While pondering this, the team heard about a colleague called L.I.
Gutenmacher building a small binary digital computer called the LEM-1.
Unusually, the LEM-1 used magnetic ferrite cores to do logic. These
cores are small iron oxide ceramic rings. We can weave them together
with wires and then magnetize them with pulses in one of two directions.
The core "remembers" this direction until the next current pulse,
making it useful for things like memory for early computers. Before
semiconductor memories like DRAM emerged, they were quite popular.
In order to maintain a consistent electrical load while reading out cores,
the LEM-1 used a pair of cores to store a bit. One "working"
core and another "compensating" core in the opposite direction.
The MSU team modified this arrangement by making one of the compensating cores into
a working core. So two ferrite cores to contain each trit.
By that point, binary logic was already becoming dominant in the
computing community so a ternary computer was certainly going against the grain.
But to his credit, supervisor Sobolev fully supported the wild project.
## The Life of the SETUN By 1958, they had their first working prototypes.
But then the State Committee for Radio Electronics declared the
device unnecessary - without the right approvals - and tried to shut it down.
Sobolev defended his team's efforts and arranged an official demo in 1960.
After passing its demo with flying colors, a plant in Russia began production. 46 were
made and distributed around the Soviet Union. The Czechs then came calling,
thinking that they could make and sell the machine for a healthy profit.
For Lenin's 100th birthday in 1970, the team completed a successor computer called the
SETUN-70. Its key feature being a structured ternary programming language. The computer
also introduced the concept of a "tryte", a group of six trits. Like bits to a byte.
But just before the Czechs began large-scale production, the whole SETUN effort was shut
down. It was alleged that this was done by a Soviet official in charge of a competing binary
computer effort, the M-20. In the end, the SETUN was thrown into the trash and the team dispersed.
In a fascinating 2004 interview, SETUN designer N.P. Brusentsov says
that he still gets emails from researchers around the world interested in his work.
Moreover, he added that he always believed that ternary is superior
to binary. He argues that ternary logic better fits the realities of
nature. It allows for more nuance by moving beyond the simple YES or NO.
To him, binary's all-or-nothing nature deviates from human reasoning and creates
unworkable paradoxes in thought. After all, only a Sith deals in absolutes.
So Brusentsov hopes that one day the world turns back to ternary.
## Ternary's Struggles Unfortunately since SETUN's demise,
binary has only continued to expand its grip on the world's computing paradigms.
In 1973, several SUNY professors emulated a ternary computer called TERNAC on a binary
Burroughs B1700 mainframe. The emulation ran at speeds similar to binary systems,
leading the authors to conclude that ternary might be viable.
The issue is that virtually everything proclaimed about
ternary's benefits is in theory. There are very few practical examples of a
ternary computer actually producing its promised component simplicity benefits.
For example, SETUN designer Brusentsov has before claimed that his computer used seven
times fewer ferrite cores than Gutenmacher's LEM-1, and had twice the processing power as
defined by word length. But LEM-1 only had so many ferrite cores for electrical balancing reasons.
Moreover, using two cores to store a trit is inefficient because two cores
can also store two binary bits. 2 bits is more than the 1.58 bits in a trit,
so one might argue that SETUN probably would have been better off as a binary computer.
There are other reasons to believe that ternary's theory does not translate to practicality.
Doug Jones of the University of Iowa noted that a specific type of adder would be 62%
more complex in ternary than binary even after adjusting for the trit's additional data load.
Moreover, people are just used to thinking in binary
terms. Programming in ternary means asking them to rewire their thinking.
Perhaps most famously, the query language SQL features three-state logic with TRUE,
FALSE and NULL. NULL means "unknown" or "no value",
and many beginners struggle to grasp it - leading to errors and confusion.
## CMOS Ternary
But the key missing part of the puzzle has always been the devices.
Binary and MOS transistors go together like peanut butter and jelly. There are just
two voltage states, and current issues aside, it's easy to tell between them.
A ternary device on the other hand must reliably distinguish
between multiple threshold voltage levels.
And that's hard. Noise can mess with those levels,
triggering stuff accidentally. You need tighter control of the inputs,
necessitating additional systems and hardware that wouldn't need to exist in binary.
What is out there that can actually be your three-state device? And ideally,
can it be CMOS-compatible?
In the late 1970s, a team led by H.T Mouftah of Queen's University
at Kingston over in Canada proposed a way to achieve the three levels using CMOS.
In Mouftah's setup, they connected both the PMOS and NMOS transistors
to resistors. The transistors are then tied to power sources of positive and negative voltage.
By opening one of the two transistors,
we can get either a negative or positive voltage. That is your -1 or 1.
To get the third output - the intermediate 0 - we open both transistors at the same time.
This worked but suffered major downsides. First it’s big. You have two transistors, two resistors,
and two power sources of opposite voltage. Second. No matter what the circuit outputs,
there is a current constantly going - eating power and generating heat.
Throughout the 1980s, Mouftah and his colleagues proposed improved setups with fewer components
and lower power draw. For instance, one had just the two CMOS transistors and
one resistor. You created the intermediate value by turning both CMOS transistors off,
leaving the resistor to pull a weak voltage from an external power source.
In 1983, Mouftah's team presented the QTC-1,
a very basic computer with four units built using this CMOS-plus-1-resistor
setup. It can fetch data from memory, write to memory, and do some basic ternary math.
For the rest of the decade, Mouftah's team kept working on their CMOS ternary system. A
notable paper in 1985 eliminated the power-hungry resistors altogether.
Another proposed some interesting ternary versions of certain circuits like ROM memory.
However, the peak of Moore's Law in the 1990s and early 2000s diminished
the perceived need for ternary's strengths. Why does it matter that
trits can carry some more information when bits and transistors are so cheap?
## Exotic Devices
Well now everyone says that Moore's Law is dead. So other devices have been proposed for potential
ternary use. Two major ones I will highlight here are memristors and carbon nanotubes.
Let's start with memristors, the famed resistive device with inherent memory. Its resistive value
depends on the history of electrical current and voltage passing through it.
Memristors can combine with traditional
CMOS transistors to produce multilevel logic. This hybrid circuit works fast,
but suffers the same complexity issues as the other CMOS arrangements mentioned earlier.
A second way would be to use a special three-value memristor to
directly build ternary logic gates. That memristor would be switched by carefully
controlling the current flowing through it. There's less known of this approach.
The second exotic thing are carbon nanotubes. Carbon nanotubes are atomic sheets of graphene
rolled up into very small tubes about a nanometer wide. We can use these to produce transistors,
and people consider it a very promising technology for multi-level transistors.
In January 2025, Chinese researchers in the National Natural Science Foundation of China
presented carbon nanotube-based devices that they call a Source-Gating Transistor.
It has a bit of a weird structure. The source electrode is partially
stretched over the channel, and the gate is positioned under that channel.
So in a specific voltage range, the current increases - giving you this "w" shaped
voltage curve and three distinct states. The authors said that this CNT transistor can be
easily manufactured and produced several ternary circuits with it, like an SRAM.
## AI?
The recent emergence of neural networks has put ternary back into the limelight.
How? I am not an AI expert, so bear with me. Deep neural networks require a lot of computation,
which limits their usefulness in devices with energy or compute constraints.
Broadly speaking, ternary's appeal is that trits let us do more - reducing a model's footprint.
A model is made up of weights - floating point numbers representing its learned parameters. When
we run inference on a model, we take the input data and multiply and sum them with the weights.
I.e. that famous multiply-accumulate or MAC action
that takes up 99% of what an AI accelerator does all the time.
Anyway, these weights come in a variety of precisions. High precision would be using
32-bit floating point numbers. These are more accurate, but multiplying them takes longer.
Moreover, it takes more memory to store these numbers, which especially sucks when transporting
these weights from memory to logic and vice versa. The famous Von Neumann bottleneck.
So we quantize these models down to lower bit numbers like 16-bit,
8-bit or even 4-bit to use less memory and reduce compute time at the cost of some accuracy.
The most aggressive form of quantization is binarization, turning all the floating point
numbers to just bits: -1 or 1. With binarization, multiplication is no longer necessary. We just
flip the bit, making inference ultra fast. The tradeoff of course is a large loss of accuracy.
Ternarization is similar, quantizing everything to trits. The memory footprint
and logic complexity get slightly worse, but there is more accuracy. Moreover,
having a zero lets you skip every multiplication action involving that zero.
But to quote a famous movie, never go full ternarization. The information losses are
too drastic. Mapping both 5 and 50 as "1" doesn't make sense. Various hybrid methods exist, though I
won't go into them here. It's just one example of the ways ternary has gone back in vogue.
## Conclusion
So after all of this, what is this Huawei patent discussing?
The patent covers a ternary logic gate that can do simple math operations like
adding or subtracting a ternary input. This can be used for ternary logic.
Since we do not have a native switch with three output states, Huawei proposes to create three
groups of transistors with significantly different threshold voltage levels - low,
medium, and high - and use that to build ternary logic gates.
Very clever indeed. Wouldn't expect anything less from Huawei. But I do
wonder about the complexity of manufacturing three groups of transistors so close together.
It's not done often because it would require extremely precise doping of the
silicon channels as well as modifying the metals and thicknesses of the gate stacks.
Nevertheless, that's not the point of the patent. Huawei's work is a sign that despite binary's
dominance, ternary retains its theoretical allure. Can ternary "revolutionize" AI inference? In
theory, maybe. But those theories will remain as such until someone goes out and builds it.
Click on any text or timestamp to jump to that moment in the video
Share:
Most transcripts ready in under 5 seconds
One-Click Copy125+ LanguagesSearch ContentJump to Timestamps
Paste YouTube URL
Enter any YouTube video link to get the full transcript
Transcript Extraction Form
Most transcripts ready in under 5 seconds
Get Our Chrome Extension
Get transcripts instantly without leaving YouTube. Install our Chrome extension for one-click access to any video's transcript directly on the watch page.