It should be possible to replace a small tree of neurons with a smaller set of functions that back propagate more efficiently and are cheaper to calculate meanwhile using less ram/cpu per computation. It's not probable that our first shoot in the dark with neurons got the optimal math structure.
Why would multiplication and addition be the only needed math, and not xor gates.
It's not our first shot in the dark, and the current configurations are pretty well principled. I would expect that other designs could work well in a task-specific sense, but only marginally, and in terms of a generic structure, there are a lot of theoretical benefits of the current design.
The entire ML literature for the last 30 years has been playing genetic optimisation on model designs and architectures. We are reaching the exploitation phase because it is becoming clear that exploration is giving diminishing returns.
On top of that, you can trivially construct an XOR gate with just 2 neurons in the hidden layer. Neural networks are already proven universal approximation schemes and they are differentiable, meaning you can train using gradient descent. These two facts are what gave rise to modern AI, not some half-motivated architecture or building block. Complexity is what you need, and gradient descent is what you use to tame it. There are probably still quite a few possible improvements to sections of the overall process, but the biggest revolution will probably come from making hardware more aligned with these ideas rather than making AI more aligned with traditional hardware.
"XOR" is actually an incorrect name for addition modulo 2. For 3 or more inputs, true "XOR" and addition modulo 2 give different results ("exclusive or" means that 1 and only 1 of the operands is true, "addition modulo 2" means that an odd number of operands are true). No computer implements true "XOR", all implement addition modulo 2.
Addition modulo 2 is special, because it is identical with subtraction modulo 2. This means that computer "XOR" has 2 possible interpretations, as addition modulo 2 and as subtraction modulo 2.
Because addition modulo 2 is special, some of the algorithms that work with additions in bigger fields also work modulo 2, but other algorithms are no longer applicable.
I do think it'd be interesting to have some kind of localized snapping when subsets of neurons adjacent enough to segment from the network as a whole are close enough to a known family of functions over their inputs. Some kind of optimizing compiler over approximated neural circuitry
The rub is that this is only worthwhile with a computational complexity gain. Maybe fitting low order polynomials might give that gain, but more complex functions take extra cycles to compute and would struggle to compete with chains of simple, practical activation functions.
There is already a Boolean version of differentiation, called Boolean variation, which includes a chain rule and allows for a binary version of backpropagation and gradient descent:
It uses XNOR (IFF, the opposite of XOR) as the activation function. This allows for a binary neural network that is trained directly in binary, not quantized later.
There is also a bunch of other papers that forego neural networks altogether and instead use something called "logic gate networks". Instead of neurons, they use logic gates. They don't have weights and use random connections instead. The learning consists in deciding which logic gate to use at each node ("neuron") in the network. They use conventional differentiation though, by "relaxing" the binary Boolean functions into continuous functions between 0 and 1, and then converting them to binary after training. I wonder whether the binary training approach from the paper above could be used for much faster training of these "logic gate networks". Currently they have extremely fast inference but slow training.
TL;DR: The problem is that modern AI GPUs -e.g., NVIDIA's Blackwell series - are fast at low-precision math (FP4, FP6, FP8, INT8) used for AI, but terrible at high-precision math (FP64) needed for scientific computing.
So, they formulated a combinatorial optimization method to unify tricks that break down a single, high-precision FP64 matrix multiplication into many small, low-precision ones using modular arithmetic (the Chinese Remainder Theorem) and then reassemble the exact result.
Conclusion: 83× speedup over native FP64 on an NVIDIA B300 GPU
On modern NVIDIA GPUs, both consumer and datacenter, any software implementation of FP64 computations will be much faster than the hardware FP64, because the hardware has 1:64 FP64:FP32 throughput.
Simple implementations of the FP64 operations with FP32 will result in a speed of up to 4 times greater than that of the hardware, for correct implementations that also implement the FP64 exponent range and the behaviors for special FP values.
By using the GPU "tensor" units, higher speedups should be achievable, like claimed in this paper.
Nonetheless, the 83x speedup from the paper is most likely bogus and not reachable in most applications. The real speedup might be 2 or 3 times less than that.
After a quick skimming through the paper, I could not find any mention about how they handle exponents and floating-point exceptions.
If they do not implement the standard FP64 exponent range, underflows and overflows would be extremely frequent. Depending on how they handle exceptions, this would either produce incorrect results or slow down the computation dramatically.
There is a good chance that for optimizations like that they rely on higher level layers of software to keep the values within bounds to avoid exceptions.
B300 has worse INT8 performance than my RTX Pro 6000. CUDA 13.4 cuBLAS already has Ozaki-II at 29.9 TFLOPS benchmark (just ran it personally). However, that is clearly not optimized. Should be able to do twice that since INT8 GEMM benchmarking shows me 59.1 TFLOPS.
So would it make more sense for me to target the paper's FP4/FP6/FP8 (maybe even the NVIDIA specific implementations) or would it make more sense for me to optimize the INT8 performance? I'm not sure the extra memory traffic wouldnt just offset non-INT8.
This paper is really hard to read but it seems like they're trying to optimize for fewest GEMMs instead of normalizing for the ones that run the fastest at the precision they need? I don't really understand why you would care about having fewer GEMMs.
Yikes. Is this paper supposed to be read by humans or agents? Seems like the authors spent very little time doing any kind of readability checks. The results do look super impressive though. can anyone more in the know on why one wants fp64 matmuls in practice? Iiuc doing it at low bit and aggregating into bf16 was good enough eg when computing dot products even on pretty long vectors.
Unlike ML/AI computations, any not too simple physical model requires computations with an FP64 precision, and sometimes even higher. For input and output experimental data, FP32 is normally enough, but any arithmetic operations done with such FP32 input data would lose information unless they are done with FP64.
Not only the precision must be around that of FP64, but also the exponent range must be wide enough to make unlikely overflows and underflows, which is a condition not satisfied by FP32.
Sometimes it is possible to use mixed precision, i.e. to do some computations with FP64 and others with FP32, but the right combination varies from a problem to another and a lot of work is necessary to determine an optimum distribution of the computations over the different precisions. It is much easier to use FP64 everywhere.
In electronics, where one frequently has to solve systems of the so-called "stiff" ordinary differential equations (e.g. in SPICE analyses), using numbers with insufficient precision frequently either prevents convergence or leads to "hallucinated" incorrect solutions.
The idea frequently pushed by those who try to support NVIDIA and its followers, that one should find an approximate solution in FP32, which should do most of the work, and then the accuracy of that solution should be improved with FP64 with a little additional work, frequently fails for electronics problems and other stiff problems, because the low-precision computations may converge to a different solution, whose improvement does not lead to the correct solution obtained with high-precision computations.
In my corner of physics, the biggest theory breakthrough came from abandoning fp128 quad-precision and going to arbitrary precision libraries with tens to hundreds of (decimal!) digits.
Well yeah, but it sounds like what was wrong was the level of precision used. It's not always possible to work around numerical issues arising from finite precision.
Don't judge based only on LLMs. They are a special case coming from having a good amount of compression bias baked into their design. There are heaps of applications in scientific computing where you really need fp64 matmuls. The biggest issue comes with ill-conditioned matrices, where a low-precision matmul can cause catastrophic cancellation.
"same hardware" might be a misleading way to think about it. There's only a handful of fp64 units on the die, so it wouldn't be a big exaggeration to say the native performance is zero. This algorithm actually makes use of the computational power of the die. And going from near-zero to solid performance is automatically a near-infinite improvement factor.
The speed of this method is part of hardware selection for sure.
But I'm saying the native performance number is too low to care about, so the 83x ratio isn't meaningful. It's an important number divided by an unimportant number. If native was a little better and the ratio was 50x, or native was even worse and the ratio was 600x, that change in ratio would basically not matter.
The second generation Intel GPUs, i.e. Battlemage, have 1:8 FP64:FP32 throughput, which is a great improvement over the other consumer GPUs.
The last consumer GPU with similar FP64 performance was AMD Radeon VII from 2019 (1:4 ratio).
Nonetheless, Intel makes only small discrete GPUs. They have outstanding performance per dollar, but moderate absolute performance.
I have an Intel Arc B580 in a computer with AMD Ryzen 9 9900X (i.e. 12-core Zen 5).
In this configuration, the GPU and the CPU have a very similar FP64 throughput, which is less than that of a 16-core 9950X (but because adding the GPU doubles the throughput, the aggregate throughput is 50% over a 9950X).
Adding the Intel GPU was worthwhile, because it doubled the throughput for a very low additional price, much less than with a second computer.
Unlike Intel Battlemage, most other recent GPUs, except the AMD Instinct datacenter GPUs, have a 1:64 FP64:FP32 throughput ratio, which is trivially beaten by any software FP64 implementation.
Even with such a speedup, the performance per dollar of a Blackwell would be less than what you can achieve with desktop Zen 5 CPUs.
Within a given budget and if you are not a big company that can buy server CPUs and datacenter GPUs at prices much lower than their list prices, the most financially-efficient way to simulate nuclear weapons or any other complex system would be to buy a set of desktops with AMD 9950X and also dual-port 25 Gb/s Ethernet NICs for interconnecting them into a ring (1 NIC per PC) or into a mesh (2 NICs per PC).
Those computers could be augmented with Intel Battlemage GPUs, which have the maximum performance per dollar of anything existing on the market.
I'm not sure if that holds for all markets. The B70 retails for about 2000 euros and has only 200 GB/s of memory bandwidth. It is the largest card in that price range by far so if you want to play with AI locally on a budget it is probably still the easiest way to get started.
It should be possible to replace a small tree of neurons with a smaller set of functions that back propagate more efficiently and are cheaper to calculate meanwhile using less ram/cpu per computation. It's not probable that our first shoot in the dark with neurons got the optimal math structure.
Why would multiplication and addition be the only needed math, and not xor gates.
Ai should be used to find that set of functions.
Like this?
https://dnhkng.github.io/posts/m4-tinystories/
https://dnhkng.github.io/posts/isa-net-compression/
I think they may have popped up on HN already.
This is really cool!
It's not our first shot in the dark, and the current configurations are pretty well principled. I would expect that other designs could work well in a task-specific sense, but only marginally, and in terms of a generic structure, there are a lot of theoretical benefits of the current design.
The entire ML literature for the last 30 years has been playing genetic optimisation on model designs and architectures. We are reaching the exploitation phase because it is becoming clear that exploration is giving diminishing returns.
Additions and multiplications give you gradients for back propagation, I’m not sure what the XOR equivalent would be.
I believe binary networks use quantization-aware training for exactly that reason as well.
On top of that, you can trivially construct an XOR gate with just 2 neurons in the hidden layer. Neural networks are already proven universal approximation schemes and they are differentiable, meaning you can train using gradient descent. These two facts are what gave rise to modern AI, not some half-motivated architecture or building block. Complexity is what you need, and gradient descent is what you use to tame it. There are probably still quite a few possible improvements to sections of the overall process, but the biggest revolution will probably come from making hardware more aligned with these ideas rather than making AI more aligned with traditional hardware.
"XOR" is actually an incorrect name for addition modulo 2. For 3 or more inputs, true "XOR" and addition modulo 2 give different results ("exclusive or" means that 1 and only 1 of the operands is true, "addition modulo 2" means that an odd number of operands are true). No computer implements true "XOR", all implement addition modulo 2.
Addition modulo 2 is special, because it is identical with subtraction modulo 2. This means that computer "XOR" has 2 possible interpretations, as addition modulo 2 and as subtraction modulo 2.
Because addition modulo 2 is special, some of the algorithms that work with additions in bigger fields also work modulo 2, but other algorithms are no longer applicable.
This sounds like Kolmogorov-Arnold networks.. rather than learning weights, learn a function computed by neurons
Because multiplication and addition let you model continuous-ish functions cheaply.
I do think it'd be interesting to have some kind of localized snapping when subsets of neurons adjacent enough to segment from the network as a whole are close enough to a known family of functions over their inputs. Some kind of optimizing compiler over approximated neural circuitry
The rub is that this is only worthwhile with a computational complexity gain. Maybe fitting low order polynomials might give that gain, but more complex functions take extra cycles to compute and would struggle to compete with chains of simple, practical activation functions.
Neurons can do XOR gates.
My first home assignment after being introduced to NN was to draw an XOR gate on paper using neurons.
How to do it, is left as an exercise to the reader.
They mean the inverse of that. Using XOR gates (or something similarly primitive) to implement neurons
There is already a Boolean version of differentiation, called Boolean variation, which includes a chain rule and allows for a binary version of backpropagation and gradient descent:
https://proceedings.neurips.cc/paper_files/paper/2024/hash/7...
It uses XNOR (IFF, the opposite of XOR) as the activation function. This allows for a binary neural network that is trained directly in binary, not quantized later.
There is also a bunch of other papers that forego neural networks altogether and instead use something called "logic gate networks". Instead of neurons, they use logic gates. They don't have weights and use random connections instead. The learning consists in deciding which logic gate to use at each node ("neuron") in the network. They use conventional differentiation though, by "relaxing" the binary Boolean functions into continuous functions between 0 and 1, and then converting them to binary after training. I wonder whether the binary training approach from the paper above could be used for much faster training of these "logic gate networks". Currently they have extremely fast inference but slow training.
TL;DR: The problem is that modern AI GPUs -e.g., NVIDIA's Blackwell series - are fast at low-precision math (FP4, FP6, FP8, INT8) used for AI, but terrible at high-precision math (FP64) needed for scientific computing.
So, they formulated a combinatorial optimization method to unify tricks that break down a single, high-precision FP64 matrix multiplication into many small, low-precision ones using modular arithmetic (the Chinese Remainder Theorem) and then reassemble the exact result.
Conclusion: 83× speedup over native FP64 on an NVIDIA B300 GPU
Wouldnt that also be interesting for training (backpropagation calculation)?
On modern NVIDIA GPUs, both consumer and datacenter, any software implementation of FP64 computations will be much faster than the hardware FP64, because the hardware has 1:64 FP64:FP32 throughput.
Simple implementations of the FP64 operations with FP32 will result in a speed of up to 4 times greater than that of the hardware, for correct implementations that also implement the FP64 exponent range and the behaviors for special FP values.
By using the GPU "tensor" units, higher speedups should be achievable, like claimed in this paper.
Nonetheless, the 83x speedup from the paper is most likely bogus and not reachable in most applications. The real speedup might be 2 or 3 times less than that.
After a quick skimming through the paper, I could not find any mention about how they handle exponents and floating-point exceptions.
If they do not implement the standard FP64 exponent range, underflows and overflows would be extremely frequent. Depending on how they handle exceptions, this would either produce incorrect results or slow down the computation dramatically.
There is a good chance that for optimizations like that they rely on higher level layers of software to keep the values within bounds to avoid exceptions.
I agree that this would be the only way to achieve the claimed speedup.
This would achieve maximum computational efficiency, but the higher level layers of the software would have to be modified from problem to problem.
Nonetheless, it might be possible for such a rewriting of the higher level layers to become simpler than in the past, when using an LLM assistant.
B300 has worse INT8 performance than my RTX Pro 6000. CUDA 13.4 cuBLAS already has Ozaki-II at 29.9 TFLOPS benchmark (just ran it personally). However, that is clearly not optimized. Should be able to do twice that since INT8 GEMM benchmarking shows me 59.1 TFLOPS.
So would it make more sense for me to target the paper's FP4/FP6/FP8 (maybe even the NVIDIA specific implementations) or would it make more sense for me to optimize the INT8 performance? I'm not sure the extra memory traffic wouldnt just offset non-INT8.
This paper is really hard to read but it seems like they're trying to optimize for fewest GEMMs instead of normalizing for the ones that run the fastest at the precision they need? I don't really understand why you would care about having fewer GEMMs.
Yikes. Is this paper supposed to be read by humans or agents? Seems like the authors spent very little time doing any kind of readability checks. The results do look super impressive though. can anyone more in the know on why one wants fp64 matmuls in practice? Iiuc doing it at low bit and aggregating into bf16 was good enough eg when computing dot products even on pretty long vectors.
Unlike ML/AI computations, any not too simple physical model requires computations with an FP64 precision, and sometimes even higher. For input and output experimental data, FP32 is normally enough, but any arithmetic operations done with such FP32 input data would lose information unless they are done with FP64.
Not only the precision must be around that of FP64, but also the exponent range must be wide enough to make unlikely overflows and underflows, which is a condition not satisfied by FP32.
Sometimes it is possible to use mixed precision, i.e. to do some computations with FP64 and others with FP32, but the right combination varies from a problem to another and a lot of work is necessary to determine an optimum distribution of the computations over the different precisions. It is much easier to use FP64 everywhere.
In electronics, where one frequently has to solve systems of the so-called "stiff" ordinary differential equations (e.g. in SPICE analyses), using numbers with insufficient precision frequently either prevents convergence or leads to "hallucinated" incorrect solutions.
The idea frequently pushed by those who try to support NVIDIA and its followers, that one should find an approximate solution in FP32, which should do most of the work, and then the accuracy of that solution should be improved with FP64 with a little additional work, frequently fails for electronics problems and other stiff problems, because the low-precision computations may converge to a different solution, whose improvement does not lead to the correct solution obtained with high-precision computations.
In my corner of physics, the biggest theory breakthrough came from abandoning fp128 quad-precision and going to arbitrary precision libraries with tens to hundreds of (decimal!) digits.
Say more! :-)
Sounds like something was wrong with the way the theory was realized in software.
Well yeah, but it sounds like what was wrong was the level of precision used. It's not always possible to work around numerical issues arising from finite precision.
COBOL compilers rely on arbitrary precision, and GNU COBOL links in GNU MP to achieve it.
https://archive.ph/K2TX3
cobol has _fixed_ arbitrary precision, BCD encoded arbitrary fixed size numbers.
they happened to use gnu MP, yes, but for cobol, dynamic arbitrary float precision or "never overflow" ints are not the point.
Don't judge based only on LLMs. They are a special case coming from having a good amount of compression bias baked into their design. There are heaps of applications in scientific computing where you really need fp64 matmuls. The biggest issue comes with ill-conditioned matrices, where a low-precision matmul can cause catastrophic cancellation.
> Is this paper supposed to be read by humans or agents?
That question is going to be increasingly relevant. And some will be intentionally written not for humans.
I often just pass the paper to agent and ask it to make me what the paper describes.
Up to 83x speed increase for fp64 matmul on b300. Great news for all the woefully underutilized Blackwell's out there!
Like, it is? That's almost two orders of magnitude performance improvement on the same hardware.
"same hardware" might be a misleading way to think about it. There's only a handful of fp64 units on the die, so it wouldn't be a big exaggeration to say the native performance is zero. This algorithm actually makes use of the computational power of the die. And going from near-zero to solid performance is automatically a near-infinite improvement factor.
Intels latest GPU for compute targets fp64 performance.
If they can deploy aoftware and models, these benefits go into hardware selection.
The speed of this method is part of hardware selection for sure.
But I'm saying the native performance number is too low to care about, so the 83x ratio isn't meaningful. It's an important number divided by an unimportant number. If native was a little better and the ratio was 50x, or native was even worse and the ratio was 600x, that change in ratio would basically not matter.
The second generation Intel GPUs, i.e. Battlemage, have 1:8 FP64:FP32 throughput, which is a great improvement over the other consumer GPUs.
The last consumer GPU with similar FP64 performance was AMD Radeon VII from 2019 (1:4 ratio).
Nonetheless, Intel makes only small discrete GPUs. They have outstanding performance per dollar, but moderate absolute performance.
I have an Intel Arc B580 in a computer with AMD Ryzen 9 9900X (i.e. 12-core Zen 5).
In this configuration, the GPU and the CPU have a very similar FP64 throughput, which is less than that of a 16-core 9950X (but because adding the GPU doubles the throughput, the aggregate throughput is 50% over a 9950X).
Adding the Intel GPU was worthwhile, because it doubled the throughput for a very low additional price, much less than with a second computer.
Unlike Intel Battlemage, most other recent GPUs, except the AMD Instinct datacenter GPUs, have a 1:64 FP64:FP32 throughput ratio, which is trivially beaten by any software FP64 implementation.
Gotta be either 2 or infinity
Could be a nice way to do nuclear weapons testing at home.
Even with such a speedup, the performance per dollar of a Blackwell would be less than what you can achieve with desktop Zen 5 CPUs.
Within a given budget and if you are not a big company that can buy server CPUs and datacenter GPUs at prices much lower than their list prices, the most financially-efficient way to simulate nuclear weapons or any other complex system would be to buy a set of desktops with AMD 9950X and also dual-port 25 Gb/s Ethernet NICs for interconnecting them into a ring (1 NIC per PC) or into a mesh (2 NICs per PC).
Those computers could be augmented with Intel Battlemage GPUs, which have the maximum performance per dollar of anything existing on the market.
I'm not sure if that holds for all markets. The B70 retails for about 2000 euros and has only 200 GB/s of memory bandwidth. It is the largest card in that price range by far so if you want to play with AI locally on a budget it is probably still the easiest way to get started.