Standard logs
Expand ↗The symptom and a configuration clue.
Step 16 · rank 0
run1: loss 0.0467894077
grad_norm 0.00197029114
run2: loss 0.0467894077
grad_norm 0.00204745238
overlap_comm: False / True
ZeRO stage: 1 / 1
…
OpGuard
Give your coding agent two training runs. OpGuard finds where their computations diverge and provides the tensor comparisons, call stacks and source your agent needs to investigate why.
Works with coding agents that can run shell commands · Open source · Apache-2.0
Install OpGuard where you train and its harness where your agent runs. Then describe the two runs you want to compare.
Install two packages, each in the environment where it runs.
# Training environment · Linux
python -m pip install "setuptools>=77.0.3" "packaging>=24.2" wheel ninja
python -m pip install --no-build-isolation --no-binary=opguard opguard
# Agent environment
python -m pip install opguard-harness
Python 3.10+. The training environment needs CUDA-enabled PyTorch and CUDA/CUPTI development tools.
Installation guide ↗Use natural language in your coding agent, such as Codex or Claude Code.
Use OpGuard to investigate why these two training runs differ: ./run-a/train.py and ./run-b/train.py.
My training Python is /path/to/train-env/bin/python.
Read `opguard-harness tools` for the available tools, and explain your findings with evidence.
Replace the paths with your own. Include the launcher arguments and configuration each run needs.
Agent integration guide ↗A useful report connects the observed difference, a causal mechanism and a test.
A later write can reuse storage while the reduction stream is still reading an earlier bucket.
Check stream completion before buffer reuse, or add a completion dependency and compare the runs again.
all_norms.appendself.ipg_buffer[self.ipg_index]new_grad_tensor.copy_Expressions from the captured DeepSpeed source. Open a line to see its full context.
In this recorded case, the loss still matches when the gradient norm starts to differ. Compare the log clues with the operation-level evidence and source used to investigate the cause.
The symptom and a configuration clue.
Step 16 · rank 0
run1: loss 0.0467894077
grad_norm 0.00197029114
run2: loss 0.0467894077
grad_norm 0.00204745238
overlap_comm: False / True
ZeRO stage: 1 / 1
…
A specific difference to trace back through code.
First observed difference · rank 0 get_grad_norm_direct · None.append#2246 scalar input signatures: run1: [0, 1077945344, 0, 0] run2: [0, 1077804032, 0, 0] Unaligned operations before boundary: run1: 0 · run2: 33 …
A gradient buffer is overwritten on the default stream before its reduction on another stream finishes. Details ↗
This recorded example uses precomputed, reviewed explanations from the logs, trace and captured source. It illustrates an investigation; it is not a live agent run or an accuracy benchmark.
Deployed at ByteDance, OpGuard diagnosed kernel races, framework mismatches, and hardware-level corruptions that existing checks missed — including a five-day embedding backward race localized in under five minutes.
Production bug cases: manual root-cause time vs OpGuard (log scale). OpGuard stays at or under the 30-minute line.
Then inspect with the visualizer — tensor diffs, call stack, and source at the pivot.
No “golden baseline” required
Compare equivalent computation across stacks, configs, and commits — pick whatever reference run is available for the bug.
We had been chasing the wrong subsystem for almost a week. OpGuard showed the exact kernel in under fifteen minutes.
Without OpGuard, we would never have noticed that the drift originated in a single row race. The loss precision is too low and gives us no clue where to start.
Internal: text and VLM pre-training, post-training framework
Open source: Megatron-LM, DeepSpeed, GPT-Neox, veRL, etc.
Explore the original demo_case5 capture, a separate recording of the same DeepSpeed case. Start at an observed difference, compare tensor fingerprints, and open its call stack and source. This is the evidence your agent can query during an investigation.
Compare computations at tensor boundaries, then investigate where they first differ. We’re also expanding beyond bitwise toward more general, practical alignment.
Determinism control → preflight → guarded replay → offline alignment. Watch the build-up one step at a time.
OpGuard was presented at OSDI ’26 and is a Best Paper Award nominee. If you use OpGuard in your research or systems work, please cite the following paper.
@inproceedings{OpGuard2026OSDI,
author = {Zhou, Ziming and Zhao, Yinjie and Zhu, Hang and Wang, Wenxiao and Bai, Zhihao and Zhang, Yun and Wang, Shuguang and Lin, Haibin and Huang, Peng},
title = {{OpGuard}: Bitwise Alignment for Precise and General Debugging of Production {LLM} Training},
booktitle = {Proceedings of the 20th USENIX Symposium on Operating Systems Design and Implementation},
series = {OSDI '26},
month = {July},
year = {2026},
address = {Seattle, WA, USA},
publisher = {USENIX Association},
}