Transcript
A (0:02)
Recently people have been thinking about trits. And I don't mean the Costa Rican ice cream sandwich meaning ternary or base 3. Compute a three value logic scheme different from the two value binary logic scheme 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 Seton computer. Trits have certain inherent benefits over bits, at least theoretically. In today's video, a highly requested, we explore ternary computing. 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 that is a bit represents 2, 0, 1 or -1, 1. A ternary digit that is a trit represents three states, usually either a balanced ternary with states -1, 0, 1 or an unbalanced ternary with states 0, 1 and 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 3'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 six 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 simple. For example, comparing 1 and 2 in binary logic takes two steps. First to ask is 1 smaller than 2? And then is 1 equal to 2? Ternary logic, on the other hand, can do it in just one step by just outputting less, equal to or greater. And finally, balanced ternary just looks nice to certain types of people. Minus 1,01, I know Thanos would approve. 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 seton. The whole thing began at Moscow State university in late 1955. Because of a petty feud, the university was supposed to receive an M2 computer from the Laboratory of Electrical Systems in the Institute of Energy at the Soviet Academy of sciences. However, the M2 computer team's lead is Brook 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 Sabolev 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 Seton at the end of 1955. The name comes from a river in Moscow. So far, so good. But how did Seton 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 Li Guttmacher building a small binary digital computer called the LEM1. Unusually, the LEM1 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 and 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 the cores, the LM1 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 Sabolev fully supported the Wild Project. 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. Sabolev 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 Seton 70, its key feature being a structured ternary programming language. The computer also introduced the concept of a trite, a group of six trits, like bits to a byte. But just before the Czechs began large scale production comp, the whole Saturn effort was shut down. It was alleged that this was done by a Soviet official in charge of a competing binary computer effort, the M20. In the end, the Saturn was thrown into the trash and the team dispersed. In a fascinating 2004 interview, Seton designer NP Bruce Sentjoff 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 Brusentov hopes that one day the world turns back to ternary. Unfortunately, since Seton'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, Seton designer Bruce Santoff has before claimed that his computer used seven times fewer ferrite cores than Guttemacher's LEM1 and had twice the processing power as defined by word length. But Lem1 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. Two bits is more than the 1.58 bits in a trit, so one might argue that Seton 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 and 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. But the key missing part of the puzzle has always been the devices. Binary and MOS transistors go together like peanut butter and jelly. They're 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. And 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. mufta of Queen's University at Kingston over in Canada proposed a way to achieve the three levels using cmos. In Mufta'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, you can get either a negative or positive voltage that's your minus 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's a current constantly going, eating power and generating heat. Throughout the 1980s, Mufta 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, Mufta's team presented the QTC1, a very basic computer with four units built using the CMOS1 resistor setup. It can fetch data from memory, write to memory and do some basic ternary math. For the rest of the decade, Mufta's team kept working on their CMOS ternary system. A Nobel 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 strengths. Why does it matter that trits can carry some more information when bits and transistors are so cheap? Well, now everyone says that Moore's law is dead. So other devices have been proposed for potential ternary use. Two major ones I'll highlight here are memristors and carbon nanotubes. Let's start with memristors. The fame 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 multi level 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 far 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 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 the channel. So in a specific voltage range the current increases, giving you this W shaped voltage curve in three distinct states. The author said that the CNT transistor can be easily manufactured and produce several ternary circuits with it, like an sram. The recent emergence of neural networks has put ternary back into the limelight. How? I'm 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 those weights. That is that famous multiply, accumulate or Mac action that 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 data 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 minus one or one. 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 turnerization. The information losses are too drastic. Mapping both 5 and 50 as one 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 into vogue. So, to end 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 also 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 or compute or whatever? In theory, maybe. But those theories will remain as such until someone goes out and build it. All right, everyone, that's it for tonight. Thanks for watching. Subscribe to the channel, sign up for the Patreon, and I'll see you guys next time.
