On AlphaTensor’s new matrix multiplication algorithms
fgiesen.wordpress.com
fgiesen.wordpress.com
[0] https://cloud.google.com/blog/products/ai-machine-learning/b...
Not trying to be dismissive just saying that... computational limits are limits on what can be done, in the end.
I stand corrected.
Edit: the term I could not remember is tradeoff.
I have some ~15 year old experience with the math behind some of this, but actually none with day-to-day deep learning applications using any of the now-conventional algorithms, so my perspective here is perhaps not that of the most pragmatic user. The status quo may have improved, at least de facto.
1. https://spectrum.ieee.org/floating-point-numbers-posits-proc...
I am familiarizing myself with recurrent neural networks and getting them trained online is a pain - I get NaNs all the time except for very small learning rates that actually prevent my networks to learn anything.
The deeper network is, the more pronounced accumulation of errors in online training is. Add 20-30 fully connected (not highway or residual) layers before softmax and you'll see wonders there, you won't be able to have anything stable.
Turns out our results were better than the papers we compared to, both in time and precision.
I am not that familiar with ml, but can't you just ignore those faulty weights?
I'm not at all caught up with the this side of ML but my first instinct is that faulty weights would lead to interpretability issues. The numbers represented by NaN/Inf vastly outnumber the ones within precision range, so interpreting them is much more of a guess.
what good will it do to compute something if its error is unbound?
the issue of the accumulation of roundoff errors is generally speaking unavoidable when it's linear but fortunately they tend to be small
Instability leads to divergence from the true answer, and I would expect it to mean super-linear divergence (though I am not an expert in this) which would quickly destroy any meaningful result (=> chaotic behaviour). But I'm not an expert.
(Disclaimer: googler, I have nothing to do with this research.)
The day when a lot of wrong math adds up to a computer drawing a pretty picture. Who would have thought.
This means regardless of how big your matrix is, or how big or small your numbers are — or even the relation between them —, you algorithm is going to be stable and accurate. If it can't be (stable), the library must let you know. This is so you can keep the numbers scaled such that they are not too large, nor too small in order to keep them stable for the operations you need to execute.
> One important strength of AlphaTensor is its flexibility to support complex stochastic and non-differentiable rewards (from the tensor rank to practical efficiency on specific hardware), in addition to finding algorithms for custom operations in a wide variety of spaces (such as finite fields). We believe this will spur applications of AlphaTensor towards designing algorithms that optimize metrics that we did not consider here, such as numerical stability or energy usage.
(apologies if I misunderstood, I wasn't calling you out specifically but a generalized misconception I've noticed in a lot of other discussions so far)
So yes I think this is an important first result.
Someone smart once said getting the wrong answer in time O(1) is very easy.
Reminds me of a joke about a guy at a job interview:
"So, what kind of skills do you have?"
"I can do mental multiplication really fast."
"Ok, what's 102 times 376?"
"87843"
[enters numbers in calculator] "That wasn't even close to correct."
"Yeah, but it was fast."Algorithmic correctness does not vary in different contexts.
Algorithmic usefulness/applicability does.
You are confusing the two.
Correctness here means that it provably generates a result that meets the definition of correct matrix multiplication.
In this case, they prove that all algorithms generated do (and that the system will actually only generate provably correct algorithms).
Applicability here is whether, when applied to a particular {not-infinite precision computer, use case}, it is viable to use it.
That does not affect whether the algorithm is correct or not, only whether you can use it to achieve a particular result.
If i have a computer with 1 bit of floating point precision, that does not make the algorithms all suddenly incorrect. Within the bounds of the what i can provide (not a lot), they still function exactly as they are supposed to. If i need 75 significant digits on this computer, it simply means that they are not useful for my computer because it cannot generate enough significant digits from them to be useful. That is totally orthogonal to whether the algorithms function as designed.
The correctness you have to prove includes proving that your error bounds are what you say they are.
I'm really unsure how you can possibly argue otherwise.
It's like arguing that a string algorithm is incorrect because it doesn't run fast enough on strings to be usable on any current computer. It's still correct. It's just not usable.
Unlike correctness, useless is very context specific. 100 years from now, an infinite precision arithmetic algorithm may be entirely useful.
1. The actual steps you have to follow.
2. Some form of error bounds/analysis that tell you how good/bad the output will be given approximate inputs.
In order to prove correctness you have to prove that the procedure gives the error bounds you claim. The error bounds are something you mathematically have to prove.
You don't get to just add your own requirement for correctness and then force people to prove it?
They claim a specific thing - they prove that thing. That thing suffices to prove that it succeeds at matrix multiplication. You for some reason really just don't like that as far as i can tell, and argue it doesn't suffice for usefulness (which i agree on)
Matrix multiplication, and "essentially any other numerical algorithm", is not defined in terms of the error bounds for correctness. That is just BS. The error bounds depend on implementation factors, and as such, they are totally unrelated to correctness.
Let's take a look: https://en.wikipedia.org/wiki/Matrix_multiplication
I have read the entire definition, nowhere does it refer to error bounds as a requirement for successful matrix multiplication!
The word "error" does not even appear on the page
Since it's wikipedia, I also pulled out my college math books. Same thing.
They prove correctness without any reference to error bounds. Those are accepted proofs.
I don't see a single basic proof that has error bounds as part of correctness.
It, again, wouldn't make any sense, because error bounds depend on implementation factors.
So again, you simply can't add your requirement to correctness just because you like it. They still remain where they should be - usefulness for application.
If your college textbooks do not mention error analysis, conditioning and stability then they are not numerical linear algebra books worthy of the name. Check out a reference like Trefethen and Bau's Numerical Linear Algebra for example. This book has a whole part (out of the 7 parts in the book) talking about conditioning and stability, and these ideas are present throughout other parts as well.
Once more the type of analysis I'm talking about is emphatically not implementation dependent. It is a property of the algorithm itself. For an example of the sort of statement I mean check out theorem 3.1 of this paper: https://arxiv.org/abs/math/0603207. If you disagree with me then please indicate what sort of "implementation factors" appear in the statement of the theorem.
Correctness of all computer science algorithms is defined by whether they meet a particular algorithmic specification. That's literally the definition of correctness:
https://en.wikipedia.org/wiki/Correctness_(computer_science)
"In theoretical computer science, an algorithm is correct with respect to a specification if it behaves as specified"
The specification is the matrix multiplication definition given right on that Wikipedia page. this algorithm meets it. It is therefore correct. (again, "error" does not appear on the page here either). There is no separate, special definition for "correctness (mathematical)" or "correctness (eigenket)". You really seem to want to there to be one, but it ain't there.
You really really really don't want to let this go, but the problem is - nothing, anywhere, agrees with you that correctness and usefulness are the same thing. Nor can you cite any reference, like i just did, to correctness that requires it do anything other than meet the specified mathematical definition. Your papers don't do it, my books don't do it. Nothing does it. Because it's not a thing.
My college textbooks talk about error analysis. I did not claim otherwise. They talk about it in the context of how to make an algorithm useful for a particular purpose, not about correctness. They are not making a ridiculous claim like you are.
I'm not going down this path anymore with you. Believe what you want, the rest of us will continue to not confuse it, and sources that people look at (textbooks, wikipedia, etc) will continue to not lead them astray.
I can only hope that at some point, you too stop trying to do so.
Your point is exactly mine - correctness is usually defined on exact numbers, which does not have error bounds. Usefulness is defined by particular implementation choices and precision choices when implemented on a particular computer.
The entire argument here is (crazily) that you can't prove correctness without error bounds, correctness is always context specifi. Of course you can, and of course it's not. Just like the wikipedia algorithm shows.
That may or may not make it useful for a particular application.
So you can think of this paper as saying "suppose you have a correct multiplication and addition operation on the field of interest. Then this algorithm for multiplying matrices over that field, which is composed of a sequence of those multiply and add operations, computes the correct matrix product." That is a perfectly provable kind of fact, that as you say doesn't stop being the case if you switch computers or something.
But fpmul and fpadd on your computer doesn't satisfy the condition for this proof! Therefore it doesn't apply, except by rough analogy. Then, other people might be interested in a different kind of proof, of a fact more like: "given two matrices of floating point numbers and fpmul and fpadd operations that are within .5eps precision, this sequence of fpmul and fpadd operations provably computes the matrix product such that the eigenvalues of the product are within .5eps of the true values". (edit to add: you could then also prove that the implementations of fpmul and fpadd on your computer satisfy the first condition, or replace them with implementations that do). That is also a well-specified correctness condition, and it is a correctness condition that is not necessarily satisfied by replacing "multiply" and "add" in the first algorithm with "fpmul" and "fpadd". This is what it means for "correctness [to be] context dependent". It doesn't invalidate the first proof, it just means we are interested in a different correctness condition than the first proof proves.
(edit to format, and add: of course different conditions on precision are relevant to different applications. Maybe I need my matrix elements to be computed within some absolute error bound, but my friend needs them computed within a relative error bound. Or I need it to be able to work on subnormal numbers within a certain precision, but my friend only needs it to be precise for numbers between 1 and 2. Different algorithms may satisfy one condition but not the other.)
This is much more clear than anything I would have been able to write.
I do agree that "'correct' means different things in different contexts."
Basically the library described at:
https://developer.nvidia.com/blog/cublas-strided-batched-mat...
I am a bit not-sold-yet on the AlphaTensor stuff because in practice it often seems like shuffling the data around in GPU memory is more expensive than doing the actual multiplications. It takes longer to move values between regular GPU memory and shared memory than it does to do a multiply, right? So all these algorithms that are optimizing the number of arithmetic operations, it isn't even clear to me that they're optimizing the right thing, because they require that you shuffle your data around in weird ways, and they don't generally measure the number of "memory moves" that are needed.
That said, I would be happy to drop in a replacement for cublasCgemm3mStridedBatched and test out if it worked better for me! It doesn't seem like these new AlphaTensor matrix multiplication routines are available as plain old c/c++ libraries yet, though.
https://docs.nvidia.com/deeplearning/performance/dl-performa...
You're correct - the gains come from really knowing the computational architecture and using this approach to find tweaks that optimise operations .. where those operations aren't just atomic mults and adds, but include piped multiply-adds and data moves.
I wonder how well it parallelizes.
If this Algo is only good for large matrices, can it reproduce the one for small matrices?
TLDR seems like the baseline strassen implementation they used is questionable wrt how really optimal it is in the first place.
I think the largest sorting network proven optimal is for a block size in the teens (13?).
Analogously to matrix multiplication, it matters most where comparisons are much more expensive than swaps.