Dan Luu 写系统问题时,习惯先测量、再对照、最后才下结论。把「How does programming language affect token efficiency and correctness?」放到智能体、评测和线上系统里,真正要问的是:默认做法会不会系统性失败。下面用中文整理成可执行的工程笔记,去掉原站导航和无关链接。
Zstd
This somewhat widely cited post (I keep seeing it cited, anyway) suggests that dynamic languages and/or languages that represent things more concisely are more token efficient. It seems to be cited enough that LLM search results agree. For example, when I searched for "dynamic vs static language token cost" (no quotes), Google's AI summary opened with
Dynamically typed languages generally have a lower LLM token cost than traditional statically typed languages because omitting explicit type declarations makes the code more compact.
Pandoc
Google's AI cited the same post, which suggests that some concise dynamic languages have maybe 1/2 to 1/3 the token cost of static languages like Rust, Go, C++, etc. The author says
There was a very meaningful gap of 2.6x between C (the least token efficient language I compared) and Clojure (the most efficient).
What does it all mean?
It dominates at just 70 tokens average, nearly half of Clojure (109 tokens). Array languages can be extremely token-efficient when they avoid exotic symbol sets. If token efficiency turns out to be a key driver, this is perhaps a very interesting way for languages to evolve.
The other dynamic vs. static language token comparison I've found floating around is this one , which supports the same conclusion. If you want to treat this as part 8 of this series of exercises on benchmarking, evals, and experimental design , you can click through to the links and think about eval issues before reading further.
Appendix: selected issues in ai-coding-lang-bench
Without running our own eval, one problem the first experiment has is that the problems are trivial, which we can see from quote above; a problem that can be solved in 70 tokens in J and 109 in Clojure isn't much of a problem at all (the author used Rosetta Code). As we saw when we looked at other evals of caveman mode vs. our own evals , you can get very different results from trivial problems where most of the work is in printing out an answer vs. slight
The issues in the second link are a little more subtle, so we'll defer most of them to an appendix, but they include issues like one of the tests executing the wrong path (which doesn't exist), causing a test to fail. One of the later agents then symlinks the non-existent path to its own executable, which works for that case, but also causes every later test to run that one agent's executable instead of the correct executable. The author tries to draw conc
Appendix: medium in a loop vs. ultra
Instead of relying on these evals, we can try running some of our own evals. As we can see from these evals as well as the evals discussed in our last exercises on evals , it's very easy to make an eval that doesn't say what the creator of the eval seems to think it's saying. No doubt these evals will not be an exception to this and will be flawed (see appendix below for more details).
As a way to build my intuition about things, I like to pre-register guesses before looking at results 1 . Some things I pre-registered with friends were:
Appendix: Guards of Atlantis 2
For the first eval, I tried giving agents the zstd RFC (plus errata) and telling them to implement a complete zstd decoder (agents are stuck in a container without internet access). The tests were not given to agents. For something with the surface area of zstd, it's not really reasonable to expect that the tests cover every possible case. For example, even though zstd is a fairly well-tested piece of software, I once found a data corruption bug in zstd .
Below, the x-axis is cost and the y-axis is correctness score (up and to the left is better / down and to the right is worse); average result on medium and ultra efforts with GPT-5.6 Sol. If we only look at medium (and ignore the fact that results often wildly differ on different tasks), we might come to a conclusion like the Alderson evaluation, that dynamic languages are more efficient and better when using LLMs because (ignoring relatively obscure langu
值得单独记下的观察
- High confidence (95%): the overall dynamic vs. static language claim won't hold For reasons stated above: this feels analogous to the caveman eval, where the result will, at best, get diluted as the problem gets larger
- Languages with a lot of bad code out there (e.g., PHP) will perform worse Appears to be false on these tasks
- Because it's so easy to re-write now, you should use a powerful language (like Haskell) Appears to be false on these tasks
- You should use a popular language There's weak support for this statement
- High confidence (95%): the overall dynamic vs. static language claim won't hold This seems correct
- Low confidence (60%): static languages will be somewhat better than dynamic at ultra effort There's not enough information to determine this conclusively, but if we had to make a binary correct/incorrect call, I would ca
- High confidence (98%): the "weird" language supremacy of something like J won't hold This seems correct
- You could maybe say this is 50% + epsilon since my mind went to framing it this way and not the other way around, but I would say extremely low confidence here at best
落地时建议先做的 5 件事
- 用自己的真实负载测,而不是只用公开榜或厂商数字。
- 把评测设计成能抓到失败模式:平均分好看但尾部崩溃,仍然算失败。
- 智能体默认不会好好用测试;要写进流程,而不是写在口头规范里。
- 性能和正确性都要有基线,改模型或改语言前后必须能对比。
- 结论写成可回滚的决策:哪一版配置、哪一版评测集、谁签字。
和智能体产品怎么接
龙虾PRO做 OpenClaw 落地时,同样吃「先测量再扩面」这条纪律:技能、数字员工和网关都要有可复现评测,而不是只看一次演示通过。
本文侧重全链路风控方法论。落地时请用自身业务单据做回放验证,不要把示例阈值直接当生产策略。 相关:风控体检 · 方案资源
常见问题 FAQ
什么是AI智能系统?
「AI智能系统」可概括为:This somewhat widely cited post (I keep seeing it cited, anyway) suggests that dynamic languages and/or languages that represent things more concisely are more token efficient. It 本文从定义、方法与实践要点展开说明。
为什么要关注AI智能系统?
关注AI智能系统,是因为它直接影响效率、风险与可复制性。文中指出:This somewhat widely cited post (I keep seeing it cited, anyway) suggests that dynamic languages and/or languages that represent things more concisely are more token efficient. It seems to be cited enough that LLM search results agree. For exampl…
如何落地AI智能系统?有哪些关键步骤?
建议按以下路径推进AI智能系统:1) Languages with a lot of bad code out there (e.g., PHP) will perform worse Appea…;2) Because it's so easy to re-write now, you should use a powerful language (…;3) You should use a popular language There's weak support for this statement;4) High confidence (95%): the overall dynamic vs. sta…
AI智能系统适合哪些人或团队?
AI智能系统更适合:产品/技术负责人、运营与增长团队、需要落地智能体或自动化的中小团队、关注「AI智能系统」方向的读者。若你只需要单次聊天式问答,可先读概念;若要上生产,请重点看步骤、权限与风控相关段落。
关于「Zstd」,本文给出了什么结论?
在「Zstd」部分,要点是:eems to be cited enough that LLM search results agree. For example, when I searched for "dynamic vs static language token cost" (no quotes), Google's AI summary opened with Dynamically typed languages generally have a lo
关于「Pandoc」,本文给出了什么结论?
在「Pandoc」部分,要点是:There was a very meaningful gap of 2.6x between C (the least token efficient language I compared) and Clojure (the most efficient). What does it all mean? It dominates at just 70 tokens average, nearly half of Clojure (