lm-resiliency includes two runtime safeguards to an existing training stack:
| Protects against | What you gain | |
|---|---|---|
| SCOUT | Silent data corruption (SDC); compute, input-pipeline, and communication stragglers; collective desynchronization; process stalls | Pinpoint faulty ranks, GPUs, nodes, or communication endpoints during training, and exclude checkpoints affected by recurring SDC from recovery; see the coverage contract |
| GEMINI | Slow, infrequent durable checkpoints | Frequent asynchronous in-memory checkpoints, peer replication, and fast recovery from nearby state |
Why LLM Resiliency
- SDC-safe recovery-verified checkpoint: SCOUT certifies recovery checkpoints and excludes candidates affected by recurring SDC, preventing corrupted state from being selected during recovery.
- Localize faulty components at runtime: SCOUT identifies affected ranks, GPUs, nodes, communication endpoints, or peer groups, including communication hangs while the training job is blocked.
- Minimize rollback: GEMINI saves complete training state to CPU memory at high frequency with no measurable training-throughput loss, reducing lost computation after a failure.
- Retrieve checkpoints quickly: GEMINI restores nearby state from memory, a surviving peer, or node-local storage, minimizing checkpoint retrieval time and global-storage reads.
- Keep protection lightweight: SCOUT incurs less than 1% amortized overhead during training for runtime failure localization.
- No framework fork:
lm-resiliencyintegrates with PyTorch, TorchTitan, Megatron Core, and DeepSpeed through automatic adapters and one public entry point. - No training-loop rewrite:
lm-resiliencyattaches hooks at framework initialization and leaves the existing training loop unchanged. - Bring your own launcher: Users can integrate
lm-resiliencywithtorchrun, Slurm, Kubernetes, or custom managers through platform-neutral APIs.
Quick Start
Install
git clone https://github.com/LMResiliency/lm-resiliency.git
cd lm-resiliency
python3.12 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -e ".[megatron]"
Use .[torchtitan], .[deepspeed], .[all], or the core package without an extra for other environments.
Add resiliency to Megatron Core
Attach resiliency after Megatron creates its model chunks, optimizer, and scheduler.
Then resume the existing train() loop from the recovered iteration.
from megatron.training import get_args
from lm_resiliency import enable_resiliency
def attach_resiliency(model_chunks, optimizer, scheduler):
resiliency = enable_resiliency(
model_chunks,
optimizer,
opt_param_scheduler=scheduler,
interval=10,
)
get_args().iteration = resiliency.step_count
return resiliency
# Call attach_resiliency(...) after Megatron setup, then enter train() unchanged.
See the Megatron Core production-loop example for a complete tiny-GPT job.
Add resiliency to TorchTitan
Pass the initialized TorchTitan Trainer before entering its existing training loop.
The adapter discovers the model, optimizer, scheduler, dataloader, topology, and checkpoint state.
from torchtitan.train import Trainer
from lm_resiliency import enable_resiliency
class MyTrainer(Trainer):
def train(self):
enable_resiliency(self, interval=10)
super().train()
See the TorchTitan production-loop example for a complete Llama debug-model job.
Framework support
| Framework | SCOUT parallelism |
|---|---|
| PyTorch | DDP, FSDP2, HSDP, TP, SP, CP, PP, EP, expert TP |
| TorchTitan | DP, FSDP2, HSDP, TP, SP, CP, PP, EP, expert TP |
| Megatron Core | DP, TP, SP, CP, PP, virtual PP, EP, expert TP |
| DeepSpeed | DP, ZeRO 1-3, TP, PP, Ulysses SP, EP, expert TP |
The package-root enable_resiliency entry point selects dense or expert replay peers from framework topology metadata.
See the API guide for framework invocation, configuration, recovery, callbacks, and lifecycle management.
See the compatibility policy for supported and tested versions.
See the PyTorch production-loop example for a complete DDP causal-LM job.
See the DeepSpeed production-loop example for a complete ZeRO-2 causal-LM job.
Manager Integration
External launchers and cluster managers can consume normalized SCOUT reports and checkpoint RecoveryDecision records, preserve GEMINI state before worker replacement, and coordinate checkpoint transfer through platform-neutral APIs.
Launcher-specific retry, placement, and replacement policy remains external. See Manager Integration in the API guide.
Documentation
| Topic | Guide |
|---|---|
| Public APIs and manager integration | API guide |
| Runnable framework integrations | Production-loop examples |
| Supported Python and framework versions | Compatibility |
| GEMINI checkpoint tiers, recovery, and cadence | GEMINI guide |
| SCOUT coverage, replay, fault reports, and checkpoint certification | SCOUT guide |
| MoE regime discovery, qualification, and measured results | MoE execution regimes |
| Complete test evidence and limitations | Validation report |
Development
python -m pip install -e ".[dev]"
CUDA_VISIBLE_DEVICES="" python -m pytest -q
GPU and distributed tests are opt-in and document their required torchrun command in each test file.
See the test guide for the integration and validation layout.
Contributing
Contributions to code, tests, documentation, and framework integrations are welcome. See CONTRIBUTING.md for setup, required checks, GPU validation, and pull-request expectations. Report security vulnerabilities privately according to SECURITY.md.
Citation
If you use lm-resiliency in your research, please cite the relevant papers.
GEMINI
GEMINI: Fast Failure Recovery in Distributed Training with In-Memory Checkpoints
@inproceedings{gemini-sosp23,
title = {{GEMINI}: Fast Failure Recovery in Distributed Training with In-Memory Checkpoints},
author = {Wang, Zhuang and Jia, Zhen and Zheng, Shuai and Zhang, Zhen and Fu, Xinwei and Ng, T. S. Eugene and Wang, Yida},
booktitle = {Proceedings of the 29th ACM Symposium on Operating Systems Principles},
year = {2023},
}
SCOUT
SCOUT: Symmetric Consensus Outlier Detection for Failure Localization in LLM Pre-Training
@misc{wang2026scout,
title = {{SCOUT}: Symmetric Consensus Outlier Detection for Failure Localization in {LLM} Pre-Training},
author = {Wang, Zhuang},
year = {2026},
url = {https://arxiv.org/abs/2608.11034}
}
License
Licensed under the BSD-3-Clause License.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lm_resiliency-0.1.0.tar.gz.
File metadata
- Download URL: lm_resiliency-0.1.0.tar.gz
- Upload date:
- Size: 216.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e77810b4fd127fc0ccb6342ebf93d1f8361df94beccdaad40669fa406ad3703
|
|
| MD5 |
a1f19574ecb79de68a48a4ab9acf3579
|
|
| BLAKE2b-256 |
8138ed00b5af6ae2ea7415630a4674ecc88696905a3494fcf80c7dc2648976fa
|
Provenance
The following attestation bundles were made for lm_resiliency-0.1.0.tar.gz:
Publisher:
release.yml on LMResiliency/lm-resiliency
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lm_resiliency-0.1.0.tar.gz -
Subject digest:
6e77810b4fd127fc0ccb6342ebf93d1f8361df94beccdaad40669fa406ad3703 - Sigstore transparency entry: 2433200490
- Sigstore integration time:
-
Permalink:
LMResiliency/lm-resiliency@cd3dd64235efdefdeb313444e8e1e73b9d222d7b -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/LMResiliency
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@cd3dd64235efdefdeb313444e8e1e73b9d222d7b -
Trigger Event:
push
-
Statement type:
File details
Details for the file lm_resiliency-0.1.0-py3-none-any.whl.
File metadata
- Download URL: lm_resiliency-0.1.0-py3-none-any.whl
- Upload date:
- Size: 219.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f4874fbcc5677faf2fd39f469fa71b95461ccdc0cb2c3f0dbd2966a7bf51cdef
|
|
| MD5 |
13caa04f95b641a068be0f225864c30e
|
|
| BLAKE2b-256 |
d4da8c4d9d87273516ae206b1d78c948773b213f1785a3de5d8680752e531bd4
|
Provenance
The following attestation bundles were made for lm_resiliency-0.1.0-py3-none-any.whl:
Publisher:
release.yml on LMResiliency/lm-resiliency
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lm_resiliency-0.1.0-py3-none-any.whl -
Subject digest:
f4874fbcc5677faf2fd39f469fa71b95461ccdc0cb2c3f0dbd2966a7bf51cdef - Sigstore transparency entry: 2433200513
- Sigstore integration time:
-
Permalink:
LMResiliency/lm-resiliency@cd3dd64235efdefdeb313444e8e1e73b9d222d7b -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/LMResiliency
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@cd3dd64235efdefdeb313444e8e1e73b9d222d7b -
Trigger Event:
push
-
Statement type: