您应该生成哪种类型的代码来使用人工智能?
我(和很多人)一直在思考“使用人工智能做什么任务是最好的”。我个人使用的框架是,当以下情况出现时,你应该使用人工智能生成代码:
1. 代码是<i>容易验证</i>的
2. 人类理解它并不重要
我发现,人工智能生成的最佳内容是纯函数级别的东西(容易验证 + 理解实现并不一定重要,只要你理解接口)。我尝试过生成整个服务或应用程序,但这些往往违反了规则1——当“正确”并没有很好定义时,验证整个应用程序的行为是否“正确”是<i>困难</i>的——例如,是否存在内存泄漏,是否安全,是否能够被监控等等。
我对其他人在这个话题上的看法很感兴趣。使用人工智能完成的任务越大,节省的时间就越多,但生成的代码中出现灾难性错误的可能性也越大。遵循这些规则的一个副作用是,生产力提升并不显著——最多也就是20-30%。
我真的很想知道是否有人找到了一种在这里取得平衡的方法——在不失去正确性的情况下显著加快速度。
查看原文
I (and many people) have been thinking a lot about "what are the best tasks to do using AI."
My personal framework I've been using is, you should use AI to generate code when:
1. The code is <i>easy to validate</i>
2. It is not important that a human understands it<p>I find that the best thing to AI generate is something on the level of a pure function (easy to validate + not necessarily important to understand implementation as long as you understand the interface).
I've tried doing things like generating whole services or applications, but those often violate rule 1 - it's <i>hard</i> to validate an entire application behaves "correctly" when "correctly" isn't really well defined - i.e., are there memory leaks, is it secure, is it able to be monitored, etc.<p>I'm curious of others thoughts on this topic. The larger the task you complete using AI, the more time savings, but also the more likely that a catastrophic error exists in the generated code.
A side effect of following these rules is there is not that much of a productivity gain - maybe 20-30% at most.<p>I'm really interested if anyone has found a way to strike a balance here - significant speedup without losing correctness.