[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7CSPB607GZY0PHJJP950RBD":3,"skill-same:01M7CSPB607GZY0PHJJP950RBD":72},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":25,"commitSha":26,"skillDirectory":27,"forksCount":28,"repositoryHtmlUrl":29,"repositoryHomepageUrl":30,"ownerHtmlUrl":31,"ownerBlogUrl":6,"ownerDescription":32,"updatedAt":33,"install":34,"resources":47},"01M7CSPB607GZY0PHJJP950RBD","nemo-mbridge-resiliency",null,"Resiliency features in Megatron Bridge including fault tolerance, straggler detection, in-process restart, preemption, and re-run state machine.","YYC-Cube\u002FYYC3-Knowledge-Base","YYC-Cube","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F235006543?v=4","01M79J2PH4SWD2X0825X6PN748","yyc3","01M79J2PHVK3F6ZBYT8K2SCZCW",1,"Apache-2.0","https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base\u002Fblob\u002Fmain\u002FYYC3-Skills-技能包\u002FYYC3-Skills-技能包-skills\u002Fskills\u002Fnemo-mbridge-resiliency\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: nemo-mbridge-resiliency\ndescription: Resiliency features in Megatron Bridge including fault tolerance, straggler detection, in-process restart, preemption, and re-run state machine.\nlicense: Apache-2.0\nwhen_to_use: Enabling resiliency features, or investigating a commit that caused training hangs, straggler detection failures, or broken restarts; 'fault tolerance', 'straggler detection', 'hang detection', 'automatic restart', 'in-process restart', 'preemption', 'nvidia-resiliency-ext'.\n---\n\n# Resiliency\n\nStable docs: @docs\u002Ftraining\u002Fresiliency.md, @docs\u002Ftraining\u002Fcheckpointing.md\nCard: @skills\u002Fnemo-mbridge-resiliency\u002Fcard.yaml\n\n## Enablement\n\n### Fault tolerance (Slurm only)\n\n#### Option 1: NeMo Run plugin (recommended)\n\n```python\nfrom megatron.bridge.recipes.run_plugins import FaultTolerancePlugin\nimport nemo_run as run\n\ntask = run.Script(...)\nrun_plugins = [\n    FaultTolerancePlugin(\n        enable_ft_package=True,\n        calc_ft_timeouts=True,\n        num_in_job_restarts=3,\n        num_job_retries_on_failure=2,\n        initial_rank_heartbeat_timeout=1800,\n        rank_heartbeat_timeout=300,\n    )\n]\nrun.run(task, plugins=run_plugins, executor=executor)\n```\n\n| Plugin parameter | Default | Description |\n|---|---|---|\n| `num_in_job_restarts` | 3 | Max restarts within same job |\n| `num_job_retries_on_failure` | 2 | Max new job launches on failure |\n| `initial_rank_heartbeat_timeout` | 1800 | First heartbeat timeout (seconds) |\n| `rank_heartbeat_timeout` | 300 | Subsequent heartbeat timeout (seconds) |\n\n#### Option 2: Direct config + ft_launcher\n\n```python\nfrom megatron.bridge.training.config import FaultToleranceConfig\n\ncfg.ft = FaultToleranceConfig(\n    enable_ft_package=True,\n    calc_ft_timeouts=True,\n    simulate_fault=False,\n    simulated_fault_type=\"random\",\n)\n```\n\nLaunch with `ft_launcher` (not `torchrun`):\n\n```bash\nexport GROUP_RANK=0  # required for non-Slurm\nft_launcher \\\n    --rdzv_backend=c10d --rdzv_endpoint=${MASTER_ADDR}:${MASTER_PORT} \\\n    --nnodes=${NUM_NODES} --nproc-per-node=${NUM_GPUS_PER_NODE} \\\n    --ft-rank_section_timeouts=setup:600,step:180,checkpointing:420 \\\n    --ft-rank_out_of_section_timeout=300 \\\n    your_training_script.py\n```\n\n| Config parameter | Default | Description |\n|---|---|---|\n| `enable_ft_package` | False | Enable fault tolerance |\n| `calc_ft_timeouts` | False | Auto-compute optimal timeouts |\n| `simulate_fault` | False | Enable fault simulation for testing |\n| `simulated_fault_type` | `\"random\"` | `\"rank_hung\"`, `\"rank_killed\"`, or `\"random\"` |\n| `simulated_fault_rank` | None | Specific rank to fault (random if None) |\n| `simulated_fault_base_delay` | 0 | Base delay before simulating fault |\n\nSection-based timeout monitoring covers setup, training steps, checkpointing,\nand out-of-section time independently. Timeouts are saved to `ft_state.json`\nfor subsequent runs when `calc_ft_timeouts=True`.\n\n### NVRx straggler detection\n\n```python\nfrom megatron.bridge.training.config import NVRxStragglerDetectionConfig\n\ncfg.nvrx_straggler = NVRxStragglerDetectionConfig(\n    enabled=True,\n    report_time_interval=300.0,\n    calc_relative_gpu_perf=True,\n    calc_individual_gpu_perf=True,\n    num_gpu_perf_scores_to_print=5,\n    gpu_relative_perf_threshold=0.7,\n    gpu_individual_perf_threshold=0.7,\n    stop_if_detected=False,\n    enable_logging=True,\n)\n```\n\n| Parameter | Default | Description |\n|---|---|---|\n| `enabled` | False | Enable straggler detection |\n| `report_time_interval` | 300.0 | Seconds between straggler checks |\n| `calc_relative_gpu_perf` | True | Compare ranks against each other |\n| `calc_individual_gpu_perf` | True | Track per-rank degradation over time |\n| `gpu_relative_perf_threshold` | 0.7 | Threshold for relative performance (0-1) |\n| `gpu_individual_perf_threshold` | 0.7 | Threshold for individual performance (0-1) |\n| `stop_if_detected` | False | Terminate training on straggler |\n| `num_gpu_perf_scores_to_print` | 5 | Number of best\u002Fworst scores to print |\n| `profiling_interval` | 1 | Profiling interval for detector |\n\n### Preemption\n\n#### Plugin (Slurm)\n\n```python\nfrom megatron.bridge.recipes.run_plugins import PreemptionPlugin\n\nplugins = [\n    PreemptionPlugin(\n        preempt_time=60,\n        enable_exit_handler=True,\n        enable_exit_handler_for_data_loader=False,\n    )\n]\n```\n\n| Plugin parameter | Default | Description |\n|---|---|---|\n| `preempt_time` | 60 | Seconds before job limit to send signal |\n| `enable_exit_handler` | True | Enable signal handler in training |\n| `enable_exit_handler_for_data_loader` | False | Enable for dataloader workers |\n\n#### Direct config\n\n```python\nimport signal\ncfg.train.exit_signal_handler = True\ncfg.train.exit_signal = signal.SIGTERM\ncfg.train.exit_signal_handler_for_dataloader = False\n```\n\n### Re-run state machine (experimental)\n\n```python\nfrom megatron.bridge.training.config import RerunStateMachineConfig\n\ncfg.rerun_state_machine = RerunStateMachineConfig(\n    rerun_mode=\"validate_results\",\n    check_for_nan_in_loss=True,\n    check_for_spiky_loss=False,\n    spiky_loss_factor=10.0,\n)\n```\n\n| Parameter | Default | Description |\n|---|---|---|\n| `rerun_mode` | `\"disabled\"` | `\"disabled\"`, `\"validate_results\"`, `\"report_determinism_stats\"` |\n| `check_for_nan_in_loss` | True | Check for NaN in loss |\n| `check_for_spiky_loss` | False | Check for unexpectedly large loss |\n| `spiky_loss_factor` | 10.0 | Loss flagged if > factor * max observed (increase for large models) |\n\nExit codes: 16 = resume to disambiguate, 17 = failed validation.\n\n### In-process restart (experimental)\n\n```python\nfrom megatron.bridge.training.config import InProcessRestartConfig\n\ncfg.inprocess_restart = InProcessRestartConfig(\n    enabled=True,\n    granularity=\"node\",\n    soft_timeout=60.0,\n    hard_timeout=90.0,\n)\n```\n\n| Parameter | Default | Description |\n|---|---|---|\n| `enabled` | False | Enable in-process restart |\n| `active_world_size` | None | Ranks executing workload (rest are warm reserves) |\n| `granularity` | `\"node\"` | `\"node\"` or `\"rank\"` restart granularity |\n| `max_iterations` | None | Max restart attempts (None = unlimited) |\n| `soft_timeout` | 60.0 | Detect GIL-released hangs (seconds) |\n| `hard_timeout` | 90.0 | Force-terminate hung ranks (seconds) |\n| `heartbeat_interval` | 30.0 | Heartbeat interval (seconds) |\n| `heartbeat_timeout` | 60.0 | Missing heartbeat timeout (seconds) |\n| `barrier_timeout` | 120.0 | Distributed barrier timeout (seconds) |\n| `completion_timeout` | 120.0 | Completion barrier timeout (seconds) |\n| `empty_cuda_cache` | True | Clear CUDA cache during restart |\n| `max_rank_faults` | None | Max rank faults before terminating |\n| `monitor_process_logdir` | None | Directory for monitor logs |\n\nRequired environment variables:\n\n```bash\nexport TORCH_CPP_LOG_LEVEL=error\nexport TORCH_NCCL_RETHROW_CUDA_ERRORS=0\nexport NCCL_NVLS_ENABLE=0\n```\n\nThe PyTorch NCCL watchdog timeout must exceed `hard_timeout`. NeMo-Run's\nSlurm Executor is not supported; launch directly with `srun --kill-on-bad-exit=0`.\n\n### Async checkpoint save\n\n```python\ncfg.checkpoint.async_save = True\ncfg.checkpoint.ckpt_format = \"torch_dist\"\n```\n\n### Local checkpointing (NVRx)\n\n```python\ncfg.checkpoint.non_persistent_local_ckpt_dir = \"\u002Flocal\u002Fscratch\u002Fckpt\"\ncfg.checkpoint.non_persistent_local_ckpt_algo = \"fully_parallel\"\n```\n\n## Code Anchors\n\n### Fault tolerance\n- Config: `src\u002Fmegatron\u002Fbridge\u002Ftraining\u002Fconfig.py` — `FaultToleranceConfig`\n- Runtime: `src\u002Fmegatron\u002Fbridge\u002Ftraining\u002Ffault_tolerance.py`\n- Plugin: `src\u002Fmegatron\u002Fbridge\u002Frecipes\u002Frun_plugins.py` — `FaultTolerancePlugin`\n- Perf plugin: `scripts\u002Fperformance\u002Fnemo-mbridge-resiliency_plugins.py`\n- Tests: `tests\u002Funit_tests\u002Ftraining\u002Ftest_fault_tolerance.py`\n- Example: `examples\u002Ftraining_features\u002Fnemo-mbridge-resiliency\u002Ffault_tolerance\u002F`\n\n### Straggler detection\n- Config: `src\u002Fmegatron\u002Fbridge\u002Ftraining\u002Fconfig.py` — `NVRxStragglerDetectionConfig`\n- Runtime: `src\u002Fmegatron\u002Fbridge\u002Ftraining\u002Fnvrx_straggler.py`\n- Train loop: `src\u002Fmegatron\u002Fbridge\u002Ftraining\u002Ftrain.py` — `check_nvrx_straggler_detection`\n- Tests: `tests\u002Funit_tests\u002Ftraining\u002Ftest_nvrx_straggler.py`, `tests\u002Ffunctional_tests\u002Ftraining\u002Ftest_nvrx_straggler.py`\n- Example: `examples\u002Ftraining_features\u002Fnemo-mbridge-resiliency\u002Fstraggler_detection\u002F`\n\n### In-process restart\n- Config: `src\u002Fmegatron\u002Fbridge\u002Ftraining\u002Fconfig.py` — `InProcessRestartConfig`\n- Runtime: `src\u002Fmegatron\u002Fbridge\u002Ftraining\u002Finprocess_restart.py`\n- Entry point: `src\u002Fmegatron\u002Fbridge\u002Ftraining\u002Fpretrain.py` — `maybe_wrap_for_inprocess_restart`\n- Tests: `tests\u002Funit_tests\u002Ftraining\u002Ftest_inprocess_restart.py`, `tests\u002Ffunctional_tests\u002Ftraining\u002Ftest_inprocess_restart.py`\n\n### Preemption\n- Plugin: `src\u002Fmegatron\u002Fbridge\u002Frecipes\u002Frun_plugins.py` — `PreemptionPlugin`\n- Signal handler: `src\u002Fmegatron\u002Fbridge\u002Ftraining\u002Futils\u002Fsig_utils.py`\n- Tests: `tests\u002Funit_tests\u002Frecipes\u002Ftest_run_plugins.py`\n\n### Re-run state machine\n- Config: `src\u002Fmegatron\u002Fbridge\u002Ftraining\u002Fconfig.py` — `RerunStateMachineConfig`\n- Init: `src\u002Fmegatron\u002Fbridge\u002Ftraining\u002Finitialize.py` — `init_rerun_state`\n\n### Checkpointing\n- Async save: `src\u002Fmegatron\u002Fbridge\u002Ftraining\u002Fcheckpointing.py` — `schedule_async_save`\n- Local ckpt: `src\u002Fmegatron\u002Fbridge\u002Ftraining\u002Fcheckpointing.py` — `LocalCheckpointManager`\n- Tests: `tests\u002Ffunctional_tests\u002Ftraining\u002Ftest_local_checkpointing.py`\n\n## Pitfalls\n\n1. **ft_launcher, not torchrun**: Direct `FaultToleranceConfig` requires\n   `ft_launcher`. Using `torchrun` silently disables FT. For non-Slurm,\n   set `GROUP_RANK=0`.\n\n2. **Async save requires torch_dist**: `async_save=True` only works with\n   `ckpt_format=\"torch_dist\"`. Other formats silently fail or error.\n\n3. **IPR + NeMo-Run**: In-process restart is not compatible with NeMo-Run\n   or Slurm preemption plugins. Requires specific PyTorch\u002FNCCL versions\n   and env vars.\n\n4. **NVRx vs legacy straggler**: Two detectors exist. Use NVRx\n   (`nvrx_straggler`); do not enable both.\n\n5. **stop_if_detected default**: NVRx logs but does not stop training by\n   default. Set `stop_if_detected=True` for automatic termination.\n\n6. **NCCL watchdog vs hard_timeout**: For IPR, NCCL watchdog timeout must\n   exceed `hard_timeout` or PyTorch kills the process before recovery.\n\n7. **Rerun state machine is alpha**: Use `check_for_nan_in_loss=True` for\n   NaN detection, but don't rely on full rerun workflows yet.\n\n## Verification\n\n### Fault tolerance\n```bash\n.\u002Fexamples\u002Ftraining_features\u002Fnemo-mbridge-resiliency\u002Ffault_tolerance\u002Frun_fault_tolerance.sh\n.\u002Fexamples\u002Ftraining_features\u002Fnemo-mbridge-resiliency\u002Ffault_tolerance\u002Frun_fault_tolerance.sh --simulate-fault\n```\nLook for `[FaultTolerance]` \u002F `[RankMonitorServer]` log lines with section\ntimeouts. Simulated fault should trigger restart from checkpoint.\n\n### Straggler detection\n```bash\nuv run python -m torch.distributed.run --nproc_per_node=2 \\\n    examples\u002Ftraining_features\u002Fnemo-mbridge-resiliency\u002Fstraggler_detection\u002Fstraggler_detection_example.py\n```\nLook for `GPU relative performance` and `GPU individual performance` reports\nwith per-rank scores.\n\n### Async checkpoint\nLook for `Scheduling async checkpoint save` in logs. Training iterations\nshould continue while checkpoint files are being written.\n\n### In-process restart\n```bash\npytest tests\u002Ffunctional_tests\u002Ftraining\u002Ftest_inprocess_restart.py -v\n```\nRequires compatible PyTorch\u002FNCCL versions.\n","# Resiliency\n\nStable docs: @docs\u002Ftraining\u002Fresiliency.md, @docs\u002Ftraining\u002Fcheckpointing.md\nCard: @skills\u002Fnemo-mbridge-resiliency\u002Fcard.yaml\n\n## Enablement\n\n### Fault tolerance (Slurm only)\n\n#### Option 1: NeMo Run plugin (recommended)\n\n```python\nfrom megatron.bridge.recipes.run_plugins import FaultTolerancePlugin\nimport nemo_run as run\n\ntask = run.Script(...)\nrun_plugins = [\n    FaultTolerancePlugin(\n        enable_ft_package=True,\n        calc_ft_timeouts=True,\n        num_in_job_restarts=3,\n        num_job_retries_on_failure=2,\n        initial_rank_heartbeat_timeout=1800,\n        rank_heartbeat_timeout=300,\n    )\n]\nrun.run(task, plugins=run_plugins, executor=executor)\n```\n\n| Plugin parameter | Default | Description |\n|---|---|---|\n| `num_in_job_restarts` | 3 | Max restarts within same job |\n| `num_job_retries_on_failure` | 2 | Max new job launches on failure |\n| `initial_rank_heartbeat_timeout` | 1800 | First heartbeat timeout (seconds) |\n| `rank_heartbeat_timeout` | 300 | Subsequent heartbeat timeout (seconds) |\n\n#### Option 2: Direct config + ft_launcher\n\n```python\nfrom megatron.bridge.training.config import FaultToleranceConfig\n\ncfg.ft = FaultToleranceConfig(\n    enable_ft_package=True,\n    calc_ft_timeouts=True,\n    simulate_fault=False,\n    simulated_fault_type=\"random\",\n)\n```\n\nLaunch with `ft_launcher` (not `torchrun`):\n\n```bash\nexport GROUP_RANK=0  # required for non-Slurm\nft_launcher \\\n    --rdzv_backend=c10d --rdzv_endpoint=${MASTER_ADDR}:${MASTER_PORT} \\\n    --nnodes=${NUM_NODES} --nproc-per-node=${NUM_GPUS_PER_NODE} \\\n    --ft-rank_section_timeouts=setup:600,step:180,checkpointing:420 \\\n    --ft-rank_out_of_section_timeout=300 \\\n    your_training_script.py\n```\n\n| Config parameter | Default | Description |\n|---|---|---|\n| `enable_ft_package` | False | Enable fault tolerance |\n| `calc_ft_timeouts` | False | Auto-compute optimal timeouts |\n| `simulate_fault` | False | Enable fault simulation for testing |\n| `simulated_fault_type` | `\"random\"` | `\"rank_hung\"`, `\"rank_killed\"`, or `\"random\"` |\n| `simulated_fault_rank` | None | Specific rank to fault (random if None) |\n| `simulated_fault_base_delay` | 0 | Base delay before simulating fault |\n\nSection-based timeout monitoring covers setup, training steps, checkpointing,\nand out-of-section time independently. Timeouts are saved to `ft_state.json`\nfor subsequent runs when `calc_ft_timeouts=True`.\n\n### NVRx straggler detection\n\n```python\nfrom megatron.bridge.training.config import NVRxStragglerDetectionConfig\n\ncfg.nvrx_straggler = NVRxStragglerDetectionConfig(\n    enabled=True,\n    report_time_interval=300.0,\n    calc_relative_gpu_perf=True,\n    calc_individual_gpu_perf=True,\n    num_gpu_perf_scores_to_print=5,\n    gpu_relative_perf_threshold=0.7,\n    gpu_individual_perf_threshold=0.7,\n    stop_if_detected=False,\n    enable_logging=True,\n)\n```\n\n| Parameter | Default | Description |\n|---|---|---|\n| `enabled` | False | Enable straggler detection |\n| `report_time_interval` | 300.0 | Seconds between straggler checks |\n| `calc_relative_gpu_perf` | True | Compare ranks against each other |\n| `calc_individual_gpu_perf` | True | Track per-rank degradation over time |\n| `gpu_relative_perf_threshold` | 0.7 | Threshold for relative performance (0-1) |\n| `gpu_individual_perf_threshold` | 0.7 | Threshold for individual performance (0-1) |\n| `stop_if_detected` | False | Terminate training on straggler |\n| `num_gpu_perf_scores_to_print` | 5 | Number of best\u002Fworst scores to print |\n| `profiling_interval` | 1 | Profiling interval for detector |\n\n### Preemption\n\n#### Plugin (Slurm)\n\n```python\nfrom megatron.bridge.recipes.run_plugins import PreemptionPlugin\n\nplugins = [\n    PreemptionPlugin(\n        preempt_time=60,\n        enable_exit_handler=True,\n        enable_exit_handler_for_data_loader=False,\n    )\n]\n```\n\n| Plugin parameter | Default | Description |\n|---|---|---|\n| `preempt_time` | 60 | Seconds before job limit to send signal |\n| `enable_exit_handler` | True | Enable signal handler in training |\n| `enable_exit_handler_for_data_loader` | False | Enable for dataloader workers |\n\n#### Direct config\n\n```python\nimport signal\ncfg.train.exit_signal_handler = True\ncfg.train.exit_signal = signal.SIGTERM\ncfg.train.exit_signal_handler_for_dataloader = False\n```\n\n### Re-run state machine (experimental)\n\n```python\nfrom megatron.bridge.training.config import RerunStateMachineConfig\n\ncfg.rerun_state_machine = RerunStateMachineConfig(\n    rerun_mode=\"validate_results\",\n    check_for_nan_in_loss=True,\n    check_for_spiky_loss=False,\n    spiky_loss_factor=10.0,\n)\n```\n\n| Parameter | Default | Description |\n|---|---|---|\n| `rerun_mode` | `\"disabled\"` | `\"disabled\"`, `\"validate_results\"`, `\"report_determinism_stats\"` |\n| `check_for_nan_in_loss` | True | Check for NaN in loss |\n| `check_for_spiky_loss` | False | Check for unexpectedly large loss |\n| `spiky_loss_factor` | 10.0 | Loss flagged if > factor * max observed (increase for large models) |\n\nExit codes: 16 = resume to disambiguate, 17 = failed validation.\n\n### In-process restart (experimental)\n\n```python\nfrom megatron.bridge.training.config import InProcessRestartConfig\n\ncfg.inprocess_restart = InProcessRestartConfig(\n    enabled=True,\n    granularity=\"node\",\n    soft_timeout=60.0,\n    hard_timeout=90.0,\n)\n```\n\n| Parameter | Default | Description |\n|---|---|---|\n| `enabled` | False | Enable in-process restart |\n| `active_world_size` | None | Ranks executing workload (rest are warm reserves) |\n| `granularity` | `\"node\"` | `\"node\"` or `\"rank\"` restart granularity |\n| `max_iterations` | None | Max restart attempts (None = unlimited) |\n| `soft_timeout` | 60.0 | Detect GIL-released hangs (seconds) |\n| `hard_timeout` | 90.0 | Force-terminate hung ranks (seconds) |\n| `heartbeat_interval` | 30.0 | Heartbeat interval (seconds) |\n| `heartbeat_timeout` | 60.0 | Missing heartbeat timeout (seconds) |\n| `barrier_timeout` | 120.0 | Distributed barrier timeout (seconds) |\n| `completion_timeout` | 120.0 | Completion barrier timeout (seconds) |\n| `empty_cuda_cache` | True | Clear CUDA cache during restart |\n| `max_rank_faults` | None | Max rank faults before terminating |\n| `monitor_process_logdir` | None | Directory for monitor logs |\n\nRequired environment variables:\n\n```bash\nexport TORCH_CPP_LOG_LEVEL=error\nexport TORCH_NCCL_RETHROW_CUDA_ERRORS=0\nexport NCCL_NVLS_ENABLE=0\n```\n\nThe PyTorch NCCL watchdog timeout must exceed `hard_timeout`. NeMo-Run's\nSlurm Executor is not supported; launch directly with `srun --kill-on-bad-exit=0`.\n\n### Async checkpoint save\n\n```python\ncfg.checkpoint.async_save = True\ncfg.checkpoint.ckpt_format = \"torch_dist\"\n```\n\n### Local checkpointing (NVRx)\n\n```python\ncfg.checkpoint.non_persistent_local_ckpt_dir = \"\u002Flocal\u002Fscratch\u002Fckpt\"\ncfg.checkpoint.non_persistent_local_ckpt_algo = \"fully_parallel\"\n```\n\n## Code Anchors\n\n### Fault tolerance\n- Config: `src\u002Fmegatron\u002Fbridge\u002Ftraining\u002Fconfig.py` — `FaultToleranceConfig`\n- Runtime: `src\u002Fmegatron\u002Fbridge\u002Ftraining\u002Ffault_tolerance.py`\n- Plugin: `src\u002Fmegatron\u002Fbridge\u002Frecipes\u002Frun_plugins.py` — `FaultTolerancePlugin`\n- Perf plugin: `scripts\u002Fperformance\u002Fnemo-mbridge-resiliency_plugins.py`\n- Tests: `tests\u002Funit_tests\u002Ftraining\u002Ftest_fault_tolerance.py`\n- Example: `examples\u002Ftraining_features\u002Fnemo-mbridge-resiliency\u002Ffault_tolerance\u002F`\n\n### Straggler detection\n- Config: `src\u002Fmegatron\u002Fbridge\u002Ftraining\u002Fconfig.py` — `NVRxStragglerDetectionConfig`\n- Runtime: `src\u002Fmegatron\u002Fbridge\u002Ftraining\u002Fnvrx_straggler.py`\n- Train loop: `src\u002Fmegatron\u002Fbridge\u002Ftraining\u002Ftrain.py` — `check_nvrx_straggler_detection`\n- Tests: `tests\u002Funit_tests\u002Ftraining\u002Ftest_nvrx_straggler.py`, `tests\u002Ffunctional_tests\u002Ftraining\u002Ftest_nvrx_straggler.py`\n- Example: `examples\u002Ftraining_features\u002Fnemo-mbridge-resiliency\u002Fstraggler_detection\u002F`\n\n### In-process restart\n- Config: `src\u002Fmegatron\u002Fbridge\u002Ftraining\u002Fconfig.py` — `InProcessRestartConfig`\n- Runtime: `src\u002Fmegatron\u002Fbridge\u002Ftraining\u002Finprocess_restart.py`\n- Entry point: `src\u002Fmegatron\u002Fbridge\u002Ftraining\u002Fpretrain.py` — `maybe_wrap_for_inprocess_restart`\n- Tests: `tests\u002Funit_tests\u002Ftraining\u002Ftest_inprocess_restart.py`, `tests\u002Ffunctional_tests\u002Ftraining\u002Ftest_inprocess_restart.py`\n\n### Preemption\n- Plugin: `src\u002Fmegatron\u002Fbridge\u002Frecipes\u002Frun_plugins.py` — `PreemptionPlugin`\n- Signal handler: `src\u002Fmegatron\u002Fbridge\u002Ftraining\u002Futils\u002Fsig_utils.py`\n- Tests: `tests\u002Funit_tests\u002Frecipes\u002Ftest_run_plugins.py`\n\n### Re-run state machine\n- Config: `src\u002Fmegatron\u002Fbridge\u002Ftraining\u002Fconfig.py` — `RerunStateMachineConfig`\n- Init: `src\u002Fmegatron\u002Fbridge\u002Ftraining\u002Finitialize.py` — `init_rerun_state`\n\n### Checkpointing\n- Async save: `src\u002Fmegatron\u002Fbridge\u002Ftraining\u002Fcheckpointing.py` — `schedule_async_save`\n- Local ckpt: `src\u002Fmegatron\u002Fbridge\u002Ftraining\u002Fcheckpointing.py` — `LocalCheckpointManager`\n- Tests: `tests\u002Ffunctional_tests\u002Ftraining\u002Ftest_local_checkpointing.py`\n\n## Pitfalls\n\n1. **ft_launcher, not torchrun**: Direct `FaultToleranceConfig` requires\n   `ft_launcher`. Using `torchrun` silently disables FT. For non-Slurm,\n   set `GROUP_RANK=0`.\n\n2. **Async save requires torch_dist**: `async_save=True` only works with\n   `ckpt_format=\"torch_dist\"`. Other formats silently fail or error.\n\n3. **IPR + NeMo-Run**: In-process restart is not compatible with NeMo-Run\n   or Slurm preemption plugins. Requires specific PyTorch\u002FNCCL versions\n   and env vars.\n\n4. **NVRx vs legacy straggler**: Two detectors exist. Use NVRx\n   (`nvrx_straggler`); do not enable both.\n\n5. **stop_if_detected default**: NVRx logs but does not stop training by\n   default. Set `stop_if_detected=True` for automatic termination.\n\n6. **NCCL watchdog vs hard_timeout**: For IPR, NCCL watchdog timeout must\n   exceed `hard_timeout` or PyTorch kills the process before recovery.\n\n7. **Rerun state machine is alpha**: Use `check_for_nan_in_loss=True` for\n   NaN detection, but don't rely on full rerun workflows yet.\n\n## Verification\n\n### Fault tolerance\n```bash\n.\u002Fexamples\u002Ftraining_features\u002Fnemo-mbridge-resiliency\u002Ffault_tolerance\u002Frun_fault_tolerance.sh\n.\u002Fexamples\u002Ftraining_features\u002Fnemo-mbridge-resiliency\u002Ffault_tolerance\u002Frun_fault_tolerance.sh --simulate-fault\n```\nLook for `[FaultTolerance]` \u002F `[RankMonitorServer]` log lines with section\ntimeouts. Simulated fault should trigger restart from checkpoint.\n\n### Straggler detection\n```bash\nuv run python -m torch.distributed.run --nproc_per_node=2 \\\n    examples\u002Ftraining_features\u002Fnemo-mbridge-resiliency\u002Fstraggler_detection\u002Fstraggler_detection_example.py\n```\nLook for `GPU relative performance` and `GPU individual performance` reports\nwith per-rank scores.\n\n### Async checkpoint\nLook for `Scheduling async checkpoint save` in logs. Training iterations\nshould continue while checkpoint files are being written.\n\n### In-process restart\n```bash\npytest tests\u002Ffunctional_tests\u002Ftraining\u002Ftest_inprocess_restart.py -v\n```\nRequires compatible PyTorch\u002FNCCL versions.\n",{"name":5,"license":15,"description":7,"when_to_use":24},"Enabling resiliency features, or investigating a commit that caused training hangs, straggler detection failures, or broken restarts; 'fault tolerance', 'straggler detection', 'hang detection', 'automatic restart', 'in-process restart', 'preemption', 'nvidia-resiliency-ext'.","main","87afe6ce96220accf50a345dea46784c8c9f210e","YYC3-Skills-技能包\u002FYYC3-Skills-技能包-skills\u002Fskills\u002Fnemo-mbridge-resiliency",0,"https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base","https:\u002F\u002Fkb.yyc3.top\u002F","https:\u002F\u002Fgithub.com\u002FYYC-Cube","万象归元于云枢 | 深栈智启新纪元","2026-11-10 10:37:32",{"source":8,"skillName":5,"commands":35,"prompt":45,"zipAvailable":46},[36,39,42],{"tool":37,"command":38},"npx","npx skills add YYC-Cube\u002FYYC3-Knowledge-Base --skill nemo-mbridge-resiliency",{"tool":40,"command":41},"bunx","bunx skills add YYC-Cube\u002FYYC3-Knowledge-Base --skill nemo-mbridge-resiliency",{"tool":43,"command":44},"pnpm","pnpm dlx skills add YYC-Cube\u002FYYC3-Knowledge-Base --skill nemo-mbridge-resiliency","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base\u002Fblob\u002Fmain\u002FYYC3-Skills-技能包\u002FYYC3-Skills-技能包-skills\u002Fskills\u002Fnemo-mbridge-resiliency\u002FSKILL.md",true,[48,54,58,62,66],{"path":49,"resourceType":50,"resourceTypeDesc":51,"sizeBytes":52,"sourceHtmlUrl":53},"BENCHMARK.md","REFERENCE","参考文档",4267,"https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base\u002Fblob\u002Fmain\u002FYYC3-Skills-技能包\u002FYYC3-Skills-技能包-skills\u002Fskills\u002Fnemo-mbridge-resiliency\u002FBENCHMARK.md",{"path":55,"resourceType":50,"resourceTypeDesc":51,"sizeBytes":56,"sourceHtmlUrl":57},"card.yaml",4910,"https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base\u002Fblob\u002Fmain\u002FYYC3-Skills-技能包\u002FYYC3-Skills-技能包-skills\u002Fskills\u002Fnemo-mbridge-resiliency\u002Fcard.yaml",{"path":59,"resourceType":50,"resourceTypeDesc":51,"sizeBytes":60,"sourceHtmlUrl":61},"evals\u002Fevals.json",1310,"https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base\u002Fblob\u002Fmain\u002FYYC3-Skills-技能包\u002FYYC3-Skills-技能包-skills\u002Fskills\u002Fnemo-mbridge-resiliency\u002Fevals\u002Fevals.json",{"path":63,"resourceType":50,"resourceTypeDesc":51,"sizeBytes":64,"sourceHtmlUrl":65},"skill-card.md",3896,"https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base\u002Fblob\u002Fmain\u002FYYC3-Skills-技能包\u002FYYC3-Skills-技能包-skills\u002Fskills\u002Fnemo-mbridge-resiliency\u002Fskill-card.md",{"path":67,"resourceType":68,"resourceTypeDesc":69,"sizeBytes":70,"sourceHtmlUrl":71},"skill.oms.sig","OTHER","其他",4809,"https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base\u002Fblob\u002Fmain\u002FYYC3-Skills-技能包\u002FYYC3-Skills-技能包-skills\u002Fskills\u002Fnemo-mbridge-resiliency\u002Fskill.oms.sig",[73,81,88,95,102,109],{"skillNo":74,"name":75,"nameZh":6,"description":76,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":77,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":19},"01M7CTDWHERCXPQCP0K03A86AS","vercel-sandbox","Run agent-browser + Chrome inside Vercel Sandbox microVMs for browser automation from any Vercel-deployed app. Use when the user needs browser automation in a Vercel app (Next.js, SvelteKit, Nuxt, Remix, Astro, etc.), wants to run headless Chrome without binary size limits, needs persistent browser sessions across commands, or wants ephemeral isolated browser environments. Triggers include \"Vercel Sandbox browser\", \"microVM Chrome\", \"agent-browser in sandbox\", \"browser automation on Vercel\", or any task requiring Chrome in a Vercel Sandbox.","MIT","https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base\u002Fblob\u002Fmain\u002FYYC3-WebSpec-Web标准\u002FYYC3-WebSpec-Web标准-standards\u002Fbrowser-agent\u002Fskills\u002Fvercel-sandbox\u002FSKILL.md",[],[],{"skillNo":82,"name":83,"nameZh":6,"description":84,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":77,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":19},"01M7CTD8D2BNJY54S65M47HEJA","slack","Interact with Slack workspaces using browser automation. Use when the user needs to check unread channels, navigate Slack, send messages, extract data, find information, search conversations, or automate any Slack task. Triggers include \"check my Slack\", \"what channels have unreads\", \"send a message to\", \"search Slack for\", \"extract from Slack\", \"find who said\", or any task requiring programmatic Slack interaction.","https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base\u002Fblob\u002Fmain\u002FYYC3-WebSpec-Web标准\u002FYYC3-WebSpec-Web标准-standards\u002Fbrowser-agent\u002Fskills\u002Fslack\u002FSKILL.md",[],[],{"skillNo":89,"name":90,"nameZh":6,"description":91,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":77,"licenseFileUrl":6,"sourceHtmlUrl":92,"categories":93,"keywords":94,"publishedAt":19},"01M7CTCSSB8ZP3Q58C3YZDZK1W","electron","Automate Electron desktop apps (VS Code, Slack, Discord, Figma, Notion, Spotify, etc.) using agent-browser via Chrome DevTools Protocol. Use when the user needs to interact with an Electron app, automate a desktop app, connect to a running app, control a native app, or test an Electron application. Triggers include \"automate Slack app\", \"control VS Code\", \"interact with Discord app\", \"test this Electron app\", \"connect to desktop app\", or any task requiring automation of a native Electron application.","https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base\u002Fblob\u002Fmain\u002FYYC3-WebSpec-Web标准\u002FYYC3-WebSpec-Web标准-standards\u002Fbrowser-agent\u002Fskills\u002Felectron\u002FSKILL.md",[],[],{"skillNo":96,"name":97,"nameZh":6,"description":98,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":77,"licenseFileUrl":6,"sourceHtmlUrl":99,"categories":100,"keywords":101,"publishedAt":19},"01M7CTCBJY76688V4DCZGWFHGQ","dogfood","Systematically explore and test a web application to find bugs, UX issues, and other problems. Use when asked to \"dogfood\", \"QA\", \"exploratory test\", \"find issues\", \"bug hunt\", \"test this app\u002Fsite\u002Fplatform\", or review the quality of a web application. Produces a structured report with full reproduction evidence -- step-by-step screenshots, repro videos, and detailed repro steps for every issue -- so findings can be handed directly to the responsible teams.","https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base\u002Fblob\u002Fmain\u002FYYC3-WebSpec-Web标准\u002FYYC3-WebSpec-Web标准-standards\u002Fbrowser-agent\u002Fskills\u002Fdogfood\u002FSKILL.md",[],[],{"skillNo":103,"name":104,"nameZh":6,"description":105,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":77,"licenseFileUrl":6,"sourceHtmlUrl":106,"categories":107,"keywords":108,"publishedAt":19},"01M7CTC4H0FFGVEAQR9PA4GA1A","agent-browser","Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling forms, clicking buttons, taking screenshots, extracting data, testing web apps, or automating any browser task. Triggers include requests to \"open a website\", \"fill out a form\", \"click a button\", \"take a screenshot\", \"scrape data from a page\", \"test this web app\", \"login to a site\", \"automate browser actions\", or any task requiring programmatic web interaction.","https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base\u002Fblob\u002Fmain\u002FYYC3-WebSpec-Web标准\u002FYYC3-WebSpec-Web标准-standards\u002Fbrowser-agent\u002Fskills\u002Fagent-browser\u002FSKILL.md",[],[],{"skillNo":110,"name":111,"nameZh":6,"description":112,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":77,"licenseFileUrl":6,"sourceHtmlUrl":113,"categories":114,"keywords":115,"publishedAt":19},"01M7CTBKVFYBG78FDSABSDJTTQ","shadcn","Manages shadcn components and projects — adding, searching, fixing, debugging, styling, and composing UI, including chat interfaces. Provides project context, component docs, and usage examples. Applies when working with shadcn\u002Fui, component registries, presets, --preset codes, or any project with a components.json file. Also triggers for \"shadcn init\", \"create an app with --preset\", \"switch to --preset\", and for building a design system or applying a DESIGN.md or brand spec to shadcn\u002Fui.","https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base\u002Fblob\u002Fmain\u002FYYC3-UI-界面组件\u002FYYC3-UI-界面组件-ui\u002Fskills\u002Fshadcn\u002FSKILL.md",[],[]]