# Deterministic Inference across Tensor Parallel Sizes That Eliminates Training-Inference Mismatch

Source: [Deterministic Inference across Tensor Parallel Sizes That Eliminates Training-Inference Mismatch](<https://www.sota2.com/research/paper/6925384cd6b0dd334292f66c>)

Collection index: [llms.txt](<https://www.sota2.com/research/llms.txt>)

Data updated: 2026-06-02T05:00:05.013Z

Authors: Ziyang Zhang, Xinheng Ding, Jiayi Yuan, Rixin Liu, Huizi Mao, Jiarong Xing, Zirui Liu

Published: 2025-11-21T22:40:00.000Z

## Abstract

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.

## Recorded benchmark results

A research result applies to its stated dataset, split, metric and evaluation configuration. Compare like-for-like settings, preserve the metric's unit and direction, and distinguish paper-reported results from independent reproduction. The best result recorded here is not a claim of exhaustive, current global coverage.

- [Deterministic Inference Evaluation on AIME'24](<https://www.sota2.com/research/sota/deterministic-inference-evaluation-on-aime-24.md>): Deterministic Inference Evaluation; AIME 24; Avg Max Probability Divergence: 0.

- [Deterministic Inference Evaluation on AMC'23](<https://www.sota2.com/research/sota/deterministic-inference-evaluation-on-amc-23.md>): Deterministic Inference Evaluation; AMC 23; Avg Max Probability Divergence: 0.

- [Mathematical Reasoning on AIME24 (Average Count of Unique Outputs)](<https://www.sota2.com/research/sota/mathematical-reasoning-on-aime24-average-count-of-unique-outputs.md>): Mathematical Reasoning; AIME24; Average Unique Outputs Count: 1.

- [Mathematical Reasoning on AMC23 (Average Count of Unique Outputs)](<https://www.sota2.com/research/sota/mathematical-reasoning-on-amc23-average-count-of-unique-outputs.md>): Mathematical Reasoning; AMC23; Average Count of Unique Outputs: 1.

## Original sources and implementation

[Original paper](<https://arxiv.org/abs/2511.17826>)

[PDF](<https://arxiv.org/pdf/2511.17826.pdf>)
