OpGuard

Debug training differences
with your AI agent.

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

5 min vs. 5 days to localize
20+ production issues diagnosed
Source + trace evidence your agent can inspect
OSDI ’26 Best Paper Award Nominee

Two runs. One prompt.

Install OpGuard where you train and its harness where your agent runs. Then describe the two runs you want to compare.

01 / Install

Set up once. Use your own agent.

Install two packages, each in the environment where it runs.

Install OpGuard + harness
# 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 ↗

From a symptom to a source-level explanation.

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.

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 output

Expand ↗

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
…

First-diff source: run1:1734 · run2:1736

Actual root cause

A gradient buffer is overwritten on the default stream before its reduction on another stream finishes. Details ↗

Explore how OpGuard exposes the evidence.

Open the trace explorer → See production results ↓

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.

Days of debugging, reduced to minutes

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.

Debugging time comparison on a log scale 10 min 1 h 1 day 1 week 2 weeks 30 min Debugging time Emb-bwd (3080) CUDA stream FlashAttn det NCCL topo Scatter SDC MoE hist Emb-bwd fuse Offload sync Triton bwd QKV layout Optim resume

Production bug cases: manual root-cause time vs OpGuard (log scale). OpGuard stays at or under the 30-minute line.

OpGuard changes ByteDance’s internal debugging workflow in production training

Before
  • Manually compare two runs
  • Guess which subsystem to check
With OpGuard

Then inspect with the visualizer — tensor diffs, call stack, and source at the pivot.

Bitwise alignment enables broader comparisons

No “golden baseline” required

Compare equivalent computation across stacks, configs, and commits — pick whatever reference run is available for the bug.

Where are reference runs selected?

  • Self-replay 45%
  • Config tweak 25%
  • Cross-framework 20%
  • Stable commit 10%

Expert testimony

Developer A

We had been chasing the wrong subsystem for almost a week. OpGuard showed the exact kernel in under fifteen minutes.

Developer B

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.

Diverse and tricky root causes

Wrong model implementation / logic 7 cases (35%)
Race conditions 5 cases (25%)
Unexpected numerical drift 6 cases (30%)
Hardware faults 2 cases (10%)

20 Production Cases by Root-cause Categories

7 cases
(35%)
5 cases
(25%)
6 cases
(30%)
2 cases
(10%)

OpGuard supports major production-level training stacks

Internal: text and VLM pre-training, post-training framework

Open source: Megatron-LM, DeepSpeed, GPT-Neox, veRL, etc.

NVIDIA Megatron-LM DeepSpeed PyTorch 2.0 PyTorch Compiler veScale veRL PyTorch FSDP GPT-Neox Transformers

Go deeper in the trace explorer.

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.

Loading trace…
demo_case5 Open-source issue

Initializing trace viewer…

Our key abstraction: bitwise alignment

Compare computations at tensor boundaries, then investigate where they first differ. We’re also expanding beyond bitwise toward more general, practical alignment.

Given the two training runs, view them as a sequence of “points”

Compare the tensors at each point. Must match bit by bit.

First mismatch point becomes a very clean pivot for debugging.

Buggy run Reference run
fp32
fp16
fp8
fp16

OpGuard Workflow

Determinism control → preflight → guarded replay → offline alignment. Watch the build-up one step at a time.

1 Determinism Control

2 Preflight: (~ 5 iters) Discover Stable Op

3 Guarded Replay: Fingerprint at Op boundary

4 Offline Alignment

V
Other Compute
K
Attention
Suspect Run
Reference Run
Other Compute
K
V
Attention
OpGuard Aligns Diverse Runtime Executions

Cite our paper

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.

OpGuard: Bitwise Alignment for Precise and General Debugging of Production LLM Training

Ziming Zhou, Yinjie Zhao, Hang Zhu, Wenxiao Wang, Zhihao Bai, Yun Zhang, Shuguang Wang, Haibin Lin, Peng Huang

Proceedings of the 20th USENIX Symposium on Operating Systems Design and Implementation (OSDI ’26), Seattle, WA, USA, July 2026. USENIX Association.

BibTeX
@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},
}