非确定性不重要
Non-Determinism Doesn't Matter

原始链接: https://sklar.rocks/non-determinism-doesnt-matter/

我曾将LLM的非确定性视为精确软件开发的缺陷。然而,我意识到虽然正确的结果至关重要,但到达它们的路径不需要确定性。LLM作为概率行为体运行,而非僵化的代码。就像选择编程语言来解决问题一样,许多路径都能通向同一个结果。工程师因此必须通过上下文工程、工具使用和结构化抽象来降低模型的随机性,从而使LLM调用确定性仪器进行精确计算。这使自动化复合:AI生成自己的可靠工具,随时间推移减少token使用和随机性。这一模式镜像了历史上的DevOps进步,机器加速了人类曾手动完成的工作。最终,我们利用今天的随机性来构建更确定、更高效的系统。

该文章挑战了“LLM 非确定性使其不适合作为‘新编译器’”这一观点。它论证了确定性并非真正的界限——LLM 可以被设计为确定性的,而编译器也可能是非确定性的。真正的区别在于“抽象的漏洞性”:编译器在仅凭理解语言时是不漏的,但依赖 auto-SIMD 等高级优化时会变得漏洞,需要变通方法。同样,LLM 只有在不需要人工审查的情况下能够生成无懈可击、可维护的代码时才是不漏的——但这目前尚未实现。对于复杂项目,开发者仍须阅读和调试 AI 输出,这使得 LLM 成为如今的漏洞抽象。核心问题不在于可预测性,而在于该工具是否能隐藏足够的复杂度,以实现在不需要深厚专业知识的情况下进行有效的开发。
相关文章

原文

One of my fundamental objections to LLM-driven software development was that model output is non-deterministic. Given the same input prompt, a model's output is not guaranteed to be identical on every run, at least under normal running conditions.

I used to think that this was a severe limitation of AI tools. How could we possibly use this unpredictable building block to craft systems that require precise and exact calculations?

But as I started to get more comfortable running AI as my primary means of "writing" code, I had a revelation:

While the result needs to be exact, there is not one correct way to get there. The means by which you obtain a correct result do not need to be deterministic!

Previously, I was used to specifying behavior in terms of code: precise sets of instructions that compile and execute in a predictable way. And mentally, I was treating LLM output like code. But over time, I realized that LLMs play a fundamentally different role than code does in software engineering. LLMs, and their respective harnesses, are actors in a system. Code is just an output.

It took me years to get comfortable with non-deterministic code generation, yet looking back on it, it seems so obvious that programming was always just a means to an end. Let's use languages, always a hot topic of debate amongst programmers, as an example. There are infinite ways to reach the same result as expressed by code, and that's only using a single programming language! There are hundreds of widely used languages out there, and it's possible to write a solution to a particular problem in just about any of them.

For years, developers have been building perfectly functional applications using very different piles of technologies, languages, and frameworks. Choosing one tech stack over another may have made it easier for a human to complete a given task. But clearly, the means of getting to that result could be wildly different across implementations.

Now that we're working with probabilistic actors, it's our job as engineers, or managers (depending on how you look at it), to reduce the probability space to a small, useful area. This is where all of the common LLM tricks come into play: context engineering, MCP, skills, harnesses, graphs, and memories are all tools used to reduce the amount of randomness in model output. But randomness in some form will always be there, which is at odds with the fact that there is still a need for the correct answer, especially when working on mission-critical software.

So let's remove more randomness by turning non-deterministic output into deterministic tools, writing software for agents to use. Agents can call these tools to perform precise, tested, and authorized operations that have the same desired result on every execution. As an added bonus, depending on the tool's complexity, we get the same correct outcome using significantly fewer tokens by calling our new agent-built abstractions.

I've seen this pattern develop both in industry, with tools like https://swamp.club, and in my own work managing production-grade infrastructure. This pattern is the modern incarnation of the compounding automation that drew me into DevOps and software development in the first place. But instead of writing our own tools, we can now use AI to create its own abstractions and instruct it to use them as it builds the foundations of our new agentic software systems.

I find it fascinating that we can harness randomness today in a way that reduces randomness in the future. In the end, it's not much different from writing your own automations on top of earlier abstractions. It's just that the machine is calling them, processing output, and taking action faster than humans ever could.

联系我们 contact @ memedata.com