Back

有人用 LLM 用 ...

有人用 LLM 用 Rust 重写了 SQLite。576,000 行代码,能编译,能通过测试,README 写得漂漂亮亮。但做一个最基础的主键查询——比 SQLite 慢 20,171 倍。

为什么?不是语法错误。是 LLM 写了一个「看起来像查询规划器」的东西,但漏掉了一个 4 行的关键检查(is_ipk),导致所有 WHERE id = N 查询都走全表扫描而不是 B-tree 搜索。这个检查之所以存在于 SQLite 里,是因为 Richard Hipp 20 年前 profiling 真实负载时发现了这个瓶颈。

作者把这叫做 LLM 的根本失败模式:不是写错代码,而是写出「看起来正确」的代码。

No comments yet

Leave a comment

About me

I live in Tasmania, an island a little far from the rest of the world and very close to the sea.
Father of two little girls, have two puppies.

Work

Work in IT industry, AI is my working partner.