Multistep workflows that chain large language model (LLM) calls suffer from context pollution: as information accumulates across steps, models hallucinate, confuse intermediate outputs, and lose track of task constraints. We present NormCode, a semiformal language for constructing plans of inferences, structured decompositions where each step operates in data isolation and receives only explicitly passed inputs, which eliminates crossstep contamination by design. NormCode enforces a strict separation between semantic operations (LLMdriven reasoning, nondeterministic) and syntactic operations (deterministic data restructuring), enabling precise cost and reliability tracing. The language exists in three isomorphic formats: .ncds for human authoring, .ncd for machine execution, and .ncn for human verification, supporting progressive formalization from sketch to production. We validate NormCode through two demonstrations: (1) a base X addition algorithm achieving 100 percent accuracy on arbitrary length inputs, and (2) self hosted execution of NormCode's own five phase compiler pipeline. The working orchestrator provides dependency driven scheduling, SQLite backed checkpointing, and loop management, making AI workflows auditable by design and addressing a critical need for transparency in high stakes domains such as legal reasoning, medical decision making, and financial analysis.
翻译:串联大型语言模型(LLM)调用的多步工作流面临上下文污染问题:随着信息在步骤间累积,模型会产生幻觉、混淆中间输出并偏离任务约束。本文提出NormCode,一种用于构建推理计划的半形式化语言,其结构化分解机制使每个步骤在数据隔离环境中运行且仅接收显式传递的输入,从而通过设计消除跨步骤污染。NormCode严格分离语义操作(LLM驱动的非确定性推理)与句法操作(确定性数据重构),支持精确的成本与可靠性追踪。该语言以三种同构格式存在:用于人工编写的.ncds格式、用于机器执行的.ncd格式以及用于人工验证的.ncn格式,支持从草图到生产环境的渐进形式化。我们通过两个案例验证NormCode:(1)在任意长度输入上实现100%准确率的基数X加法算法;(2)NormCode自身五阶段编译器流水线的自主托管执行。该工作流编排器提供依赖驱动调度、SQLite支持的检查点机制及循环管理,使AI工作流具备可审计性设计,满足法律推理、医疗决策和金融分析等高风险领域对透明度的关键需求。