Live data from Hacker News

Neural programmer better than Quicksort

arxiv.org

111–120 of 132 posts

Re: Neural programmer better than Quicksort

#111
post #81
post #37

Earlier quoted context omitted.

> I am not sure I will ever trust an ML algorithm trained on inputs/outputs only It’s doing TDD!

Imagine a world where all programmers do is write the tests and the generalized learning algos write all the implementations.

Welcome to my company a few years ago. Except they were not programmers but PM and architects, and algos were subcontractors. Now we have real developers (I'm in one of those teams)

Re: Neural programmer better than Quicksort

#112
post #105

Earlier quoted context omitted.

What else is hard besides converting (high + low) / 2 To Low + (high - low) / 2 What else about this problem is a "sharp edge"?

I may have been a little too harsh. Binary search is close to being a good interview question, especially since the algorithm does, rarely, come up in real code. But I prefer questions that are more like what people will be doing in their day-to-day job, and binary search is just a little too fiddly.

Me: "Show me a binary search in C on the whiteboard."

Candidate: bsearch(key, base, num, size, compare_fn);

Me: "Your offer should arrive within one to two weeks. Need any help with relocation expenses?"

Re: Neural programmer better than Quicksort

#113
post #70

Earlier quoted context omitted.

Tests are simple to unterstand. Complicated proofs I do not understand, without much effort. And I surely know that you can make mistakes with test cases as well. So I surely do not claim my way to be superior. But it works way better for me.

Test cases are not necessarily simple to understand. Especially the test cases needed to trigger some deep bug.

And so aphyr gets paid, for instance. You may not even be able realistically to run a test case. The laws of life say your 10000 core compute job will fail non-deterministically only after a day or so. It would clearly be helpful to have at least some formal guarantees, such as liveness at some level.

Re: Neural programmer better than Quicksort

#114
post #105

Earlier quoted context omitted.

I may have been a little too harsh. Binary search is close to being a good interview question, especially since the algorithm does, rarely, come up in real code. But I prefer questions that are more like what people will be doing in their day-to-day job, and binary search is just a little too fiddly.

Me: "Show me a binary search in C on the whiteboard." Candidate: bsearch(key, base, num, size, compare_fn); Me: "Your offer should arrive within one to two weeks. Need any help with relocation expenses?"

100% this. Maybe not everyone knows the specific function you’re looking for, but for the ones that know standard library APIs really well, that’s your hire.

Re: Neural programmer better than Quicksort

#115
post #82
post #6

It's really hard to write correct code. Sorting was broken in java and nobody noticed for a long time: http://envisage-project.eu/wp-content/uploads/2015/02/sortin... The same was true for java's binary search: https://ai.googleblog.com/2006/06/extra-extra-read-all-about... So I am not sure I will ever trust an ML algorithm trained on inputs/outputs only (which is what I think "neural program induction" means). The a…

It would be funny if a two phase approach to sorting would result in increased average performance. First sort using the ML algorithm. Then sort the almost sorted result with a traditional algorithm optimized for almost sorted results. In fact, I think my own brain does the two phase approach to many problems.

Could you train the ML algorithm to select the best traditional algorithm based on the distribution of the items being sorted?!

Re: Neural programmer better than Quicksort

#116
post #99

Short version: In summary, this paper makes strong claims of generalisation and efficiency but does not seem to provide sufficently strong evidence to back them up, e.g. it does not perform an asymptotic analysis to support the efficiency claim, it doesn't show actual program output to allow the evaluation of what is actually learned and the claim about strong generalisation is based on a very vaguely described exper…

> I'm still left wondering why an "instruction" is qualitatively different to a "function" Functions can be recursive. So the algorithm that the agent generates is able to use divide-and-conquer.

Yes, but the "functions" in the paper are implemented as two extra types of instruction- one representing a function call and one representing the "return" point of the function. So again, the difference is not clear. An instruction is an instruction, but some instructions are function calls (or returns). Why not just call them all "instructions", or all "functions"?

Re: Neural programmer better than Quicksort

#117
post #6

It's really hard to write correct code. Sorting was broken in java and nobody noticed for a long time: http://envisage-project.eu/wp-content/uploads/2015/02/sortin... The same was true for java's binary search: https://ai.googleblog.com/2006/06/extra-extra-read-all-about... So I am not sure I will ever trust an ML algorithm trained on inputs/outputs only (which is what I think "neural program induction" means). The a…

Apparently modern GPUs have sorting-networks implemented in hardware (giving you effectively constant-time sorting for fixed-size input) - which may be preferable for use if you’re processing hostile input which may be contrived to hit QuickSort’s worst-case and the cost of hitting the PCI Express bus is less than the cost of randomizing the input to mitigate QuickSort attacks. But yes - I agree it’s weird that many…

GPUs having hardware explicitly for sorting sounds a bit odd, when you can efficiently implement sorting networks in software on the same GPU.

If you have a source, I would like to learn more.

Re: Neural programmer better than Quicksort

#118
post #105

Earlier quoted context omitted.

What else is hard besides converting (high + low) / 2 To Low + (high - low) / 2 What else about this problem is a "sharp edge"?

I may have been a little too harsh. Binary search is close to being a good interview question, especially since the algorithm does, rarely, come up in real code. But I prefer questions that are more like what people will be doing in their day-to-day job, and binary search is just a little too fiddly.

I wouldn’t say so. In theory you’d expect a FAANG engineer to be able to construct a correctly terminating loop by reasoning about the loop invariant, but in practice every single candidate gets lost in guesswork and messing up the edge cases and termination condition.

Re: Neural programmer better than Quicksort

#119
post #81

Earlier quoted context omitted.

Imagine a world where all programmers do is write the tests and the generalized learning algos write all the implementations.

Welcome to my company a few years ago. Except they were not programmers but PM and architects, and algos were subcontractors. Now we have real developers (I'm in one of those teams)

That's such a big pile of yikes, I'm morbidly drawn to see that codebase.

Re: Neural programmer better than Quicksort

#120
post #83
post #69

Earlier quoted context omitted.

> If this thing can efficiently almost-correctly-sort because it's better at these types of pattern matching, we can just run a final pass of insertion sort to make it useful! Depends on what kinds of mistakes the almost-correct approach makes. If it just puts elements in the wrong order, your suggestion works. But if it makes mistakes like duplicating elements, or dropping them, or completely making up new entries,…

> Depends on what kinds of mistakes the almost-correct approach makes. If it just puts elements in the wrong order, your suggestion works. But if it makes mistakes like duplicating elements, or dropping them, or completely making up new entries, no post-processing will help. The algorithm modifies the original list only by swapping entries. As such, it's guaranteed to result in a permutation.

Yes, in that case the post-processing would work.

But it also limits their system to in-place algorithms only.

Post reply on HN