AI的未来是Ruby on Rails。
The future of AI is Ruby on Rails

原始链接: https://www.seangoedecke.com/ai-and-ruby/#fnref-1

大型语言模型 (LLM) 擅长代码生成,但由于上下文窗口的限制,在大规模代码库中的有效性会降低。虽然编辑器内的代码补全仍然很有价值,但人工智能辅助编程的“力量”在于用更少的 token 来表达功能。与 Golang 相比,Python 更适合 LLM,因为 Golang 比较冗长。压缩代码并不理想,因为 LLM 需要可读的名称。 理想的语言需要在 token 效率和可读性之间取得平衡,优先考虑开发者的幸福感。Ruby,凭借其对简洁表达的关注,非常符合这一标准,尤其是在 Ruby on Rails 框架下。虽然 Ruby on Rails 可能存在其他问题,但它擅长将功能压缩到较小的代码量中,这对于 LLM 来说非常理想。使用类型语言也有好处,可以弥补 LLM 的一个主要弱点,即缺乏像人类一样测试代码的能力。尽管如此,JavaScript 和 Python 也是不错的选择,因为 LLM 通常是用它们训练的。

Hacker News 最新 | 过去 | 评论 | 提问 | 展示 | 招聘 | 提交 登录 人工智能的未来是 Ruby on Rails (seangoedecke.com) daviducolo 3小时前 8 分 | 隐藏 | 过去 | 收藏 | 3 评论 fxtentacle 1分钟前 | 下一条 [–] ……因为作者认为 Ruby 和 Rails 是一种非常简洁的语言。然后理论是,更少的标记占用注意力窗口中的更少空间。 回复 danielbln 8分钟前 | 上一条 | 下一条 [–] https://news.ycombinator.com/item?id=43422994 回复 lifthrasiir 9分钟前 | 上一条 [–] 按照这种逻辑,人工智能的未来是高尔夫语言。 回复 加入我们,参加 6 月 16-17 日在旧金山举办的人工智能创业学校! 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 申请 YC | 联系我们 搜索:

原文

Large language models are very good at generating and editing code. Right now, it’s probably the “killer app” of AI: the companies actually making money from language models - like GitHub Copilot, Cursor, Windsurf - are all doing code generation.

This works astonishingly well at small scale, but there’s an obvious problem when the codebase grows larger. Tools that write the code for you will hit a wall once the codebase can’t fit inside the model context. Changes suddenly stop working, and attempts to fix it just create more bugs elsewhere. Even models that advertise large context windows don’t necessarily have large effective context windows. The more you put in the context, the dumber the LLM gets. This is why in-editor completions are still the gold standard for AI-assisted programming. It leans into the model’s strengths at being surprisingly good at small-scale changes.

Paul Graham has a famous blog post where he talks about how some programming languages are more powerful than others. By power he means something like having more fundamental language features (e.g. recursion, macros), and thus the ability to do things that other languages simply cannot do (or at least can’t do without writing a lot more laborious code).

With that in mind, I think this is a good proxy for AI-assisted programming power: how many tokens does it take to express a program that does X?

Here’s a simple example. If you want to ask a LLM to build a blogging webapp, should you pick Python or Golang? (Forget that Golang is likely to be more performant, and just think about which choice is more likely to get you a working app). I think it’s obvious you should pick Python. Golang has much more boilerplate - error handling, iterating over collections - which means that you’re going to hit the token limit much more quickly. Your Python app will fit in fewer tokens, so you can add more features before you reach that point.

Golang is easier for humans than LLMs, because all of Golang’s extra tokens can be more-or-less safely ignored by a human programmer. You can skim over the if err != nil or for loops. A LLM can’t skim in the same way: a token takes up space in its context window, whether it’s boilerplate or not. Should a LLM write minified code, then, to take up as little space as possible? I don’t think so - it still needs expressive variable names, for the same reason a human would. The ideal language for LLMs is thus a language that uses as few tokens as possible per-feature, while still being readable. In other words, a language designed from the ground up for developer happiness.

That’s Ruby! The entire point of the language is that you should be able to express your program as briefly and elegantly as possible, even if it costs more CPU cycles to run. Ruby on Rails has its own problems - to put it mildly - but the thing it does well is fitting a lot of features into a small amount of code. That’s exactly what LLMs need.

Should we be doing all our vibe coding in Ruby on Rails? Maybe not yet. I do think using a typed language is a good idea, so that one of the big gaps of LLMs - their inability to test their own code like a human would - can be covered by the typechecker. There’s also a good argument for sticking with Javascript and Python, because of their outsized presence in the LLM training data.

Still, it’s an intriguing thought. Ruby is the most “human” language I know: written for humans, with interesting human foibles, reads like human language, and so on. It would be pretty ironic if it also turned out to be the language of the robots.

联系我们 contact @ memedata.com