Live data from Hacker News

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

cprimozic.net

101–110 of 160 posts

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

#101

Earlier quoted context omitted.

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.

A 32-bit adder is just 4 8-bit adders with carry connected. I don't see why it'd be significantly more difficult.

In my EE class that discussed adders, we learned this wasn't exactly true. A lot of adders compute the carry bit separately because it takes time to propagate if you actually capture it as output.

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

#102

These stories remind me of a story from Discover Magazine https://www.discovermagazine.com/technology/evolving-a-consc... A researcher was using a process to "evolve" a FPGA and the result was a circuit that was super efficient but worked in ways that were unexpected: part of the circuit seemed unconnected to the rest but if removed the whole thing stopped working and it would only work at a specific temperature.

Overfitting IRL

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

#103
post #58

Earlier quoted context omitted.

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.

Right, but there exists software that would be robust to noise, e.g. ...neural networks. I'm curious if not-quiet-perfect adders might be beneficial in some cases.

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

#104
The trick of performing binary addition by using analog voltages was used in the IAS family of computers (1952), designed by John von Neumann. It implemented a full adder by converting two input bits and a carry in bit into voltages that were summed. Vacuum tubes converted the analog voltage back into bits by using a threshold to generate the carry-out and more complex thresholds to generate the sum-out bit.

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

#105
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.

Quad-level flash memory cells (https://en.wikipedia.org/wiki/Multi-level_cell#Quad-level_ce...) can store 4 bits for months.

Because of that, I would (hand-wavingly) expect it can be made to work for a three-bit adder (with four bits of output)

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

#106
post #71
post #68

Earlier quoted context omitted.

> a TWh, which is about six million years' of power i'm not a physics guy but wanted to check this - a Watt is a per second measure, and a Terawatt is 1 trillion watts, so 1 TWh is 50 billion seconds of 20 Watts, which is 1585 years of power for a single brain, not 6 million. i'm sure i got this wrong as i'm not a physics guy but where did i go wrong here? a more neutral article (that doesn't have a clear "AI is harm…

A watt is not a per-second measure, Wh are the energy measurement to W being the power. TWh = 10^12Wh which means a trillion-watt for 1 hour. 10^12 / 20 (power of brain) / 24 (hours in a day) / 365 (days in a year) = 5 707 762 years.

One watt is one joule per second. What exactly do you mean by "a per-second measure"?

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

#107
> One thought that occurred to me after this investigation was the premise that the immense bleeding-edge models of today with billions of parameters might be able to be built using orders of magnitude fewer network resources by using more efficient or custom-designed architectures.

I'm pretty convinced that something equivalent to GPT could run on consumer hardware today, and the only reason it doesn't is because OpenAI has a vested interest in selling it as a service.

It's the same as Dall-E and Stable Diffusion - Dall-E makes no attempt to run on consumer hardware because it benefits OpenAI to make it so large that you must rely on someone with huge resources (i.e. them) to use it. Then some new research shows that effectively the same thing can be done on a consumer GPU.

I'm aware that there's plenty of other GPT-like models available on Huggingface, but (to my knowledge) there is nothing that reaches the same quality that can run on consumer hardware - yet.

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

#108

Earlier quoted context omitted.

Are transformers not already very specialized to the task of learning from sequences of word vectors? I'm sure there is more that can be done with them other than making the input sequences really long, but my point was that LLMs are hardly lacking in design specialized to their purpose.

> Are transformers not already very specialized to the task of learning from sequences of word vectors? No, you can use transformers for vision, image generation, audio generation/recognition, etc. They are 'specialized' in that they are for working with sequences of data, but almost everything can be nicely encoded as a sequence. In order to input images, for example, you typically split the image into blocks and th…

That's fair, and I didn't realize people were using them for images that way. I would still argue that they are at least somewhat more specialized than plain fully-connected layers, much like convolutional layers.

It is definitely interesting that we can do so much with a relatively small number of generic "primitive" components in these big models. but I suppose that's part of the point.

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

#109
post #78
post #50

Earlier quoted context omitted.

Very easy to design a radio component into electronics, much harder to design it out.

I’ve had all kinds of cheap electronics that came with unadvertised radio features for free.

My fillings tune in Radio Moscow. Keeps me awake at night.

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

#110
post #71

Earlier quoted context omitted.

A watt is not a per-second measure, Wh are the energy measurement to W being the power. TWh = 10^12Wh which means a trillion-watt for 1 hour. 10^12 / 20 (power of brain) / 24 (hours in a day) / 365 (days in a year) = 5 707 762 years.

One watt is one joule per second. What exactly do you mean by "a per-second measure"?

The seconds are not a denominator, OP was doing TWh / W as if W = 1 / 3600 * Wh which is not the case.
Post reply on HN