Live data from Hacker News

Reverse engineering a neural network's clever solution to binary addition

cprimozic.net

51–60 of 160 posts

Re: Reverse engineering a neural network's clever solution to binary addition

#51
post #39

Impressive. Am I right that what is really going on here is that the network is implementing the "+" operator by actually having the CPU of the host carrying out the "+" when executing the network? I.e., the network converts the binary input and output to floating point, and then it is the CPU of the host the network is running on that really does the addition in floating point. So usually one does a bunch of FLOPs t…

That's an accurate enough description of what's going on here, yeah, but I'm very curious if this could be implemented in hardware. What we've got is an inexact not-quite-binary adder, but one that's potentially smaller and faster than the regular binary ones.

Re: Reverse engineering a neural network's clever solution to binary addition

#52

A couple questions: 1. How much of this outcome is due to the unusual (pseudo) periodic activation function? Seems like a lot of the DAC-like behavior is coming from the periodicity of the first layer’s output, which seems to be due to the unique activation function. 2. Would the behavior of the network change if the binary strings were encoded differently? The author encodes them as 1D arrays with 1 corresponding to…

I think that the activation function definitely is important for this particular case, but it's not actually periodic; it saturates (with a configurable amount of leakyness) on both ends. The periodic behavior happens due to patterns in individual bits as you count up.

As for the encoding, I think it's a pretty normal way to encode binary inputs like this. Having the values be -1 and 1 is pretty common since it makes the data centered at 0 rather than 0.5 which can lead to better training results.

Re: Reverse engineering a neural network's clever solution to binary addition

#54
post #40

Earlier quoted context omitted.

> If it can add and subtract it may be able to multiply (repeated addition) and divide? If it can multiply it can do exponents? It was just a simple feed-forward network. It can't do arbitrary amounts of repeated addition (nor repeat any other operation arbitrarily often).

None of these require arbitrary amounts of repeated addition though. E.g. multiplying two 8 bit numbers requires at most 7 additions.

Yeah I did not mean a loop, repeated in the network.

Re: Reverse engineering a neural network's clever solution to binary addition

#55
post #3

That's awesome - the network's solution is essentially to convert the input to analog, perform the actual addition in analog , and then convert that back to digital. And the first two parts of that all happened in the input weights, no less.

An 8 bit adder is too small and allows such 'hack'. He should try training a 32 or 64 bit adder, decrease the weights accuracy to bfloat16, introduce dropout regularization (or other kind of noise) to get more 'interesting' results. Addendum: another interesting variation to try is a small transformer network, and feeding the bits sequentially as symbols. This kind of architecture could compute bignum-sized integers.

Its converted the input into its native language, in a way

Re: Reverse engineering a neural network's clever solution to binary addition

#56
post #39

Impressive. Am I right that what is really going on here is that the network is implementing the "+" operator by actually having the CPU of the host carrying out the "+" when executing the network? I.e., the network converts the binary input and output to floating point, and then it is the CPU of the host the network is running on that really does the addition in floating point. So usually one does a bunch of FLOPs t…

That's an accurate enough description of what's going on here, yeah, but I'm very curious if this could be implemented in hardware. What we've got is an inexact not-quite-binary adder, but one that's potentially smaller and faster than the regular binary ones.

It can be implemented in hardware but the implementation would be more complex than a digital adder based on logical gates.

Re: Reverse engineering a neural network's clever solution to binary addition

#58
post #39

Impressive. Am I right that what is really going on here is that the network is implementing the "+" operator by actually having the CPU of the host carrying out the "+" when executing the network? I.e., the network converts the binary input and output to floating point, and then it is the CPU of the host the network is running on that really does the addition in floating point. So usually one does a bunch of FLOPs t…

That's an accurate enough description of what's going on here, yeah, but I'm very curious if this could be implemented in hardware. What we've got is an inexact not-quite-binary adder, but one that's potentially smaller and faster than the regular binary ones.

Why it works here is that the "analog" representation is not influenced by noise, because it's simulated on digital hardware.

On the other hand, why we use digital hardware precisely because it's robust against the noise present in the hardware analog circuits.

Re: Reverse engineering a neural network's clever solution to binary addition

#59

The essay linked from the article is interesting: http://www.incompleteideas.net/IncIdeas/BitterLesson.html

One thing that the essay doesn't consider is the importance of efficiency in computation. Efficiency is important because in practice it is often the factor which most limits the scalability of a computational system. The human brain only consumes around 20W [1], but for numerical calculations it is massively outclassed by an ARM chip consuming a tenth of that. Conversely, digital models of neural networks need a hug…

Thanks for those numbers! They are frankly scary.

Six millions years of power for a single brain is one year of power for six million brains. The knowledge that ChatGPT contains is far higher than the knowledge a random sample of six million people have produced in a year.

With that said, I think we should apply ML and the results of the bitter lesson to things which are more intractable than searching the web or playing Go. Have you ever talked to a System's Biologist? Ask them about how anything works, and they'll start with 'oh, it's so complicated. You have X, and then Y, and then Z, and nobody knows about W. And then how they work together? Madness!"

Post reply on HN