LLM-42: 通过验证推测实现LLM推理的确定性
LLM-42: Enabling Determinism in LLM Inference with Verified Speculation
AI总结:
LLM-42通过验证推测方法,在LLM推理中实现确定性,利用形状一致的减少和轻量级验证-回滚循环,减少确定性需求的开销。
摘要:
在LLM推理中,相同提示在不同运行中可能产生不同输出。从系统层面看,这种非确定性源于浮点数非结合性与动态分批和GPU内核的减少顺序随批次大小变化相结合。消除非确定性的一种直接方法是禁用动态分批,但这样做会严重降低吞吐量。另一种方法是使内核批处理不变,但这种方法将确定性紧密耦合到内核设计,需要新的实现。这种耦合也导致固定的运行时开销,无论实际工作负载需要多少确定性。受推测解码思想的启发,我们提出了LLM-42,一种基于调度的方法,用于在LLM推理中实现确定性。我们的关键观察是,如果序列处于一致状态,下一个发出的标记即使在动态分批下也可能是一致的。此外,大多数GPU内核使用形状一致的减少。利用这些见解,LLM-42使用非确定性的快速路径解码标记,并通过轻量级的验证-回滚循环强制确定性。验证器在固定形状减少调度下回放候选标记,提交那些在不同运行中保证一致的标记,并回滚那些违反确定性的标记。LLM-42大部分重用现有的内核不变,并且只有在需要确定性的流量比例内才会产生开销。
英文摘要:
In LLM inference, the same prompt may yield different outputs across different runs. At the system level, this non-determinism arises from floating-point non-associativity combined with dynamic batching and GPU kernels whose reduction orders vary with batch size. A straightforward way to eliminate non-determinism is to disable dynamic batching during inference, but doing so severely degrades throughput. Another approach is to make kernels batch-invariant; however, this tightly couples determinism to kernel design, requiring new implementations. This coupling also imposes fixed runtime overheads, regardless of how much of the workload actually requires determinism. Inspired by ideas from speculative decoding, we present LLM-42, a scheduling-based approach to enable determinism in LLM inference. Our key observation is that if a sequence is in a consistent state, the next emitted token is likely to be consistent even with dynamic batching. Moreover, most GPU kernels use shape-consistent reductions. Leveraging these insights, LLM-42 decodes tokens using a non-deterministic fast path and enforces determinism via a lightweight verify-rollback loop. The verifier replays candidate tokens under a fixed-shape reduction schedule, commits those that are guaranteed to be consistent across runs, and rolls back those violating determinism. LLM-42 mostly re-uses existing kernels unchanged and incurs overhead only in proportion to the traffic that requires determinism.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。