News for hackers. Stuff that matters.
Re:Hash-Based Bisect Debugging in Compilers and Runtimes by Scaevolus on Thursday July 18, 2024 @06:04PM (#41000188)
Aside: bisecting flakes doesn't have to involve repeated runs. You can reformulate bisection as an information probing operation, expanding the scope to support noisy benchmarks or low-probability flakes. Bayesian inference narrows down the probable range of the failure for each new observation, and you can choose new probes to maximize information gain-- or even run them in parallel to minimize the total time.

You do have to provide flake rate probability to do the probability estimates, but even roughly correct rates work fine. Running bisects assuming a 5% chance of getting a false positive or negative barely adds more steps and greatly improves robustness.

The math is pretty simple too-- my old prototype might still be in Google's monorepo; I should reimplement it for the open source world.

Re:Hash-Based Bisect Debugging in Compilers and Runtimes by rsc on Thursday July 18, 2024 @06:31PM (#41000360)
Indeed. Something like this is what I intend to do when I get some time.
Re:Hash-Based Bisect Debugging in Compilers and Runtimes by eru on Thursday July 18, 2024 @10:02PM (#41001498)
Could you briefly sketch out the math (or point to a sketch) so that other people can pick it up? I'm quite interested!

(I suspect you could get pretty far with a Monte Carlo simulation, and that would let you bypass most of the math anyway.)

Re:Hash-Based Bisect Debugging in Compilers and Runtimes by ajb on Thursday July 18, 2024 @10:11PM (#41001534)
Here is a doc explaining a Bayesian search algorithm; not sure if it's precisely what GP has in mind.

https://github.com/Ealdwulf/BBChop/blob/master/BBChop/doc/Ba...

(Edit- had wrong link originally)

Re:Hash-Based Bisect Debugging in Compilers and Runtimes by eru on Friday July 19, 2024 @07:47AM (#41005307)
Thanks!
Re:Hash-Based Bisect Debugging in Compilers and Runtimes by dwattttt on Friday July 19, 2024 @12:53AM (#41002093)
For Bayesian Inference, the example in the Wikipedia article is good (who doesn't like cookies?): https://en.m.wikipedia.org/wiki/Bayesian_inference#Examples

When gathering more evidence, you'd use your new belief about which cookie bowl Fred has as P(H1)=0.6 and P(H2)=0.4

Re:Hash-Based Bisect Debugging in Compilers and Runtimes by eru on Friday July 19, 2024 @03:08AM (#41002737)
That just explains Bayesian inference in general, which is useful, but not what I'm after.

I was specifically interested in the application to binary search / bisection in the presence of flaky tests.

Re:Hash-Based Bisect Debugging in Compilers and Runtimes by dwattttt on Friday July 19, 2024 @07:46PM (#41012666)
You apply the same process, but your hypotheses are "bug is before/after this bisection point". Your "probability of evidence given hypothesis before/after" are where you incorporate your guess about the tests flakiness. Still works even if you don't have "true" numbers for the tests flakiness, just won't converge as quickly
Re:Hash-Based Bisect Debugging in Compilers and Runtimes by efdb on Friday July 19, 2024 @05:37AM (#41004174)
J
Re:Hash-Based Bisect Debugging in Compilers and Runtimes by efdb on Friday July 19, 2024 @05:37AM (#41004175)
H
Re:Hash-Based Bisect Debugging in Compilers and Runtimes by jhfdbkofdchk on Friday July 19, 2024 @07:02AM (#41004888)
The Probabilistic Bisection Algorithm by Horstein, original paper is "Sequential transmission using noiseless feedback," IEEE Trans. Inform. Theory, 9(3):136–143. https://ieeexplore.ieee.org/document/1057832

Here's a nice presentation on an analysis of the method, references start on slide 47

https://people.orie.cornell.edu/pfrazier/Presentations/2014....

Paraphrasing the theorem from Jedynak, Frazier, Sznitman (2011):

Suppose [flake probability] is constant, known, and bounded away from 1/2, and we use the entropy loss function. ... The policy that chooses [next test point] at the median of [current posterior distribution] is optimal.

And some python code that implements a version of the analysis

https://github.com/choderalab/thresholds/blob/master/thresho...

Re:Hash-Based Bisect Debugging in Compilers and Runtimes by eru on Friday July 19, 2024 @07:47AM (#41005306)
Thanks!