logoalt Hacker News

Show HN: An agent skill that optimizes code with falsifiable hypotheses

92 points • by 0x23 • last Monday at 2:02 PM • 10 comments • view on HN

Hi all, I am a professor in algorithm engineering. In our field we use a method of falsifiable hypothesis testing to improve algorithms. More precisely, this is a cycle consisting of designing an algorithm, analyzing the algorithm, then implementing it and lastly testing it using experiments on real-world instances which leads to designing new algorithms based on the current observations.

We put this methodology into an AI skill which runs in an infinite loop. This skill first creates a performance profile, then produces a hypothesis which is implemented and tested automatically using an AI agent. If the change improved the performance and tests negotiated with the user verify it, the change is kept, if not it is discarded. Everything is tracked via version control.

Part of the output is a pdf report which documents all the code changes and progress over time as well as individual patches to only merge specific patches if one chooses to do so. Moreover, this comes with a knowledge-base in which we collect global optimization knowledge, thereby improving the skill over time.

We ran this on a wide range of public code bases, e.g. our KaHIP graph partitioning toolkit, which improved running time by 3.9x, or our VieCut minimum cut solver, where the skill improved the running time of the system by 8.9x; I do believe the skill is very easy to use and hence am sharing this here. Let me know what you think!


Comments

tomcatfish • yesterday at 9:13 PM

The example report is a good demo:

https://github.com/CHSZLab/AgenticAlgorithmEngineering/blob/...

➕ show 1 reply
tikimcfee • yesterday at 8:26 PM

Looking forward to passing this to my little fleet of specialists. Anything that helps to articulate the process of optimization through rigor is alright with me.

octoberfranklin • yesterday at 11:39 PM

Most of these "falsifiable hypotheses" implicitly mean "for all inputs" -- or they would, if stated formally. This is a $\Pi_1$ condition, which is not in fact falsifiable by executing the code -- you'd need to execute it for infinitely many inputs!

Presumably you're stochastically approximating the real goal hypothesis. You should be more forthright about this; your AI-generated page really sweeps it under the rug.

➕ show 1 reply
emilss • yesterday at 9:00 PM

cool stuff, can try it with GPU porting to tinygrad

➕ show 1 reply
perching_aix • yesterday at 9:43 PM

I've been doing a lowbrow version of this for a while, where during the reviewing of AI generated changes, I'd ask for a justifications / "concern-addressed" based tabulation of the changes proposed.

This allows me to steamroll overengineered parts, or identify assumptions that are not actually practical or rooted in reality. To an extent, this can indeed be automated by just putting the agents in a loop as described, especially if the reviewer agent is from a different provider. Nice to see someone do a proper version of this.

vibenow • today at 1:44 AM

[flagged]

Wiyseful • today at 3:30 AM

optimizing yourself away heck yeeee

prince_alex • yesterday at 9:17 PM

the author is optimizing himself away a great man

cutiesoulmate • yesterday at 4:23 PM

[flagged]