提出内核契约框架,约束训练与推理的数值差异。
Training-Inference Kernel Contracts: Bounding Divergence in Post-Training and Deployment
- 用契约定义训练与推理内核的可接受偏差范围。
- 推导出从对数偏移到奖励漂移的严格边界。
- 适合关注模型部署可靠性的研发人员使用。
现代后训练流程中,策略函数 pi_theta 在训练时使用优化自动微分的内核(K_train),而在推理时则采用低精度、融合计算、动态批处理的内核(K_inf)。在有限精度下,这两个内核在相同权重下可能产生不同的分布,其差距集中在基准测试中代表性不足的片段上。本文提出内核契约:一种以契约为核心的框架,用于定义 K_train 与 K_inf 之间可接受的偏差。契约 C = (N, S, R, O, Pi) 结合数值、统计、运行时和可观测性条款,以及违规后的升级策略。我们从对数偏移推导出到总变差距离,再到受控奖励漂移的一系列边界,并将其应用于强化学习后训练场景,其中每标记的重要性比率漂移可导出在显式支持与范数假设下的策略梯度偏差界。此外,我们描述了四阶段上线流水线、在线路由循环及最小化 YAML DSL 的契约文件格式。本文为框架与术语论文,未报告生产规模实证验证。
原文摘要 · Abstract (English)
A modern post-training pipeline often writes one symbol for its policy, pi_theta, while evaluating it through two different programs: a training kernel optimized for autograd and an inference kernel optimized for low-precision, fused, dynamically batched serving. In finite precision, these kernels can induce different distributions at identical weights, with the gap concentrated on slices that aggregate benchmarks under-represent. This paper proposes kernel contracts: a contract-first framework for specifying acceptable divergence between K_train and K_inf. A contract C = (N, S, R, O, Pi) combines numerical, statistical, runtime, and observability clauses with an escalation policy from violations to routing actions. We derive a chain of bounds from logit drift to total-variation distance to bounded reward drift, and specialize it to RL post-training, where per-token importance-ratio drift yields a bound on policy-gradient bias under explicit support and norm assumptions. We also describe a four-stage promotion pipeline, online routing loop, and minimal YAML DSL for contract artifacts. This is a framework and vocabulary paper; we do not report production-scale empirical validation.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。