DeepSpeed Universal Checkpoint Lexicographic Sort Corruption
DeepSpeed universal checkpoint loading sorts rank directories lexicographically instead of numerically, causing rank_10 to be loaded before rank_2. This silently corrupts model weights because each rank's parameters are loaded into the wrong rank's optimizer state. Denpex detects the corrupted checkpoint by validating parameter checksums across ranks.
DeepSpeed universal checkpoint loading sorts rank directories lexicographically instead of numerically, causing rank_10 to be loaded before rank_2.
- Root cause
- DeepSpeed sorts rank directories using lexicographic order: rank_0, rank_1, rank_10, rank_11..., rank_2, rank_3... Numeric order should be: rank_0, rank_1, rank_2, rank_3...
- Recommended fix
- Upgrade DeepSpeed to v0.14.0+ which fixes the lexicographic sort to numeric sort
- How Denpex helps
- Denpex investigates DeepSpeed Universal Checkpoint Lexicographic Sort Corruption using the evidence you provide or your connected workload collects. Earlier rank, host or application evidence is needed to distinguish an initiating failure from a downstream report.
What this failure is
DeepSpeed Universal Checkpoint Lexicographic Sort Corruption is a Data Integrity failure seen during ML training runs. DeepSpeed universal checkpoint loading sorts rank directories lexicographically instead of numerically, causing rank_10 to be loaded before rank_2. This silently corrupts model weights because each rank's parameters are loaded into the wrong rank's optimizer state. Denpex detects the corrupted checkpoint by validating parameter checksums across ranks. Common tags: Deepspeed, Checkpoint, Sort, Corruption.
Is this what broke your run? Paste your log.
You're reading about DeepSpeed Universal Checkpoint Lexicographic Sort Corruption. Paste your own traceback and relevant evidence for an investigation of your workload, with a next action or a specific missing fact. A reference entry does not establish your cause. No account or card for the free diagnosis. Review data handling before submitting sensitive logs.
Before uploading, review cloud data handling and local options.
Upload your log file. Large files are processed in your browser. Only selected evidence is submitted when you run diagnosis.
Why it happens (the mechanism)
DeepSpeed sorts rank directories using lexicographic order: rank_0, rank_1, rank_10, rank_11..., rank_2, rank_3... Numeric order should be: rank_0, rank_1, rank_2, rank_3..., rank_10, rank_11... When rank_10 is loaded in rank_2's position, all parameters from rank_10 onwards are loaded into the wrong rank. This silently corrupts model weights because each rank's optimizer states (momentum, variance) are mismatched with its parameters. Taken together, these mechanisms explain why the failure is reproducible, why it tends to surface on specific workloads or scales, and why generic mitigation attempts often fall short without addressing the underlying cause.
What you'll observe
- Model weights are silently corrupted after loading a universal checkpoint
- Training produces wrong results or diverges after resuming from a universal checkpoint
- The corruption is invisible. No error is raised during checkpoint loading
Common symptoms and what they mean
Check possible explanations against the incident evidence. A matching symptom alone does not establish its cause.
| Symptom | Possible explanation |
|---|---|
| Training loss diverges after resuming from a universal checkpoint with 10+ ranks | DeepSpeed sorts rank directories using lexicographic order: rank_0, rank_1, rank_10, rank_11..., rank_2, rank_3... |
| Model accuracy drops significantly after checkpoint resume | Numeric order should be: rank_0, rank_1, rank_2, rank_3..., rank_10, rank_11... |
| Parameter checksums differ across ranks after loading the same universal checkpoint | When rank_10 is loaded in rank_2's position, all parameters from rank_10 onwards are loaded into the wrong rank |
| The issue only appears with 10+ ranks (rank_10 sorts before rank_2 lexicographically) | This silently corrupts model weights because each rank's optimizer states (momentum, variance) are mismatched with its parameters |
Which systems are affected
- DeepSpeed ZeRO-3 with universal checkpoint format
- Training with 10+ ranks where lexicographic sort differs from numeric sort
- DeepSpeed versions before v0.14.0
- Checkpoint conversion between DeepSpeed and Hugging Face formats
How to confirm this is the problem
Use this checklist to test the hypothesis against a small reproduction. No single line proves the root cause, so preserve the preceding events and compare one variable at a time.
- ✓Reproduce the failure from a clean checkpoint/seed: the symptom must appear without warm-up state from a previous run.
- ✓Verified signal present: Training loss diverges after resuming from a universal checkpoint with 10+ ranks
- ✓Verified signal present: Model accuracy drops significantly after checkpoint resume
- ✓Verified signal present: Parameter checksums differ across ranks after loading the same universal checkpoint
- ✓Verified signal present: The issue only appears with 10+ ranks (rank_10 sorts before rank_2 lexicographically)
- ✓A targeted fix from the "How to fix it" section eliminates or substantially reduces the symptom within one validation pass.
Root cause
- DeepSpeed sorts rank directories using lexicographic order: rank_0, rank_1, rank_10, rank_11..., rank_2, rank_3...
- Numeric order should be: rank_0, rank_1, rank_2, rank_3..., rank_10, rank_11...
- When rank_10 is loaded in rank_2's position, all parameters from rank_10 onwards are loaded into the wrong rank
- This silently corrupts model weights because each rank's optimizer states (momentum, variance) are mismatched with its parameters
The fix and how to prevent it
How to fix it
- Upgrade DeepSpeed to v0.14.0+ which fixes the lexicographic sort to numeric sort
- If upgrade is not possible: rename rank directories with zero-padded names (rank_00, rank_01..., rank_09, rank_10) before loading
- Validate checkpoint integrity after loading: compare parameter checksums across ranks
- As a diagnostic: save a small test checkpoint with 10+ ranks and verify that rank_2 loads rank_2's data
- Use Denpex to validate universal checkpoint integrity and detect sort-related corruption
Step-by-step remediation
- 1Upgrade DeepSpeed to v0.14.0+ which fixes the lexicographic sort to numeric sort
- 2If upgrade is not possible: rename rank directories with zero-padded names (rank_00, rank_01..., rank_09, rank_10) before loading
- 3Validate checkpoint integrity after loading: compare parameter checksums across ranks
- 4As a diagnostic: save a small test checkpoint with 10+ ranks and verify that rank_2 loads rank_2's data
- 5Use Denpex to validate universal checkpoint integrity and detect sort-related corruption
How to prevent it
- Use DeepSpeed v0.14.0+ which sorts rank directories numerically
- Always validate model weights after loading a universal checkpoint: compare parameter norms across ranks
- Use zero-padded rank directory names as a defensive measure
- Include checkpoint integrity validation in training resume scripts
Save this diagnosis and catch the next crash automatically
All root cause, fix, and prevention steps above are free to read. Create a free account with any email or GitHub to keep your saved diagnosis history across the encyclopedia and run cloud checks, or use a work email below for the 30-day Team evaluation. No card required.
Or start a 30-day free Team trial (work email)
Verified work email unlocks all 14 fleet diagnostic tools, Slack alerts, and team history for 30 days. No card and no automatic charge.
Diagnose your own log automatically
The root cause and fix steps above stay free. Create a free account to analyze full job logs, attribute the first failed rank, and keep saved incident history.
Sign up free. Analyze your cluster logsNo credit card. Daily allowance follows verified trust tier. Instant access.
Diagnose this failure in VS Code
Select the traceback or open the failed terminal, then run Denpex locally to inspect matched failure patterns, supporting evidence and next checks without uploading the log. Verify recommendations against your workload before changing production.
Install the free VS Code extensionDeepSpeed errors in context
DeepSpeed changes when parameters, gradients and optimizer state are created, partitioned, gathered and offloaded. The hub separates ZeRO, memory, checkpoint and pipeline failures by lifecycle phase.
Compare related deepspeed errorsRelated failures to investigate next
Don't just read the fix, diagnose your run
The encyclopedia explains documented failure patterns. Denpex investigates your logs, configuration and stack, shows the supporting evidence, and asks for missing details when needed.