Saved in:
Bibliographic Details
Main Authors: Zhang, Ziyang, Ding, Xinheng, Yuan, Jiayi, Liu, Rixin, Mao, Huizi, Xing, Jiarong, Liu, Zirui
Format: Preprint
Published: 2025
Subjects:
Online Access:https://arxiv.org/abs/2511.17826
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866917545646227456
author Zhang, Ziyang
Ding, Xinheng
Yuan, Jiayi
Liu, Rixin
Mao, Huizi
Xing, Jiarong
Liu, Zirui
author_facet Zhang, Ziyang
Ding, Xinheng
Yuan, Jiayi
Liu, Rixin
Mao, Huizi
Xing, Jiarong
Liu, Zirui
contents Deterministic inference is increasingly critical for large language model (LLM) applications such as LLM-as-a-judge evaluation, multi-agent systems, and Reinforcement Learning (RL). However, existing LLM serving frameworks exhibit non-deterministic behavior: identical inputs can yield different outputs when system configurations (e.g., tensor parallel (TP) size, batch size) vary, even under greedy decoding. This arises from the non-associativity of floating-point arithmetic and inconsistent reduction orders across GPUs. While prior work has addressed batch-size-related nondeterminism through batch-invariant kernels, determinism across different TP sizes remains an open problem, particularly in RL settings, where the training engine typically uses Fully Sharded Data Parallel (i.e., TP = 1) while the rollout engine relies on multi-GPU TP to maximize the inference throughput, creating a natural mismatch between the two. This precision mismatch problem may lead to suboptimal performance or even collapse for RL training. We identify and analyze the root causes of TP-induced inconsistency and propose Tree-Based Invariant Kernels (TBIK), a set of TP-invariant matrix multiplication and reduction primitives that guarantee bit-wise identical results regardless of TP size. Our key insight is to align intra- and inter-GPU reduction orders through a unified hierarchical binary tree structure. We implement these kernels in Triton and integrate them into vLLM and FSDP. Experiments confirm zero probability divergence and bit-wise reproducibility for deterministic inference across different TP sizes. Also, we achieve bit-wise identical results between vLLM and FSDP in RL training pipelines with different parallel strategy. Code is available at https://github.com/nanomaoli/llm_reproducibility.
format Preprint
id arxiv_https___arxiv_org_abs_2511_17826
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Deterministic Inference across Tensor Parallel Sizes That Eliminates Training-Inference Mismatch
Zhang, Ziyang
Ding, Xinheng
Yuan, Jiayi
Liu, Rixin
Mao, Huizi
Xing, Jiarong
Liu, Zirui
Machine Learning
Computation and Language
Deterministic inference is increasingly critical for large language model (LLM) applications such as LLM-as-a-judge evaluation, multi-agent systems, and Reinforcement Learning (RL). However, existing LLM serving frameworks exhibit non-deterministic behavior: identical inputs can yield different outputs when system configurations (e.g., tensor parallel (TP) size, batch size) vary, even under greedy decoding. This arises from the non-associativity of floating-point arithmetic and inconsistent reduction orders across GPUs. While prior work has addressed batch-size-related nondeterminism through batch-invariant kernels, determinism across different TP sizes remains an open problem, particularly in RL settings, where the training engine typically uses Fully Sharded Data Parallel (i.e., TP = 1) while the rollout engine relies on multi-GPU TP to maximize the inference throughput, creating a natural mismatch between the two. This precision mismatch problem may lead to suboptimal performance or even collapse for RL training. We identify and analyze the root causes of TP-induced inconsistency and propose Tree-Based Invariant Kernels (TBIK), a set of TP-invariant matrix multiplication and reduction primitives that guarantee bit-wise identical results regardless of TP size. Our key insight is to align intra- and inter-GPU reduction orders through a unified hierarchical binary tree structure. We implement these kernels in Triton and integrate them into vLLM and FSDP. Experiments confirm zero probability divergence and bit-wise reproducibility for deterministic inference across different TP sizes. Also, we achieve bit-wise identical results between vLLM and FSDP in RL training pipelines with different parallel strategy. Code is available at https://github.com/nanomaoli/llm_reproducibility.
title Deterministic Inference across Tensor Parallel Sizes That Eliminates Training-Inference Mismatch
topic Machine Learning
Computation and Language
url https://arxiv.org/abs/2511.17826