展示HN:基于GPT-4.1和遗传编程的开源AlphaEvolve克隆版

3作者: Sai_Praneeth9 个月前原帖
每个人都看到了AlphaEvolve的热潮。我对它在后台是如何工作的产生了浓厚的兴趣,决定自己动手构建一个。<p>我的设置使用GPT-4.1来变异矩阵乘法代码,指导原则是一些手工设计的变异策略(循环重排、分块、Strassen算法等)。每个候选者都会在速度和准确性上进行评估。然后,我应用帕累托选择和拥挤距离来在几代中进化出更好的实现。<p>我遇到了所有常见的LLM奖励黑客——返回输入、调用np.dot等。因此,我强制使用原始实现,并严格限制变异空间。<p>经过一番挣扎(以及OpenAI的积分消失),我最终得到了一个能够从简单基线快速进化出正确实现的系统。<p>完整故事在这里(包括所有失败和设计黑客):<a href="https:&#x2F;&#x2F;saipraneeth.in&#x2F;ml&#x2F;building-evolve" rel="nofollow">https:&#x2F;&#x2F;saipraneeth.in&#x2F;ml&#x2F;building-evolve</a><p>代码是公开的。欢迎批评、分叉或尝试进化你自己的实现。<a href="https:&#x2F;&#x2F;github.com&#x2F;think-a-tron&#x2F;evolve">https:&#x2F;&#x2F;github.com&#x2F;think-a-tron&#x2F;evolve</a>
查看原文
Everyone saw the AlphaEvolve hype. I got obsessed with how it might work under the hood and decided to just build it myself.<p>My setup uses GPT-4.1 to mutate matrix multiplication code, guided by a bunch of hand-crafted mutation strategies (loop reordering, tiling, Strassen, etc.). Each candidate is evaluated on both speed and accuracy. Then I apply Pareto selection with crowding distance to evolve better ones over generations.<p>I ran into all the usual LLM reward hacks-returning the input, calling np.dot, etc. So I forced primitive-only implementations and tightly constrained the mutation space.<p>After some struggle (and OpenAI credits vanishing), I ended up with a system that can actually evolve fast, correct implementations starting from a naive baseline.<p>Full story here (with all the failures and design hacks): <a href="https:&#x2F;&#x2F;saipraneeth.in&#x2F;ml&#x2F;building-evolve" rel="nofollow">https:&#x2F;&#x2F;saipraneeth.in&#x2F;ml&#x2F;building-evolve</a><p>Code’s public. Roast it, fork it, or try evolving your own. <a href="https:&#x2F;&#x2F;github.com&#x2F;think-a-tron&#x2F;evolve">https:&#x2F;&#x2F;github.com&#x2F;think-a-tron&#x2F;evolve</a>