I haven't read this paper, but that strategy was exactly the strategy behind "The Case for Learned Index Structures"[0]. The idea was you could train a model to predict the location of a row based on a primary key. After computing the model, you could then go through every row and compute a bound on how far off the model is from the actual row. To perform a lookup, you start off at the model's guess, then look around based on the bound on the model for a row with the given primary key.
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.
> OTOH the standard library sort can be improved if you know the distribution of the numbers you're sorting (e.g., small numbers can bucket sort, small lists can use a sorting network, etc).
Even better: the standard library sort usually assumes only comparison. For special cases like sorting on integer keys you can conceivably do better.
The algorithm modifies the original list only by swapping entries. As such, it's guaranteed to result in a permutation.
But it also limits their system to in-place algorithms only.
You are right in some sense, but you'd still have trouble implementing something like bucket sort in your setting, if all you have are comparisons.
I feel that if we ever want to build an intelligent problem solver machine, we need some facility for abstract reasoning and work like this papet is a major contributor towards that goal. (if its reproducible and valid ofc...)
It’s doing TDD!
Its just that algorithms like the Prolog’s WAM or the reet used in rules are replaced with neural nets and the like.
Rules use the same When Then format acting on a Given fact base. Prologs Horn Clauses can easily be translated into that form.
BDD writes all tests in the format Given When Then.
It’s already here.
According to the article, they couldn't find a case where it wasn't correct.
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 instances around the whole world and transformed our simple centralized problem into an horrendous decentralized one).
The central reason for me to use computers is that they are (or at least were) deterministic to a much higher degree that normal life, and so many things in the 10 last years becoming much more non-deterministic in particular on social websites is something that frustrates me every single day as it just makes the whole experience and process of using computers & the web very unreliable compared to what it used to be.
https://news.ycombinator.com/item?id=23507197
(The article was very light on details though, and it was probably just one team that consolidated to MongoDB, not the accounts itself... one hopes.)
This trend seems to be everwhere
Stackoverflow was just using 4 db servers in 2016 (https://nickcraver.com/blog/2016/02/17/stack-overflow-the-ar...)
That is why I am not a huge fan of proving code in the first place. If you have a really complicated proof of formal correctness, then who guarantees you, there is no misstake in the proof itself? At least this is what I have seen in university, lots of complicated stuff on the whiteboard, with a result. And then someone figured out, it was wrong.
So I rather do lots of testing, for all known test cases.
How is this any different? You can still make mistakes in your test code, test data, omit cases that would fail, etc. I think I'd be less confident in a set of unit tests than I would with an automated proof checker.
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.
Especially the test cases needed to trigger some deep bug.
Like humans.
How do we deal with problematic humans?
Retraining or replacement.
That’s... equivocation.
Both humans and ML algorithms are flexible. That is the point of “learning”.
Adaptation.
Neither humans nor ML make zero errors.
Ceteris paribus, if an ML algorithm makes fewer errors at a task which with low error tolerance - you would use the algorithm instead of the human, no?
Perfect is the enemy of good enough.
I suppose it depends on your end goals.
With black box algorithms, we throw in some new training data and just hope it's enough.
> With black box algorithms, we throw in some new training data and just hope it's enough.
A small wording change and they're equivalent again.
To some extent human beings are also a black box - with some very peculiar failure conditions and side-channel weaknesses.
However, it is true that validating it for a very large number of inputs and outputs has value. This is not uncommon even in mathematics. For example, Goldbach's Conjecture (https://www.wikiwand.com/en/Goldbach%27s_conjecture) has not been proven but has been shown to hold for all integers less than 4 × 10^18
There’s some cool work on using neural program induction in compilers to try generate faster implementations based off the ‘oracle’ program that’s being compiled.
Can u provide more details?
I am familiar with garden-variety ML-optimization-of-combinatorical-space in compilers.
How would u even "measure" the expected performance unless these are gradual greedy changes
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.
I used to ask "implement binary search" as an interview question and gave up on using it because not a single candidate could do it correctly in 45 minutes. This was at a FAANG.
If they didn't, than I believe you did a poor job of guiding them. I refuse to believe that this is some esoteric, tough question. If you can solve dynamic programming problems, you can easily solve this one.
(high + low) / 2
To
Low + (high - low) / 2
What else about this problem is a "sharp edge"?
Candidate: bsearch(key, base, num, size, compare_fn);
Me: "Your offer should arrive within one to two weeks. Need any help with relocation expenses?"
But yes - I agree it’s weird that many standard-libraries (looking at you, .NET!) have only a single `Sort` method oh their vector-types with the details of the implementation buried in the documentation instead of shipping with a first-class sorting-algorithms library.
If you have a source, I would like to learn more.
(And if this insertion sort won't complete in O(n), say <= 3n, then, fallback to Quicksort, so won't turn into O(n^2) just because the ML alg hit a corner case)
It runs in O(n log (number of runs)). It's quite a lot simpler than Timsort.
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).
Pfffft, just wait until they get it writing code with its own proofs of correctness in dependent type theory. It'll be correct and twice as unreadable as incorrect human-written code!
Checking that the output is a (optionally stable) permutation of the input is the hard part. You can't do that dynamically if you have, for example, overwritten your input by sorting in place. And making a copy of your input is only going to be affordable in very specific and small instances on which you might as well just run a well-understood algorithm.
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 above bugs are only hit because the programmers who wrote it didn't think about overflow. What is this "neural programmer" assuming about their inputs? We'll never know.
OTOH the standard library sort can be improved if you know the distribution of the numbers you're sorting (e.g., small numbers can bucket sort, small lists can use a sorting network, etc). 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!