Show HN: An agent skill that optimizes code with falsifiable hypotheses (chszlab.github.io)

56 points by 0x23 2 days ago

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!

tomcatfish 2 hours ago

0x23 an hour ago

Thanks!

tikimcfee 3 hours ago

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.

emilss 2 hours ago

cool stuff, can try it with GPU porting to tinygrad

0x23 an hour ago

If you could contribute that to the knowledge-base, would be greatly appreciated!

perching_aix an hour ago

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 down 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.

prince_alex 2 hours ago

the author is optimizing himself away a great man