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…
> I am not sure I will ever trust an ML algorithm trained on inputs/outputs only It’s doing TDD!
Neural programmer better than Quicksort
81–90 of 132 posts
Re: Neural programmer better than Quicksort
#82It'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…
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.
Re: Neural programmer better than Quicksort
#83It'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…
> 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,…
The algorithm modifies the original list only by swapping entries. As such, it's guaranteed to result in a permutation.
Re: Neural programmer better than Quicksort
#84Earlier quoted context omitted.
It doesn't need to be 100% correct. There's a place for fast sorting algorithms which are correct most of the time - basically anything non-critical, like sorting comments by upvotes. According to the article, they couldn't find a case where it wasn't correct.
> There's a place for fast sorting algorithms which are correct most of the time - basically anything non-critical, like sorting comments by upvotes. Nothing saddens me more than this trend of the modern web where everything works semi-probabilistically (even if it's likely for "good" technical reasons, such as, "we wrote our server backend in Ruby which is slow as molasses so now we need 230 CDN and 800 databases in…
Re: Neural programmer better than Quicksort
#85Earlier quoted context omitted.
It doesn't need to be 100% correct. There's a place for fast sorting algorithms which are correct most of the time - basically anything non-critical, like sorting comments by upvotes. According to the article, they couldn't find a case where it wasn't correct.
> There's a place for fast sorting algorithms which are correct most of the time - basically anything non-critical, like sorting comments by upvotes. Nothing saddens me more than this trend of the modern web where everything works semi-probabilistically (even if it's likely for "good" technical reasons, such as, "we wrote our server backend in Ruby which is slow as molasses so now we need 230 CDN and 800 databases in…
Re: Neural programmer better than Quicksort
#86Earlier quoted context omitted.
Next step is to prove the ML-produced algorithm is correct. I can see a world where we generate algorithms and then automatically prove they're correct based on a formal description of the problem being solved.
It doesn't need to be 100% correct. There's a place for fast sorting algorithms which are correct most of the time - basically anything non-critical, like sorting comments by upvotes. According to the article, they couldn't find a case where it wasn't correct.
Re: Neural programmer better than Quicksort
#87In 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 experimental setup.
Longer version below.
Interesting paper. It describes a Reinforcement Learning method to learn neural network models that imitate the behaviour of agents performing a) sorting, b) binary search and c) solutions to the NP-complete knapsack problem. The technique is notable because it learns from program traces also, not only from input-output pairs. The technique relies on a hard-coded set of problem-dependent a) input states and b) instruction sets. The latter are what it sounds like, sets of instructions that form the building blocks of the learned programs, although in an enhanced version of the technique, functions are also added to the (less complex?) instructions. Input states basically include all other information that may be useful to a learner, other than the instructions and functions from which to build a program. Two different setups are tested: a) one using the single instruction "swap" (that swaps two elements) and where the input state includes information of the full list, and b) one with more instructions and localised information that is reported to generalise better and be more efficient. The latter setup is also augmented with "functions" which are stated to be more complex than operations, though the distinction is rather on the vague side (there is some more information in an appendix but it's not very helpful, I'm still left wondering why an "instruction" is qualitatively different to a "function").
The paper is poorly organised and requires long appendices to elucidate all manner of poorly defined concepts in the main paper. This doesn't help when it comes time to evaluate the two most striking claims in the paper, namely that the proposed method(s?) a) show strong generalisation and b) outperform hand-crafted sorting algorithm quick-sort in sorting lists of numbers.
The first claim is difficult to evaluate because the paper presents results of sorting lists of variable _size_ but does not say anything clear about list _contents_. For example, while training lists are chosen to have a random length in [10,20] and with elements in the same range, testing lists have their length incrased, but there is no mention of the values of the elements in those litss and, going by what is described in appendix C, lists can have duplicate values. In other words, it's possible that the "strong generalisation" results refer to sorting lists of variable size with the same unique elements as in the training lists. In that case, the claim of "strong" genearlisation is not supported.
The second claim is difficult to evaluate for two reasons: a) there is no example of the training output, i.e. we never get to see what progams, exactly, the proposed approach is learning; and b) there is no attempt to asymptotic analysis of the learned models (which would be hard without an example thereof). Instead, the claim of efficiency seems to rest on two presmises: a) that sorting programs of O(n log n) time complexity are in the hypothesis space defined by the input states and instruction sets and functions for the relevant experimental setup, i.e. the learner could learn an O(n log n) sorting algorithm; and, b) that the number of training steps taken by the learning agents in imitation of the teacher agents is in the ballparck of n log n of the input. In other words, the strongest evidence for the efficiency claim seems to be a count of instructions (or function) calls during training. So, this very strong claim is also very poorly supported.
Re: Neural programmer better than Quicksort
#88It'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…
According to the authors, the proposed approach is notable for training not only on input/output pairs but also on program traces. In addition, reinforcement learning is used to train e.g. sorting agents on the behaviour of "teacher agents" that comprise hand-crafted implementations of well-known sorting algorithms (bubble- insertion- and quick-sort).
Re: Neural programmer better than Quicksort
#89The code (which is a few percent faster than quicksort) is on the last page: procedure QUICKSORTAGENT(input state) 2: Let i = 1, j = 2, l = 3, h = 4 3: if FunctionID = None then 4: return vh ← Function1(vl ← vl, vh ← vh) 5: else if FunctionID = 1 then . QuickSort 6: if vl vl then 15: return vi ← Function1(vl ← vl, vh ← vi) 16: else 17: return MoveVar(j, +1) 18: end if 19: else if prev = (vi ← Function1(vl ← vl, vh ←…
Was this "discovered" by their system or was it hand-crafted by the authors from their custom instruction set elements ?
In fact, as far as I understand it the paper claims that the learned model (i.e. the student agent) has learned to reproduce the behaviour of this teacher agent after training for a smaller number of steps on average than what the teacher needs to sort a list. That is what the entire claim about superior efficiency rests on (there is no example of a learned model and no asymptotic analysis of the program such a model represents).
Re: Neural programmer better than Quicksort
#90Quite dull research wrapped in fancy words. Essentially they generate functions that map a program state to another program state and counts those function calls and compares with e.g. the number of function calls in quick sort. They "cheat" by feeding how all elements compares the their neighbours at each step. Like, if you give the algorithm that input for free what's the point. Notably, none of the popular sorting…
The point, as also explained in the paper, is that even with such information and with a handful of basic operations from which to compose a program, the space of all possible programs is huge and finding a prorgam that does what it should in any reasonable amount of time is extremely difficult.
If you are familiar with the literature of program induction (which includes a lot more than neural program induction and goes back a few decades) you will notice that the hypothesis spaces for program learning are truly vast and it is impossible to make any kind of progress without some kind of "dirty trick" to reduce their size. The common approach is to impose a strong inductive bias on the representation language, so as to guide the search to find a correct program. The approach in the article is no different. And of course "inductive bias" here always means domain knowledge.
But, amicably, if you think there's any better way to do this, many people, myself included, would be very curious to hear what you have to say. In fact, if you could really innovate in this field you'd be guaranteed an illustrious research career. Learning programs from examples is hard.