God Does Not Play Dice: Enforcing Batch Invariance in Agentic Kernel Generation

📄 arXiv: 2610.36623v1 📥 PDF

作者: Youwei Bao, Chengpeng Wang, Simin Chen

分类: cs.AI, cs.LG, cs.SE

发布日期: 2026-10-27


💡 一句话要点

提出 ool以解决GPU内核生成中的批次不变性问题

🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)

关键词: 批次不变性 GPU内核生成 动态验证 静态分析 大型语言模型

📋 核心要点

  1. 现有的GPU内核生成方法未能考虑批次不变性,导致相同输入在不同上下文中产生不同输出,影响可重复性。
  2. 本文提出 ool,通过结合静态依赖分析和动态位一致性验证,确保内核生成的批次不变性,同时保留原有优化能力。
  3. 实验结果显示, ool在三个代理框架下的BI通过率从67.6%提升至91.9%,并保持了91.8%的基线加速效果。

📝 摘要(中文)

大型语言模型(LLM)服务系统动态批处理用户请求,导致相同请求在不同运行中可能与不同请求一起处理。如果GPU内核缺乏批次不变性(BI),则在不变输入的情况下,变化的批次上下文可能会改变数值输出,从而影响可重复性。现有内核生成代理关注正确性和效率,但忽视了BI。我们发现83个可批处理的发布工件中有19个确认的BI违规。为了解决这一限制,我们提出了 ool,它结合了基于合同的静态依赖分析与动态验证位一致性。实验表明, ool将BI通过率从67.6%提高到91.9%,同时保留了91.8%的基线几何平均加速。

🔬 方法详解

问题定义:本文旨在解决GPU内核生成中的批次不变性(BI)问题。现有方法在处理动态批处理请求时,未能保证相同输入在不同上下文中的输出一致性,导致可重复性问题。

核心思路:论文提出 ool,结合合同指导的静态依赖分析与动态验证,确保在不同批次上下文中内核生成的输出保持一致。通过这种设计, ool能够在不牺牲性能的情况下增强内核生成的可靠性。

技术框架: ool作为插件组件集成于现有内核代理中,主要包括合同指导的静态分析模块和动态验证模块。优化循环中引入连续接受门,拒绝结构上风险或动态不变的候选,确保最终输出的可靠性。

关键创新: ool的核心创新在于将静态分析与动态验证相结合,形成了一种新的内核生成策略。这一方法与现有方法的本质区别在于,它不仅关注性能和正确性,还引入了批次不变性的约束。

关键设计:在设计中, ool使用了合同指导的静态分析来识别潜在的BI违规,并通过动态验证确保在不同批次上下文中的位一致性。具体参数设置和损失函数的选择旨在最大化BI通过率,同时保持优化性能。

🖼️ 关键图片

fig_0
fig_1
fig_2

📊 实验亮点

实验结果表明, ool显著提高了BI通过率,从67.6%提升至91.9%,同时保持了91.8%的基线几何平均加速。这一成果展示了 ool在内核优化中的有效性,能够作为可靠性目标与正确性和速度并行优化。

🎯 应用场景

ool的研究成果在大型语言模型服务系统中具有广泛的应用潜力,尤其是在需要高可重复性和高性能的场景中。通过确保内核生成的批次不变性, ool能够提升系统的可靠性,减少调试和维护成本,未来可能在更多AI服务和计算密集型应用中得到推广。

📄 摘要(原文)

Large language model (LLM) serving systems dynamically batch user requests for GPU execution, so the same request may be processed alongside different requests across runs. If the GPU kernels lack batch invariance (BI), this changing batch context can alter the numerical output for an unchanged input, undermining reproducibility. Existing kernel generation agents focus on correctness and efficiency but \emph{overlook BI}. We find 19 confirmed BI violations among 83 batch-applicable released artifacts. To address this limitation, we propose \tool, which combines contract-guided static dependency analysis with dynamic validation of bitwise consistency across batch contexts. \tool is designed as a plug-in component for general kernel agents, allowing their original optimization capabilities to be reused while adding BI enforcement. We integrate it as successive acceptance gates in the optimization loop, rejecting structurally risky or dynamically non-invariant candidates before performance benchmarking and returning feedback to the agent. Experiments across three agent frameworks under baseline and BI-aware generation on real world LLM serving tasks show that \tool improves the BI pass rate from 67.6\% to 91.9\% while retaining 91.8\% of the baseline geometric mean speedup. These results demonstrate that \tool can be incorporated into kernel optimization by agents as an additional reliability objective alongside correctness and speed.