News for hackers. Stuff that matters.
Re:Backpropagation is a leaky abstraction by fizixer on Monday December 19, 2016 @06:32PM (#13215975)
Backpropagation is a leaky abstraction in the sense that every algorithm/physics-principle/mathematical-theorem is a leaky abstraction. Take 'sort.' If you use a sort API for large N in a performance-critical section of your code without knowing if the implementation of that sort is an insertion-sort or a quicksort, "you would be nervous." Hence you are dealing with a leaky abstraction, per this article.

I would much rather respond to the students who ask about why they need to know the details, by saying "because you registered for this class."

Essentially the question "if you’re never going to write backward passes once the class is over, why practice writing them?" is another way of asking "why reinvent the wheel?". And the best answer is "because learning is all about reinventing the wheel". The "code reuse as much as possible" mantra applies to when you're "using" a technique to do something else, not when you're "learning" the technique itself. They might as well register for Calculus and ask "why learn integrals and derivatives when mathematica can do them for you", or take an Aerodynamics class and ask "why learn fluid mechanics and dynamics, heck newton's laws, when an airplane can run on autopilot." I doubt "because calculus is a leaky abstraction" or "because fluid dynamics is a leaky abstraction" is a good answer to that.

Re:Backpropagation is a leaky abstraction by skybrian on Monday December 19, 2016 @07:15PM (#13216234)
I think you're sweeping an important distinction under the rug.

If every major language provides an O(n log n) sort function, is it still a leaky abstraction? I'd say no. You can use it without worrying much about the details.

But it sounds like the situation with back-propagation is different, since the internal details of the algorithm affect whether you get a usable answer at all.

A borderline case might be something like a SQL database, where in theory, creating an index shouldn't change query results, but in practice, the performance can change so much that it effectively does.

Unlike with back-propagation, you can tune database performance without worrying about queries returning different results (assuming they don't time out). So it's still a useful guarantee.

Re:Backpropagation is a leaky abstraction by sirclueless on Monday December 19, 2016 @07:34PM (#13216332)
Speaking from experience, I've had to worry about what implementation of sort is being used in many languages, from Java to C++, even Go and Python.

There are a lot of details to get right: how are elements compared? Is the sort stable? Is it efficient for small N? Is it efficient for nearly-sorted arrays? Is it efficient when almost all the elements compare equal? Is it guaranteed O(n log n) or average? If average, is there an input that reliably triggers n^2 behavior making it a DDoS vector?

Anything is a leaky abstraction when you care enough.

Re:Backpropagation is a leaky abstraction by im3w1l on Tuesday December 20, 2016 @07:12AM (#13219156)
Those properties should ideally be part of the documentation so that the abstraction stops leaking.
Re:Backpropagation is a leaky abstraction by 4ad on Tuesday December 20, 2016 @08:13AM (#13219476)
One could argue that if these details are necessary for correct/performant operation, then it is a leaky abstraction.
Re:Backpropagation is a leaky abstraction by im3w1l on Tuesday December 20, 2016 @09:27AM (#13220029)
To me a leaky abstraction is an abstraction that does not expose all the relevant details. So if those details are written on the spec sheet of the black box then there is no leak.

If the box is only labelled with O(nlog n) without specifying constants then there is a leak.

Re:Backpropagation is a leaky abstraction by ezanmoto on Tuesday December 20, 2016 @09:26AM (#13220018)
I feel that if you care that much about the internals of the abstraction then you don't necessarily want an abstraction anymore, but rather the concrete thing that is being abstracted over. I think abstraction is an admirable quality that has numerous advantages, but if you need guarantees on the properties of what's under the abstraction then an abstraction is probably not what's needed at that point.
Re:Backpropagation is a leaky abstraction by hiddencost on Tuesday December 20, 2016 @03:11AM (#13218269)
Except that for nontrivial use cases, the many different nlogn sort algorithms have trade offs which matter. A friend just wrote his own sort implementation optimized to maximize cache hits, because of certain quirks of his data that he knows ahead of time.

In much the same way, much of the interesting work with machine learning requires deep specialist knowledge in which selecting the best approach requires digging beneath the abstraction. Many specific applications have their own quirks, which is where significant gains are often made. (To be honest, I think the last year was more exciting for the advances in applied ML than in theoretical work.)

A co-worker wrote a library for distributed training of DNNs for a specialized use case. Because of certain quirks of our use case (think sparsity and consistent patterns in the data), there were certain optimizations he could make to the training process that gave nice linear scaling in the number of training nodes.

Re:Backpropagation is a leaky abstraction by belvoran on Tuesday December 20, 2016 @03:39AM (#13218363)
What is O(n log n)? Time complexity? What about memory requirement? Last month I decreased memory requirement from 16GB to 100MB in one implementation of a "stable&fast" algorithm. Really, using a function just because it's O(n log n) without understanding its characteristic is like a blind surgeon randomly amputating limbs because maybe it will help. But that's fine for me, I have more work then, fixing software bugs made by incompetent* programmers is quite nice.

*incompetent - those who think they know something and are not willing to learn anything new

Re:Backpropagation is a leaky abstraction by masklinn on Tuesday December 20, 2016 @04:04AM (#13218439)
> What is O(n log n)? Time complexity?

And then worst case? Best case? Average case? Which applies to random input? Nearly-sorted input? What's the overhead for a "short sort", can/should I use this to sort small sequences in a tight-ish loop or is it only for large sequences?

Re:Backpropagation is a leaky abstraction by dkersten on Tuesday December 20, 2016 @06:15AM (#13218911)
And then worst case? Best case? Average case?

I was under the illusion that Big-O was always asymptotic complexity (ie worst case) and that other notations (little-o, big-omega, big-thetha etc) were used for best/average/etc case. Perhaps I'm wrong, however.

Which applies to random input? Nearly-sorted input? What's the overhead for a "short sort", can/should I use this to sort small sequences in a tight-ish loop or is it only for large sequences?

Indeed. The details matter.

My favourite example is how a naive linear search can perform better than a non-linear search with a better (in O() terms) algorithm if, for example, the linear search can do most of its work in cache (eg small input sizes or otherwise regular access patterns (predictable for prefetch)).

Re:Backpropagation is a leaky abstraction by 4ad on Tuesday December 20, 2016 @08:18AM (#13219505)
> I was under the illusion that Big-O was always asymptotic complexity (ie worst case) and that other notations (little-o, big-omega, big-thetha etc) were used for best/average/etc case. Perhaps I'm wrong, however.

No, asymptotic notation only refers to the behaviour of the function (or algorithm) as you take the limit N->inf, e.g. changes to the size of the input. But the nature of the input often changes the behavior as well.

Re:Backpropagation is a leaky abstraction by dkersten on Tuesday December 20, 2016 @01:41PM (#13222619)
Thanks for the correction!
Re:Backpropagation is a leaky abstraction by scott_s on Tuesday December 20, 2016 @09:55AM (#13220283)
You can have Big-O of worst case and Big-O of average case. "Asymptotic complexity" itself does not imply worst case; the assumptions you make to construct the function itself determine worst case or average case.
Re:Backpropagation is a leaky abstraction by mypalmike on Tuesday December 20, 2016 @04:03AM (#13218437)
Why do you assume the commenter doesn't understand the time and memory characteristics of quicksort?
Re:Backpropagation is a leaky abstraction by RyanZAG on Tuesday December 20, 2016 @04:59AM (#13218648)
Nobody mentioned quicksort. You're assuming quicksort, which is what the issue is. Many languages don't actually use quicksort, fyi. The practical performance considerations of just quicksort itself also change depending on how you've implemented the small details - are you moving memory around, or just changing pointers? Huge difference in the real world, no difference in the algorithm.
Re:Backpropagation is a leaky abstraction by mypalmike on Tuesday December 20, 2016 @10:37PM (#13226623)
I oversimplified my response and it lost the point I was making. You are certainly correct that many languages don't use quicksort. My bad.

I was responding to a comment that I felt was needlessly dismissive. The default sort algorithm of any major language's standard library is usually not worth trying to beat, and calling someone "incompetent" for not reinventing the wheel each time they encounter data that needs to be sorted is absurd. Note: I said "usually", not "never". A competent programmer doesn't fix problems that don't exist, and you would absolutely have to profile code before convincing me that the choice of sorting algorithm was the source of a performance problem.

As far as the details go... In only a few languages (e.g. C) might you really even consider moving memory around rather than pointers. The semantics of standard library sort in Java, C#, Ruby, Python, Javascript... is sorting an array of primitives by value or objects by reference.

Re:Backpropagation is a leaky abstraction by belvoran on Tuesday December 20, 2016 @07:58AM (#13219400)
There is no quicksort mentioned.
Re:Backpropagation is a leaky abstraction by paulddraper on Monday December 19, 2016 @09:37PM (#13216966)
> If every major language provides an O(n log n) sort function, is it still a leaky abstraction? I'd say no.

Great example :) You get different results if you use merge sort or quicksort.

The former is stable; the latter is not.

Okay...so you can be more specific with your API and specify whether stability is guaranteed. Eventually you can be specific enough that you essentially characterize the implementation.

Re:Backpropagation is a leaky abstraction by fizixer on Monday December 19, 2016 @07:42PM (#13216368)
> If every major language provides an O(n log n) sort function, is it still a leaky abstraction?

Yes, if the performance is still not acceptable and you look into the problem and discover that your scenario could benefit from radix sort, or one of partial sorting, or some kind of intermittent sorting, all of which would require investigating the specific case at a "white box" level, ignoring the existence of a black-box O(n-log-n) sort API call.

Re:Backpropagation is a leaky abstraction by quelltext on Monday December 19, 2016 @07:51PM (#13216418)
The implementation is a black box but the performance characteristics could very well be part of the API contract. When you require and it's feasible to use radix sort you probably know not to use the standard sort function.
Re:Backpropagation is a leaky abstraction by smallnamespace on Monday December 19, 2016 @08:05PM (#13216478)
Yes, but reasoning about the API contract is exactly what being taught sorting algorithms helps you navigate, just like learning the guts of backprop helps the ML practitioner understand why things can go wrong.
Re:Backpropagation is a leaky abstraction by nullc on Monday December 19, 2016 @07:28PM (#13216308)
> You can use it without worrying much about the details.

I invite you to start sorting data which is often already sorted (or often all identical) and tell me you didn't need to worry about the details.

Re:Backpropagation is a leaky abstraction by joe_the_user on Monday December 19, 2016 @10:23PM (#13217198)
Perhaps the distinction would be between things that are "fundamentally a heuristic with some math behind it" versus things are "mostly theoretically settled with some corner cases you have to worry about"

And neural networks using backpropagation to minimize an error function are definitely the former while the "go to" techniques of mathematics are generally the latter.

I think this is generally acknowledged, in fact.

Sooo it seems logical that students of these modern machine learning techniques should be impelled to "get their hands dirty" with the numericals processes involved since this will add to the data they use to drive the intuitions which allow them to avoid the multiple pitfalls of neural networks.

Re:Backpropagation is a leaky abstraction by sherjilozair on Monday December 19, 2016 @11:33PM (#13217483)
I think Andrej is arguing over and above the reasons you cite. Not only should you learn backprop because of the same reason you learn to do 2+2, but you should learn backprop ALSO because it's a leaky abstraction.

This is a non-trivial statement, because there are other things which are not leaky. For example, he's not arguing that deep learning practitioners should also learn assembly programming or go into how CUBLAS implements matrix multiplication. Although these things are nice to learn, you probably won't need them 99.9% of the times. Backprop knowledge, however, is much more crucial to design novel deep learning systems.

Re:Backpropagation is a leaky abstraction by annnnd on Tuesday December 20, 2016 @09:50AM (#13220232)
> Backprop knowledge, however, is much more crucial to design novel deep learning systems.

I would argue that it's not just for that. You need to understand what is happening inside DNN if you want to construct it properly.

Re:Backpropagation is a leaky abstraction by posterboy on Monday December 19, 2016 @08:34PM (#13216601)
> "because you registered for this class."

The Authoritative Argument is not very convincing when your good authority over the course material being challenged. Maybe there is some irony or deeper truth, lost on me. Are you perhaps a leaky abstraction?

edit:

> The "code reuse as much as possible" mantra applies to when ...

... you are able to reasonably compromise, got it.

Re:Backpropagation is a leaky abstraction by KODeKarnage on Tuesday December 20, 2016 @12:18AM (#13217659)
> The Authoritative Argument is not very convincing

Neither is a straw man argument.

He wasn't making an argument from authority. He was essentially saying "because you are learning, not doing".

Re:Backpropagation is a leaky abstraction by posterboy on Tuesday December 20, 2016 @07:31PM (#13225730)
>essentially

No, implicitly and very subtly. The essence of the argument was the student in a voluntary class. The implications are manifold, but not stating the implications has a meaning on the meta level, that the students understanding is not expected, but the students expectation of an authoritative answer has to be satisfied anyway by stating the obvious to establish or retain authority.

Re:Backpropagation is a leaky abstraction by arikrak on Monday December 19, 2016 @07:33PM (#13216328)
If someone wants to know a little calculus for a small area of engineering, do they really need to learn various manual techniques for calculating integrals? Why can't they use Mathematica? (What if they're just taking calculus as a requirement of CS or premed?) They're not planning on developing new integrations techniques. Does a pilot need to learn fluid dynamics like an airplane engineer?

Maybe educational students should only require what's actually practical. That can include things that can be solved by computers if they teach ideas that have practical value.

Re:Backpropagation is a leaky abstraction by conistonwater on Monday December 19, 2016 @07:46PM (#13216398)
> If someone wants to know a little calculus for a small area of engineering, do they really need to learn various manual techniques for calculating integrals?

Yes, but the logic goes the other way: if they are unable to use the technique manually, then one may conclude they do not understand the idea well enough to use it, whether or not Mathematica is available. The two, manual application and understanding/intuition, go hand in hand and can't be separated. My understanding is that this has even been studied more formally, there is a paper I remember reading by Kahneman and somebody else [1] about the development of intuition and the tension between heuristics-and-biases and naturalistic decision making. In short, don't trust people so much, if they say they understand something but are unable to actually do it, be a bit more skeptical.

[1] Found it: https://www.ncbi.nlm.nih.gov/pubmed/19739881 On second thought, it's probably not as relevant as I remembered it.

Re:Backpropagation is a leaky abstraction by kazinator on Tuesday December 20, 2016 @11:09AM (#13221069)
Performance is the same thing as correctness only in hard real time.

A better analogy might be stable sort versus unstable. If you need a stable sort, and unstable one is wrong.

(Not sure if that counts as an abstraction leak, though! It's just the semantics. Unstable sort doesn't leak that it is unstable; that's its behavior. If a sort is just documented as putting items in order, an actual implementation does leak information about whether or not it is stable.)

Re:Backpropagation is a leaky abstraction by thecity2 on Monday December 19, 2016 @06:39PM (#13216012)
"because fluid dynamics is a leaky abstraction"

No pun intended!