Answers from the documentation; checking which model is on duty
Hi - I answer from the OpenSmartRoute documentation: routing, the API, plans and quotas, self-hosting. Ask away, or open a support ticket if you need a person.
Grounded in the docs - follow a source before acting on it.
Stable On-Policy Reinforcement Learning on TPU with Bitwise Zero-Train - OpenSmartRoute
Stable On-Policy Reinforcement Learning on TPU with Bitwise Zero-Train–Inference Match
Google developed a method to make reinforcement learning on TPU more stable by ensuring identical numerical results during sampling and training.
Key points
Verified on 64 TPU v5p chips across multi-host setups.
Uses a four-part recipe to align sampler and trainer computations.
Achieves bitwise-identical log probabilities for actions.
Reduces off-policy drift in large-scale RL training.
Why it matters: Ensuring numerical stability improves training consistency, reduces errors, and enhances the reliability of large language model reinforcement learning.
By OpenSmartRoute editorial · written through the router by llm-small
From Google AI developers blog - “Unlocking Stable On-Policy RL on TPU with Bitwise-Zero Train–Inference Mismatch”
Introduction - what was announced and why it matters
Google AI researchers announced a new method to make reinforcement learning (RL) on Tensor Processing Units (TPUs) more stable. This method ensures that the numerical results during sampling and training are exactly the same. It matters because small numerical differences can cause RL training to become unstable or stop working properly. Stable RL training allows models to learn more reliably and efficiently, especially at large scale.
This development addresses a long-standing problem in large language model RL. When models are trained with RL, the process involves generating actions and evaluating them repeatedly. If the calculations differ even slightly between sampling and training, it can lead to errors or slow progress. The new approach guarantees that these calculations match perfectly, improving the quality and stability of RL training on TPUs.
The challenge of numerical instability in RL on TPU
Reinforcement learning involves a policy that decides what actions to take based on previous data. For large language models, this policy is the model itself, which predicts the next token or word. During training, the model generates sequences of tokens, and the RL process updates the model based on how well it performs.
On TPUs, RL training faces a problem called numerical instability. Tiny differences in calculations can cause the model to assign different probabilities to the same token. These differences happen because floating-point arithmetic, the way computers handle decimal numbers, is not always exact. When these small errors add up, they can destabilize the training process or make it less reliable.
In practice, the sampling process (which generates tokens) and the training process (which updates the model) run on separate code paths. Each path may handle calculations differently, leading to slight discrepancies. Even with the same model weights, the log probabilities assigned to tokens can differ. This mismatch creates a hidden off-policy gap, meaning the training no longer perfectly follows the sampling policy.
What is train–inference mismatch and why it matters
Google introduced Gemini 4 Hydrogen, a faster model for robotics that combines strong spatial reasoning with efficiency. It supports real-world robot control and simulation.
Train–inference mismatch occurs when the calculations during training differ from those during inference or sampling. In RL, the model's output probabilities guide learning. If these probabilities are not consistent, the model learns from data that does not match what it generates.
This mismatch is problematic because it can cause the model to learn from incorrect signals. It can also lead to instability, where the model's performance fluctuates or stalls. Ensuring that the same numerical results are produced during sampling and training is essential for on-policy RL, where the model learns from its own generated data.
In large-scale RL, this mismatch has become a major obstacle. Many recent efforts have focused on eliminating these differences to stabilize training. Achieving bitwise identical results means that the same floating-point calculations produce exactly the same bits, ensuring perfect alignment between sampling and training.
The Zero-TIM solution: how it closes the numerical gap
Google's solution, called Zero-TIM (Zero Train–Inference Mismatch), closes the numerical gap between sampling and training. It ensures that both processes produce exactly the same log probabilities for each token, down to the bit level. This is achieved by controlling how floating-point calculations are performed and combined.
Zero-TIM was developed in the Tunix library and verified on a large scale across 64 TPU v5p chips. It guarantees that the sampler and trainer assign identical log probabilities to the same actions, even when running on different hardware or code paths. This alignment makes RL training more stable and reliable on TPUs.
The key idea is to eliminate differences in how floating-point sums are computed. Floating-point addition is not associative, meaning the order of addition can change the result. Small differences in the order of operations can lead to different rounding outcomes, which causes the mismatch. Zero-TIM addresses this by standardizing the process.
Details of the four-part recipe for alignment
Zero-TIM uses a four-part recipe to achieve numerical alignment across separate sampling and training pipelines. Each part targets a specific source of discrepancy.
First, within each shard of the TPU, kernels are locked to control the order of accumulation. This prevents different reduction sequences from producing different results. Second, the order of cross-shard reductions is explicitly defined in the program, not left to collective implementation choices. This ensures consistency across multiple devices.
Third, the log probability scoring tail is standardized. All paths use the same fixed softmax construction, which prevents differences in the final probability calculation. Fourth, serving kernels are wrapped with custom differentiation rules. This allows the same forward calculations to be reused during training, with controlled backward passes that preserve numerical alignment.
These steps work together to make sure that every path—sampling, prefill, and training—produces bitwise-identical log probabilities for each token. This consistency is crucial for stable, on-policy RL training at large scale.
Implementation specifics: kernels, reduction order, and precision
Implementing Zero-TIM involves specific technical choices in how calculations are performed on TPUs. The core of the approach is to control the order of floating-point reductions and the precision used during intermediate steps.
Within each tensor-parallel rank, custom kernels called Pallas kernels manage accumulation order and intermediate precision. These kernels process data in fixed contraction order, ensuring that the sequence of operations is consistent. Partial sums are accumulated in float32, which has higher precision than bfloat16, and then cast to the final output type.
The kernels initialize a scratch accumulator before processing each tile of data. They then add each tile's partial results to this accumulator. By always starting from a float32 sum, the process avoids differences caused by rounding errors. This approach applies to attention calculations, multilayer perceptrons (MLPs), and the language model head.
For projections that run across multiple TPU devices, the partial results are transported separately from their addition. The addition occurs in a fixed order, ensuring the same result regardless of the number of devices or the shape of the data. This explicit control over reduction order prevents discrepancies in log probabilities.
Verification and benchmarking results on TPU
To verify the effectiveness of Zero-TIM, Google tested it on a synthetic environment called FrozenLake. They used a public checkpoint called Qwen3-8B to run 200-step numerical tests across 64 TPU v5p chips. The tests compared standard training, token importance sampling (TIS), and Zero-TIM.
Results showed that Zero-TIM produced zero difference in log probabilities between sampling and training at every step. This means the sampler and trainer always agreed exactly. In contrast, standard training and TIS showed non-zero differences, which could affect learning stability.
The tests also measured how well the models solved the environment. Zero-TIM achieved higher solve rates, indicating more stable and effective training. These benchmarks demonstrate that Zero-TIM can improve large-scale RL training by eliminating numerical discrepancies.
Impacts on large-scale RL training and stability
Eliminating train–inference mismatch has become a key goal in large-scale RL. When the numerical calculations are aligned, models can learn more reliably and converge faster. This stability is especially important for training large language models, which involve complex computations over long trajectories.
Using Zero-TIM, teams can run RL training on TPUs with confidence that the results are consistent and accurate. This reduces the risk of training instability or divergence. It also simplifies debugging and evaluation, since the same calculations are used during sampling and training.
As a result, large-scale RL systems become more predictable and easier to optimize. This can lead to better model quality, faster training times, and more efficient use of hardware resources. Zero-TIM sets a new standard for numerical stability in TPU-based RL training.
How OpenSmartRoute helps with deployment and integration
OpenSmartRoute is an open-source router for AI requests. It directs each request to the best-fit model, agent, or tool from a catalog defined by the team. It scores every candidate based on quality, cost, speed, and safety. The team can set the importance of each factor per request.
Using OpenSmartRoute, teams can ensure that models are used efficiently and safely. It can enforce rules, such as keeping personal data on on-premises models or respecting region and cost limits. The system learns from outcomes, giving more traffic to well-performing models and less to poor ones.
For large-scale RL training, OpenSmartRoute can help manage model deployment and request routing. It provides insights into costs and performance, making it easier to optimize training and inference workflows. Its ability to measure routing accuracy and enforce rules supports stable, reliable AI system operation.
How it compares - what existed before, what this changes and what stays the same
Before Zero-TIM, the sampler and trainer paths in RL training on TPUs often produced different log probabilities for the same actions. These differences came from floating-point rounding and inconsistent reduction orderings. This mismatch could destabilize training and reduce model quality.
Traditional RL stacks relied on separate execution paths for sampling and training. The sampler generated actions during inference, while the trainer evaluated those actions in batched forward passes. These paths used different code, shapes, and reduction methods. As a result, their log probabilities could differ at the bit level.
Zero-TIM changes this by enforcing bitwise-identical log probabilities across all paths. It aligns the reduction order, intermediate precision, and floating-point operations. This guarantees that sampling and training produce the same results, eliminating the hidden off-policy gap.
What stays the same is the overall structure of the RL stack. Teams can still run sampling and training separately. Zero-TIM does not require merging these into a single engine. Instead, it introduces precise control over floating-point reductions and ordering. This preserves flexibility while improving numerical stability.
Zero-TIM also retains the core principles of on-policy RL. The model still serves as the policy, and the training remains on-policy. The key difference is the numerical consistency, which ensures that the same actions and probabilities are used during rollout and evaluation.
In summary, Zero-TIM replaces the previous inconsistent reduction and rounding methods with a deterministic, bitwise-aligned approach. It improves stability without changing the fundamental RL workflow or requiring monolithic architectures.
Questions this leaves open - what the source does not say and how a reader can check it
The source does not specify the exact implementation details of the custom differentiation rules used to wrap serving kernels. It also does not describe how these rules are integrated into existing training pipelines or how they affect performance.
It remains unclear whether Zero-TIM introduces any additional computational overhead. The source mentions explicit control over reduction order and intermediate precision, but does not quantify the impact on training speed or memory usage. A reader can investigate this by benchmarking the modified kernels against standard ones in their own environment.
The article does not specify how widely applicable Zero-TIM is across different model architectures or RL algorithms. It focuses on language models and transformer-based architectures. To verify applicability, a reader could test the approach on their specific models or tasks, checking for numerical discrepancies and training stability.
Another open question is whether Zero-TIM can be integrated with other optimization techniques, such as mixed-precision training or model parallelism. The source hints at compatibility with tensor-parallel shards but does not detail how it interacts with other methods. Experimentation in different setups can clarify this.
The source also does not discuss potential limitations or failure modes of Zero-TIM. For example, whether certain model sizes or shapes might still produce minor discrepancies. Users can explore this by running controlled tests, comparing log probabilities across paths under various configurations.
Finally, the long-term effects of enforcing bitwise consistency on model convergence and generalization are not addressed. While initial benchmarks show improved stability, further analysis is needed to understand impacts on final model quality. Researchers can perform ablation studies to assess these effects.
In conclusion, while Zero-TIM offers a robust solution to numerical mismatch, some implementation details, performance considerations, and broader applicability remain to be explored. Practical testing and benchmarking are recommended for teams considering adoption.
Google's new open-source guide details how to design and optimize models for TPU hardware, focusing on shape alignment, architecture choices, and parallelism.