#95 by GitHub stars

stas00/ml-engineering

Machine Learning Engineering Open Book

History

Review weekly changes to SKILL.md before updating. Dates mark the weeks in which we observed each version; checks apply to the recorded commits.

View weekly changes

SKILL.md

Week of Nov 2, 2026 · +0 / −0 lines

Before Network or broad shell → After Network or broad shell

adab2fa8732e → b601d543c998

Diff text is unavailable under the recorded licenses. Line counts and the GitHub link remain available.

Compare on GitHub

Week of Oct 26, 2026 · Line counts unavailable

Before Not checked yet → After Network or broad shell

First observation → adab2fa8732e

No earlier version was observed for comparison.

Compare on GitHub

skills/evaluate-cluster/SKILL.md

Week of Nov 2, 2026 · +0 / −0 lines

Before Network or broad shell → After Network or broad shell

adab2fa8732e → b601d543c998

Diff text is unavailable under the recorded licenses. Line counts and the GitHub link remain available.

Compare on GitHub

Week of Oct 26, 2026 · Line counts unavailable

Before Not checked yet → After Network or broad shell

First observation → adab2fa8732e

No earlier version was observed for comparison.

Compare on GitHub

skills/ml-engineering/SKILL.md

Week of Nov 2, 2026 · +0 / −0 lines

Before Instructions only → After Network or broad shell

adab2fa8732e → b601d543c998

Diff text is unavailable under the recorded licenses. Line counts and the GitHub link remain available.

Compare on GitHub

Week of Oct 26, 2026 · Line counts unavailable

Before Not checked yet → After Instructions only

First observation → adab2fa8732e

No earlier version was observed for comparison.

Compare on GitHub

View on GitHubAdd to my skills

Verified commit b601d543c9989c825883c2a12c40da490bee5dac

19.7kGitHub stars
38stars in 7 days
3skills in this repository
27commits in 30 days

Heat

5.6
  • Star growth, last 7 daysAhead of 51% of tracked repositories
  • Star growth, last 24 hoursAhead of 69% of tracked repositories
  • Rank movement, last 7 daysAhead of 68% of tracked repositories
  • Commits, last 30 daysAhead of 86% of tracked repositories
  • Accounts asking about it through MCP, last 7 daysNot available
  • Hot votes this weekAhead of 0% of tracked repositories

Heat never changes the order by stars, and sponsorship never touches it. How heat works

Stars over time

Aug 2, 2026Nov 6, 202619,672

Individual skills in this repository

How it works

When your agent uses it

What it loads into context

Frontmatter

0 tokens

Always available to the agent

SKILL.md

54 tokens

When the skill is activated

Reference documents

380,619 tokens

Loaded on request

Token counts are estimates. Scripts run separately; they are not counted as reference context.

The playbook

    Scripts executed separately

    • Makefile
    • build/check-links.py
    • build/check-new-links.sh
    • build/check-programs
    • build/check-redirects.py
    • build/check-style.py
    • build/check-table-width.py
    • build/cover/build_final_cover.py
    • build/fix-tables.py
    • build/mdbook/md-to-html.py
    • build/mdbook/mv-links.py
    • build/mdbook/preprocess-html-for-epub.py
    • build/mdbook/utils/build_utils.py
    • build/mdbook/utils/github_md_utils.py
    • compute/accelerator/benchmarks/mamf-finder-all-gpus.py
    • compute/accelerator/benchmarks/mamf-finder.py
    • debug/NicerTrace.py
    • debug/code/collective_mismatch.py
    • debug/code/collective_mismatch_analyze.py
    • debug/code/kernel_oob.py
    • debug/code/kernel_oob_gdb.py
    • debug/code/kernel_oob_prebuilt.py
    • debug/code/kernel_race.py
    • debug/code/see-mem-usage.py
    • debug/tiny-scripts/c4-en-10k.py
    • debug/tiny-scripts/cm4-synthetic-testing.py
    • debug/tiny-scripts/fsmt-make-super-tiny-model.py
    • debug/tiny-scripts/general-pmd-ds-unpack.py
    • debug/tiny-scripts/general-pmd-synthetic-testing.py
    • debug/tiny-scripts/idefics-make-tiny-model.py
    • debug/tiny-scripts/m4-ds-unpack.py
    • debug/tiny-scripts/mt5-make-tiny-model.py
    • debug/tiny-scripts/openwebtext-10k.py
    • debug/tiny-scripts/oscar-en-10k.py
    • debug/torch-distributed-gpu-test.py
    • debug/underflow_overflow.py
    • insights/when-to-upgrade-gpus/bench_decompose.py
    • insights/when-to-upgrade-gpus/bench_flash_attn.py
    • insights/when-to-upgrade-gpus/benchmark.py
    • insights/when-to-upgrade-gpus/install.sh
    • insights/when-to-upgrade-gpus/plot_results.py
    • insights/when-to-upgrade-gpus/run_sweep.sh
    • network/benchmarks/all_gather_object_vs_all_gather.py
    • network/benchmarks/all_gather_object_vs_all_reduce.py
    • network/benchmarks/all_reduce_bench.py
    • network/benchmarks/all_reduce_latency_comp.py
    • network/benchmarks/torch-dist-bench-pyxis.sbatch
    • network/benchmarks/torch-dist-bench.py
    • orchestration/slurm/cron-daily.slurm
    • orchestration/slurm/cron-hourly.slurm
    • orchestration/slurm/example.slurm
    • orchestration/slurm/launchers/accelerate-launcher.slurm
    • orchestration/slurm/launchers/lightning-launcher.slurm
    • orchestration/slurm/launchers/srun-launcher.slurm
    • orchestration/slurm/launchers/torchrun-launcher.slurm
    • orchestration/slurm/undrain-good-nodes.sh
    • storage/fio-json-extract.py
    • storage/fio-scan
    • storage/mmap-io-bench.py
    • testing/testing_utils.py
    • training/checkpoints/torch-checkpoint-convert-to-bf16
    • training/checkpoints/torch-checkpoint-shrink.py
    • training/fault-tolerance/fs-watchdog.py
    • training/fault-tolerance/fs-watchdog.slurm
    • training/fault-tolerance/slurm-status.py
    • training/fault-tolerance/slurm-status.slurm
    • training/performance/benchmarks/activation-memory-per-layer.py
    • training/performance/benchmarks/dataloader/num-workers-bench.py
    • training/performance/benchmarks/dataloader/pin-memory-non-block-bench.py
    • training/performance/benchmarks/matrix-shape/swiglu-maf-bench.py
    • training/performance/benchmarks/numa/numa-set-pynvml.py
    • training/performance/benchmarks/numa/numa-set.sh
    • training/performance/benchmarks/torch-compile-bench.py
    • training/performance/distributed/torch-dist-mem-usage.py
    • training/tools/main_process_first.py
    • training/tools/multi-gpu-non-interleaved-print.py
    • training/tools/printflock.py

    Files

    • .gitignoreasset1,984 bytes
    • LICENSE-CC-BY-SAasset20,131 bytes
    • Makefileruns3,625 bytes
    • README.mddoc9,539 bytes
    • SKILL.mdcore225 bytes
    • build/README.mddoc1,493 bytes
    • build/SESSION.mddoc88,899 bytes
    • build/check-links.pyruns4,463 bytes
    • build/check-new-links.shruns1,662 bytes
    • build/check-programsruns2,545 bytes
    • build/check-redirects.pyruns20,784 bytes
    • build/check-style.pyruns4,444 bytes
    • build/check-table-width.pyruns12,152 bytes
    • build/consistency-checks.mddoc9,361 bytes
    • build/cover/README.mddoc582 bytes
    • build/cover/build_final_cover.pyruns8,594 bytes
    • build/cover/sources/Machine-Learning-Engineering-art.pngasset416,042 bytes
    • build/fix-tables.pyruns11,285 bytes
    • build/linkcheckerrcasset211 bytes
    • build/mdbook/md-to-html.pyruns3,480 bytes
    • build/mdbook/mv-links.pyruns934 bytes
    • build/mdbook/preprocess-html-for-epub.pyruns5,736 bytes
    • build/mdbook/utils/build_utils.pyruns152 bytes
    • build/mdbook/utils/github_md_utils.pyruns7,416 bytes
    • build/prince_style.cssasset3,339 bytes
    • build/requirements.txtdoc60 bytes
    • chapters-md.txtdoc1,299 bytes
    • compute/README.mddoc240 bytes
    • compute/accelerator/README.mddoc129,402 bytes
    • compute/accelerator/amd/debug.mddoc11,491 bytes
    • compute/accelerator/amd/performance.mddoc600 bytes
    • compute/accelerator/benchmarks/README.mddoc37,251 bytes
    • compute/accelerator/benchmarks/mamf-finder-all-gpus.pyruns17,524 bytes
    • compute/accelerator/benchmarks/mamf-finder.pyruns115,762 bytes
    • compute/accelerator/images/8x-H100-node-Dell-PowerEdge-XE9680.pngasset395,518 bytes
    • compute/accelerator/images/maf-nvidia-amd-efficiency.pngasset78,662 bytes
    • compute/accelerator/images/nvidia-a100-matmul-tflops.pngasset164,527 bytes
    • compute/accelerator/images/nvidia-a100-spec.pngasset134,749 bytes
    • compute/accelerator/nvidia/debug.mddoc28,705 bytes
    • compute/accelerator/nvidia/images/dcgm-metrics.pngasset43,482 bytes
    • compute/cpu-memory/README.mddoc2,523 bytes
    • compute/cpu/README.mddoc6,424 bytes
    • contributors.mddoc1,580 bytes
    • courses/lesson-learned/README.mddoc41,679 bytes
    • courses/lesson-learned/lesson-learned-cover.pngasset3,178,428 bytes
    • courses/lesson-learned/lesson-learned-cover.promptasset2,328 bytes
    • debug/NicerTrace.pyruns9,469 bytes
    • debug/README.mddoc851 bytes
    • debug/code/collective_mismatch.pyruns495 bytes
    • debug/code/collective_mismatch_analyze.pyruns867 bytes
    • debug/code/kernel_oob.cuasset459 bytes
    • debug/code/kernel_oob.pyruns237 bytes
    • debug/code/kernel_oob_gdb.pyruns300 bytes
    • debug/code/kernel_oob_prebuilt.pyruns273 bytes
    • debug/code/kernel_race.cuasset513 bytes
    • debug/code/kernel_race.pyruns239 bytes
    • debug/code/see-mem-usage.pyruns4,950 bytes
    • debug/images/math-fp-discrepancy-outcome-lizard.pngasset689,964 bytes
    • debug/images/mem-profiler-llama-8b-ckpt-offload-cpu.pngasset427,834 bytes
    • debug/images/tensor-needle-in-a-hay-stack.pngasset32,098 bytes
    • debug/images/torch-mem-profile-mem-leak.pngasset189,562 bytes
    • debug/make-tiny-models-tokenizers-datasets.mddoc1,357 bytes
    • debug/nccl-performance-debug.mddoc79 bytes
    • debug/pytorch.mddoc239,060 bytes
    • debug/tiny-scripts/README.mddoc687 bytes
    • debug/tiny-scripts/c4-en-10k.pyruns2,622 bytes
    • debug/tiny-scripts/cm4-synthetic-testing.pyruns8,260 bytes
    • debug/tiny-scripts/fsmt-make-super-tiny-model.pyruns3,263 bytes
    • debug/tiny-scripts/general-pmd-ds-unpack.pyruns3,142 bytes
    • debug/tiny-scripts/general-pmd-synthetic-testing.pyruns6,837 bytes
    • debug/tiny-scripts/idefics-make-tiny-model.pyruns1,545 bytes
    • debug/tiny-scripts/m4-ds-unpack.pyruns3,553 bytes
    • debug/tiny-scripts/mt5-make-tiny-model.pyruns3,347 bytes
    • debug/tiny-scripts/openwebtext-10k.pyruns3,078 bytes
    • debug/tiny-scripts/oscar-en-10k.pyruns4,193 bytes
    • debug/tools.mddoc9,945 bytes
    • debug/torch-distributed-gpu-test.pyruns3,787 bytes
    • debug/torch-distributed-hanging-solutions.mddoc2,041 bytes
    • debug/underflow_overflow.mddoc288 bytes
    • debug/underflow_overflow.pyruns13,104 bytes
    • images/Machine-Learning-Engineering-SKILL.pngasset1,581,325 bytes
    • images/Machine-Learning-Engineering-book-cover-1275x1650.pngasset1,189,019 bytes
    • images/Machine-Learning-Engineering-book-cover-200x259.pngasset56,786 bytes
    • images/Machine-Learning-Engineering-book-cover.oraasset2,463,176 bytes
    • images/Machine-Learning-Engineering-book-cover.pdfasset2,002,489 bytes
    • images/Machine-Learning-Engineering-book-cover.pngasset318,841 bytes
    • images/Machine-Learning-Engineering-book-cover.svgasset1,754,255 bytes
    • inference/README.mddoc55,205 bytes
    • inference/images/github-vllm-stats-2024-08-24.pngasset87,581 bytes
    • inference/images/infer-kv-cache.pngasset100,403 bytes
    • inference/images/mha-gqa-mqa-mla.pngasset134,881 bytes
    • inference/images/softmax-temperature.pngasset64,911 bytes
    • insights/ai-battlefield.mddoc30,919 bytes
    • insights/how-to-choose-cloud-provider.mddoc34,971 bytes
    • insights/images/640px-Baureihe52Heizer.jpgasset58,603 bytes
    • insights/when-to-upgrade-gpus/README.mddoc39,591 bytes
    • insights/when-to-upgrade-gpus/bench_decompose.pyruns8,830 bytes
    • insights/when-to-upgrade-gpus/bench_flash_attn.pyruns1,823 bytes
    • insights/when-to-upgrade-gpus/benchmark.pyruns9,587 bytes
    • insights/when-to-upgrade-gpus/install.shruns4,663 bytes
    • insights/when-to-upgrade-gpus/plot_results.pyruns2,975 bytes
    • insights/when-to-upgrade-gpus/results_plot.pngasset197,132 bytes
    • insights/when-to-upgrade-gpus/run_sweep.shruns1,124 bytes
    • model-parallelism/README.mddoc87 bytes
    • network/README.mddoc153,026 bytes
    • network/benchmarks/README.mddoc57,048 bytes
    • network/benchmarks/all_gather_object_vs_all_gather.pyruns1,732 bytes
    • network/benchmarks/all_gather_object_vs_all_reduce.pyruns1,302 bytes
    • network/benchmarks/all_reduce_bench.pyruns898 bytes
    • network/benchmarks/all_reduce_latency_comp.pyruns3,365 bytes
    • network/benchmarks/images/all-reduce-bench-latency-8xh200.pngasset335,057 bytes
    • network/benchmarks/images/all-reduce-bench-plot-4n.pngasset330,720 bytes
    • network/benchmarks/images/all-reduce-bench-plot-8xh200.pngasset348,824 bytes
    • network/benchmarks/images/all-reduce-bench-profile-2gib.pngasset209,812 bytes
    • network/benchmarks/images/all-reduce-multi-node-bandwidth.pngasset137,296 bytes
    • network/benchmarks/images/torch-dist-bench-busbw-8xb200.pngasset608,562 bytes
    • network/benchmarks/images/torch-dist-bench-latency-8xb200.pngasset583,846 bytes
    • network/benchmarks/torch-dist-bench-pyxis.sbatchruns728 bytes
    • network/benchmarks/torch-dist-bench.pyruns48,493 bytes
    • network/comms.mddoc13,527 bytes
    • network/debug/README.mddoc20,080 bytes
    • network/images/all-reduce-bw-2025.pngasset157,333 bytes
    • network/images/all-reduce-collective.pngasset60,357 bytes
    • network/images/all-reduce-ring-chunk1.pngasset177,247 bytes
    • network/images/all-reduce-ring-chunk2.pngasset73,855 bytes
    • network/images/all-to-all-bw-2025.pngasset151,813 bytes
    • network/images/amd-infinity-arch-MI300X.pngasset264,498 bytes
    • network/images/broadcast-ring.pngasset64,457 bytes
    • network/images/ccgrid11-low-level-latency.pngasset251,943 bytes
    • network/images/ccgrid11-uni-direction-bandwidth.pngasset214,865 bytes
    • network/images/collective-all-gather-1.pngasset117,371 bytes
    • network/images/collective-all-gather-2.pngasset33,525 bytes
    • network/images/collective-all-reduce-1.pngasset66,403 bytes
    • network/images/collective-all-reduce-2.pngasset41,757 bytes
    • network/images/collective-all-to-all-1.pngasset62,088 bytes
    • network/images/collective-all-to-all.pngasset58,900 bytes
    • network/images/collective-broadcast-1.pngasset61,400 bytes
    • network/images/collective-broadcast-2.pngasset24,279 bytes
    • network/images/collective-gather-1.pngasset49,409 bytes
    • network/images/collective-gather-2.pngasset27,334 bytes
    • network/images/collective-reduce-1.pngasset43,953 bytes
    • network/images/collective-reduce-2.pngasset27,630 bytes
    • network/images/collective-reduce-scatter.pngasset68,898 bytes
    • network/images/collective-scatter-1.pngasset47,972 bytes
    • network/images/collective-scatter-2.pngasset28,292 bytes
    • network/images/nccl-all-reduce-scan-nvlstree.pngasset203,734 bytes
    • network/images/nccl-all-reduce-scan.pngasset413,813 bytes
    • orchestration/README.mddoc2,469 bytes
    • orchestration/kubernetes/README.mddoc2,582 bytes
    • orchestration/slurm/README.mddoc1,277 bytes
    • orchestration/slurm/admin.mddoc4,225 bytes
    • orchestration/slurm/cron-daily.slurmruns690 bytes
    • orchestration/slurm/cron-hourly.slurmruns692 bytes
    • orchestration/slurm/example.slurmruns2,190 bytes
    • orchestration/slurm/launchers/README.mddoc1,089 bytes
    • orchestration/slurm/launchers/accelerate-launcher.slurmruns3,055 bytes
    • orchestration/slurm/launchers/lightning-launcher.slurmruns2,152 bytes
    • orchestration/slurm/launchers/srun-launcher.slurmruns2,650 bytes
    • orchestration/slurm/launchers/torchrun-launcher.slurmruns2,775 bytes
    • orchestration/slurm/performance.mddoc3,693 bytes
    • orchestration/slurm/undrain-good-nodes.shruns1,880 bytes
    • orchestration/slurm/users.mddoc46,867 bytes
    • resources/README.mddoc7,808 bytes
    • skills/README.mddoc1,069 bytes
    • stabs/README.mddoc111 bytes
    • stabs/incoming.mddoc8,594 bytes
    • storage/README.mddoc64,813 bytes
    • storage/fio-json-extract.pyruns1,055 bytes
    • storage/fio-scanruns2,822 bytes
    • storage/mmap-io-bench.pyruns3,704 bytes
    • testing/README.mddoc32,783 bytes
    • testing/testing_utils.pyruns38,139 bytes
    • todo.mddoc11,781 bytes
    • training/README.mddoc1,101 bytes
    • training/checkpoints/README.mddoc577 bytes
    • training/checkpoints/torch-checkpoint-convert-to-bf16runs1,348 bytes
    • training/checkpoints/torch-checkpoint-shrink.pyruns3,312 bytes
    • training/datasets.mddoc2,557 bytes
    • training/dtype.mddoc12,293 bytes
    • training/emulate-multi-node.mddoc28,984 bytes
    • training/fault-tolerance/README.mddoc41,962 bytes
    • training/fault-tolerance/fs-watchdog.pyruns7,408 bytes
    • training/fault-tolerance/fs-watchdog.slurmruns614 bytes
    • training/fault-tolerance/slurm-status.pyruns6,213 bytes
    • training/fault-tolerance/slurm-status.slurmruns975 bytes
    • training/hparams.mddoc2,328 bytes
    • training/images/fp16-bf16-fp8.pngasset47,288 bytes
    • training/images/fp32-tf32-fp16-bf16.pngasset43,057 bytes
    • training/images/mixed-precision-fp16.pngasset140,509 bytes
    • training/instabilities/README.mddoc5,175 bytes
    • training/instabilities/images/bloom-176B-success.pngasset26,547 bytes
    • training/instabilities/images/idefics-80b-tr-190-01-image2text.pngasset52,589 bytes
    • training/instabilities/images/idefics-80b-tr-190-01-losses-2023-06-04.pngasset51,326 bytes
    • training/instabilities/images/idefics-80b-tr-190-01-spike-2023-05-27.pngasset19,478 bytes
    • training/instabilities/images/idefics-80b-tr-190-01-spike-recover-2023-05-30.pngasset25,808 bytes
    • training/instabilities/images/llama-7b-grokking-no-zoom.pngasset39,990 bytes
    • training/instabilities/images/llama-7b-grokking.pngasset52,129 bytes
    • training/instabilities/images/pre-bloom-104B-en-fail.pngasset35,744 bytes
    • training/instabilities/images/pre-bloom-tr1-13B-glitch-1-2.pngasset14,371 bytes
    • training/instabilities/images/pre-bloom-tr8-104B-glitch-1.pngasset18,601 bytes
    • training/instabilities/images/pre-bloom-tr8-104B-glitch-5.pngasset22,114 bytes
    • training/instabilities/images/pre-bloom-tr8-104B-glitch-7-10.pngasset22,063 bytes
    • training/instabilities/images/ptl-repeat-data-p1.pngasset39,661 bytes
    • training/instabilities/images/ptl-repeat-data-p2.pngasset26,141 bytes
    • training/instabilities/images/ptl-repeat-data-p3.pngasset43,889 bytes
    • training/instabilities/training-loss-patterns.mddoc10,937 bytes
    • training/model-parallelism/README.mddoc56,178 bytes
    • training/model-parallelism/images/all-reduce-reduce-scatter-all-gather.pngasset141,996 bytes
    • training/model-parallelism/images/deepspeed-ulysses-math.pngasset9,052 bytes
    • training/model-parallelism/images/deepspeed-ulysses.pngasset114,290 bytes
    • training/model-parallelism/images/dist-flash-attn.pngasset198,001 bytes
    • training/model-parallelism/images/parallelism-deepspeed-3d.pngasset22,806 bytes
    • training/model-parallelism/images/parallelism-flexflow.jpegasset350,725 bytes
    • training/model-parallelism/images/parallelism-gpipe-bubble.pngasset47,865 bytes
    • training/model-parallelism/images/parallelism-pp-dualpipe.pngasset104,951 bytes
    • training/model-parallelism/images/parallelism-sagemaker-interleaved-pipeline.pngasset20,982 bytes
    • training/model-parallelism/images/parallelism-tp-independent-gelu.pngasset5,846 bytes
    • training/model-parallelism/images/parallelism-tp-parallel_gemm.pngasset129,135 bytes
    • training/model-parallelism/images/parallelism-tp-parallel_self_attention.pngasset166,226 bytes
    • training/model-parallelism/images/parallelism-tp-parallel_shard_processing.pngasset101,490 bytes
    • training/model-parallelism/images/parallelism-zero-dp-pp.pngasset54,989 bytes
    • training/model-parallelism/images/parallelism-zero.pngasset162,554 bytes
    • training/performance/README.mddoc87,060 bytes
    • training/performance/benchmarks/activation-memory-per-layer.pyruns1,767 bytes
    • training/performance/benchmarks/dataloader/num-workers-bench.pyruns1,636 bytes
    • training/performance/benchmarks/dataloader/pin-memory-non-block-bench.pyruns2,156 bytes
    • training/performance/benchmarks/matrix-shape/swiglu-maf-bench.pyruns3,465 bytes
    • training/performance/benchmarks/numa/numa-set-pynvml.pyruns1,967 bytes
    • training/performance/benchmarks/numa/numa-set.shruns1,011 bytes
    • training/performance/benchmarks/torch-compile-bench.pyruns2,348 bytes
    • training/performance/distributed/torch-dist-mem-usage.pyruns3,395 bytes
    • training/performance/images/a100-server-hwloc.pngasset68,514 bytes
    • training/performance/images/attention-less-heads.pngasset107,777 bytes
    • training/performance/images/flash-attention.pngasset60,566 bytes
    • training/performance/images/tiling.pngasset122,838 bytes
    • training/performance/images/wave-quant.pngasset311,618 bytes
    • training/re-train-hub-models.mddoc2,541 bytes
    • training/reproducibility/README.mddoc13,926 bytes
    • training/tools/main_process_first.pyruns6,386 bytes
    • training/tools/multi-gpu-non-interleaved-print.pyruns1,202 bytes
    • training/tools/printflock.pyruns1,903 bytes

    No excerpt is shown for this license. Read the source on GitHub.

    View the complete source on GitHub

    Skills included

    • evaluate-cluster
    • ml-engineering

    Repository facts

    License
    CC-BY-SA-4.0
    Created
    Sep 2, 2020
    Last pushed
    Nov 4, 2026
    Forks
    1,302
    Open issues
    0
    Project activity
    Active

    Rank over the last 12 weeks

    Now #95 · best #84 · down 6 in 30 days

    1. #93 on Oct 25
    2. #93 from Oct 28 to Oct 29
    3. #94 on Oct 30
    4. #95 from Oct 31 to Nov 2
    5. #96 on Nov 3
    6. #95 since Nov 4
    17 earlier periods
    1. #77 on Aug 2
    2. #80 on Aug 7
    3. #81 on Aug 8
    4. #83 from Aug 9 to Aug 10
    5. #84 from Aug 11 to Aug 15
    6. #85 from Aug 16 to Aug 25
    7. #86 from Aug 26 to Aug 27
    8. #87 from Aug 28 to Sep 17
    9. #88 from Sep 18 to Sep 20
    10. #89 from Sep 21 to Oct 1
    11. #90 from Oct 2 to Oct 4
    12. #89 on Oct 5
    13. #88 on Oct 6
    14. #89 from Oct 7 to Oct 11
    15. #90 from Oct 12 to Oct 20
    16. #91 from Oct 21 to Oct 22
    17. #92 from Oct 23 to Oct 24

    Before you install

    Network or broad shell

    Automated signals, not a guarantee

    Checked Nov 6, 2026

    Not fully analyzed: some files were too long, unreadable or missing. This never lowers the level.

    Show 160 notes
    • images/Machine-Learning-Engineering-book-cover.svg:1 Analysis incomplete: file exceeds text byte budget
    • images/Machine-Learning-Engineering-book-cover.svg:4 Analysis incomplete: physical or joined line exceeds character limit
    • images/Machine-Learning-Engineering-book-cover.svg:2 Analysis incomplete: physical or joined line exceeds character limit
    • skills/evaluate-cluster/SKILL.md:1 Analysis incomplete: Referenced executable target unavailable; not analyzed
    • skills/evaluate-cluster/SKILL.md:1 Analysis incomplete: Referenced executable target unavailable; not analyzed
    • skills/evaluate-cluster/SKILL.md:1 Analysis incomplete: Referenced executable target unavailable; not analyzed
    • skills/evaluate-cluster/SKILL.md:1 Analysis incomplete: Referenced executable target unavailable; not analyzed
    • skills/evaluate-cluster/SKILL.md:1 Analysis incomplete: Referenced executable target unavailable; not analyzed
    • skills/evaluate-cluster/SKILL.md:1 Analysis incomplete: Referenced executable target unavailable; not analyzed
    • skills/evaluate-cluster/SKILL.md:1 Analysis incomplete: Referenced executable target unavailable; not analyzed
    • skills/evaluate-cluster/SKILL.md:1 Analysis incomplete: Referenced executable target unavailable; not analyzed
    • skills/evaluate-cluster/SKILL.md:1 Analysis incomplete: Referenced executable target unavailable; not analyzed
    • skills/evaluate-cluster/SKILL.md:1 Analysis incomplete: Referenced executable target unavailable; not analyzed
    • skills/evaluate-cluster/SKILL.md:1 Analysis incomplete: Referenced executable target unavailable; not analyzed
    • skills/evaluate-cluster/SKILL.md:1 Analysis incomplete: Referenced executable target unavailable; not analyzed
    • skills/evaluate-cluster/SKILL.md:1 Analysis incomplete: Referenced executable target unavailable; not analyzed
    • skills/evaluate-cluster/SKILL.md:1 Analysis incomplete: Referenced executable target unavailable; not analyzed
    • skills/evaluate-cluster/SKILL.md:1 Analysis incomplete: Referenced executable target unavailable; not analyzed
    • skills/evaluate-cluster/SKILL.md:1 Analysis incomplete: Referenced executable target unavailable; not analyzed
    • skills/evaluate-cluster/SKILL.md:1 Analysis incomplete: Referenced executable target unavailable; not analyzed
    Show all 1,616 signals by file

    .gitignore

    • Access to secretsline 117
      [Credential-related source omitted]

    Makefile

    • Executable scriptline 1
      Executable file
    • Dangerous shell operationline 70
      find . -name "*html" -exec rm {} \;

    README.md

    • Network accessline 11
      This repo is an ongoing brain dump of my experiences training Large Language Models (LLM) (and VLMs); a lot of the know-how I acquired while training the open-source [BLOOM-176B](https://huggingface.co/bigscience/bloom) model in 2022 and [I
    • Network accessline 56
      1. **[And more debugging](https://github.com/stas00/the-art-of-debugging)**
    • Network accessline 68
      I announce any significant updates on my twitter channel [https://twitter.com/StasBekman](https://twitter.com/StasBekman).
    • Network accessline 72
      You can download various ebook formats of this book: * [PDF](https://huggingface.co/stas/ml-engineering-book/resolve/main/Stas%20Bekman%20-%20Machine%20Learning%20Engineering.pdf?download=true)
    • Network accessline 73
      * [PDF](https://huggingface.co/stas/ml-engineering-book/resolve/main/Stas%20Bekman%20-%20Machine%20Learning%20Engineering.pdf?download=true)
    • Network accessline 74
      * [EPUB](https://huggingface.co/stas/ml-engineering-book/resolve/main/Stas%20Bekman%20-%20Machine%20Learning%20Engineering.epub?download=true)
    • Network accessline 79
      Thanks to HuggingFace for giving me permission to host my book's ebook formats at the [HF hub](https://huggingface.co/stas/ml-engineering-book).
    • Network accessline 89
      See also the companion skills: [The Art of Debugging](https://github.com/stas00/the-art-of-debugging/blob/master/SKILL.md) and [Stas' Python Cookbook](https://github.com/stas00/python-cookbook/blob/master/SKILL.md).
    • Network accessline 98
      - [Building resilient ML Engineering skills](https://www.youtube.com/watch?v=IBJUt9JPKHk) given on 2026-01-10 for the [GPU Mode community](https://github.com/gpu-mode). Only had time to discuss performance reality of accelerators, network a
    • Network accessline 102
      If you want to discuss something related to ML engineering this repo has the [community discussions](https://github.com/stas00/ml-engineering/discussions) available - so please don't hesitate to share your experience or start a new discussi
    • Network accessline 139
      Special thanks go to [Thom Wolf](https://github.com/thomwolf) who proposed that I lead the BLOOM-176B training back when I didn't know anything about large scale training. This was the project that catapulted me into the intense learning pr
    • Network accessline 141
      Recently, I continued expanding my knowledge and experience while training models and building scalable training/inference systems at [Contextual.AI](https://contextual.ai/) and I'm grateful for that opportunity to Aman and Douwe.
    • Network accessline 147
      If you found a bug, typo or would like to propose an improvement please don't hesitate to open an [Issue](https://github.com/stas00/ml-engineering/issues) or contribute a PR.
    • Network accessline 151
      - [The Art of Debugging Open Book](https://github.com/stas00/the-art-of-debugging) — methodologies and recipes for debugging Unix, Python and PyTorch programs.
    • Network accessline 152
      - [Stas' Python Cookbook](https://github.com/stas00/python-cookbook) — everyday Python and standard-library recipes.
    • Network accessline 166
      publisher = {Stasosphere Online Inc.},   journal = {GitHub repository},   url = {https://github.com/stas00/ml-engineering}
    • Network accessline 167
      journal = {GitHub repository},   url = {https://github.com/stas00/ml-engineering} }
    • Network accessline 168
      url = {https://github.com/stas00/ml-engineering}
    • Network accessline 174
      ✔ **Books:**  [Machine Learning Engineering](https://github.com/stas00/ml-engineering) |
    • Network accessline 175
      [Machine Learning Engineering](https://github.com/stas00/ml-engineering) |
    • Network accessline 176
      [The Art of Debugging](https://github.com/stas00/the-art-of-debugging) |
    • Network accessline 177
      [Stas' Python Cookbook](https://github.com/stas00/python-cookbook)
    • Network accessline 179
      ✔ **Applications:**  [ipyexperiments](https://github.com/stas00/ipyexperiments)
    • Network accessline 180
      [ipyexperiments](https://github.com/stas00/ipyexperiments)
    • Network accessline 182
      ✔ **Tools and Cheatsheets:**  [bash](https://github.com/stas00/bash-tools) |
    • Network accessline 183
      [bash](https://github.com/stas00/bash-tools) |
    • Network accessline 184
      [conda](https://github.com/stas00/conda-tools) |
    • Network accessline 185
      [git](https://github.com/stas00/git-tools) |
    • Network accessline 186
      [jupyter-notebook](https://github.com/stas00/jupyter-notebook-tools) |
    • Network accessline 187
      [make](https://github.com/stas00/make-tools) |
    • Network accessline 188
      [python](https://github.com/stas00/python-tools) |
    • Network accessline 189
      [tensorboard](https://github.com/stas00/tensorboard-tools) |
    • Network accessline 190
      [unix](https://github.com/stas00/unix-tools)
    • Network accessline 192
      ✔ **Other Machine Learning:**  [ML ways](https://github.com/stas00/ml-ways) |
    • Network accessline 193
      [ML ways](https://github.com/stas00/ml-ways) |
    • Network accessline 194
      [Porting](https://github.com/stas00/porting)

    SKILL.md

    • Network accessline 5
      Canonical URL: https://github.com/stas00/ml-engineering/blob/master/skills/ml-engineering/SKILL.md

    build/README.md

    • Network accessline 14
      2. Download the free version of [Prince XML](https://www.princexml.com/download/). It's used to build the pdf version of this book.

    build/SESSION.md

    • Dangerous shell operationline 73
      9. A measurement's provenance belongs in the book; the run's setup does not. What tool version, what flags, what hardware, what date - that is provenance, and a reader needs it to judge the number. That the package was missing and had to be
    • Network accessline 236
      wget --user-agent="Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:39.0) Gecko/20100101 Firefox/39.0" URL
    • Network accessline 239
      10. A guessed URL that returns a page is not necessarily the page you wanted - check the title and body before quoting it. If a guess lands on a listing or tag page, follow the site's own links, or read its `/specifications`-style index, to
    • Network accessline 240
      11. **Do not propose adding an unmaintained GitHub repository** (archived, README says "not actively maintained" / "research artifact only", last meaningful commit years stale with no successor named). Prefer the live successor when one exi
    • Network accessline 257
      9. A `000` result is bot mitigation, not death - `amd.com`, `hpe.com`, `microsoft.com` and `nasa.gov` all reject a bare client. Confirm with the browser user-agent recipe in `Sources and citations` item 9 before calling anything dead. 10. W
    • Network accessline 258
      10. Watch the URL extractor itself. Markdown wraps URLs in ways that corrupt a naive regex: a closing paren ends the match, so `Hopper_(microarchitecture)` truncates and then 404s, and a URL inside backticks picks the backtick up as its tai
    • Network accessline 259
      11. Two moves are invisible to an HTTP check, and `build/check-redirects.py` now reports both. A **`<meta http-equiv="refresh">`** is markup rather than a status, so `curl -L` does not follow it and the stale URL answers `200` forever. Conc

    build/check-links.py

    • Executable scriptline 1
      #!/usr/bin/env python3
    • Network accessline 17
      # network. But one defect is detectable locally and cheaply, so it is caught on every run: a URL # wrapped into another URL. An archive citation legitimately carries two schemes # (web.archive.org/web/<ts>/https://original), so three or mor
    • Network accessline 18
      # wrapped into another URL. An archive citation legitimately carries two schemes # (web.archive.org/web/<ts>/https://original), so three or more means a replacement was applied to a # URL that was a substring of a longer one. Concrete near-
    • Network accessline 19
      # (web.archive.org/web/<ts>/https://original), so three or more means a replacement was applied to a

    build/check-new-links.sh

    • Executable scriptline 1
      #!/usr/bin/env bash
    • Network accessline 25
      for url in "$@"; do     case "$url" in         http://*|https://*) ;;
    • Network accessline 26
      case "$url" in         http://*|https://*) ;;         *)
    • Network accessline 27
      http://*|https://*) ;;
    • Network accessline 57
      if result=$(curl "${curl_args[@]}" "$url" 2>&1); then
    • Network accessline 58
      printf 'LIVE %s -> %s\n' "$url" "$result"     elif result=$(curl --http1.1 "${curl_args[@]}" "$url" 2>&1); then         printf 'LIVE %s -> %s\n' "$url" "$result"
    • Network accessline 59
      elif result=$(curl --http1.1 "${curl_args[@]}" "$url" 2>&1); then

    build/check-programs

    • Executable scriptline 1
      #!/usr/bin/env bash

    build/check-redirects.py

    • Executable scriptline 1
      #!/usr/bin/env python3
    • Network accessline 8
      Two mechanisms are checked. HTTP redirects, which curl follows for us, and <meta refresh>,
    • Network accessline 61
      # A <meta http-equiv="refresh"> is a redirect that curl does not follow, because it is markup
    • Network accessline 124
      u = re.sub(r'^(https://github\.com/[^/]+/[^/]+)\.git$', r'\1', u)
    • Network accessline 151
      try:         r = subprocess.run(['curl', '-sL', '--max-time', '20', '-A', BROWSER_UA,
    • Network accessline 152
      r = subprocess.run(['curl', '-sL', '--max-time', '20', '-A', BROWSER_UA,
    • Network accessline 203
      """curl never sends the #fragment, so `final` always lacks it. Carry it over, or a naive

    build/check-style.py

    • Executable scriptline 1
      #!/usr/bin/env python3

    build/check-table-width.py

    • Executable scriptline 1
      #!/usr/bin/env python3
    • Network accessline 247
      ("|[" + "n" * 20 + "](https://example.com/" + "n" * 80 + ")|\n|---|\n|x|", False),

    build/cover/build_final_cover.py

    • Executable scriptline 1
      #!/usr/bin/env python3
    • Network accessline 104
      return (         '<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n'         '<svg xmlns="http://www.w3.org/2000/svg" '
    • Network accessline 105
      '<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n'         '<svg xmlns="http://www.w3.org/2000/svg" '         'xmlns:xlink="http://www.w3.org/1999/xlink" '
    • Network accessline 106
      '<svg xmlns="http://www.w3.org/2000/svg" '
    • Network accessline 107
      'xmlns:xlink="http://www.w3.org/1999/xlink" '
    • Network accessline 108
      'xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" '

    build/fix-tables.py

    • Executable scriptline 1
      #!/usr/bin/env python

    build/linkcheckerrc

    • Network accessline 1
      # rtfm https://linkchecker.github.io/linkchecker/man/linkcheckerrc.html

    build/mdbook/md-to-html.py

    • Executable scriptline 1
      Executable file
    • Network accessline 19
      my_repo_url = "https://github.com/stas00/ml-engineering/blob/master"
    • Network accessline 48
      with open(cover_md_file, "w") as f:         f.write(f"""         PDF Conversion was done with https://www.princexml.com
    • Network accessline 49
      f.write(f"""         PDF Conversion was done with https://www.princexml.com <div class="page_break"></div>
    • Network accessline 50
      PDF Conversion was done with https://www.princexml.com
    • Network accessline 55
      This is an ebook version of [Machine Learning Engineering Open Book by Stas Bekman](https://github.com/stas00/ml-engineering/) generated on {date}.
    • Network accessline 57
      As this book is constantly being updated, if you downloaded it as a pdf or an epub file and the date isn't recent, chances are that it's already outdated - make sure to check the latest version at [https://github.com/stas00/ml-engineering](

    build/mdbook/mv-links.py

    • Executable scriptline 1
      Executable file

    build/mdbook/preprocess-html-for-epub.py

    • Executable scriptline 1
      #!/usr/bin/env python3

    build/mdbook/utils/build_utils.py

    • Executable scriptline 1
      Executable file

    build/mdbook/utils/github_md_utils.py

    • Executable scriptline 1
      Executable file
    • Network accessline 115
      # - empty links (i.e. just local anchor to the same doc)     # - skip explicit .md links     # - external links like https://...
    • Network accessline 117
      # - external links like https://...
    • Network accessline 150
      # skip:     # - empty links (i.e. just local anchor to the same doc)     # - external links like https://...
    • Network accessline 152
      # - external links like https://...
    • Network accessline 241
      # # run to test some of these utils     # para = 'bb [Markdown text](foo.md#tar) aaa bb [Markdown text2](foo/#bar) aaa [Markdown text3](http://ex.com/foo/#bar)'
    • Network accessline 242
      # para = 'bb [Markdown text](foo.md#tar) aaa bb [Markdown text2](foo/#bar) aaa [Markdown text3](http://ex.com/foo/#bar)'

    build/prince_style.css

    • Network accessline 1
      /*   CSS style sheet for prince html2pdf system (http://www.princexml.com/)
    • Network accessline 2
      CSS style sheet for prince html2pdf system (http://www.princexml.com/)
    • Network accessline 6
      prince --no-author-style -s prince_style.css http://en.wikipedia.org/wiki/Winter_war -o foo.pdf
    • Network accessline 9
      @import url(http://www.princexml.com/fonts/gentium/index.css);

    compute/accelerator/README.md

    • Network accessline 5
      There exist two main ML workloads - training and inference. There is also the finetuning workload which is usually the same as training, unless a much lighter [LORA-style](https://arxiv.org/abs/2106.09685) finetuning is performed. The latte
    • Network accessline 100
      [Additional glossary @ Modal](https://modal.com/gpu-glossary)
    • Network accessline 128
      [source](https://www.nvidia.com/en-us/data-center/a100/)
    • Network accessline 134
      This is one of the key characteristics that the accelerators are judged by. The term TFLOPS defines how many trillions of FloatingPointOperations the chip can perform in a second. The more the better. There is a different definition for dif
    • Network accessline 157
      [source](https://developer.nvidia.com/blog/cuda-11-features-revealed/)
    • Network accessline 178
      First, let's extract the necessary accelerator specs from [wiki](https://en.wikipedia.org/wiki/Hopper_(microarchitecture)#H100_accelerator_and_DGX_H100).
    • Network accessline 180
      The tricky part was to find the FMAs ops per Tensor Core per clock cycle for BF16 (half precision). I found them [here](https://forums.developer.nvidia.com/t/how-to-calculate-the-tensor-core-fp16-performance-of-h100/244727/2). Most are comi
    • Network accessline 296
      1. [Google Cloud TPU v5e documentation](https://docs.cloud.google.com/tpu/docs/v5e)
    • Network accessline 297
      2. [Google Cloud TPU v4 documentation](https://docs.cloud.google.com/tpu/docs/v4)
    • Network accessline 298
      3. Oddly NVIDIA A100 PCIe and SXM revisions [spec](https://www.nvidia.com/en-us/data-center/a100/) are reported to have the same TFLOPS, which is odd considering the SXM version uses 30% more power and uses a 5% faster HBM.
    • Network accessline 299
      4. [NVIDIA A100 specifications](https://www.nvidia.com/en-us/data-center/a100/) - covers both the SXM and PCIe rows
    • Network accessline 300
      5. [AMD Instinct MI250 specifications](https://www.amd.com/en/products/accelerators/instinct/mi200/mi250.html)
    • Network accessline 301
      6. [NVIDIA L40S specifications](https://www.nvidia.com/en-us/data-center/l40s/)
    • Network accessline 302
      7. [AMD Instinct MI250X specifications](https://www.amd.com/en/products/accelerators/instinct/mi200/mi250x.html)
    • Network accessline 303
      8. Intel Gaudi2 and 3 only have partial TFLOPS [specs](https://www.intel.com/content/www/us/en/content-details/817486/intel-gaudi-3-ai-accelerator-white-paper.html) published, but it does support FP32, TF32, BF16, FP16 & FP8, INT8 and INT16
    • Network accessline 304
      9. [Intel Gaudi 2 AI accelerator white paper](https://www.intel.com/content/www/us/en/content-details/839363/intel-gaudi-2-ai-accelerators-white-paper.html)
    • Network accessline 305
      10. [Google Cloud TPU v5p documentation](https://docs.cloud.google.com/tpu/docs/v5p)
    • Network accessline 306
      11. Trainium2 also supports FP8/FP16/BF16/TF32 @ 2563TFLOPS w/ 4:1 sparsity. See [AWS Trainium2 architecture documentation](https://awsdocs-neuron.readthedocs-hosted.com/en/latest/about-neuron/arch/neuron-hardware/trainium2.html).
    • Network accessline 307
      12. [NVIDIA H100 specifications](https://www.nvidia.com/en-us/data-center/h100/) - covers both the SXM and PCIe rows
    • Network accessline 308
      13. [Google Cloud TPU v6e documentation](https://docs.cloud.google.com/tpu/docs/v6e)
    • Network accessline 309
      14. GH200 - same note as GB200 - this is 2 GPUs in one package, so the table includes specs per chip w/o sparsity. See [NVIDIA GH200 Grace Hopper Superchip specifications](https://www.nvidia.com/en-us/data-center/grace-hopper-superchip/).
    • Network accessline 310
      15. I didn't include `NVIDIA H100 dual NVL` as it's, well, 2x GPUs - so it won't be fair - it's the same FLOPS as H100 but 2x everything, plus at has a bit more memory (94GiB per chip, as compared to 80GiB H100) and the memory is a bit fast
    • Network accessline 311
      16. H200 is the same as H100 but has 141GiB vs 80GiB of HBM memory, and its memory is faster, HBMe@4.8TBps vs HBM@3.35TBps - so basically H200 solves the memory-bandwidth and memory-capacity bottlenecks of H100. See [NVIDIA H200 specificati
    • Network accessline 312
      17. [AMD Instinct MI300X specifications](https://www.amd.com/en/products/accelerators/instinct/mi300/mi300x.html)
    • Network accessline 313
      18. MI325X is the same compute as MI300X, but has more memory and more power (more efficient compute). See [AMD Instinct MI325X specifications](https://www.amd.com/en/products/accelerators/instinct/mi300/mi325x.html).
    • Network accessline 314
      19. Gaudi3 as of 2026-08 is running at 1600MHz (MME) and not the planned 1750MHz, therefore its BF16 TFLOPS are 1677 and not 1835 as per whitepaper spec. Same goes for fp8 which runs at the same TFLOPS as BF16. 20. [NVIDIA DGX B200 datashee
    • Network accessline 315
      20. [NVIDIA DGX B200 datasheet](https://resources.nvidia.com/en-us-dgx-systems/dgx-b200-datasheet) - `FP4 Tensor Core: 144|72` petaFLOPS sparse|dense for 8 GPUs, so 9000 dense per GPU; the [HGX page](https://www.nvidia.com/en-us/data-center
    • Network accessline 316
      21. [NVIDIA DGX B300 datasheet](https://resources.nvidia.com/en-us-dgx-systems/dgx-b300-datasheet) - `FP4 Tensor Core 144|108` PFLOPS sparse|dense for 8 GPUs, so 13500 dense per GPU, the "1.5x dense FP4" over B200 the datasheet advertises; 
    • Network accessline 317
      22. [AMD Instinct MI355X specifications](https://www.amd.com/en/products/accelerators/instinct/mi350/mi355x.html) - these are AMD's dense figures. AMD also publishes `with Structured Sparsity` variants at exactly 2x - 10.1PFLOPS for OCP-FP8
    • Network accessline 318
      23. Since GB200 is 2x B200 chips the table includes TFLOPS per chip for a fair comparison - you'd 2x it for the real GB200 - it also seems to run the B200 chips a bit faster so higher specs than standalone B200. This also means that instead
    • Network accessline 319
      24. GB200 NVL72 and GB300 NVL72 seem to be the same but faster fp4 and more memory for the latter. See [NVIDIA GB300 NVL72 specifications](https://www.nvidia.com/en-us/data-center/gb300-nvl72/).
    • Network accessline 320
      25. [Google Cloud TPU v7x documentation](https://docs.cloud.google.com/tpu/docs/tpu7x) - Google calls it "the latest TPU available on Google Cloud" and documents using it through GKE or Compute Engine, so it is treated as available like eve
    • Network accessline 321
      26. [NVIDIA Vera Rubin NVL72 specifications](https://www.nvidia.com/en-us/data-center/vera-rubin-nvl72/) - pre-release, so these are announced figures rather than a shipped part's spec sheet
    • Network accessline 322
      27. AMD's MI455X figures come from its [product page](https://www.amd.com/en/products/accelerators/instinct/mi400/mi455x.html), read on 2026-08-06. `fp32` 315, `fp16` 5000, `bf16` 5000 and `int8` 5000 are AMD's own dense numbers. `fp8`, `fp
    • Network accessline 323
      28. Ascend 950DT figures are from the Atlas 950 SuperPoD product-spec table on [Ascend Community](https://www.hiascend.com/en/hardware/cluster?tag=950) (read 2026-08-10): `114.1 / 58.8 / 31.1` PFLOPS @ `mxFP4` / `mxFP8/HiF8` / `FP16/BF16` f
    • Network accessline 324
      29. H200 NVL is the PCIe card version of the H200: the same chip and the same 141GB of HBM3e at 4.8TBps as the H200 SXM, but with a 600W power limit instead of 700W, and NVIDIA rates its compute about 16% lower. The `tf32`, `fp16`, `bf16`, 
    • Network accessline 325
      30. Intel GPU D270 (code-named Crescent Island) is the first product in Intel's Xe3P-based GPU D-series - an inference-only data-center accelerator (32 Xe3P cores, 256 XMX matrix engines, 32MB L2), announced at OCP 2026 (2026-10-12) with cu
    • Network accessline 417
      6. NVIDIA B200 SXM, BF16: MAMF ~274–300 W @ 1965 MHz; MSMF 1439 @ 3072x18944x4608, ~978–987 W @ 1399–1443 MHz, 61–74°C 7. AMD MI355X, BF16: `PYTORCH_TUNABLEOP_ENABLED=0` 8. AMD MI350X, BF16: `PYTORCH_TUNABLEOP_ENABLED=1`, 1000 W; the `amdsm
    • Network accessline 418
      7. AMD MI355X, BF16: `PYTORCH_TUNABLEOP_ENABLED=0` 8. AMD MI350X, BF16: `PYTORCH_TUNABLEOP_ENABLED=1`, 1000 W; the `amdsmi` sample of ~340 W @ 2181 MHz lags the MAMF burst, as on MI300X (note 10); MSMF 1195 @ 4096x4096x8192, 1000 W, 74–100°
    • Network accessline 419
      8. AMD MI350X, BF16: `PYTORCH_TUNABLEOP_ENABLED=1`, 1000 W; the `amdsmi` sample of ~340 W @ 2181 MHz lags the MAMF burst, as on MI300X (note 10); MSMF 1195 @ 4096x4096x8192, 1000 W, 74–100°C. This node's cooling limited its MSMF: the 4 GPUs
    • Network accessline 420
      9. AMD MI325X, BF16: `PYTORCH_TUNABLEOP_ENABLED=1`, `numa_balancing=0`, 1000 W. MSMF 787 @ 9216x9728x8192, 1000 W @ 1577 MHz, 73°C. 10. AMD MI300X, BF16: `PYTORCH_TUNABLEOP_ENABLED=1`, 750 W; MAMF is not a boost burst - the card reaches its
    • Network accessline 421
      10. AMD MI300X, BF16: `PYTORCH_TUNABLEOP_ENABLED=1`, 750 W; MAMF is not a boost burst - the card reaches its 750 W cap within the first ~4 ms kernel, and the `amdsmi` sample of ~198 W @ 2088 MHz lags it and reads close to idle (~180 W @ 209
    • Network accessline 423
      12. NVIDIA H200 SXM, FP8: MAMF ~154–163 W @ 1980 MHz; MSMF 1354 @ 1536x2816x10240, ~683–689 W @ 1767–1848 MHz, 63–72°C 13. NVIDIA B200 SXM, FP8: MAMF ~270–312 W @ 1965 MHz; MSMF 2788 @ 3072x18944x6144, ~975–982 W @ 1399–1447 MHz, 61–73°C 14
    • Network accessline 424
      13. NVIDIA B200 SXM, FP8: MAMF ~270–312 W @ 1965 MHz; MSMF 2788 @ 3072x18944x6144, ~975–982 W @ 1399–1447 MHz, 61–73°C 14. AMD MI300X, FP8: `float8_e4m3fnuz`, `PYTORCH_TUNABLEOP_ENABLED=1`, 750 W; MAMF is not a boost burst, as in note 10; M
    • Network accessline 425
      14. AMD MI300X, FP8: `float8_e4m3fnuz`, `PYTORCH_TUNABLEOP_ENABLED=1`, 750 W; MAMF is not a boost burst, as in note 10; MSMF 1182 @ 8192x4864x4096, 750 W @ 1322–1378 MHz, 73–86°C. Measured by [Amy Sartran](https://github.com/stas00/ml-engin
    • Network accessline 444
      - Rows are not always exactly comparable with each other. Each is the best shape found for *that* accelerator, and often on a different `torch`/CUDA or ROCm version, so any gap between two rows mixes hardware, shape and software. But it's a
    • Network accessline 445
      - Of the rows with an MSMF, H200, B200 and A100 PCIe were measured with benchmark version 4 of `mamf-finder.py` (the report header prints it), and B300 and MI300X with an earlier version that defined both headlines differently, so compare t
    • Network accessline 446
      - MI325X was measured on 2026-10-05 with the unchanged version 4 finder at [`30ddd970`](https://github.com/stas00/ml-engineering/commit/30ddd97054eb01035c0a5079a58f011df603b525), with siblings idle. These are best-MAMF single-run pairs, not
    • Network accessline 457
      update: this new metric is starting to catch on. AMD published this graph and [explanations of why the efficiency of accelerators is going down as they get faster](https://rocm.blogs.amd.com/software-tools-optimization/Understanding_Peak_an
    • Network accessline 461
      [source](https://rocm.blogs.amd.com/software-tools-optimization/Understanding_Peak_and_Max-Achievable_FLOPS/README.html)
    • Network accessline 506
      The accelerators use [High Bandwidth Memory](https://en.wikipedia.org/wiki/High_Bandwidth_Memory) (HBM) which is a 3D version of SDRAM memory. For example, the 80GiB A100-SXM comes with HBM2e at 2.0TBps, and the 80GiB H100-SXM comes with HB
    • Network accessline 521
      - While I was researching this table I found a wide variation of the above numbers. I think it's because either there were different implementations or the specs changed several times and different publications caught different specs. The t
    • Network accessline 575
      * The listed sizes preserve vendor-published `GB` labels. As of 2026-07-29, NVIDIA's [HGX AI Factory components](https://docs.nvidia.com/enterprise-reference-architectures/hgx-ai-factory/latest/components.html) page lists B200 at 180GB, and
    • Network accessline 577
      * The `NVIDIA Rubin SXM` row is the standard Rubin GPU (the `288`GB HBM4 part, sometimes called `R200`). `19.20 TBps` is NVIDIA's current per-GPU figure on the [Vera Rubin NVL72](https://www.nvidia.com/en-us/data-center/vera-rubin-nvl72/) s
    • Network accessline 636
      1. AMD MI350X / MI355X [cache specification](https://rocm.docs.amd.com/projects/ai-ecosystem/en/latest/optimization/workload-optimization.html) and [announcement](https://newsroom.amd.com/news/amd-unveils-vision-for-an-open-ai-ecosystem-det
    • Network accessline 637
      2. AMD MI300X / MI325X [cache specification](https://rocm.docs.amd.com/projects/ai-ecosystem/en/latest/optimization/workload-optimization.html) and [announcement](https://www.amd.com/en/newsroom/press-releases/2024-10-10-amd-delivers-leader
    • Network accessline 638
      3. [AMD Instinct MI455X specifications and announcement](https://www.amd.com/en/products/accelerators/instinct/mi400/mi455x.html)
    • Network accessline 639
      4. NVIDIA Blackwell [cache specification](https://docs.nvidia.com/cuda/blackwell-tuning-guide/index.html) and [announcement](https://nvidianews.nvidia.com/news/nvidia-blackwell-platform-arrives-to-power-a-new-era-of-computing)
    • Network accessline 640
      5. Intel Gaudi3 [cache specification](https://www.intel.com/content/www/us/en/content-details/817486/intel-gaudi-3-ai-accelerator-white-paper.html) and [announcement](https://newsroom.intel.com/artificial-intelligence/vision-2024-enterprise
    • Network accessline 641
      6. NVIDIA Hopper [cache specification](https://docs.nvidia.com/cuda/hopper-tuning-guide/index.html) and [announcement](https://nvidianews.nvidia.com/news/nvidia-announces-dgx-h100-systems-worlds-most-advanced-enterprise-ai-infrastructure)
    • Network accessline 642
      7. NVIDIA Ampere [cache specification](https://docs.nvidia.com/cuda/ampere-tuning-guide/index.html) and [announcement](https://nvidianews.nvidia.com/news/nvidias-new-ampere-data-center-gpu-in-full-production)
    • Network accessline 659
      1. [AMD Instinct MI455X specifications and announcement](https://www.amd.com/en/products/accelerators/instinct/mi400/mi455x.html)
    • Network accessline 660
      2. AMD MI350X / MI355X [cache specification](https://rocm.docs.amd.com/projects/ai-ecosystem/en/latest/optimization/workload-optimization.html) and [announcement](https://newsroom.amd.com/news/amd-unveils-vision-for-an-open-ai-ecosystem-det
    • Network accessline 661
      3. AMD MI300X / MI325X [cache specification](https://rocm.docs.amd.com/projects/ai-ecosystem/en/latest/optimization/workload-optimization.html) and [announcement](https://www.amd.com/en/newsroom/press-releases/2024-10-10-amd-delivers-leader
    • Network accessline 662
      4. Intel Gaudi3 [cache specification](https://www.intel.com/content/www/us/en/content-details/817486/intel-gaudi-3-ai-accelerator-white-paper.html) and [announcement](https://newsroom.intel.com/artificial-intelligence/vision-2024-enterprise
    • Network accessline 663
      5. Intel Gaudi2 [architecture specification](https://docs.habana.ai/en/latest/Gaudi_Overview/Gaudi_Architecture.html) and [announcement](https://www.intel.com/content/www/us/en/developer/articles/technical/habana-gaudi2-processor-for-deep-l
    • Network accessline 664
      6. NVIDIA Blackwell [cache specification](https://docs.nvidia.com/cuda/blackwell-tuning-guide/index.html) and [announcement](https://nvidianews.nvidia.com/news/nvidia-blackwell-platform-arrives-to-power-a-new-era-of-computing)
    • Network accessline 665
      7. NVIDIA Hopper [cache specification](https://docs.nvidia.com/cuda/hopper-tuning-guide/index.html) and [announcement](https://nvidianews.nvidia.com/news/nvidia-announces-dgx-h100-systems-worlds-most-advanced-enterprise-ai-infrastructure)
    • Network accessline 666
      8. NVIDIA Ampere [cache specification](https://docs.nvidia.com/cuda/ampere-tuning-guide/index.html) and [announcement](https://nvidianews.nvidia.com/news/nvidias-new-ampere-data-center-gpu-in-full-production)
    • Network accessline 689
      1. [AMD Instinct MI300 Series / MI350 Series workload optimization](https://rocm.docs.amd.com/projects/ai-ecosystem/en/latest/optimization/workload-optimization.html)
    • Network accessline 690
      2. [Intel Gaudi architecture](https://docs.habana.ai/en/latest/Gaudi_Overview/Gaudi_Architecture.html)
    • Network accessline 691
      3. [Intel Gaudi3 white paper](https://www.intel.com/content/www/us/en/content-details/817486/intel-gaudi-3-ai-accelerator-white-paper.html)
    • Network accessline 692
      4. [NVIDIA Ampere Tuning Guide](https://docs.nvidia.com/cuda/ampere-tuning-guide/index.html)
    • Network accessline 693
      5. [NVIDIA Blackwell Tuning Guide](https://docs.nvidia.com/cuda/blackwell-tuning-guide/index.html)
    • Network accessline 694
      6. [NVIDIA Hopper Tuning Guide](https://docs.nvidia.com/cuda/hopper-tuning-guide/index.html)
    • Network accessline 695
      7. [NVIDIA Hopper architecture white paper](https://resources.nvidia.com/en-us-hopper-architecture/nvidia-h100-tensor-c)
    • Network accessline 696
      8. [NVIDIA H200 specifications](https://www.nvidia.com/en-us/data-center/h200/)
    • Network accessline 719
      Also known as [clock rate](https://en.wikipedia.org/wiki/Clock_rate) this spec tells us at which frequency the card runs. As hardware becomes faster newer generations will typically increase the clock speed.
    • Network accessline 761
      1. [AMD Instinct MI355X specifications](https://www.amd.com/en/products/accelerators/instinct/mi350/mi355x.html)
    • Network accessline 762
      2. [AMD Instinct MI455X specifications](https://www.amd.com/en/products/accelerators/instinct/mi400/mi455x.html)
    • Network accessline 763
      3. [AMD Instinct MI300X specifications](https://www.amd.com/en/products/accelerators/instinct/mi300/mi300x.html)
    • Network accessline 764
      4. [AMD Instinct MI325X specifications](https://www.amd.com/en/products/accelerators/instinct/mi300/mi325x.html)
    • Network accessline 765
      5. [NVIDIA System Management Interface documentation](https://docs.nvidia.com/deploy/nvidia-smi/)
    • Network accessline 766
      6. [Intel Gaudi `hl-smi` documentation](https://docs.habana.ai/en/latest/Management_and_Monitoring/Embedded_System_Tools_Guide/System_Management_Interface_Tool.html)
    • Network accessline 767
      7. [NVIDIA A100 architecture white paper](https://images.nvidia.com/aem-dam/en-zz/Solutions/data-center/nvidia-ampere-architecture-whitepaper.pdf)
    • Network accessline 768
      8. [NVIDIA GB300 NVL72 specifications](https://www.nvidia.com/en-us/data-center/gb300-nvl72/)
    • Network accessline 769
      9. [NVIDIA Vera Rubin NVL72 specifications](https://www.nvidia.com/en-us/data-center/vera-rubin-nvl72/)
    • Network accessline 770
      10. [Intel Gaudi architecture documentation](https://docs.habana.ai/en/latest/Gaudi_Overview/Gaudi_Architecture.html)
    • Network accessline 771
      11. Intel Gaudi exposes separate clocks for its Matrix Multiplication Engine (MME) and Tensor Processing Core (TPC). 12. 1830MHz is NVIDIA's official compute clock for H200 and H100, superseding the 1980MHz that was widely published earlier
    • Network accessline 772
      12. 1830MHz is NVIDIA's official compute clock for H200 and H100, superseding the 1980MHz that was widely published earlier. It is also self-consistent: it reproduces the 989TFLOPS bf16 spec exactly through the [TFLOPS calculation](#how-to-
    • Network accessline 773
      13. [NVIDIA H200 specifications](https://www.nvidia.com/en-us/data-center/h200/) publish no clock for H200 NVL. Its 835TFLOPS bf16 spec works back to about 1545MHz through the [TFLOPS calculation](#how-to-calculate-theoretical-tflops), if i
    • Network accessline 774
      14. [AMD Instinct MI350X specifications](https://www.amd.com/en/products/accelerators/instinct/mi350/mi350x.html)
    • Network accessline 793
      - [NVIDIA defines TGP](https://docs.nvidia.com/mission-control/docs/systems-administration-guide/2.3.0/wpps/concepts.html#tgp-total-graphics-power) as the total electrical power for the GPU core, onboard memory, and supporting board circuit
    • Network accessline 794
      - [AMD lists MI250X](https://www.amd.com/en/products/accelerators/instinct/mi200/mi250x.html) with 500W TDP and 560W peak TBP, so for this OAM module the published peak TBP is 60W above its TDP.
    • Network accessline 795
      - NVIDIA's [GB300 rack-planning example](https://docs.nvidia.com/mission-control/docs/systems-administration-guide/2.3.0/prs/faq.html) adds four 1.4kW GPUs and a 1kW CPU into a 6.6kW managed node budget, adds 0.9kW of static node power, the
    • Network accessline 842
      1. [NVIDIA Mission Control power-management FAQs](https://docs.nvidia.com/mission-control/docs/systems-administration-guide/2.3.0/prs/faq.html)
    • Network accessline 843
      2. [AMD Instinct MI355X specifications](https://www.amd.com/en/products/accelerators/instinct/mi350/mi355x.html)
    • Network accessline 844
      3. [AMD Instinct MI325X specifications](https://www.amd.com/en/products/accelerators/instinct/mi300/mi325x.html)
    • Network accessline 845
      4. [AMD Instinct MI350X specifications](https://www.amd.com/en/products/accelerators/instinct/mi350/mi350x.html)
    • Network accessline 846
      5. [NVIDIA DGX B200 power capping](https://docs.nvidia.com/dgx/dgxb200-user-guide/power-capping.html)
    • Network accessline 847
      6. [NVIDIA DGX B300 power capping](https://docs.nvidia.com/dgx/dgxb300-user-guide/power-capping.html)
    • Network accessline 848
      7. [Intel Gaudi 3 AI accelerator white paper](https://www.intel.com/content/www/us/en/content-details/817486/intel-gaudi-3-ai-accelerator-white-paper.html)
    • Network accessline 849
      8. [AMD Instinct MI300X specifications](https://www.amd.com/en/products/accelerators/instinct/mi300/mi300x.html)
    • Network accessline 850
      9. [NVIDIA H100 specifications](https://www.nvidia.com/en-us/data-center/h100/)
    • Network accessline 851
      10. [NVIDIA H200 specifications](https://www.nvidia.com/en-us/data-center/h200/)
    • Network accessline 852
      11. [AMD Instinct MI350P specifications](https://www.amd.com/en/products/accelerators/instinct/mi350/mi350p.html)
    • Network accessline 853
      12. [Intel Gaudi 2 AI accelerator white paper](https://www.intel.com/content/www/us/en/content-details/839363/intel-gaudi-2-ai-accelerators-white-paper.html)
    • Network accessline 854
      13. [NVIDIA RTX PRO 6000 Blackwell Server Edition specifications](https://www.nvidia.com/en-us/data-center/rtx-pro-6000-blackwell-server-edition/)
    • Network accessline 855
      14. [AMD Instinct MI250X specifications](https://www.amd.com/en/products/accelerators/instinct/mi200/mi250x.html)
    • Network accessline 856
      15. [NVIDIA A100 specifications](https://www.nvidia.com/en-us/data-center/a100/)
    • Network accessline 857
      16. [NVIDIA L40S specifications](https://www.nvidia.com/en-us/data-center/l40s/)
    • Network accessline 858
      17. [AMD Instinct MI455X specifications](https://www.amd.com/en/products/accelerators/instinct/mi400/mi455x.html)
    • Network accessline 859
      18. [AWS Trainium2 architecture documentation](https://awsdocs-neuron.readthedocs-hosted.com/en/latest/about-neuron/arch/neuron-hardware/trainium2.html)
    • Network accessline 860
      19. [NVIDIA Vera Rubin NVL72 specifications](https://www.nvidia.com/en-us/data-center/vera-rubin-nvl72/)
    • Network accessline 861
      20. Google doesn't publish power consumption specs for recent TPUs, the older ones can be found [here](https://en.wikipedia.org/wiki/Tensor_Processing_Unit#Products)
    • Network accessline 900
      NVIDIA: - [Vera Rubin NVL72](https://www.nvidia.com/en-us/data-center/vera-rubin-nvl72/) -- the 72 GPUs supernode at NVLink speed with Grace Rubin - 36x blocks of 2x Rubin GPU + Vera CPU
    • Network accessline 901
      - [Vera Rubin NVL72](https://www.nvidia.com/en-us/data-center/vera-rubin-nvl72/) -- the 72 GPUs supernode at NVLink speed with Grace Rubin - 36x blocks of 2x Rubin GPU + Vera CPU
    • Network accessline 902
      - [GB300 NVL72](https://www.nvidia.com/en-us/data-center/gb300-nvl72/) - the 72 GPUs supernode at NVLink speed with B300s (Grace Blackwell - 36x blocks of 2x B300 + Grace CPU)
    • Network accessline 903
      - [GB200 NVL72](https://www.nvidia.com/en-us/data-center/gb200-nvl72/) - the 72 GPUs supernode at NVLink speed with B200s. (Grace Blackwell - 36x blocks of 2x B200 + Grace CPU)
    • Network accessline 904
      - [B300](https://www.nvidia.com/en-us/data-center/hgx/) - NVIDIA now publishes official HGX B300 platform specs and lists it as shipping, as of 2026-07-31. Note that those are 8-GPU board figures (144PFLOPS FP4 sparse, 2.1TB total memory, 1
    • Network accessline 905
      - [B200](https://www.nvidia.com/en-us/data-center/hgx/) - same story: official HGX B200 platform specs published and shipping (144PFLOPS FP4 sparse, 1.4TB total memory, 14.4TBps total NVLink), with the [DGX B200 datasheet](https://resources
    • Network accessline 906
      - [H200](https://www.nvidia.com/en-us/data-center/h200/) - mainly the same as H100, but with more and faster memory! Widely available as of 2026-07-31.
    • Network accessline 907
      - [H100](https://www.nvidia.com/en-us/data-center/h100) - 2-3x faster than A100 (half precision), 6x faster for fp8, has been available on all Tier-1 compute clouds since Q4-2023.
    • Network accessline 908
      - [GH200](https://www.nvidia.com/en-us/data-center/grace-hopper-superchip/) - 2 chips on one card - (1) H100 w/ 96GiB HBM3 or 144GiB HBM3e + (2) Grace CPU w/ 624GiB RAM - available as of 2026-07-31. Do not confuse with H200, which is a diff
    • Network accessline 909
      - [L40S](https://www.nvidia.com/en-us/data-center/l40s/) - a powerful card that is supposed to be more than 2x cheaper than H100, and it's more powerful than A100.
    • Network accessline 910
      - [A100](https://www.nvidia.com/en-us/data-center/a100/#specifications) - huge availability, but already getting outdated. But given the much lower cost than H100 this is still a great GPU.
    • Network accessline 912
      AMD: - [MI455X](https://www.amd.com/en/products/accelerators/instinct/mi400/mi455x.html) ~= Rubin, a little above it on the published numbers - but those are AMD Performance Labs projections carrying "Results subject to change when products
    • Network accessline 913
      - [MI455X](https://www.amd.com/en/products/accelerators/instinct/mi400/mi455x.html) ~= Rubin, a little above it on the published numbers - but those are AMD Performance Labs projections carrying "Results subject to change when products are 
    • Network accessline 914
      - [MI355X](https://www.amd.com/en/products/accelerators/instinct/mi350/mi355x.html) ~= B200 - just starting to emerge, mainly on Tier-2 clouds
    • Network accessline 915
      - [MI350X](https://www.amd.com/en/products/accelerators/instinct/mi350/mi350x.html) ~= B200 - the same silicon as MI355X, air-cooled at 1000W and 2200MHz; rentable on demand on Tier-2 clouds as of 2026-10-07
    • Network accessline 916
      - [MI325X](https://www.amd.com/en/products/accelerators/instinct/mi300/mi325x.html) ~= H200 - available mainly on Tier-2 clouds
    • Network accessline 917
      - [MI300X](https://www.amd.com/en/products/accelerators/instinct/mi300/mi300x.html) ~= H100 - available mainly on Tier-2 clouds (lots of new startups)
    • Network accessline 918
      - [MI250](https://www.amd.com/en/products/accelerators/instinct/mi200/mi250.html) ~= A100 - very few clouds have them
    • Network accessline 921
      Intel: - Falcon Shores - canceled - [Gaudi3](https://habana.ai/products/gaudi3/), somewhat below B200 theoretical TFLOPS-wise - already available on Intel cloud - [spec](https://www.intel.com/content/www/us/en/content-details/817486/intel-g
    • Network accessline 922
      - Falcon Shores - canceled - [Gaudi3](https://habana.ai/products/gaudi3/), somewhat below B200 theoretical TFLOPS-wise - already available on Intel cloud - [spec](https://www.intel.com/content/www/us/en/content-details/817486/intel-gaudi-3-
    • Network accessline 923
      - [Gaudi3](https://habana.ai/products/gaudi3/), somewhat below B200 theoretical TFLOPS-wise - already available on Intel cloud - [spec](https://www.intel.com/content/www/us/en/content-details/817486/intel-gaudi-3-ai-accelerator-white-paper.
    • Network accessline 925
      - [Gaudi2](https://habana.ai/products/gaudi2/) somewhere between A100 and H100 theoretical TFLOPS-wise [spec](https://docs.habana.ai/en/latest/Gaudi_Overview/Gaudi_Architecture.html) - available on Intel cloud. AWS has the older Gaudi1 via 
    • Network accessline 927
      Amazon: - [Trainium2](https://awsdocs-neuron.readthedocs-hosted.com/en/latest/about-neuron/arch/neuron-hardware/trainium2.html) < H100 - available on AWS (works via PyTorch XLA)
    • Network accessline 928
      - [Trainium2](https://awsdocs-neuron.readthedocs-hosted.com/en/latest/about-neuron/arch/neuron-hardware/trainium2.html) < H100 - available on AWS (works via PyTorch XLA)
    • Network accessline 931
      Google: - [TPU7x](https://docs.cloud.google.com/tpu/docs/tpu7x) (Ironwood) - 2307TFLOPS bf16 and 192GB HBM per chip, in 4-chip VMs up to a 9216-chip pod. Rent-only on GCP, like every TPU generation
    • Network accessline 932
      - [TPU7x](https://docs.cloud.google.com/tpu/docs/tpu7x) (Ironwood) - 2307TFLOPS bf16 and 192GB HBM per chip, in 4-chip VMs up to a 9216-chip pod. Rent-only on GCP, like every TPU generation
    • Network accessline 933
      - [TPU v6e](https://docs.cloud.google.com/tpu/docs/v6e) (Trillium) and [TPU v5p](https://docs.cloud.google.com/tpu/docs/v5p) - the previous two generations, both still offered
    • Network accessline 936
      SambaNova: - [SN40L](https://sambanova.ai/products/rdu-ai-chips) - fourth-generation RDU, 16 per SambaRack; inference-oriented rather than a training part
    • Network accessline 937
      - [SN40L](https://sambanova.ai/products/rdu-ai-chips) - fourth-generation RDU, 16 per SambaRack; inference-oriented rather than a training part
    • Network accessline 938
      - [SN50](https://sambanova.ai/blog/introducing-the-sn50-rdu-purpose-built-for-agentic-inference) - fifth generation, announced Feb-2026, "will start shipping to customers in the second half of 2026"
    • Network accessline 943
      [Cerebras](https://www.cerebras.ai/) cluster and systems based on WaferScale Engine (WSE).
    • Network accessline 952
      Google [TPUs](https://cloud.google.com/tpu), [specs](https://docs.cloud.google.com/tpu/docs/system-architecture-tpu-vm) - lock-in, can't switch to another vendor like NVIDIA -> AMD
    • Network accessline 954
      Recent architecture specs: - [v7x](https://docs.cloud.google.com/tpu/docs/tpu7x)
    • Network accessline 955
      - [v7x](https://docs.cloud.google.com/tpu/docs/tpu7x)
    • Network accessline 956
      - [v6e](https://docs.cloud.google.com/tpu/docs/v6e)
    • Network accessline 957
      - [v5p](https://docs.cloud.google.com/tpu/docs/v5p)
    • Network accessline 959
      Cerebras: - [Cloud](https://www.cerebras.ai/cloud)
    • Network accessline 960
      - [Cloud](https://www.cerebras.ai/cloud)
    • Network accessline 970
      - [TensTorrent](https://tenstorrent.com), [n150s/n300s specs](https://docs.tenstorrent.com/aibs/wormhole/index.html#specificationsrequirements)
    • Network accessline 971
      - [d-Matrix](https://www.d-matrix.ai), [specs](https://www.d-matrix.ai/product/)
    • Network accessline 982
      For the baseline prices it should be easy to find a few good sites that provide an up-to-date public price comparisons across clouds - just search for something like [cloud gpu pricing comparison](https://www.google.com/search?q=cloud+gpu+p
    • Network accessline 984
      Also Lantern Works tracks [on-demand GPU cloud rental prices](https://thelanternworks.com/gpu/price-comparison/) across multiple providers.
    • Network accessline 1026
      [AMD's table comparing its high-end gpus](https://rocm.docs.amd.com/en/latest/reference/gpu-specs.html)
    • Network accessline 1030
      [Architecture](https://docs.habana.ai/en/latest/Gaudi_Overview/Gaudi_Architecture.html)
    • Network accessline 1037
      There are no official TFLOPS information published (and from talking to an Intel representative they have no intention to publish any.) They publish the [following benchmarks](https://www.intel.com/content/www/us/en/developer/platform/gaudi
    • Network accessline 1049
      The Xe3P XMX engines natively support the full precision ladder - FP64, FP32, TF32, FP16, BF16, dual-format FP8, FP4, the OCP MX formats (MXFP4/MXFP8) and int8/int4 - but as of launch the only compute figure Intel has published is **1.3 PFL
    • Network accessline 1067
      Specs: [Trainium2](https://awsdocs-neuron.readthedocs-hosted.com/en/latest/about-neuron/arch/neuron-hardware/trainium2.html), [Trn2 instances](https://aws.amazon.com/ec2/instance-types/trn2/).
    • Network accessline 1080
      Specs: [TPU7x](https://docs.cloud.google.com/tpu/docs/tpu7x), [TPU system architecture](https://docs.cloud.google.com/tpu/docs/system-architecture-tpu-vm).
    • Network accessline 1096
      Two things to be careful about. The TFLOPS and memory comparison-table rows for Ascend 950DT use the **64-card** Atlas 950 SuperPoD product-spec table on the English Ascend Community page (`114.1 / 58.8 / 31.1` PFLOPS @ mxFP4 / mxFP8-HiF8 /
    • Network accessline 1098
      Specs: [Ascend Community](https://www.hiascend.com/en). Be aware that both Huawei sites are JavaScript applications that serve only a page shell to a plain downloader - `e.huawei.com` returns 255KB of HTML containing not one occurrence of `
    • Network accessline 1108
      Specs: [Cerebras WSE](https://www.cerebras.ai/chip).
    • Network accessline 1124
      Specs: [RDU AI chips](https://sambanova.ai/products/rdu-ai-chips), [SambaRack](https://sambanova.ai/products/sambarack).
    • Network accessline 1133
      NVIDIA GPUs run on [CUDA](https://developer.nvidia.com/cuda/toolkit)
    • Network accessline 1137
      AMD GPUs run on [ROCm](https://www.amd.com/en/products/software/rocm.html) - note that PyTorch intentionally reuses the same `torch.cuda` Python API on ROCm, so many programs that only use PyTorch APIs can run unchanged on supported AMD GPU
    • Network accessline 1141
      The API is via [Habana SynapseAI® SDK](https://habana.ai/intel-gaudi-software/) which supports PyTorch and TensorFlow.
    • Network accessline 1143
      Useful integrations: - [HF Optimum Habana](https://github.com/huggingface/optimum-habana) which also includes - [DeepSpeed](https://github.com/deepspeedai/DeepSpeed) integration.
    • Network accessline 1144
      - [HF Optimum Habana](https://github.com/huggingface/optimum-habana) which also includes - [DeepSpeed](https://github.com/deepspeedai/DeepSpeed) integration.
    • Network accessline 1156
      - [MLPerf via MLCommons](https://mlcommons.org/) publishes various hardware benchmarks that measure training, inference, storage and other tasks' performance. The round numbers advance a few times a year, so head to the suite pages rather t

    compute/accelerator/amd/debug.md

    • Network accessline 29
      On Linux, AMD’s isolation docs lean on `ROCR_VISIBLE_DEVICES` when you want stack-wide isolation; for ordinary single-framework PyTorch work, `HIP_VISIBLE_DEVICES` / `CUDA_VISIBLE_DEVICES` is enough. See [GPU isolation techniques](https://r
    • Network accessline 250
      - **Modern Instinct (MI300X, MI325X, MI350X, MI355X)**: AMD's system-acceptance guides want the IOMMU **enabled** in BIOS and running in pass-through mode on the kernel command line - `iommu=pt` together with `amd_iommu=on` (or `intel_iommu
    • Network accessline 252
      - **Legacy last resort**: on older systems where neither pass-through nor the BIOS default helped, fully disabling it via `amd_iommu=off` (or the softer `iommu=soft`) was the historical workaround - see AMD's [IOMMU advisory for multi-GPU e

    compute/accelerator/amd/performance.md

    • Network accessline 5
      - [AMD Instinct MI300X system optimization](https://instinct.docs.amd.com/projects/system-acceptance/en/latest/gpus/mi300x.html)
    • Network accessline 6
      - [AMD Instinct MI300X workload optimization](https://rocm.docs.amd.com/projects/ai-ecosystem/en/latest/optimization/workload-optimization.html)
    • Network accessline 10
      [omniperf](https://github.com/ROCm/rocprofiler-compute) - Advanced Profiling and Analytics for AMD Hardware - e.g. can plot a roofline performance of your AMD accelerator and many other things.

    compute/accelerator/benchmarks/README.md

    • Network accessline 9
      1. [How to Accurately Time CUDA Kernels in PyTorch](https://www.speechmatics.com/company/articles-and-news/timing-operations-in-pytorch)
    • Network accessline 10
      2. [How to Benchmark Code on CUDA Devices?](https://salykova.github.io/sgemm-gpu#2-how-to-benchmark-code-on-cuda-devices) - this one is different from (1) in that it suggests to set both GPU and Memory clocks, whereas (1) only locks the GPU
    • Network accessline 18
      Dynamic power is roughly proportional to clock frequency times the number of transistors that flip. High-entropy or "unpredictable" bit patterns flip more transistors per cycle than sparse, sorted, or all-zero patterns, so the same-shape ma
    • Network accessline 33
      Maximum Achievable Matmul FLOPS (MAMF) Benchmark: [mamf-finder.py](./mamf-finder.py) was derived from research found in [The Case for Co-Designing Model Architectures with Hardware](https://arxiv.org/abs/2401.14489) paper.
    • Dangerous shell operationline 84
      sudo sh -c 'echo 0 > /proc/sys/kernel/numa_balancing'
    • Network accessline 90
      This will make the first iteration very slow, while it's searching for the best GEMM algorithm in the BLAS libraries for each `matmul` shape it encounters, but subsequent operations are likely to be significantly faster than the baseline. S
    • Network accessline 94
      **Intel dGPUs (A770, A750, B580, etc.)** - Follow Intel Extension for PyTorch [installation steps](https://pytorch-extension.intel.com/installation?platform=gpu)
    • Network accessline 95
      - Follow Intel Extension for PyTorch [installation steps](https://pytorch-extension.intel.com/installation?platform=gpu)
    • Network accessline 204
      Peak GEMM shapes are not mysterious; they follow the paper's recipe ([arXiv:2401.14489](https://arxiv.org/abs/2401.14489)):
    • Network accessline 253
      If you get a better MAMF or MSMF than the [table](../README.md#maximum-achievable-and-sustainable-matmul-flops-comparison-table) shows, e.g. with a more recent `torch`, CUDA or ROCm, BLAS library or driver, or you measured an accelerator or

    compute/accelerator/benchmarks/mamf-finder-all-gpus.py

    • Executable scriptline 1
      #!/usr/bin/env python
    • Access to secretsline 125
      [Credential-related source omitted]
    • Access to secretsline 216
      [Credential-related source omitted]
    • Access to secretsline 320
      [Credential-related source omitted]

    compute/accelerator/benchmarks/mamf-finder.py

    • Executable scriptline 1
      #!/usr/bin/env python
    • Network accessline 26
      For the auto search, discussion, and important nuances see: https://github.com/stas00/ml-engineering/tree/master/compute/accelerator/benchmarks#maximum-achievable-and-sustainable-matmul-flops-finder
    • Network accessline 27
      https://github.com/stas00/ml-engineering/tree/master/compute/accelerator/benchmarks#maximum-achievable-and-sustainable-matmul-flops-finder
    • Network accessline 29
      Results table: https://github.com/stas00/ml-engineering/tree/master/compute/accelerator#maximum-achievable-and-sustainable-matmul-flops-comparison-table
    • Network accessline 30
      https://github.com/stas00/ml-engineering/tree/master/compute/accelerator#maximum-achievable-and-sustainable-matmul-flops-comparison-table
    • Network accessline 32
      Credits: - Parts of this benchmark have been derived from https://github.com/EleutherAI/cookbook/tree/main/benchmarks/sizing
    • Network accessline 33
      - Parts of this benchmark have been derived from https://github.com/EleutherAI/cookbook/tree/main/benchmarks/sizing
    • Network accessline 34
      (highly recommended!) - Imtiaz Sajwani: HPU porting - Xiaoyu Zhang https://github.com/BBuf - flexible dtype support
    • Network accessline 35
      - Imtiaz Sajwani: HPU porting - Xiaoyu Zhang https://github.com/BBuf - flexible dtype support - Oren Leung https://github.com/OrenLeung - flagging the lack of cache/dest-matrix reset and suggesting a fix - also
    • Network accessline 36
      - Xiaoyu Zhang https://github.com/BBuf - flexible dtype support
    • Network accessline 37
      - Oren Leung https://github.com/OrenLeung - flagging the lack of cache/dest-matrix reset and suggesting a fix - also
    • Network accessline 38
      proposing geomean - Ivan Fioravanti https://github.com/ivanfioravanti - MPS support """
    • Network accessline 39
      - Ivan Fioravanti https://github.com/ivanfioravanti - MPS support
    • Access to secretsline 602
      [Credential-related source omitted]
    • Network accessline 611
      # # l2_cache: written between iterations to emulate cache reset. On AMD this is really L3/LLC — 256MiB is the highest # across recent accelerators so far (https://github.com/stas00/ml-engineering/tree/master/compute/accelerator#caches).
    • Network accessline 612
      # l2_cache: written between iterations to emulate cache reset. On AMD this is really L3/LLC — 256MiB is the highest # across recent accelerators so far (https://github.com/stas00/ml-engineering/tree/master/compute/accelerator#caches). # C_r
    • Network accessline 613
      # across recent accelerators so far (https://github.com/stas00/ml-engineering/tree/master/compute/accelerator#caches).
    • Network accessline 813
      # Instead of brute-forcing a 3D grid of MxNxK shapes, `--search auto` constructs a small set of shapes the accelerator # should run at/near peak on, using the three rules from "The Case for Co-Designing Model Architectures with Hardware" # 
    • Network accessline 814
      # should run at/near peak on, using the three rules from "The Case for Co-Designing Model Architectures with Hardware" # (https://arxiv.org/abs/2401.14489): #   1. Tensor-core alignment: M, N, K are multiples of `128 bytes / dtype_size` ele
    • Network accessline 815
      # (https://arxiv.org/abs/2401.14489):
    • Access to secretsline 1703
      [Credential-related source omitted]

    compute/accelerator/nvidia/debug.md

    • Dangerous shell operationline 30
      sudo grep Xid /var/log/syslog
    • Dangerous shell operationline 31
      sudo dmesg -T | grep Xid
    • Network accessline 36
      The full list of Xid Errors and their interpretation can be found [here](https://docs.nvidia.com/deploy/xid-errors/latest/index.html).
    • Network accessline 38
      Many Xid log lines carry far more fields than the one above, and they are cryptic. [Xid 31 MMU Faults: What Causes Them and How to Fix Production GPU Crashes](https://www.abhik.ai/articles/gpu-xid31-mmu-faults) is a good example of how to d
    • Network accessline 40
      NVIDIA's [Xid Catalog](https://docs.nvidia.com/deploy/xid-errors/analyzing-xid-catalog.html) goes further for Ampere and newer GPUs: for each Xid it lists which GPUs can log it, what triggers it, and what to do about it - an immediate actio
    • Network accessline 94
      Now, there are 2 types of errors - Correctable and Uncorrectable. The correctable one is a Single Bit ECC Error (SBE) where despite memory being faulty the driver can still recover the correct value. The uncorrectable one is where more than
    • Network accessline 109
      To dive even deeper into the GPU debugging, please refer to [this document](https://docs.nvidia.com/deploy/gpu-debug-guidelines/index.html) - it includes a useful triage chart which helps to determine when to RMA GPUs. This document has add
    • Network accessline 117
      When that happens it shows up in the same `Remapped Rows` block as above, with the failure flag set and a bank that has run out of spares. This is [Crusoe Cloud's published signature](https://docs.crusoecloud.com/resources/troubleshooting) 
    • Network accessline 191
      NVIDIA® Data Center GPU Manager (DCGM) is documented [here](https://docs.nvidia.com/datacenter/dcgm/latest/user-guide/index.html) and can be downloaded from [here](https://github.com/NVIDIA/DCGM#quickstart).
    • Dangerous shell operationline 292
      $ sudo dmesg | grep -i 'limited by'
    • Network accessline 340
      Row remapping is how Ampere and later GPUs deal with memory that has gone bad - a degrading bank row is replaced by one of the spares that every HBM bank reserves for the purpose. It is [NVIDIA's replacement for the page retirement scheme](
    • Network accessline 434
      As explained [here](https://arthurchiao.art/blog/understanding-gpu-performance/) the `GPU-Util` column in the `nvidia-smi` output isn't really telling you the GPU Utilization. What it's telling you is the percentage of time during which one
    • Network accessline 438
      What you want to measure instead is GPU's utilization of the available capacity, otherwise known as "saturation". Alas, this information isn't provided by `nvidia-smi`. In order to get this information you need to install [dcgm-exporter](ht
    • Network accessline 444
      git clone https://github.com/NVIDIA/dcgm-exporter.git
    • Dangerous shell operationline 462
      $ sudo cmd/dcgm-exporter/dcgm-exporter -c 500 -f dcp-metrics-custom.csv
    • Network accessline 472
      watch -n 0.5 "curl http://localhost:9400/metrics"
    • Network accessline 478
      This is a quick way of doing that, but the intention is to use it with [Prometheus](https://prometheus.io/) which will give you nice charts. E.g. the article included an example where you can see the SM occupancy, Tensor core, FP16 and FP32
    • Network accessline 482
      ([source](https://arthurchiao.art/blog/understanding-gpu-performance/))

    compute/cpu-memory/README.md

    • Network accessline 9
      - Loading the model weights, unless they are loaded directly onto the GPUs - this is usually a transitory memory usage that goes back to zero once the model has been moved to GPUs. - Saving the model weights. In some situations each GPU wri
    • Network accessline 10
      - Saving the model weights. In some situations each GPU writes its own checkpoint directly to the disk, in other cases the model is recomposed on the CPU before it's written to disk - this too is a transitory memory usage. - Possible parame
    • Network accessline 11
      - Possible parameter and optimizer state offloading when using frameworks like [DeepSpeed](https://www.deepspeed.ai/tutorials/zero-offload/). In which case quite a lot of CPU memory might be needed.
    • Network accessline 18
      - If the `DataLoader` uses HF `datasets` in `mmap` mode the Resident memory usage may appear to be using a huge amount of CPU memory as it'll try to map out the whole datasets to the memory. Except this is misleading, since if the memory is

    compute/cpu/README.md

    • Network accessline 42
      To score what a model generated, RL tool-use workloads have to run it - a test suite, a compilation, a package install, a symbolic math check. That runs in a sandbox: an isolated environment, since generated code is untrusted by constructio
    • Network accessline 48
      1. Isolation taxes system calls, not arithmetic. gVisor adds no cost to CPU instructions, but routes every system call through its own user-space kernel, so in some situations file- and process-heavy work could slow by multiples - and a tes
    • Network accessline 53
      footnote: A [Nebius agentic-RL writeup](https://nebius.com/blog/posts/in-agentic-rl-faster-tokens-are-not-enough) (2026-09) measured this on a Terminal-Bench workload, GLM-5.2 on 32 B300s. With the number of in-flight trajectories held at 1
    • Network accessline 59
      Some frameworks, like [DeepSpeed](https://www.deepspeed.ai/tutorials/zero-offload/) and [FSDP](https://docs.pytorch.org/docs/stable/fsdp.html) can offload some compute work to CPUs without creating a bottleneck. In which case you'd want add
    • Network accessline 71
      [Hyper-Threads](https://en.wikipedia.org/wiki/Hyper-threading) double the CPU cores number, by virtualizing each physical core into 2 virtual ones, allowing 2 threads to use the same CPU core at the same time. Depending on the type of workl

    contributors.md

    • Network accessline 5
      1. Some of them did it via PRs, and are thus listed automatically [here](https://github.com/stas00/ml-engineering/graphs/contributors)
    • Network accessline 8
      - [Adam Moody](https://github.com/adammoody)
    • Network accessline 9
      - [Alex Rogozhnikov](https://github.com/arogozhnikov)
    • Network accessline 10
      - [Bowei Liu](https://github.com/boweiliu)
    • Network accessline 11
      - [Darrick Horton](https://www.linkedin.com/in/darrick-horton/)
    • Network accessline 12
      - [Elio VP](https://www.linkedin.com/in/eliovp/)
    • Network accessline 13
      - [Garrett Goon](https://github.com/garrett361)
    • Network accessline 14
      - [Horace He](https://github.com/Chillee)
    • Network accessline 15
      - [Ivan Yashchuk](https://github.com/IvanYashchuk)
    • Network accessline 16
      - [Jack Dent](https://github.com/jackdent)
    • Network accessline 17
      - [Jeff Rasley](https://github.com/jeffra/)
    • Network accessline 18
      - [Jon Stevens](https://github.com/jon-hotaisle)
    • Network accessline 19
      - [Jordan Nanos](https://github.com/JordanNanos)
    • Network accessline 20
      - [Mark Saroufim](https://github.com/msaroufim)
    • Network accessline 21
      - [Olatunji Ruwase](https://github.com/tjruwase)
    • Network accessline 22
      - Oren Leung - [Quentin Anthony](https://github.com/Quentin-Anthony) - [Ross Wightman](https://github.com/rwightman)
    • Network accessline 23
      - [Quentin Anthony](https://github.com/Quentin-Anthony)
    • Network accessline 24
      - [Ross Wightman](https://github.com/rwightman)
    • Network accessline 25
      - [Samyam Rajbhandari](https://github.com/samyam)
    • Network accessline 26
      - [Satyaki Upadhyay](https://github.com/satyaki-up)
    • Network accessline 27
      - [Shikib Mehri](https://github.com/Shikib)
    • Network accessline 28
      - [Siddharth Singh](https://github.com/siddharth9820)
    • Network accessline 29
      - [Stéphane Requena](https://twitter.com/s_requena)
    • Network accessline 30
      - [Zhiqi Tao](https://www.linkedin.com/in/zhiqitao/)

    courses/lesson-learned/README.md

    • Network accessline 7
      - [Machine Learning Engineering (MLE)](../../README.md) - [The Art of Debugging (AoD)](https://github.com/stas00/the-art-of-debugging)
    • Network accessline 8
      - [The Art of Debugging (AoD)](https://github.com/stas00/the-art-of-debugging)
    • Network accessline 310
      From [The Art of Debugging](https://github.com/stas00/the-art-of-debugging):
    • Network accessline 318
      📖 [The power of one-liner programs](https://github.com/stas00/the-art-of-debugging/blob/master/methodology/README.md#the-power-of-one-liner-programs)
    • Network accessline 326
      📖 [Finding a breaking commit by bisecting revisions](https://github.com/stas00/the-art-of-debugging/blob/master/methodology/README.md#finding-a-breaking-commit-by-bisecting-revisions)
    • Network accessline 334
      📖 [Get the backtrace from the core file](https://github.com/stas00/the-art-of-debugging/blob/master/compiled-programs/README.md#get-the-backtrace-from-the-core-file)
    • Network accessline 343
      📖 [Get the backtrace from the still running process](https://github.com/stas00/the-art-of-debugging/blob/master/compiled-programs/README.md#get-the-backtrace-from-the-still-running-process) + [py-spy](https://github.com/stas00/the-art-of-de
    • Network accessline 351
      📖 [Run the program under gdb](https://github.com/stas00/the-art-of-debugging/blob/master/compiled-programs/README.md#run-the-program-under-gdb)
    • Network accessline 359
      📖 [nm](https://github.com/stas00/the-art-of-debugging/blob/master/compiled-programs/README.md#nm)
    • Network accessline 363
      *All lessons are drawn from [Machine Learning Engineering](../../README.md) and [The Art of Debugging](https://github.com/stas00/the-art-of-debugging) by Stas Bekman, distributed under [CC BY-SA 4.0](../../LICENSE-CC-BY-SA).*

    debug/NicerTrace.py

    • Executable scriptline 1
      Executable file
    • Network accessline 85
      It was written against https://github.com/python/cpython/blob/3.8/Lib/trace.py. If you're
    • Access to secretsline 207
      [Credential-related source omitted]
    • Dangerous shell operationline 226
      # string with commands to run - passed to exec()

    debug/code/collective_mismatch.py

    • Executable scriptline 1
      #!/usr/bin/env python

    debug/code/collective_mismatch_analyze.py

    • Executable scriptline 1
      #!/usr/bin/env python

    debug/code/kernel_oob.py

    • Executable scriptline 1
      #!/usr/bin/env python

    debug/code/kernel_oob_gdb.py

    • Executable scriptline 1
      #!/usr/bin/env python

    debug/code/kernel_oob_prebuilt.py

    • Executable scriptline 1
      #!/usr/bin/env python

    debug/code/kernel_race.py

    • Executable scriptline 1
      #!/usr/bin/env python

    debug/code/see-mem-usage.py

    • Executable scriptline 1
      Executable file

    debug/pytorch.md

    • Network accessline 13
      Moreover, large models often require massive resources, which are typically expensive and can also can make a debugging process super complicated. For example any debugger can handle a single process, but if your model doesn't fit and requi
    • Network accessline 26
      Important: given their popularity and the well designed simple API I will be discussing HF [`transformers`](https://github.com/huggingface/transformers/) models. But the same principle can be applied to any other model.
    • Network accessline 39
      Now let's go through the actual code and convert ["google/mt5-small"](https://huggingface.co/google/mt5-small/tree/main) into its tiny random counterpart.
    • Network accessline 63
      Also please note that you don't need any GPUs to do that and you could do this even on a huge 176B parameter model like [BLOOM-176B](https://huggingface.co/bigscience/bloom). Since you never load the actual original model, except its config
    • Network accessline 81
      The original ["google/mt5-small"](https://huggingface.co/google/mt5-small/tree/main) model file was 1.2GB. With the above changes (and vocab shrinking as explained in the following sections) we got it down to 126MB.
    • Network accessline 83
      If you're dealing with a multi-level nested config, you will have to update each sub-level's config object separately. For example in [IDEFICS](https://huggingface.co/HuggingFaceM4/idefics-9b/blob/main/config.json) we have 1 main and 2 nest
    • Network accessline 105
      A related trap: architectures that interleave block types spell the pattern out in a `layer_types` list with one entry per layer. [Qwen/Qwen-AgentWorld-35B-A3B](https://huggingface.co/Qwen/Qwen-AgentWorld-35B-A3B/blob/main/config.json#L19) 
    • Network accessline 152
      [Anthony Moi](https://github.com/n1t0)'s tokenizer shrinker:
    • Network accessline 199
      [Lysandre Debut](https://github.com/LysandreJik)' shrinker using `train_new_from_iterator`:
    • Network accessline 274
      Here is the full version of [make_tiny_model.py](https://huggingface.co/stas/tiny-random-llama-2/blob/main/make_tiny_model.py) which includes both the model and the tokenizer shrinking.
    • Network accessline 281
      git clone https://github.com/google/sentencepiece
    • Access to secretsline 286
      [Credential-related source omitted]
    • Network accessline 301
      tokenizer_orig.save_pretrained(tmp_dir) with open(vocab_orig_path, 'rb') as f: data = f.read() # adapted from https://blog.ceshine.net/post/trim-down-sentencepiece-vocabulary/
    • Network accessline 302
      with open(vocab_orig_path, 'rb') as f: data = f.read() # adapted from https://blog.ceshine.net/post/trim-down-sentencepiece-vocabulary/ m = model.ModelProto()
    • Network accessline 303
      # adapted from https://blog.ceshine.net/post/trim-down-sentencepiece-vocabulary/
    • Network accessline 321
      If we continue the MT5 code from earlier in this chapter and add the tokenizer shrinking code from the previous section, we end up with this script [mt5-make-tiny-model.py](https://huggingface.co/stas/mt5-tiny-random/blob/main/mt5-make-tiny
    • Network accessline 323
      Here is another example  [fsmt-make-super-tiny-model.py](https://huggingface.co/stas/tiny-wmt19-en-ru/blob/main/fsmt-make-super-tiny-model.py) - here you can see I'm creating a totally new tiny vocab from scratch.
    • Network accessline 327
      Also be aware that since HF `transformers` needs tiny models for their testing, you are very likely to already find one for each architecture available mostly from https://huggingface.co/hf-internal-testing (except they didn't include the c
    • Network accessline 346
      footnote: as of [`datasets` 4.0](https://github.com/huggingface/datasets/releases/tag/4.0.0), Hub-hosted Python loading scripts are no longer executed by `load_dataset`. Keep any builder/unpacker `.py` in the repo as documentation of how th
    • Network accessline 350
      - [stas/oscar-en-10k](https://huggingface.co/datasets/stas/oscar-en-10k/blob/main/oscar-en-10k.py)
    • Network accessline 351
      - [stas/c4-en-10k](https://huggingface.co/datasets/stas/c4-en-10k/blob/main/c4-en-10k.py)
    • Network accessline 352
      - [stas/openwebtext-10k](https://huggingface.co/datasets/stas/openwebtext-10k/blob/main/openwebtext-10k.py)
    • Network accessline 356
      And here are some examples of synthetic datasets, where instead of just shrinking the original tarball, I untar'ed it, manually chose the representative examples and then wrote a script to build any size of desired dataset based on those fe
    • Network accessline 357
      - [stas/general-pmd-synthetic-testing](https://huggingface.co/datasets/stas/general-pmd-synthetic-testing/blob/main/general-pmd-synthetic-testing.py) and the [unpacker](https://huggingface.co/datasets/stas/general-pmd-synthetic-testing/blob
    • Network accessline 358
      - [stas/cm4-synthetic-testing](https://huggingface.co/datasets/stas/cm4-synthetic-testing/blob/main/cm4-synthetic-testing.py) - and the [unpacker](https://huggingface.co/datasets/stas/cm4-synthetic-testing/blob/main/m4-ds-unpack.py)
    • Network accessline 366
      And here is for example the instructions of deploying these scripts for [stas/general-pmd-synthetic-testing](https://huggingface.co/datasets/stas/general-pmd-synthetic-testing/):
    • Network accessline 369
      # prep dataset repo https://huggingface.co/new-dataset => stas/general-pmd-synthetic-testing
    • Network accessline 370
      https://huggingface.co/new-dataset => stas/general-pmd-synthetic-testing
    • Network accessline 371
      git clone https://huggingface.co/datasets/stas/general-pmd-synthetic-testing
    • Dangerous shell operationline 376
      rm -rf data
    • Dangerous shell operationline 387
      rm image.jpg text.txt
    • Network accessline 407
      Similar to tiny models, you will find many tiny datasets under https://huggingface.co/hf-internal-testing.
    • Network accessline 421
      perl -lne 'while (/(https.*?.py)\)/g) { $x=$1; $x=~s/blob/raw/; print qq[wget $x] }' make-tiny-models.md
    • Network accessline 426
      When debugging PyTorch workflows, as explained in [using small payload](https://github.com/stas00/the-art-of-debugging/blob/master/methodology/README.md#2-small-payload) you'd normally try to use tiny random models (as covered [above](#fast
    • Network accessline 430
      Therefore in this section we will discuss how to reduce the model's number of hidden layers from many to just 1-2. If the layers aren't identical (e.g. some MoE models alternate between 2 different block configurations) then ensure you incl
    • Network accessline 434
      The config entry that we want to change is [`num_hidden_layers`](https://huggingface.co/Qwen/Qwen3-30B-A3B-Instruct-2507/blob/e67ac5d/config.json#L24). Some architectures pair it with a companion entry that has to be trimmed in lockstep - a
    • Network accessline 439
      git clone https://huggingface.co/Qwen/Qwen3-30B-A3B-Instruct-2507
    • Network accessline 468
      After finding the desired model on https://huggingface.co/, clone its git repo to the local disk, modify the `num_hidden_layers` entry in `config.json`, and then load the model from the local clone (same as we have just shown when measuring
    • Network accessline 471
      git clone https://huggingface.co/Qwen/Qwen3-30B-A3B-Instruct-2507
    • Network accessline 507
      git clone https://github.com/huggingface/transformers/tree/main/src/transformers
    • Network accessline 513
      Continuing the example of working with `Qwen/Qwen3-30B-A3B-Instruct-2507` model, we find the place where its architecture modeling code lives in the HF Transformers code base. For example, we can look at the `architectures` field in the [mo
    • Network accessline 578
      When I was debugging 15M sequence length training using [ALST](https://arxiv.org/abs/2506.13996) - I would only run self-attention in the last layer and then skip it in the previous layers - this reduced my testing time from hours to minute
    • Network accessline 716
      Luckily, PyTorch has a special [autograd mechanism that is used to detect anomalies](https://docs.pytorch.org/docs/stable/autograd.html#debugging-and-anomaly-detection). When enabled it'll augment the `backward` traceback with the `forward`
    • Network accessline 809
      When developing [Arctic Long Sequence Training](https://arxiv.org/abs/2506.13996) a lot of the work involved hard (`contiguous`) reshaping of tensors for Sequence Parallelism, which lead to a very poor HBM utilization, because the reshapes 
    • Network accessline 859
      Indeed, H200 is about 140GiB, so this checks out. You might wonder what's the point of this. This discovery code is useful when you have to deal with multiple systems accessing the same GPU - e.g. VLLM and VeRL sharing the same GPUs and PyT
    • Network accessline 914
      The solution: to prevent CPU from stealing GPU memory switch to the CDMM mode (from the default NUMA mode), as explained in a paper linked from [this post](https://developer.nvidia.com/blog/understanding-memory-management-on-hardware-cohere
    • Dangerous shell operationline 916
      $ echo options nvidia NVreg_CoherentGPUMemoryMode=driver | sudo tee /etc/modprobe.d/nvidia-openrm.conf
    • Network accessline 967
      At this stage you'd typically go to https://docs.pytorch.org/memory_viz and drop the memory profile pickle file you generated in Stage 1 into the browser at that URL. The most useful feature there is the 'Active memory profile` drop-down me
    • Network accessline 969
      To get a feeling for what it looks like, here is an example of a memory profile rendering for a memory leak I discovered while I was working on a tricky implementation of a [`TiledMLP` `torch.autograd.Function`](https://github.com/deepspeed
    • Network accessline 977
      As long as you're in the `forward` function it's relatively easy to find where in the code leaks comes from. But if it's a `backward` it becomes much more complicated unless you're debugging a custom autograd function. Still it should give 
    • Network accessline 979
      Besides profiling memory leaks, this functionality is also useful for showing how different implementations of the same algorithm use a different amount of gpu memory. For example, the following visualization I prepared for the [Arctic Long
    • Network accessline 994
      Additional resources: - [Understanding GPU Memory 1: Visualizing All Allocations over Time](https://pytorch.org/blog/understanding-gpu-memory-1/)
    • Network accessline 995
      - [Understanding GPU Memory 1: Visualizing All Allocations over Time](https://pytorch.org/blog/understanding-gpu-memory-1/)
    • Network accessline 996
      - HF folks made an [improved rendering version](https://huggingface.co/spaces/Leiyre/memory-viz).
    • Network accessline 1001
      While external memory profilers can be very useful, often having control over when you take a sample of GPU and CPU memory usage is needed. `see-mem-usage` debug util has been developed by the [DeepSpeed project](https://github.com/deepspee
    • Network accessline 1162
      For example, here is how I found a memory leak in `all_gather_object`, which you can see from this [Issue](https://github.com/pytorch/pytorch/issues/150798). And there were several other similar leaks in PyTorch I discovered using this tool
    • Network accessline 1176
      which is very difficult to notice. This is typically performed by an `oom-kill` via [cgroups](https://docs.kernel.org/admin-guide/cgroup-v2.html). The `SIGKILL` is not trappable, so the program itself can't report anything - but the kernel 
    • Network accessline 1178
      note: Moreover in some situations, as in recent kubernetes implementations, the user gets kicked out from the job allocation, which makes it even more difficult to debug. [Kubernetes Silent Pod Killer](https://itnext.io/kubernetes-silent-po
    • Network accessline 1293
      [`cgmemtime`](https://github.com/gsauthof/cgmemtime) is a little gem of a C program that uses cgroups v2 to measure the peak CPU memory usage of a process and all of its descendants no matter how many generations follow it.
    • Network accessline 1297
      git clone https://github.com/gsauthof/cgmemtime
    • Network accessline 1694
      Until recently Python couldn't tell us the name of the variable that was passed to a function, hence we need to pass the variable name as a string. Since Python 3.14 there is a way to overcome this, using [template strings (t-strings)](http
    • Network accessline 1843
      There is also the [lovely-tensors](https://github.com/xl0/lovely-tensors/) library that is designed to automate the process of making the tensor dump more useful and provide shapes, statistics, nan/inf counts, tensor memory usage, etc.
    • Network accessline 1921
      Let's use fp16 floating point representation for demonstrating how we end up with Infinity numbers. 65504 is the largest normal floating point number that can be represented in the fp16 precision. This is slightly below `2**16` due to how t
    • Network accessline 1974
      As of `transformers==4.57.1` the above will give you `loss=tensor(nan)`. The issue here is that the special `-100` label masks tokens to be excluded from the loss calculation and in the above example, we have 0 tokens that aren't masked, si
    • Network accessline 1982
      You can see it in context [here](https://github.com/deepspeedai/DeepSpeed/blob/df59f203f40c8a292dd019ae68c9e6c88f107026/deepspeed/runtime/sequence_parallel/ulysses_sp.py#L1184-L1186). Though the code has evolved since then, and you can find
    • Network accessline 2092
      Let's match the report to the code from [`models/t5/modeling_t5.py`](https://github.com/huggingface/transformers/blob/main/src/transformers/models/t5/modeling_t5.py):
    • Network accessline 2259
      For example, see this [discussion](https://github.com/deepspeedai/DeepSpeed/issues/4932) - the users reported that when doing Llama-2-7b inference they were getting quite different logits depending on how the model was initialized. To clari
    • Network accessline 2265
      This snapshot and the commentary come from this [PyTorch Issue thread](https://github.com/pytorch/pytorch/issues/84936#issuecomment-1246084645).
    • Network accessline 2267
      If you're curious where I pulled this code from - this is a simplified reduction of this original code in [modeling_llama.py](https://github.com/huggingface/transformers/blob/3f69f415adcbdaedec154ba8eac220ef3276975d/src/transformers/models/
    • Network accessline 2327
      In theory enabling this variable should make everything run really slow, but in reality it really depends on your software. We did the whole of BLOOM-176B training using `CUDA_LAUNCH_BLOCKING=1` with [`Megatron-DeepSpeed`](https://github.co
    • Network accessline 2331
      Note: [NCCL==2.14.3 coming with `pytorch==1.13` hangs](https://github.com/NVIDIA/nccl/issues/750) when `CUDA_LAUNCH_BLOCKING=1` is used. So don't use it with that version of pytorch. The issue has been fixed in `nccl>=2.17` which should be 
    • Network accessline 2503
      Primary reference: [NVIDIA Compute Sanitizer](https://docs.nvidia.com/compute-sanitizer/).
    • Network accessline 2524
      Reference: [NVIDIA cuda-gdb](https://docs.nvidia.com/cuda/cuda-gdb/).
    • Network accessline 2537
      The general mechanics - enabling core dumps (`ulimit -c unlimited` and `kernel.core_pattern`), loading a core file into `gdb`, and the `bt` / `bt full` / `thread apply all bt` commands - are covered in [Segmentation fault, core files and gd
    • Network accessline 2758
      If you want to reproduce a disk-full failure on demand rather than wait for one, see [emulating an almost full disk partition](https://github.com/stas00/the-art-of-debugging/tree/master/methodology#emulating-an-almost-full-disk-partition).
    • Network accessline 2805
      - `PID` is the process id of the hanging python process. - `-n` is useful if you want to see stack traces from python extensions written in C, C++, etc., as the program may hang in one of the extensions - you may need to add `sudo` before t
    • Network accessline 2807
      - you may need to add `sudo` before the command - for more details see [this note](https://github.com/benfred/py-spy/blob/master/README.md#when-do-you-need-to-run-as-sudo).
    • Dangerous shell operationline 2811
      sudo echo 0 > /proc/sys/kernel/yama/ptrace_scope
    • Network accessline 2813
      which will allow you running `py-spy` (and `strace`) without needing `sudo`. Beware of the possible [security implications](https://wiki.ubuntu.com/SecurityTeam/Roadmap/KernelHardening#ptrace_Protection) - but typically if your compute node
    • Dangerous shell operationline 2817
      sudo sysctl -w kernel.yama.ptrace_scope=0
    • Dangerous shell operationline 2818
      sudo bash -c "echo 0 > /proc/sys/kernel/yama/ptrace_scope"
    • Dangerous shell operationline 3001
      PDSH_RCMD_TYPE=ssh pdsh -w nodename-[5,8] 'sudo bash -c "source ~/.pdshrc; pgrep -P $(pgrep -o python) | xargs -I {} py-spy dump --pid {}"'
    • Access to secretsline 3012
      [Credential-related source omitted]
    • Access to secretsline 3013
      [Credential-related source omitted]
    • Dangerous shell operationline 3040
      ds_ssh -f hostfile "source ~/.pdshrc; ps aux | grep python | grep -v grep | grep `whoami` | awk '{print \$2}' | xargs -I {} sudo py-spy dump --pid {} "
    • Network accessline 3148
      Primary reference: [ProcessGroupNCCL environment variables](https://docs.pytorch.org/docs/stable/torch_nccl_environment_variables.html).
    • Access to secretsline 3242
      [Credential-related source omitted]
    • Dangerous shell operationline 3391
      sudo sysctl -w kernel.core_pattern=/tmp/core-%e.%p.%h.%t
    • Network accessline 3441
      Once you need to use more than one node to scale your training, e.g., if you want to use DDP to train faster, you have to get the nodes to talk to each other, so that communication collectives could send data to each other. This is typicall
    • Network accessline 3460
      telnet localhost:6000 nmap -p 6000 localhost nc -zv localhost 6000
    • Network accessline 3461
      nmap -p 6000 localhost nc -zv localhost 6000 curl -v telnet://localhost:6000
    • Network accessline 3462
      nc -zv localhost 6000
    • Network accessline 3463
      curl -v telnet://localhost:6000
    • Dangerous shell operationline 3508
      $ sudo ifconfig
    • Dangerous shell operationline 3518
      $ sudo ifconfig
    • Dangerous shell operationline 3530
      $ sudo ifconfig
    • Network accessline 3604
      Another popular way is to use [Message Passing Interface (MPI)](https://en.wikipedia.org/wiki/Message_Passing_Interface). There are a few open source implementations of it available.
    • Network accessline 3657
      There could be a variety of reason for this failing, but of the most likely one is when you're on the cloud and the 2 nodes weren't provisioned so that their IB is connected. So your Ethernet inter-node connectivity works, but it's too slow
    • Network accessline 3796
      """     PDB Subclass for debugging multi-processed code     Suggested in: https://stackoverflow.com/questions/4716533/how-to-attach-debugger-to-a-python-subproccess
    • Network accessline 3797
      PDB Subclass for debugging multi-processed code     Suggested in: https://stackoverflow.com/questions/4716533/how-to-attach-debugger-to-a-python-subproccess     """
    • Network accessline 3798
      Suggested in: https://stackoverflow.com/questions/4716533/how-to-attach-debugger-to-a-python-subproccess
    • Network accessline 3822
      `dist.breakpoint()` and `ForkedPdb` above both require you to plant the breakpoint in the source before the run. Python 3.14 adds the missing case: attaching to a process that is *already running* and that you did not prepare in advance, gi
    • Network accessline 3841
      Primary reference: [Python 3.14 pdb](https://docs.python.org/3.14/library/pdb.html).
    • Network accessline 3889
      [hyperfine](https://github.com/sharkdp/hyperfine) runs a given command multiple times and reports how long it took to run: the mean, the standard deviation, and the fastest and slowest run. It can also compare two or more commands and repor
    • Dangerous shell operationline 3893
      sudo apt-get install -y hyperfine
    • Dangerous shell operationline 3928
      $ hyperfine -p 'sync; echo 3 | sudo tee /proc/sys/vm/drop_caches' 'python -c "import torch"'
    • Network accessline 3984
      - `ht.hpu.Event(enable_timing)` - Intel Gaudi - `torch.xpu.Event(enable_timing)` - Intel dGPUs - Apple MPS has a different API, but we can emulate the same API as can seen in [mamf-finder.py](https://github.com/stas00/ml-engineering/blob/00
    • Network accessline 3986
      - Apple MPS has a different API, but we can emulate the same API as can seen in [mamf-finder.py](https://github.com/stas00/ml-engineering/blob/0099885db36a8f06556efe1faf552518852cb1e0/compute/accelerator/benchmarks/mamf-finder.py#L159).
    • Network accessline 3992
      Here are some excellent articles going into deeper explanations and examples: - [How to Accurately Time CUDA Kernels in Pytorch](https://www.speechmatics.com/company/articles-and-news/timing-operations-in-pytorch)
    • Network accessline 3993
      - [How to Accurately Time CUDA Kernels in Pytorch](https://www.speechmatics.com/company/articles-and-news/timing-operations-in-pytorch)
    • Network accessline 3997
      In [Python Profilers](https://github.com/stas00/the-art-of-debugging/blob/master/python/README.md#profilers) we have seen how to use general Python profilers to detect where the program is slow. For PyTorch there are specially designed prof
    • Network accessline 4063
      For more options please refer to the [`torch.profiler` doc](https://docs.pytorch.org/docs/stable/profiler.html).
    • Network accessline 4065
      Additionally, here is [an excellent introduction to `torch.profiler` from the HuggingFace team](https://huggingface.co/blog/torch-profiler).
    • Network accessline 4075
      I assume you already have the correct version of torch installed, if not head [here](https://pytorch.org/get-started/locally/).
    • Network accessline 4157
      Now let's use it to profile 2 forward calls using [Liger Kernel](https://github.com/linkedin/Liger-Kernel):
    • Access to secretsline 4264
      [Credential-related source omitted]
    • Access to secretsline 4265
      [Credential-related source omitted]
    • Network accessline 4277
      footnote: since the culprit here was `torch.compile`, you could also have spotted the recompilation directly with `TORCH_LOGS=recompiles` (and `TORCH_LOGS=graph_breaks` for eager fallbacks); see [PyTorch compiler troubleshooting](https://do

    debug/tiny-scripts/c4-en-10k.py

    • Executable scriptline 1
      Executable file
    • Network accessline 6
      # You may obtain a copy of the License at # #     http://www.apache.org/licenses/LICENSE-2.0
    • Network accessline 7
      # #     http://www.apache.org/licenses/LICENSE-2.0 #
    • Network accessline 8
      #     http://www.apache.org/licenses/LICENSE-2.0
    • Network accessline 38
      The full 1TB+ dataset is at https://huggingface.co/datasets/c4.
    • Network accessline 41
      _URL = "https://cdn-datasets.huggingface.co/nlp/datasets/c4/c4-en-10k.tar.xz"
    • Network accessline 56
      description=_DESCRIPTION,             features=datasets.Features({"text": datasets.Value("string")}),             homepage="https://huggingface.co/datasets/allenai/c4/",
    • Network accessline 57
      features=datasets.Features({"text": datasets.Value("string")}),             homepage="https://huggingface.co/datasets/allenai/c4/",             citation=_CITATION,
    • Network accessline 58
      homepage="https://huggingface.co/datasets/allenai/c4/",

    debug/tiny-scripts/cm4-synthetic-testing.py

    • Executable scriptline 1
      Executable file
    • Dangerous shell operationline 7
      rm -rf data
    • Dangerous shell operationline 18
      # rm texts*
    • Network accessline 27
      # prep dataset repo https://huggingface.co/new-dataset => HuggingFaceM4/cm4-synthetic-testing
    • Network accessline 28
      https://huggingface.co/new-dataset => HuggingFaceM4/cm4-synthetic-testing
    • Network accessline 29
      git clone https://huggingface.co/datasets/HuggingFaceM4/cm4-synthetic-testing
    • Network accessline 70
      _DESCRIPTION = """This dataset is designed to be used in testing. It's derived from cm4-10k dataset""" _HOMEPAGE = "https://huggingface.co/datasets/HuggingFaceM4/cm4-synthetic-testing"
    • Network accessline 71
      _HOMEPAGE = "https://huggingface.co/datasets/HuggingFaceM4/cm4-synthetic-testing"
    • Network accessline 73
      _URL = "https://huggingface.co/datasets/HuggingFaceM4/cm4-synthetic-testing/resolve/main/data.tar.gz"

    debug/tiny-scripts/fsmt-make-super-tiny-model.py

    • Executable scriptline 1
      #!/usr/bin/env python
    • Network accessline 7
      # You may obtain a copy of the License at # #     http://www.apache.org/licenses/LICENSE-2.0
    • Network accessline 8
      # #     http://www.apache.org/licenses/LICENSE-2.0 #
    • Network accessline 9
      #     http://www.apache.org/licenses/LICENSE-2.0

    debug/tiny-scripts/general-pmd-ds-unpack.py

    • Executable scriptline 1
      Executable file
    • Network accessline 50
      list2range('1,2,5-7,10')     [1, 2, 5, 6, 7, 10]     # from https://stackoverflow.com/a/6405711/9201239
    • Network accessline 51
      [1, 2, 5, 6, 7, 10]     # from https://stackoverflow.com/a/6405711/9201239     """
    • Network accessline 52
      # from https://stackoverflow.com/a/6405711/9201239

    debug/tiny-scripts/general-pmd-synthetic-testing.py

    • Executable scriptline 1
      Executable file
    • Network accessline 6
      # prep dataset repo https://huggingface.co/new-dataset => HuggingFaceM4/general-pmd-synthetic-testing
    • Network accessline 7
      https://huggingface.co/new-dataset => HuggingFaceM4/general-pmd-synthetic-testing
    • Network accessline 8
      git clone https://huggingface.co/datasets/HuggingFaceM4/general-pmd-synthetic-testing
    • Dangerous shell operationline 12
      rm -rf data
    • Dangerous shell operationline 22
      rm image.jpg text.txt
    • Dangerous shell operationline 41
      rm -rf data
    • Network accessline 70
      _DESCRIPTION = """This dataset is designed to be used in testing. It's derived from general-pmd-10k dataset""" _HOMEPAGE = "https://huggingface.co/datasets/HuggingFaceM4/general-pmd-synthetic-testing"
    • Network accessline 71
      _HOMEPAGE = "https://huggingface.co/datasets/HuggingFaceM4/general-pmd-synthetic-testing"
    • Network accessline 73
      _URL = "https://huggingface.co/datasets/HuggingFaceM4/general-pmd-synthetic-testing/resolve/main/data.tar.gz"

    debug/tiny-scripts/idefics-make-tiny-model.py

    • Executable scriptline 1
      #!/usr/bin/env python

    debug/tiny-scripts/m4-ds-unpack.py

    • Executable scriptline 1
      Executable file
    • Network accessline 52
      list2range('1,2,5-7,10')     [1, 2, 5, 6, 7, 10]     # from https://stackoverflow.com/a/6405711/9201239
    • Network accessline 53
      [1, 2, 5, 6, 7, 10]     # from https://stackoverflow.com/a/6405711/9201239     """
    • Network accessline 54
      # from https://stackoverflow.com/a/6405711/9201239

    debug/tiny-scripts/mt5-make-tiny-model.py

    • Executable scriptline 1
      #!/usr/bin/env python
    • Network accessline 7
      # You may obtain a copy of the License at # #     http://www.apache.org/licenses/LICENSE-2.0
    • Network accessline 8
      # #     http://www.apache.org/licenses/LICENSE-2.0 #
    • Network accessline 9
      #     http://www.apache.org/licenses/LICENSE-2.0
    • Network accessline 22
      # To build: # 1. clone sentencepiece into this dir # git clone https://github.com/google/sentencepiece
    • Network accessline 23
      # 1. clone sentencepiece into this dir # git clone https://github.com/google/sentencepiece #
    • Network accessline 24
      # git clone https://github.com/google/sentencepiece
    • Network accessline 53
      # adapted from https://blog.ceshine.net/post/trim-down-sentencepiece-vocabulary/

    debug/tiny-scripts/openwebtext-10k.py

    • Executable scriptline 1
      Executable file
    • Network accessline 6
      # You may obtain a copy of the License at # #     http://www.apache.org/licenses/LICENSE-2.0
    • Network accessline 7
      # #     http://www.apache.org/licenses/LICENSE-2.0 #
    • Network accessline 8
      #     http://www.apache.org/licenses/LICENSE-2.0
    • Network accessline 27
      title={OpenWebText Corpus},   author={Aaron Gokaslan*, Vanya Cohen*, Ellie Pavlick, Stefanie Tellex},   howpublished{\\url{http://Skylion007.github.io/OpenWebTextCorpus}},
    • Network accessline 28
      author={Aaron Gokaslan*, Vanya Cohen*, Ellie Pavlick, Stefanie Tellex},   howpublished{\\url{http://Skylion007.github.io/OpenWebTextCorpus}},   year={2019}
    • Network accessline 29
      howpublished{\\url{http://Skylion007.github.io/OpenWebTextCorpus}},
    • Network accessline 39
      The full 8M-record dataset is at https://huggingface.co/datasets/openwebtext
    • Network accessline 42
      _URL = "https://cdn-datasets.huggingface.co/nlp/datasets/openwebtext/openwebtext-10k.tar.xz"
    • Network accessline 57
      description=_DESCRIPTION,             features=datasets.Features({"text": datasets.Value("string")}),             homepage="https://skylion007.github.io/OpenWebTextCorpus/",
    • Network accessline 58
      features=datasets.Features({"text": datasets.Value("string")}),             homepage="https://skylion007.github.io/OpenWebTextCorpus/",             citation=_CITATION,
    • Network accessline 59
      homepage="https://skylion007.github.io/OpenWebTextCorpus/",

    debug/tiny-scripts/oscar-en-10k.py

    • Executable scriptline 1
      Executable file
    • Network accessline 6
      # You may obtain a copy of the License at # #     http://www.apache.org/licenses/LICENSE-2.0
    • Network accessline 7
      # #     http://www.apache.org/licenses/LICENSE-2.0 #
    • Network accessline 8
      #     http://www.apache.org/licenses/LICENSE-2.0
    • Network accessline 31
      address   = {Mannheim},   doi       = {10.14618/ids-pub-9021},   url       = {http://nbn-resolving.de/urn:nbn:de:bsz:mh39-90215},
    • Network accessline 32
      doi       = {10.14618/ids-pub-9021},   url       = {http://nbn-resolving.de/urn:nbn:de:bsz:mh39-90215},   pages     = {9 -- 16},
    • Network accessline 33
      url       = {http://nbn-resolving.de/urn:nbn:de:bsz:mh39-90215},
    • Network accessline 44
      The full 1TB+ dataset is at https://huggingface.co/datasets/oscar.
    • Network accessline 47
      _URL = "https://cdn-datasets.huggingface.co/nlp/datasets/oscar/oscar-en-10k.tar.xz"
    • Network accessline 62
      description=_DESCRIPTION,             features=datasets.Features({"text": datasets.Value("string")}),             homepage="https://oscar-corpus.com/",
    • Network accessline 63
      features=datasets.Features({"text": datasets.Value("string")}),             homepage="https://oscar-corpus.com/",             citation=_CITATION,
    • Network accessline 64
      homepage="https://oscar-corpus.com/",

    debug/tools.md

    • Network accessline 47
      git clone https://github.com/huggingface/transformers
    • Network accessline 70
      So for example if you know that `transformers==4.33.0` was good and `transformers@main` (`HEAD`) is bad, find which commit is corresponding to the tag `4.33.0` by visiting [the releases page](https://github.com/huggingface/transformers/rele
    • Network accessline 141
      You can then go to `https://github.com/huggingface/transformers/commit/` and append the commit SHA to that url which will take you to the commit, (e.g. `https://github.com/huggingface/transformers/commit/57f44dc4288a3521bd700405ad41e90a4687

    debug/torch-distributed-gpu-test.py

    • Executable scriptline 1
      #!/usr/bin/env python
    • Access to secretsline 74
      [Credential-related source omitted]

    debug/underflow_overflow.py

    • Executable scriptline 1
      Executable file
    • Network accessline 5
      # You may obtain a copy of the License at # #     http://www.apache.org/licenses/LICENSE-2.0
    • Network accessline 6
      # #     http://www.apache.org/licenses/LICENSE-2.0 #
    • Network accessline 7
      #     http://www.apache.org/licenses/LICENSE-2.0

    images/Machine-Learning-Engineering-book-cover.svg

    • Network accessline 1
      <?xml version="1.0" encoding="UTF-8" standalone="no"?> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="1275" height="1650" viewBox="0 0 1
    • Network accessline 2
      <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="1275" height="1650" viewBox="0 0 1275 1650">

    inference/README.md

    • Network accessline 43
      See [NVIDIA's inference optimization overview](https://developer.nvidia.com/blog/mastering-llm-techniques-inference-optimization/) and [LLM benchmarking metric definitions](https://developer.nvidia.com/blog/llm-benchmarking-fundamental-conc
    • Network accessline 70
      The [OCP microscaling (MX) formats](https://github.com/openxla/xla/discussions/18085) use one 8-bit E8M0 scale per block of 32 values. Including the shared scale, their packed payload sizes are:
    • Network accessline 85
      ([source](https://developer.nvidia.com/blog/accelerated-inference-for-large-transformer-models-using-nvidia-fastertransformer-and-nvidia-triton-inference-server/))
    • Network accessline 96
      You can get these dimensions from `config.json` inside the model's folder or from an equivalent file if it's different. e.g. [meta-llama/Meta-Llama-3.1-8B](https://huggingface.co/meta-llama/Meta-Llama-3.1-8B/blob/main/config.json).
    • Network accessline 110
      [DeepSeek v3](https://arxiv.org/abs/2412.19437) introduced Multi-Latent Attention (MLA) which compresses the Key and Value into a latent vector, which further reduces the KV-cache size.  See section 2.1.1 of the paper for the specific detai
    • Network accessline 116
      [source](https://arxiv.org/abs/2405.04434)
    • Network accessline 118
      [SwiftKV](https://arxiv.org/abs/2410.03960) was invented to deal with the common situation of 10:1 ratio of prefill vs decode use-cases, reducing inference computation during prompt processing rather than just compressing memory. By combini
    • Network accessline 120
      KV cache while saving recomputation has a big negative impact on inference's performance. Here is a quote from [Dynamic Memory Compression: Retrofitting LLMs for Accelerated Inference](https://arxiv.org/abs/2403.09636):
    • Network accessline 209
      ([source](https://www.hopsworks.ai/dictionary/llm-temperature))
    • Network accessline 219
      For any positive temperature, scaling doesn't change the logit rank order, so a pure greedy argmax chooses the same token. It still changes sampling probabilities. With Top-K, the same K candidates remain eligible but their relative samplin
    • Network accessline 223
      For more on decoding methods, see this [HuggingFace blog](https://huggingface.co/blog/how-to-generate).
    • Network accessline 254
      There are multiple implementations of this technique. As of 2026-08 vLLM supports four of them as [structured output backends](https://docs.vllm.ai/en/latest/features/structured_outputs/), and picks one automatically unless you override it:
    • Network accessline 255
      - https://github.com/mlc-ai/xgrammar
    • Network accessline 256
      - https://github.com/guidance-ai/llguidance
    • Network accessline 257
      - https://github.com/dottxt-ai/outlines
    • Network accessline 258
      - https://github.com/noamgat/lm-format-enforcer
    • Network accessline 328
      Here is a good indepth dive into this subject: [Assisted Generation: a new direction toward low-latency text generation](https://huggingface.co/blog/assisted-generation).
    • Network accessline 330
      One other much simpler solution for [input-grounded tasks](#input-grounded-tasks), is to use [ngram prompt lookup decoding](https://github.com/apoorvumang/prompt-lookup-decoding). In this approach there is no need for a draft model, instead
    • Network accessline 343
      One of the solutions is called Fully [Homomorphic Encryption](https://en.wikipedia.org/wiki/Homomorphic_encryption) (FHE).
    • Network accessline 345
      Have a look at one such implementation, [concrete-ml](https://github.com/zama-ai/concrete-ml) that rewrites the model to be able to have the client run part of the model themselves, then the intermediary encrypted activations are sent to th
    • Network accessline 347
      There are various other approaches, e.g. this paper: [LLMs Can Understand Encrypted Prompt: Towards Privacy-Computing Friendly Transformers](https://arxiv.org/abs/2305.18396v3) goes into a custom solution based on Secure Multi-Party Computa
    • Network accessline 463
      According to wiki there are [3 types of reading](https://en.wikipedia.org/wiki/Speed_reading#Types_of_reading) and the reading speed is measured in words per minute (WPM).
    • Network accessline 540
      If you read benchmarks and run into p50, p75, p90, p95, and p99, these percentiles are values in an ordered distribution. A p95 value is the threshold at or below which 95% of observations fall; the remaining 5% are above it. The desirable 
    • Network accessline 542
      For example, let's look at partial output of a system loading report generated by [k6](https://github.com/grafana/k6) on an inference server:
    • Network accessline 556
      Please refer to [Percentile](https://en.wikipedia.org/wiki/Percentile) for a much more indepth explanation.
    • Network accessline 569
      - vLLM supports the `--load-format` flag, where one could choose options like `npcache` (numpy format caching) or `tensorizer` using  CoreWeave’s [Tensorizer](https://github.com/coreweave/tensorizer).  ([recipe](https://docs.vllm.ai/en/stab
    • Network accessline 579
      At the moment I mainly use [TTFT](#time-to-first-token) and [decode throughput](#decode-throughput) benchmarks. TTFT measures the client-observed time from sending the request until receiving the first non-empty generated chunk. The inter-t
    • Network accessline 614
      TTFT is not pure prefill time. It includes request transport, queueing, scheduling, prompt processing, first-token generation, and response transport. Dividing the prompt-token count by TTFT therefore does not produce prefill throughput; th
    • Network accessline 618
      note: I've discovered that when I use the openAI client it doesn't scale well and with many concurrent requests the openAI client creates a bottleneck and doesn't measure the real server performance - I am yet to figure out if it's an issue
    • Network accessline 622
      - https://github.com/vllm-project/vllm/blob/main/benchmarks/benchmark_throughput.py - my favorite tool so far
    • Network accessline 623
      - https://github.com/grafana/k6 - useful for load testing to simulate multiple concurrent clients - uses JavaScript clients.
    • Network accessline 643
      [vLLM](https://github.com/vllm-project/vllm)
    • Network accessline 647
      [DeepSpeed-FastGen](https://github.com/deepspeedai/DeepSpeed/tree/master/blogs/deepspeed-fastgen) from [the DeepSpeed team](https://github.com/deepspeedai/DeepSpeed).
    • Network accessline 651
      [TensorRT-LLM](https://github.com/NVIDIA/TensorRT-LLM) (also integrated what used to be `FasterTransformer`)
    • Network accessline 657
      [SGLang](https://github.com/sgl-project/sglang)
    • Network accessline 661
      [llama.cpp](https://github.com/ggml-org/llama.cpp) - local / single-box serving (CPU, CUDA including datacenter GPUs, Metal, …); not a multi-tenant production peer to vLLM/SGLang.
    • Network accessline 665
      [LightLLM](https://github.com/ModelTC/lightllm)
    • Network accessline 669
      [LMDeploy](https://github.com/InternLM/lmdeploy)
    • Network accessline 673
      [MLC-LLM](https://github.com/mlc-ai/mlc-llm)
    • Network accessline 685
      - **Intel Gaudi (HPU)**: the [vllm-gaudi](https://github.com/vllm-project/vllm-gaudi) plugin (the older [HabanaAI/vllm-fork](https://github.com/HabanaAI/vllm-fork) is being retired), plus [Optimum for Intel Gaudi](https://github.com/hugging
    • Network accessline 686
      - **AWS Trainium/Inferentia**: the [AWS Neuron SDK](https://github.com/aws-neuron/aws-neuron-sdk), which serves through standard vLLM APIs and [Optimum Neuron](https://github.com/huggingface/optimum-neuron).
    • Network accessline 687
      - **Google TPU**: [tpu-inference](https://github.com/vllm-project/tpu-inference) - the vLLM TPU plugin unifying JAX and PyTorch, and the successor to the now-archived [JetStream](https://github.com/AI-Hypercomputer/JetStream); [MaxText](htt
    • Network accessline 688
      - **Modular MAX**: [MAX](https://github.com/modular/modular) - a portable serving stack that also runs on CPUs and NVIDIA/AMD GPUs.
    • Network accessline 689
      - **Apple Silicon**: [MLX](https://github.com/ml-explore/mlx) / [mlx-lm](https://github.com/ml-explore/mlx-lm), plus llama.cpp's Metal backend.
    • Network accessline 690
      - **Tenstorrent**: [tt-metal](https://github.com/tenstorrent/tt-metal) and its vLLM integration.
    • Network accessline 694
      Finally, some vendors expose inference only as a hosted service on their own hardware, rather than as an installable framework - e.g. [Cerebras Inference](https://www.cerebras.ai/inference), Groq and [SambaNova](https://sambanova.ai/).
    • Network accessline 712
      For example, here is a snapshot of [vLLM](https://github.com/vllm-project/vllm)'s stats as of 2024-08-24, which is one of the most popular inference frameworks as of 2026-08.
    • Network accessline 725
      - [Groq](https://groq.com/)
    • Network accessline 732
      - [A Survey on Efficient Inference for Large Language Models (2024)](https://arxiv.org/abs/2404.14294)

    insights/ai-battlefield.md

    • Network accessline 34
      - Since ML does a lot of parallel processing ([SIMD](https://en.wikipedia.org/wiki/Single_instruction,_multiple_data)) GPUs were used at the beginning, but now you additionally have TPUs, FPGAs, HPUs, QPUs, RDUs, etc. Recent CPUs are becomi
    • Network accessline 57
      - The [Dot-com bubble](https://en.wikipedia.org/wiki/Dot-com_bubble) occurred during 1995-2000. And a very similar situation is happening right now in the AI space.
    • Network accessline 142
      Pros: - Managed for you - all you need is your software to do the training and a bit of [SLURM](../orchestration/slurm) know-how to launch jobs - Often sponsored by the local government/university - probably could get the job done for less 
    • Network accessline 144
      - Often sponsored by the local government/university - probably could get the job done for less $$ or even free (e.g. we trained [BLOOM-176B](https://huggingface.co/bigscience/bloom) for free on [JeanZay HPC](http://www.idris.fr/en/)!)
    • Network accessline 181
      Imagine a steam locomotive - the engine is great, but if the [fireman](https://en.wikipedia.org/wiki/Fireman_(steam_engine)) isn't fast enough to shovel the coal in, the train won't move fast.
    • Network accessline 185
      [source](https://commons.wikimedia.org/wiki/File:Baureihe52Heizer.jpg)
    • Network accessline 189
      - Accelerators get ~2x faster every 2 years ([Moore's law](https://en.wikipedia.org/wiki/Moore%27s_law))
    • Network accessline 231
      - If a single iteration requires 624 Tera floating point operations and it took 4 secs to run then we know that we get: `624/4=156` actual TFLOPS - now BF16@A100 is [advertised as 312TFLOPS](https://www.nvidia.com/en-us/data-center/a100/) s
    • Network accessline 232
      - now BF16@A100 is [advertised as 312TFLOPS](https://www.nvidia.com/en-us/data-center/a100/) so `156/312=0.5` gives us 50% MFU.
    • Network accessline 246
      - There is not much that can be done about the accelerator memory since its bandwidth is what it is - one can only write more efficient software to make data move faster to/from the accelerator - hint: fused and custom written kernels (like
    • Network accessline 298
      - NVIDIA GPUs: all based on [CUDA](https://developer.nvidia.com/cuda/toolkit), which most training frameworks support. You can easily moved between different NVIDIA GPUs and most things would work the same.
    • Network accessline 300
      - AMD MI250/MI3xx: with PyTorch using [ROCm](https://pytorch.org/blog/pytorch-for-amd-rocm-platform-now-available-as-python-package/) you can run most CUDA-based software as is. This is really the only inter-operable accelerator with the NV
    • Network accessline 302
      - Intel Gaudi2/Gaudi3: if you use HF Transformers/Diffusers you can use [optimum-habana](https://github.com/huggingface/optimum-habana). If you use HF Trainer with NVIDIA GPUs it should be relatively easy to switch to train/infer on Gaudi2.
    • Network accessline 304
      - Google TPU and AWS Trainium: both via [XLA](https://openxla.org/xla) - PyTorch works, custom CUDA kernels don't
    • Network accessline 308
      - Cerebras: is also working on PyTorch support via [Cerebras Software Platform (CSoft) via XLA](https://www.cerebras.ai/blog/supporting-pytorch-on-the-cerebras-wafer-scale-engine/).
    • Network accessline 310
      Also in general most ML code could be compiled into cross-platform formats like [Open Neural Network Exchange (ONNX)](https://en.wikipedia.org/wiki/Open_Neural_Network_Exchange) which can be run on a variety of accelerators. This approach i
    • Network accessline 523
      Learning how to [debug efficiently](https://github.com/stas00/the-art-of-debugging/tree/master/methodology) should also make this process much less painful.

    insights/how-to-choose-cloud-provider.md

    • Network accessline 82
      As a continuation of a previous section, a [Service Level Agreement](https://en.wikipedia.org/wiki/Service-level_agreement) (SLA) is an agreement between a service providers and a customer that define various guarantees and expectations wit
    • Network accessline 84
      The other term is Service Level Objective (SLO) where SLA is quantified. For example, an SLO may define a Monthly Uptime Percentage to 99.5%, if the uptime is less than 99.5% the provider credits the customer to a certain percentage of the 
    • Network accessline 152
      I'm yet to find a golden reference point, but, for example,  [SemiAnalysis](https://newsletter.semianalysis.com/p/ai-neocloud-playbook-and-anatomy#%C2%A7cluster-deployment-and-acceptance-test) suggests that OEM provider performs a 3-4 weeks
    • Network accessline 214
      But, of course, only you know what your workloads' specific requirements are. Also consider the relationship between local storage and remote (shared) storage, as some providers will reduce the size and performance of local drives to save m
    • Network accessline 287
      In general, CSPs follow NVIDIA's [DGX SuperPOD Reference Architecture](https://docs.nvidia.com/dgx-superpod/reference-architecture-scalable-infrastructure-h100/latest/abstract.html) which provides a lot of detail on how to build a rail-opti
    • Network accessline 289
      However, many of the largest GPU clusters in the world now run RoCEv2 instead of InfiniBand. Meta has [proven](https://engineering.fb.com/2024/08/05/data-center-engineering/roce-network-distributed-ai-training-at-scale/) that you can train 
    • Network accessline 383
      - semianalysis.com created a ClusterMax CSP rating system and includes excellent explanations of the different criteria and plans to continue ranking many CSPs. [2025](https://newsletter.semianalysis.com/p/the-gpu-cloud-clustermax-rating-sy

    insights/when-to-upgrade-gpus/bench_decompose.py

    • Executable scriptline 1
      #!/usr/bin/env python3
    • Access to secretsline 31
      [Credential-related source omitted]
    • Access to secretsline 32
      [Credential-related source omitted]
    • Access to secretsline 42
      [Credential-related source omitted]
    • Access to secretsline 43
      [Credential-related source omitted]
    • Access to secretsline 44
      [Credential-related source omitted]
    • Access to secretsline 45
      [Credential-related source omitted]
    • Access to secretsline 46
      [Credential-related source omitted]
    • Access to secretsline 47
      [Credential-related source omitted]
    • Access to secretsline 48
      [Credential-related source omitted]
    • Access to secretsline 49
      [Credential-related source omitted]
    • Access to secretsline 58
      [Credential-related source omitted]
    • Access to secretsline 117
      [Credential-related source omitted]

    insights/when-to-upgrade-gpus/bench_flash_attn.py

    • Executable scriptline 1
      #!/usr/bin/env python3

    insights/when-to-upgrade-gpus/benchmark.py

    • Executable scriptline 1
      #!/usr/bin/env python3
    • Access to secretsline 18
      [Credential-related source omitted]
    • Access to secretsline 19
      [Credential-related source omitted]
    • Access to secretsline 30
      [Credential-related source omitted]
    • Access to secretsline 31
      [Credential-related source omitted]
    • Access to secretsline 32
      [Credential-related source omitted]
    • Access to secretsline 33
      [Credential-related source omitted]
    • Access to secretsline 34
      [Credential-related source omitted]
    • Access to secretsline 35
      [Credential-related source omitted]
    • Access to secretsline 38
      [Credential-related source omitted]
    • Access to secretsline 39
      [Credential-related source omitted]
    • Access to secretsline 51
      [Credential-related source omitted]
    • Access to secretsline 166
      [Credential-related source omitted]

    insights/when-to-upgrade-gpus/install.sh

    • Executable scriptline 1
      #!/usr/bin/env bash
    • Network accessline 13
      DEEPSPEED=0.19.2 LIGER=0.8.0 CU130=https://download.pytorch.org/whl/cu130
    • Network accessline 15
      CU130=https://download.pytorch.org/whl/cu130
    • Dangerous shell operationline 28
      sudo update-alternatives --set cuda /usr/local/cuda-13.0 2>/dev/null || true
    • Network accessline 30
      echo "== installing torch==$TORCH (cu130) ==" uv pip install --upgrade "torch==$TORCH" --index-url "$CU130"
    • Network accessline 31
      uv pip install --upgrade "torch==$TORCH" --index-url "$CU130"
    • Dangerous shell operationline 49
      rm -rf ~/.cache/torch_extensions/* 2>/dev/null || true
    • Network accessline 63
      uv pip install --no-deps flash-attn-3 --index-url "$CU130"

    insights/when-to-upgrade-gpus/plot_results.py

    • Executable scriptline 1
      #!/usr/bin/env python3

    insights/when-to-upgrade-gpus/run_sweep.sh

    • Executable scriptline 1
      #!/usr/bin/env bash

    network/README.md

    • Network accessline 64
      - algbw: algorithm bandwidth - payload size divided by elapsed time - Bi-directional, Duplex: a transmission from one point to another in both directions A <-> B, typically 2x the one-direction (unidirectional) rate - Bisection Width: minim
    • Network accessline 65
      - Bi-directional, Duplex: a transmission from one point to another in both directions A <-> B, typically 2x the one-direction (unidirectional) rate - Bisection Width: minimum number of links cut to divide the network into two parts (not nec
    • Network accessline 66
      - Bisection Width: minimum number of links cut to divide the network into two parts (not necessarily equal). The bandwidth of those links is known as Bisection Bandwidth - which is often used as a metric for real network bandwidth). Sometim
    • Network accessline 129
      Here is a [good overview article](https://www.fs.com/blog/a-quick-look-at-the-differences-rdma-vs-tcpip-2945.html).
    • Network accessline 183
      2. AWS publishes `NeuronLink-v3 ... 1.28 TB/sec bandwidth per chip` for Trainium2 without declaring directionality, so it's halved here per the directionality note below. AWS doesn't publish a per-link rate or a link count, so Trainium2 can
    • Network accessline 184
      3. PCIe 6 is listed under `Announced, availability not confirmed` because no shipping accelerator attaches at Gen6 as of 2026-07-31 - current parts are Gen5 x16 (NVIDIA H200 SXM lists `PCIe Gen5`, AMD MI350X/MI355X list `PCIe 5.0 x16`), so 
    • Network accessline 185
      4. Google publishes a "Bidirectional inter-chip interconnect (ICI) bandwidth per chip (GBps)" of 1200 for TPU7x, halved here per the note above. Peer-to-peer is the per-axis figure, "bi-directional bandwidth of 200 GBps per axis" - and 6 ne
    • Network accessline 244
      [PCIe](https://en.wikipedia.org/wiki/PCI_Express) is a high-speed serial computer expansion bus standard that can be found even on the cheapest computer desktop.
    • Network accessline 280
      footnote: a released specification is not shipping silicon. As of 2026-07-30 [PCI-SIG](https://pcisig.com/specifications) lists `PCI Express Base Specification Revision 7.0` as released, while PCIe 8.0 exists only as a members-only draft, t
    • Network accessline 288
      - [NVLink](https://en.wikipedia.org/wiki/NVLink) is a wire-based serial multi-lane near-range communications link developed by NVIDIA. Here is the [What Is NVLink](https://blogs.nvidia.com/blog/what-is-nvidia-nvlink/) blog post with more ba
    • Network accessline 312
      There is a good overview of evolution of NVLink (1 to 4) [here](https://www.naddod.com/blog/unveiling-the-evolution-of-nvlink).
    • Network accessline 405
      As of 2026-08 there is no public spec of the speed, but I found 450GBps unidirectional mentioned [here](https://newsletter.semianalysis.com/p/gb200-hardware-architecture-and-component#%C2%A7the-4-rack-scale-form-factors-of-blackwell) for GB
    • Network accessline 469
      [NVSwitch](https://www.nvidia.com/en-us/data-center/nvlink/) can connect more than 8 GPUs at the speed of [NVLink](#nvlink). It's advertised to connect up to 256 GPUs in the future generations of the switch.
    • Network accessline 479
      The [NVIDIA DGX H100](https://web.archive.org/web/20231208180425/https://developer.nvidia.com/blog/upgrading-multi-gpu-interconnectivity-with-the-third-generation-nvidia-nvswitch/) connects eight H100 GPUs through four third-generation NVSw
    • Network accessline 483
      A [DGX H100 SuperPOD](https://docs.nvidia.com/dgx-superpod/reference-architecture-scalable-infrastructure-h100/latest/index.html) scalable unit contains 32 DGX H100 systems (256 GPUs), but each DGX remains its own in-node NVSwitch domain. T
    • Network accessline 487
      Recently [GB200 NVL72](https://www.nvidia.com/en-us/data-center/gb200-nvl72/) has been introduced, which uses NVSwitch to put 72 Blackwell GPUs into a single node all inter-connected at NVLink 5 900GBps unidirectional speed. So instead of h
    • Network accessline 519
      Platform specs: - [MI250X](https://www.amd.com/en/products/accelerators/instinct/mi200/mi250x.html)
    • Network accessline 520
      - [MI250X](https://www.amd.com/en/products/accelerators/instinct/mi200/mi250x.html)
    • Network accessline 521
      - [MI300x](https://www.amd.com/en/products/accelerators/instinct/mi300/platform.html)
    • Network accessline 522
      - [MI325X](https://www.amd.com/en/products/accelerators/instinct/mi300/mi325x.html)
    • Network accessline 523
      - [MI350X](https://www.amd.com/en/products/accelerators/instinct/mi350/mi350x.html)
    • Network accessline 524
      - [MI355X](https://www.amd.com/en/products/accelerators/instinct/mi350/mi355x.html)
    • Network accessline 535
      According to [Gaudi2 spec](https://habana.ai/wp-content/uploads/2023/10/HLS-Gaudi2_Datasheet_10_23.pdf), these nodes provide the same 100GbE RoCE v2 RDMA hardware for inter- and intra-node connectivity (24x 100Gbps per card).
    • Network accessline 542
      According to [Gaudi3 spec](https://www.intel.com/content/www/us/en/content-details/817486/intel-gaudi-3-ai-accelerator-white-paper.html), these nodes provide the same setup as Gaudi2 except the cards are 2x faster using 200GbE RoCE v2 RDMA 
    • Network accessline 549
      NeuronLink v3 ([spec](https://awsdocs-neuron.readthedocs-hosted.com/en/latest/about-neuron/arch/neuron-hardware/trn2-arch.html)) is the intra-node equivalent of NVLink for AWS Trainium2, but it's a point-to-point architecture, like AMD MI* 
    • Network accessline 604
      1. [NVIDIA DGX B300 specifications](https://www.nvidia.com/en-us/data-center/dgx-b300/)
    • Network accessline 605
      2. [AWS EC2 accelerated-computing network specifications](https://docs.aws.amazon.com/ec2/latest/instancetypes/ac.html)
    • Network accessline 606
      3. [Intel Gaudi3 white paper](https://www.intel.com/content/www/us/en/content-details/817486/intel-gaudi-3-ai-accelerator-white-paper.html)
    • Network accessline 607
      4. [NVIDIA DGX H100/H200 user guide](https://docs.nvidia.com/dgx/dgxh100-user-guide/introduction-to-dgxh100.html)
    • Network accessline 608
      5. [Intel Gaudi2 data sheet](https://habana.ai/wp-content/uploads/2023/10/HLS-Gaudi2_Datasheet_10_23.pdf)
    • Network accessline 609
      6. [Google Cloud GPUDirect-TCPX/TCPXO](https://docs.cloud.google.com/kubernetes-engine/docs/how-to/gpu-bandwidth-gpudirect-tcpx)
    • Network accessline 610
      7. [HPE Slingshot 11 QuickSpecs](https://www.hpe.com/us/en/collaterals/collateral.a50002546enw.html)
    • Network accessline 611
      8. [Cornelis CN-100HFA specifications](https://www.cornelis.com/product/cornelis-omni-path-accelerated-host-fabric-adapter-cn-100hfa)
    • Network accessline 612
      9. [InfiniBand Trade Association XDR specification release](https://infinibandta.org/ibta-unveils-xdr-infiniband-specification-to-enable-the-next-generation-of-ai-and-scientific-computing/)
    • Network accessline 613
      10. [NVIDIA NDR cabling guide](https://docs.nvidia.com/dgx-superpod/design-guide-cabling-data-centers/latest/ndr-overview.html)
    • Network accessline 614
      11. 2 ports of 4 XDR lanes each (4x200Gbps = 800Gbps per port); a node with this layout is illustrative, not a documented product. 12. 1 port of 4 NDR lanes (4x100Gbps = 400Gbps). 13. Cornelis [CN6000 product page](https://www.cornelis.com/
    • Network accessline 615
      12. 1 port of 4 NDR lanes (4x100Gbps = 400Gbps). 13. Cornelis [CN6000 product page](https://www.cornelis.com/products/cn6000?product_range=supernics) and [AMD MI400 reference architecture](https://www.cornelis.com/stories/cornelis-announces
    • Network accessline 616
      13. Cornelis [CN6000 product page](https://www.cornelis.com/products/cn6000?product_range=supernics) and [AMD MI400 reference architecture](https://www.cornelis.com/stories/cornelis-announces-new-reference-architecture-for-ai-inference-trai
    • Network accessline 617
      14. 800Gbps product sampling in 2026; GA target Q4-2026; eight-adapter node remains illustrative. 15. [InfiniBand Trade Association roadmap](https://infinibandta.org/infiniband-roadmap/) 16. GDR is on the InfiniBand Trade Association roadma
    • Network accessline 618
      15. [InfiniBand Trade Association roadmap](https://infinibandta.org/infiniband-roadmap/)
    • Network accessline 619
      16. GDR is on the InfiniBand Trade Association roadmap; no GDR product has shipped. The 2-port node is illustrative. 17. [Cornelis CN5000 launch](https://www.cornelis.com/stories/cornelis-launches-cn5000-industry-leading-ai-and-hpc-scale-ou
    • Network accessline 620
      17. [Cornelis CN5000 launch](https://www.cornelis.com/stories/cornelis-launches-cn5000-industry-leading-ai-and-hpc-scale-out-network)
    • Network accessline 632
      29. Google publishes a higher headline number for these machine types - 1800Gbps max network bandwidth for A3 Mega and 1000Gbps for A3 High. Those totals include the VPC/frontend NIC; the figures above count only the accelerator fabric, so 
    • Network accessline 634
      31. The `v1`-`v4` EFA generation labels are AWS's own, taken from the [supported instance types](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/efa.html#efa-instance-types) tables, which group instances under `Nitro v3 (EFA v1)` throug
    • Network accessline 664
      1. [NVIDIA InfiniBand adapters](https://www.nvidia.com/en-us/networking/infiniband-adapters/) - NVIDIA states "up to 1.6 terabits per second (Tb/s) throughput" for ConnectX-9, "up to 800 gigabits per second (Gb/s) of data throughput" for Co
    • Network accessline 665
      2. [AMD Pensando networking](https://www.amd.com/en/products/network-interface-cards/pensando.html) - "up to 800 Gbps of Ethernet connectivity" for Vulcano and "up to 400 Gbps Ethernet speeds" for Pollara 400.
    • Network accessline 669
      6. AMD advertises "up to 2.4 Tbps of scale-out bandwidth per GPU" for Vulcano. That's three 800Gbps NICs attached to one GPU - a platform configuration, not a single faster NIC. Same trap as the node-aggregate columns elsewhere in this chap
    • Network accessline 670
      7. These two sit under `Announced, availability not confirmed` because the vendor page names the product but states no availability, not because the vendor says it is unreleased. NVIDIA lists ConnectX-9 in its adapter portfolio without a sh
    • Network accessline 671
      8. [Cornelis CN6000 SuperNIC adapters](https://www.cornelis.com/product/cornelis-cn6000-omni-path-adapters) - Bandwidth `800G`; Performance `1.6Tbps bidirectional (800Gbps Tx and 800Gbps Rx)`; Dual QSFP-DD (`x4` @ 112 Gbps/lane); PCIe 6.0 x
    • Network accessline 677
      [InfiniBand](https://en.wikipedia.org/wiki/InfiniBand) (IB) has been around for a few decades so there are many available configurations that can be found out there. So that if someone says they have InfiniBand that is insufficient informat
    • Network accessline 705
      1. [InfiniBand Trade Association XDR specification release](https://infinibandta.org/ibta-unveils-xdr-infiniband-specification-to-enable-the-next-generation-of-ai-and-scientific-computing/)
    • Network accessline 706
      2. [NVIDIA NDR cabling guide](https://docs.nvidia.com/dgx-superpod/design-guide-cabling-data-centers/latest/ndr-overview.html)
    • Network accessline 707
      3. [InfiniBand Trade Association roadmap](https://infinibandta.org/infiniband-roadmap/)
    • Network accessline 726
      1. [InfiniBand Trade Association roadmap](https://infinibandta.org/infiniband-roadmap/)
    • Network accessline 727
      2. [InfiniBand Trade Association historical 8X and 12X roadmap](https://infinibandta.org/infiniband-trade-association-ibta-announces-updated-infiniband-roadmap-projecting-data-speeds-of-104gb-s-per-4x-port-in-2011/)
    • Network accessline 739
      InfiniBand provides [RDMA](https://en.wikipedia.org/wiki/Remote_direct_memory_access).
    • Network accessline 743
      - One configuration of NVIDIA DGX H100 comes with 8x NVIDIA ConnectX-7 (CX7) Ethernet/InfiniBand ports each of 400Gbps, for a total of 3.2Tbps (0.4TBps) unidirectional to connect with other DGX servers. - For DGX H100 SuperPOD the ConnectX-
    • Network accessline 744
      - For DGX H100 SuperPOD the ConnectX-7s across all 32 DGX servers and associated InfiniBand switches provide 12.8TBps of unidirectional bandwidth (25.6TBps counting both directions) for use within the pod or for scaling out to multiple Supe
    • Network accessline 745
      - NVIDIA DGX GB200 NVL72 compute trays provide four single-port ConnectX-7 interfaces at up to 400Gbps each, corresponding to one 400Gbps connection per GPU ([networking documentation](https://docs.nvidia.com/dgx/dgxgb200-user-guide/network
    • Network accessline 748
      [InfiniBand](https://en.wikipedia.org/wiki/InfiniBand) used to have multiple manufacturers, but at the moment it's just NVIDIA (purchased Mellanox) - which makes it a single-vendor interconnect, a lock-in consideration when weighing it agai
    • Network accessline 750
      Practical links: - [InfiniBand Utilities](https://networking-docs.nvidia.com/mlnxofedswum/24.10-5.1.6.1lts/infiniband-fabric-utilities) (the link could be outdated as it's versioned) - these are useful when debugging an IB setup.
    • Network accessline 751
      - [InfiniBand Utilities](https://networking-docs.nvidia.com/mlnxofedswum/24.10-5.1.6.1lts/infiniband-fabric-utilities) (the link could be outdated as it's versioned) - these are useful when debugging an IB setup.
    • Network accessline 759
      [NVIDIA Quantum-2 InfiniBand Platform](https://www.nvidia.com/en-us/networking/quantum2/) is the switch side of NDR, pairing with the ConnectX-7 adapters in [Network adapters](#network-adapters). It supports 400Gbps per port, provides RDMA,
    • Network accessline 766
      [NVIDIA Quantum-X800 InfiniBand Platform](https://www.nvidia.com/en-us/networking/products/infiniband/quantum-x800/) is the switch side of XDR, pairing with ConnectX-8, and supports 800Gbps per port and includes in-network computing with [S
    • Network accessline 773
      [Spectrum-X](https://www.nvidia.com/en-us/networking/spectrumx/) is NVIDIA's Ethernet answer to its own InfiniBand line, for shops that want RoCE rather than IB. NVIDIA describes it as "the tight coupling of the NVIDIA Spectrum-X Ethernet s
    • Network accessline 796
      Source: [NVIDIA Ethernet switching](https://www.nvidia.com/en-us/networking/ethernet-switching/), as of 2026-07-30. NVIDIA does not state per-model availability there, so `GA` is `?` for the Spectrum-6 SN6000 systems - the newer co-packaged
    • Network accessline 808
      Note that NVIDIA does not attach a Quantum product name to the InfiniBand version on its [InfiniBand page](https://www.nvidia.com/en-us/networking/products/infiniband/) - only the generic photonics framing - so there is no generation to put
    • Network accessline 822
      [Elastic Fabric Adapter (EFA)](https://aws.amazon.com/hpc/efa/) is a recent inter-node networking technology created by AWS.
    • Network accessline 830
      The generation labels above are AWS's own: its [supported instance types](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/efa.html#efa-instance-types) page groups every EFA-capable instance under a `Nitro v3 (EFA v1)` through `Nitro v6 
    • Network accessline 847
      According to [Gaudi2 spec](https://habana.ai/wp-content/uploads/2023/10/HLS-Gaudi2_Datasheet_10_23.pdf), these nodes provide `3*8=24` NICs of 100GbE RoCE v2 RDMA for a total of 2.4Tbps of inter-node connectivity with other Gaudi2 nodes.
    • Network accessline 852
      According to [Gaudi3 spec](https://www.intel.com/content/www/us/en/content-details/817486/intel-gaudi-3-ai-accelerator-white-paper.html), these nodes provide `3*8=24` NICs of 200GbE RoCE v2 RDMA for a total of 4.8Tbps of inter-node connecti
    • Network accessline 857
      [HPE Slingshot interconnect](https://www.hpe.com/ca/en/compute/hpc/slingshot-interconnect.html) seems to be used by HPCs. As of 2026-08 it provides 200Gbps per link. Some HPCs use 4 of those links to build 800Gbps interconnects, and, of cou
    • Network accessline 863
      GPUDirect-TCPX is an RDMA-over-TCP software solution developed by Google for A3 instances. GPUDirect-TCPXO is a hardware-accelerated extension of TCPX available only on A3 Mega. The docs are scarce, but here is some information on [TCPX](ht
    • Network accessline 869
      [Omni-Path Architecture](https://en.wikipedia.org/wiki/Omni-Path) (OPA). Originally by Intel, the technology got sold to Cornelis Networks. It's also known as Omni-Path Express (OPX).
    • Network accessline 871
      case study: I used this technology at JeanZay HPC in France in 2022. It was only 135Gbps and while the vendor tried to fix it a year later it was still the same speed. Hopefully the issue has been resolved and the speed is much faster nowad
    • Network accessline 873
      [Cornelis Omni-Path Accelerated Host Fabric Adapter CN-100HFA](https://www.cornelis.com/product/cornelis-omni-path-accelerated-host-fabric-adapter-cn-100hfa) 100Gbps NICs have been around for many years now - and until 2025 this was the onl
    • Network accessline 875
      [CN5000](https://www.cornelis.com/product/cornelis-cn5000-omni-path-adapters) 400Gbps NICs began shipping in June 2025 and have been broadly available since Q3-2025 - see note 18 under the [inter-node networking](#inter-node-networking) tab
    • Network accessline 877
      footnote: Cornelis's marketing pages sometimes say "400Gbps bidirectional", but the [product-family docs](http://docs.cornelis.com/en/cn5000-product-family-descriptions/fabric-hardware-components/cn5000-supernic.html) state "400 Gbps (4 x 1
    • Network accessline 879
      [CN6000](https://www.cornelis.com/product/cornelis-cn6000-omni-path-adapters) is the next generation - an 800Gbps SuperNIC on PCIe 6.0 that runs Omni-Path, RoCEv2, and Ultra Ethernet concurrently (each of its dual QSFP-DD ports independentl
    • Network accessline 883
      Omni-Path provides [RDMA](https://en.wikipedia.org/wiki/Remote_direct_memory_access).
    • Network accessline 888
      [The UALink initiative](https://ualinkconsortium.org/) is an attempt to create an open standard to compete with [NVLink](#nvlink). Supposedly it'll be based on AMD's [Infinity Fabric](#infinity-fabric--xgmi). The consortium published the `U
    • Network accessline 902
      caveat on sourcing: use Huawei's Chinese pages, not the English ones. Both are JavaScript applications, but the Chinese product pages inline the full specification table while the English equivalents inline almost nothing - the English Atla
    • Network accessline 909
      NVIDIA [Scalable Hierarchical Aggregation and Reduction Protocol (SHARP)](https://networking-docs.nvidia.com/sharpum/300) - allows performing data reductions and aggregations on the network itself (in-network computing). This is very useful
    • Network accessline 911
      To understand the importance of this technology - for `all-reduce` operations, instead of 2N sends, it will only need N+1 sends - so for a large N - it almost doubles the effective all-reduce throughput. (N is the number of communicating ra
    • Network accessline 917
      case study: I discovered SHARP accidentally when an H100 intra-node NVLink 4.0 [torch-collective-bench](benchmarks/torch-dist-bench.py) benchmark reported 480GBps for a 4GiB payload when the theoretical spec was only 450GBps! We figured out
    • Network accessline 947
      NVIDIA's own documentation draws a 4-GPU line, though it takes one step to see why: NVLink SHARP is implemented with multicast - the switch reduces and then fans the result back out to every participant - which is why NCCL's setup log for `
    • Network accessline 953
      In the case of NVL36, NVL72 and others bigger than NVL8 the granularity is likely 4 GPUs rather than 8, since a compute tray holds 2 GB200 modules and each module is 1 Grace CPU + 2 Blackwell GPUs. The [NVIDIA GB200 NVL Partition User Guide
    • Network accessline 963
      [source](https://www.nvidia.com/en-us/on-demand/session/gtc25-s72583/)
    • Network accessline 1031
      If the experimental model still contains 2B params like in the previous section and grads are in fp32 then the training program needs to send 8GB (`2B * 4B`) of data on every iteration. Moreover, since syncing the gradients requires an [`al
    • Network accessline 1037
      ([source](https://docs.pytorch.org/tutorials/intermediate/dist_tuto.html#collective-communication))
    • Network accessline 1060
      oh and this whole synchronization protocol is called DDP ([DistributedDataParallel](https://docs.pytorch.org/docs/stable/generated/torch.nn.parallel.DistributedDataParallel.html)) in the PyTorch lingo.
    • Network accessline 1103
      For example, when you read, the [A100 spec](https://www.nvidia.com/en-us/data-center/a100/#specifications) the TFLOPS there means TeraFloatingPointOperations per second.
    • Network accessline 1110
      Also see the [wiki page](https://en.wikipedia.org/wiki/FLOPS) for more clarifications.
    • Network accessline 1112
      For GPT-family of decoder transformers models we can use the math described in this [BLOOM-176 docs](https://github.com/bigscience-workshop/bigscience/tree/master/math#calculate-tflops):
    • Network accessline 1143
      So if we do a mixed half-precision training and most of the operations are done in half-precision then we can roughly say that we do [312TFLOPS on A100](https://www.nvidia.com/en-us/data-center/a100/#specifications) and usually a well optim
    • Network accessline 1145
      footnote: It's a ~3x [989TFLOPS on H100](https://www.nvidia.com/en-us/data-center/h100) (scroll to the end) and also it shows a misleading 2x numbers for sparsity so you have to mentally divide it by 2.
    • Network accessline 1248
      This benchmark run an `all_reduce` collective for various payload sizes from 32KiB to 16GiB. The value that we care about is the `busbw` - this column tells us the real network throughput as explained [here](https://github.com/NVIDIA/nccl-t
    • Network accessline 1382
      note: [NVIDIA/nvbandwidth](https://github.com/NVIDIA/nvbandwidth) is supposed to be a more detailed and correct benchmark to replace `p2pBandwidthLatencyTest`, but I found the latter to provide very similar results.
    • Network accessline 1386
      ![nccl all-reduce scan benchmark](images/nccl-all-reduce-scan.png) ([source](https://arxiv.org/abs/2411.13055))
    • Network accessline 1387
      ([source](https://arxiv.org/abs/2411.13055))
    • Network accessline 1391
      ![nccl all-reduce nvlstree scan benchmark](images/nccl-all-reduce-scan-nvlstree.png) [source](https://www.nvidia.com/en-us/on-demand/session/gtc24-s62129/)
    • Network accessline 1392
      [source](https://www.nvidia.com/en-us/on-demand/session/gtc24-s62129/)
    • Network accessline 1396
      ![Low-level Uni-directional Bandwidth Measurements](images/ccgrid11-uni-direction-bandwidth.png) ([source](https://ieeexplore.ieee.org/document/5238655))
    • Network accessline 1397
      ([source](https://ieeexplore.ieee.org/document/5238655))
    • Network accessline 1406
      [source](https://www.nvidia.com/en-us/on-demand/session/gtc25-s72583/)
    • Network accessline 1409
      Another tool for bandwidth measurements on NVIDIA GPUs is [NVIDIA/nvbandwidth](https://github.com/NVIDIA/nvbandwidth).
    • Network accessline 1413
      Normally NCCL passes each payload through its own internal staging buffers, since it knows nothing about where the peers keep their data. If instead every rank's buffer sits at the same offset of a registered NCCL symmetric memory window, e
    • Network accessline 1575
      A collective can't tell you this. An `all-reduce` across nodes will always lean on the intra-node fabric, which is the whole point of this section. To measure the wire itself, use a point-to-point RDMA benchmark. [`ib_write_bw`](https://man
    • Network accessline 1579
      Fabrics with their own userspace stack rather than verbs - [Slingshot](#hpe-slingshot-interconnect), [Omni-Path](#omni-path) via OPX, [GPUDirect-TCPX](#gpudirect-tcpx) - need their own tools. The nearest equivalent there is `fi_rma_bw` from
    • Network accessline 1581
      footnote: RDMA-write-over-[SRD](#glossary-and-concepts) support was contributed to `perftest` by AWS ([PR 206](https://github.com/linux-rdma/perftest/pull/206)). Confirmed on a live instance on 2026-08-07: on an 8x H200 `p5en.48xlarge` node
    • Network accessline 1583
      footnote: it is tempting to instead keep all the accelerators and take the intra-node fabric away with [`NCCL_P2P_DISABLE=1`](https://docs.nvidia.com/deeplearning/nccl/user-guide/docs/env.html), but that only pushes intra-node traffic down 
    • Network accessline 1591
      ![Low-level Latency Measurements](images/ccgrid11-low-level-latency.png) ([source](https://ieeexplore.ieee.org/document/5238655))
    • Network accessline 1592
      ([source](https://ieeexplore.ieee.org/document/5238655))
    • Network accessline 1600
      - **It gets the only tree.** NCCL implements its tree algorithm for all-reduce only; the other collectives use rings. A NCCL maintainer models the tree's latency as `2*(G-1)*l + 2*log2(N)*L`, which grows with the log of the node count, and 
    • Network accessline 1601
      - **The other collectives lack an equivalent.** NCCL 2.23 added the PAT algorithm for all-gather and reduce-scatter, but only for one GPU per node, and a maintainer says it's "not yet as low-latency as the Tree allreduce" ([NCCL #1473](http
    • Network accessline 1618
      Proprietary network hardware vendors like AWS (EFA) don't disclose their secrets and therefore the public libraries like [nccl](https://github.com/NVIDIA/nccl) cannot support those out of the box. These vendors have to supply their own vers
    • Network accessline 1620
      Originally proprietary hardware vendors used the trick of telling the users to use `LD_LIBRARY_PATH` and/or `LD_PRELOAD` to dynamically overload `libnccl.so` to get their custom version loaded into PyTorch or another framework. But recently
    • Network accessline 1624
      On EFA that plugin is [aws-ofi-nccl](https://github.com/aws/aws-ofi-nccl). NCCL has no transport for that NIC, so it cannot run over EFA without the plugin.
    • Network accessline 1626
      For more information about dynamic library loading see [this section](https://github.com/stas00/the-art-of-debugging/tree/master/compiled-programs#shared-libraries-ldsoconf-nm-unresolved-symbols-ldd-ld_library_path-ld_preload).
    • Network accessline 1632
      [MSCCL++](https://github.com/microsoft/mscclpp) implements the NCCL collective API in `libmscclpp_nccl.so`, which takes the place of `libnccl.so`. The application keeps its NCCL calls, and the collective runs an MSCCL++ schedule on the GPU.
    • Network accessline 1634
      [UCCL-collective](https://github.com/uccl-project/uccl), also called UCCL-Tran, is a [NCCL Net Plugin](#proprietary-network-hardware-and-nccl). NCCL still chooses the algorithm. The plugin replaces the transport: it sprays packets over many
    • Network accessline 1642
      [DeepEP](https://github.com/deepseek-ai/DeepEP) is DeepSeek's library for [expert-parallel](../training/model-parallelism/README.md#expert-parallelism) dispatch and combine. A call moves the hidden states of the tokens a rank holds, and onl
    • Network accessline 1663
      - Azure: [availability set](https://learn.microsoft.com/en-us/azure/virtual-machines/availability-set-overview?source=recommendations)
    • Network accessline 1664
      - AWS: [cluster placement groups](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/placement-groups.html)
    • Network accessline 1665
      - GCP: [compact placement policies](https://docs.cloud.google.com/compute/docs/instances/use-compact-placement-policies)

    network/benchmarks/README.md

    • Network accessline 54
      Read the normalized `busbw` column rather than `algbw` - [PERFORMANCE.md](https://github.com/NVIDIA/nccl-tests/blob/master/doc/PERFORMANCE.md#bandwidth) explains why. Like `nccl-tests`, the benchmark measures a unidirectional bandwidth, so 
    • Network accessline 73
      ![all-reduce multi node bandwidth](images/all-reduce-multi-node-bandwidth.png) [source](https://www.nvidia.com/en-us/on-demand/session/gtc24-s62129/)
    • Network accessline 74
      [source](https://www.nvidia.com/en-us/on-demand/session/gtc24-s62129/)
    • Network accessline 76
      If you're benchmarking a different collective the expected bandwidth can be very different from the above all-reduce results. [This presentation](https://www.nvidia.com/en-us/on-demand/session/gtc24-s62129/) also gives point-to-point commun
    • Network accessline 148
      - Each call's time is the time from the end of the previous queued call to its own end, as in `nccl-tests`' per-iteration timing (`-I 1`), which it reports in its `i_*` columns, and as the median in its `-J` JSON output. The first call of a
    • Network accessline 149
      - A call isn't done until it's done on every rank, so each call's time is that of its slowest rank, as in `nccl-tests`' per-iteration median and p99. Its `time` column is instead each rank's time per call averaged over the ranks, which is c
    • Network accessline 150
      - Small payloads get up to 1000 calls each, so that the p99 is the 10th slowest of them, and larger payloads fewer, once 1000 calls would move more than 40MiB - [Intel MPI Benchmarks](https://github.com/intel/mpi-benchmarks) counts its repe
    • Network accessline 184
      The payload, `algbw` and `busbw` follow `nccl-tests`, whose [PERFORMANCE.md](https://github.com/NVIDIA/nccl-tests/blob/master/doc/PERFORMANCE.md) explains them. The payload is the larger of a rank's input and output buffers, and `busbw` is 
    • Network accessline 323
      - [nccl-tests](https://github.com/NVIDIA/nccl-tests) - NVIDIA's benchmark of every NCCL collective through the NCCL C API; `time` is the mean per call, `-I 1` adds per-call min, max and p99. One 32MiB payload by default, while its README sw
    • Network accessline 324
      - [rccl-tests](https://github.com/ROCm/rccl-tests) - the same benchmark for AMD's RCCL, with the same flags and columns.
    • Network accessline 325
      - [OSU Micro-Benchmarks](https://mvapich.cse.ohio-state.edu/benchmarks/) - the MPI benchmarks from the MVAPICH team; `osu_allreduce` and its siblings report the average, min and max latency per call, 1B to 1MiB by default.
    • Network accessline 326
      - [Intel MPI Benchmarks](https://github.com/intel/mpi-benchmarks) - `IMB-MPI1 Allreduce` and the other collectives report `t_min`, `t_max` and `t_avg` per call, 0B to 4MiB by default.
    • Network accessline 327
      - [PARAM](https://github.com/facebookresearch/param) - Meta's benchmarks, whose `train/comms/pt/comms.py` times collectives through `torch.distributed` like this benchmark does and reports p50, p75 and p95 latency, 8B to 64B by default.
    • Network accessline 328
      - [UCC perftest](https://github.com/openucx/ucc) - `ucc_perftest` times collectives through UCC, which can run over NCCL, and reports the average, min and max latency; one 128-element payload by default.
    • Network accessline 329
      - [MSCCL++](https://github.com/microsoft/mscclpp) - its `python/mscclpp_benchmark/allreduce_bench.py` times MSCCL++'s all-reduce kernels against NCCL's from 4KiB to 1GiB. See [Other collective libraries](../README.md#other-collective-librar
    • Network accessline 330
      - [DeepEP](https://github.com/deepseek-ai/DeepEP) - DeepSeek's MoE expert-parallel all-to-all library, whose tests time its dispatch and combine kernels at realistic token counts rather than sweeping payload sizes. See [Other collective lib
    • Network accessline 350
      [NVIDIA/nccl-tests](https://github.com/NVIDIA/nccl-tests) benchmarks collectives - `all-reduce`, `all-gather`, `reduce-scatter` and the rest - and reports the same `busbw`/`algbw` columns as [torch-dist-bench.py](torch-dist-bench.py).
    • Network accessline 357
      git clone https://github.com/NVIDIA/nccl-tests
    • Network accessline 371
      [NVIDIA/nvbandwidth](https://github.com/NVIDIA/nvbandwidth) measures point-to-point bandwidth between hosts and accelerators - the closest thing to a direct reading of a single link, as opposed to a collective's aggregate:
    • Network accessline 374
      git clone https://github.com/NVIDIA/nvbandwidth
    • Network accessline 385
      [p2pBandwidthLatencyTest](https://github.com/NVIDIA/cuda-samples/tree/master/cpp/5_Domain_Specific/p2pBandwidthLatencyTest) from CUDA samples is a low-level accelerator-to-accelerator benchmark:
    • Network accessline 388
      git clone https://github.com/NVIDIA/cuda-samples/
    • Network accessline 404
      For example, you need to find a way to prevent the network usage from fluctuations. When we were doing performance optimizations for [108B pre-BLOOM experiments](https://github.com/bigscience-workshop/bigscience/tree/master/train/tr8-104B-w
    • Network accessline 413
      Note: The [EAI cookbook](https://github.com/EleutherAI/cookbook) contains a set of [communication benchmarks](https://github.com/EleutherAI/cookbook/tree/main/benchmarks/communication) for each collective that you can use to quickly measure
    • Network accessline 419
      On CSPs that have enabled [SLURM Pyxis Container Plugin](https://github.com/NVIDIA/pyxis), such as CoreWeave, Crusoe, AWS, Oracle, Azure, GCP, etc, `torch-dist-bench.py` can be easily ran & reproduced via the following command:
    • Network accessline 460
      Frameworks that shard weights and optim stages like [DeepSpeed](https://github.com/deepspeedai/DeepSpeed) w/ ZeRO Stage-3 do a lot more traffic than frameworks like [Megatron-DeepSpeed](https://github.com/bigscience-workshop/Megatron-DeepSp
    • Network accessline 470
      [full details](https://github.com/deepspeedai/DeepSpeed/issues/2928#issuecomment-1463041491)
    • Network accessline 477
      As it's often not easy to benchmark hundreds of nodes, often we try to benchmark interconnect performance using, say, 4 nodes. I wasn't sure whether this would give the correct indication for when 40 or 400 nodes will be used so I asked abo
    • Network accessline 486
      For the optimal GDS performance, disable ACS by following these instructions [here](https://docs.nvidia.com/deeplearning/nccl/user-guide/docs/troubleshooting.html#pci-access-control-services-acs). Here are some [additional notes](https://do
    • Network accessline 493
      While NCCL is excellent at automatically figuring out the best performance for any given network, sometimes it needs some help, in which case the following NCCL env vars are used to tune up performance. Let's look at a few common ones you m
    • Network accessline 506
      I was asking questions about how a user can do the optimization and was told at [this NCCL Issue](https://github.com/NVIDIA/nccl/issues/790) that basically the user shouldn't try to optimize anything as NCCL has a ton of smart algorithms in
    • Network accessline 518
      There is also an algo named `NVLS`, which uses NVLink SHARP to do the reduction inside the switch and can therefore report more than the wire spec - with NVLink 4.0 (450GBps) an `all-reduce` benchmark clocks 480GBps. `NVLSTree` (NCCL 2.18+)
    • Network accessline 568
      Cooperative Thread Array (CTA) implements CUDA thread blocks - You can read about it [here](https://docs.nvidia.com/cuda/parallel-thread-execution/#thread-hierarchy).
    • Network accessline 574
      The CTA value is derived algorithmically by NCCL, but the default behavior can be overridden by setting the lower and upper limits via the env vars: [`NCCL_MIN_CTAS`](https://docs.nvidia.com/deeplearning/nccl/user-guide/docs/env.html?highli
    • Network accessline 595
      For nuances see this paper: [Adaptive Routing in InfiniBand Hardware](https://web-backend.simula.no/sites/default/files/publications/files/adaptive_routing_in_infiniband_hardware.pdf).

    network/benchmarks/all_gather_object_vs_all_gather.py

    • Executable scriptline 1
      #!/usr/bin/env python
    • Access to secretsline 22
      [Credential-related source omitted]

    network/benchmarks/all_gather_object_vs_all_reduce.py

    • Executable scriptline 1
      #!/usr/bin/env python
    • Access to secretsline 17
      [Credential-related source omitted]

    network/benchmarks/all_reduce_bench.py

    • Executable scriptline 1
      #!/usr/bin/env python
    • Network accessline 6
      Its new location is: https://github.com/stas00/ml-engineering/blob/master/network/benchmarks/torch-dist-bench.py
    • Network accessline 15
      new_url = "https://github.com/stas00/ml-engineering/blob/master/network/benchmarks/torch-dist-bench.py"
    • Access to secretsline 19
      [Credential-related source omitted]

    network/benchmarks/all_reduce_latency_comp.py

    • Executable scriptline 1
      #!/usr/bin/env python
    • Network accessline 33
      # the 2*(n-1)/n busbw correction factor specific to all-reduce is explained here:     # https://github.com/NVIDIA/nccl-tests/blob/master/doc/PERFORMANCE.md#allreduce
    • Network accessline 34
      # https://github.com/NVIDIA/nccl-tests/blob/master/doc/PERFORMANCE.md#allreduce
    • Access to secretsline 92
      [Credential-related source omitted]

    network/benchmarks/torch-dist-bench-pyxis.sbatch

    • Executable scriptline 1
      #!/bin/bash

    network/benchmarks/torch-dist-bench.py

    • Executable scriptline 1
      #!/usr/bin/env python
    • Network accessline 5
      The latest version of this program can be found at https://github.com/stas00/ml-engineering/blob/master/network/benchmarks/torch-dist-bench.py
    • Network accessline 6
      https://github.com/stas00/ml-engineering/blob/master/network/benchmarks/torch-dist-bench.py
    • Network accessline 8
      This benchmark is very similar to https://github.com/NVIDIA/nccl-tests, but much easier to set up, since all
    • Network accessline 15
      For detailed documentation please refer to: https://github.com/stas00/ml-engineering/blob/master/network/benchmarks/README.md#torch-dist-bench
    • Network accessline 16
      https://github.com/stas00/ml-engineering/blob/master/network/benchmarks/README.md#torch-dist-bench
    • Network accessline 18
      This script: - has been derived from @jeffra's gist: https://gist.github.com/jeffra/b5e80466b4c86be00ea3b6f130fb7a36
    • Network accessline 19
      - has been derived from @jeffra's gist: https://gist.github.com/jeffra/b5e80466b4c86be00ea3b6f130fb7a36
    • Network accessline 20
      - which in turn is derived from the logic in https://github.com/NVIDIA/nccl-tests
    • Network accessline 22
      * Indu Thangakrishnan https://github.com/indhub to handle timing correctly using cuda events
    • Network accessline 151
      # the busbw correction factors of nccl-tests, explained in # https://github.com/NVIDIA/nccl-tests/blob/master/doc/PERFORMANCE.md#bus-bandwidth - busbw reflects how optimally
    • Network accessline 152
      # https://github.com/NVIDIA/nccl-tests/blob/master/doc/PERFORMANCE.md#bus-bandwidth - busbw reflects how optimally
    • Network accessline 954
      # 1. device_id arg was added in torch==2.3     # 2. setting device_id leads to hanging in 2.6.0<torch<2.7.1 https://github.com/pytorch/pytorch/issues/153960
    • Network accessline 955
      # 2. setting device_id leads to hanging in 2.6.0<torch<2.7.1 https://github.com/pytorch/pytorch/issues/153960
    • Access to secretsline 1022
      [Credential-related source omitted]

    network/comms.md

    • Network accessline 11
      PyTorch has `send` and `recv` for blocking, `isend` and `irecv` for non-blocking p2p comms. [more](https://docs.pytorch.org/tutorials/intermediate/dist_tuto.html#id1).
    • Network accessline 19
      Reference: [PyTorch 2.14 release blog](https://pytorch.org/blog/pytorch-2-14-release-blog/).
    • Network accessline 30
      ![broadcast](images/collective-broadcast-1.png) [source](https://images.nvidia.com/events/sc15/pdfs/NCCL-Woolley.pdf)
    • Network accessline 31
      [source](https://images.nvidia.com/events/sc15/pdfs/NCCL-Woolley.pdf)
    • Network accessline 33
      ![broadcast](images/collective-broadcast-2.png) [source](https://images.nvidia.com/events/sc15/pdfs/NCCL-Woolley.pdf)
    • Network accessline 34
      [source](https://images.nvidia.com/events/sc15/pdfs/NCCL-Woolley.pdf)
    • Network accessline 38
      `dist.broadcast(tensor, src, group)`: Copies `tensor` from `src` to all other processes. [doc](https://docs.pytorch.org/docs/stable/distributed.html#torch.distributed.broadcast).
    • Network accessline 44
      ![gather](images/collective-gather-1.png) [source](https://images.nvidia.com/events/sc15/pdfs/NCCL-Woolley.pdf)
    • Network accessline 45
      [source](https://images.nvidia.com/events/sc15/pdfs/NCCL-Woolley.pdf)
    • Network accessline 47
      ![gather](images/collective-gather-2.png) [source](https://images.nvidia.com/events/sc15/pdfs/NCCL-Woolley.pdf)
    • Network accessline 48
      [source](https://images.nvidia.com/events/sc15/pdfs/NCCL-Woolley.pdf)
    • Network accessline 52
      `dist.gather(tensor, gather_list, dst, group)`: Copies one `tensor` from every process in the group into `gather_list` on `dst`. [doc](https://docs.pytorch.org/docs/stable/distributed.html#torch.distributed.gather)
    • Network accessline 58
      ![all-gather](images/collective-all-gather-1.png) [source](https://images.nvidia.com/events/sc15/pdfs/NCCL-Woolley.pdf)
    • Network accessline 59
      [source](https://images.nvidia.com/events/sc15/pdfs/NCCL-Woolley.pdf)
    • Network accessline 61
      ![all-gather](images/collective-all-gather-2.png) [source](https://images.nvidia.com/events/sc15/pdfs/NCCL-Woolley.pdf)
    • Network accessline 62
      [source](https://images.nvidia.com/events/sc15/pdfs/NCCL-Woolley.pdf)
    • Network accessline 68
      `dist.all_gather(tensor_list, tensor, group)`: Copies `tensor` from all processes to `tensor_list`, on all processes. [doc](https://docs.pytorch.org/docs/stable/distributed.html#torch.distributed.all_gather)
    • Network accessline 74
      ![reduce](images/collective-reduce-1.png) [source](https://images.nvidia.com/events/sc15/pdfs/NCCL-Woolley.pdf)
    • Network accessline 75
      [source](https://images.nvidia.com/events/sc15/pdfs/NCCL-Woolley.pdf)
    • Network accessline 77
      ![reduce](images/collective-reduce-2.png) [source](https://images.nvidia.com/events/sc15/pdfs/NCCL-Woolley.pdf)
    • Network accessline 78
      [source](https://images.nvidia.com/events/sc15/pdfs/NCCL-Woolley.pdf)
    • Network accessline 82
      `dist.reduce(tensor, dst, op, group)`: Applies `op` to every `tensor` and stores the result in `dst`. [doc](https://docs.pytorch.org/docs/stable/distributed.html#torch.distributed.reduce)
    • Network accessline 84
      PyTorch supports multiple reduction operations like: `avg`, `sum`, `product`, `min`, `max`, `band`, `bor`, `bxor`, and others - [full list](https://docs.pytorch.org/docs/stable/distributed.html#torch.distributed.ReduceOp).
    • Network accessline 92
      [source](https://images.nvidia.com/events/sc15/pdfs/NCCL-Woolley.pdf)
    • Network accessline 94
      [source](https://images.nvidia.com/events/sc15/pdfs/NCCL-Woolley.pdf)
    • Network accessline 96
      For example, this collective is used in [DDP](https://docs.pytorch.org/docs/stable/generated/torch.nn.parallel.DistributedDataParallel.html) to reduce gradients between all participating ranks.
    • Network accessline 100
      `dist.all_reduce(tensor, op, group)`: Same as reduce, but the result is stored in all processes. [doc](https://docs.pytorch.org/docs/stable/distributed.html#torch.distributed.all_reduce)
    • Network accessline 106
      ![scatter](images/collective-scatter-1.png) [source](https://images.nvidia.com/events/sc15/pdfs/NCCL-Woolley.pdf)
    • Network accessline 107
      [source](https://images.nvidia.com/events/sc15/pdfs/NCCL-Woolley.pdf)
    • Network accessline 109
      ![scatter](images/collective-scatter-2.png) [source](https://images.nvidia.com/events/sc15/pdfs/NCCL-Woolley.pdf)
    • Network accessline 110
      [source](https://images.nvidia.com/events/sc15/pdfs/NCCL-Woolley.pdf)
    • Network accessline 114
      `dist.scatter(tensor, scatter_list, src, group)`: Copies the `i`-th tensor `scatter_list[i]` to the `i`-th process. [doc](https://docs.pytorch.org/docs/stable/distributed.html#torch.distributed.scatter)
    • Network accessline 121
      ![reduce-scatter](images/collective-reduce-scatter.png) [source](https://images.nvidia.com/events/sc15/pdfs/NCCL-Woolley.pdf)
    • Network accessline 122
      [source](https://images.nvidia.com/events/sc15/pdfs/NCCL-Woolley.pdf)
    • Network accessline 128
      `dist.reduce_scatter(output, input_list, op, group, async_op)`: Reduces, then scatters a list of tensors to all processes in a group. [doc](https://docs.pytorch.org/docs/stable/distributed.html#torch.distributed.reduce_scatter)
    • Network accessline 135
      ![all-to-all](images/collective-all-to-all-1.png) [source](https://images.nvidia.com/events/sc15/pdfs/NCCL-Woolley.pdf)
    • Network accessline 136
      [source](https://images.nvidia.com/events/sc15/pdfs/NCCL-Woolley.pdf)
    • Network accessline 138
      ![all-to-all](images/collective-all-to-all.png) [source](https://images.nvidia.com/events/sc15/pdfs/NCCL-Woolley.pdf)
    • Network accessline 139
      [source](https://images.nvidia.com/events/sc15/pdfs/NCCL-Woolley.pdf)
    • Network accessline 146
      `dist.all_to_all(output_tensor_list, input_tensor_list, group)`: Scatters list of input tensors to all processes in a group and return gathered list of tensors in output list. [doc](https://docs.pytorch.org/docs/stable/distributed.html#torc
    • Network accessline 169
      ![ring-based broadcast](images/broadcast-ring.png) [source](https://images.nvidia.com/events/sc15/pdfs/NCCL-Woolley.pdf)
    • Network accessline 170
      [source](https://images.nvidia.com/events/sc15/pdfs/NCCL-Woolley.pdf)
    • Network accessline 190
      ![ring-based all-reduce chunk 1](images/all-reduce-ring-chunk1.png) [source](https://images.nvidia.com/events/sc15/pdfs/NCCL-Woolley.pdf)
    • Network accessline 191
      [source](https://images.nvidia.com/events/sc15/pdfs/NCCL-Woolley.pdf)
    • Network accessline 195
      ![ring-based all-reduce chunk 2](images/all-reduce-ring-chunk2.png) [source](https://images.nvidia.com/events/sc15/pdfs/NCCL-Woolley.pdf)
    • Network accessline 196
      [source](https://images.nvidia.com/events/sc15/pdfs/NCCL-Woolley.pdf)
    • Network accessline 222
      Sources: 1. [Demystifying NCCL: An In-depth Analysis of GPU Communication Protocols and Algorithms](https://arxiv.org/abs/2507.04786) (2025), Table I.
    • Network accessline 223
      1. [Demystifying NCCL: An In-depth Analysis of GPU Communication Protocols and Algorithms](https://arxiv.org/abs/2507.04786) (2025), Table I.
    • Network accessline 234
      - [UvA Deep Learning Tutorials](https://uvadlc-notebooks.readthedocs.io/en/latest/tutorial_notebooks/DL2/High-performant_DL/Multi_GPU/hpdlmultigpu.html#Communication-Primitives)
    • Network accessline 238
      - [Demystifying NCCL: An In-depth Analysis of GPU Communication Protocols and Algorithms](https://arxiv.org/abs/2507.04786) (2025) - this paper presents a comprehensive analysis of NCCL, focusing on its communication protocol variants (Simp

    network/debug/README.md

    • Network accessline 21
      This section is definitely non-exhaustive and is meant to cover some of the most common setup issues that I have often encountered. For more complex problems please research the [NCCL repo Issues](https://github.com/NVIDIA/nccl/issues) or f
    • Network accessline 51
      tells us that [nccl-fastsocket](https://github.com/google/nccl-fastsocket) transport layer plugin is used and it discovered 8 `ibs*` network interfaces (NIC cards). If you're using Google Cloud this is correct, and your NCCL is likely setup
    • Network accessline 58
      Here, you can see that IB is used with 8 `mlx5_*` interfaces for collective comms, and one OOB, which stands for Out-Of-Band, and is used for doing bootstrapping the connections and is usually using a slower Ethernet NIC (at times [several 
    • Network accessline 138
      The full doc is [here](https://docs.nvidia.com/deeplearning/nccl/user-guide/docs/env.html#nccl-socket-ifname).
    • Network accessline 147
      The full doc is [here](https://docs.nvidia.com/deeplearning/nccl/user-guide/docs/env.html#nccl-ib-hca).
    • Network accessline 175
      * Give enough resources by adding to the docker `run` these additional args: `--shm-size=1g --ulimit memlock=-1` ([more details](https://docs.nvidia.com/deeplearning/nccl/user-guide/docs/troubleshooting.html#sharing-data))
    • Network accessline 222
      For consumer-level GPUs there could be a variety of reasons for your GPU not being supported, often it's the IOMMU and/or ACS features being enabled. At other times it's just the driver version. And if you spend some time searching you migh
    • Network accessline 224
      To check if PCI Access Control Services (ACS) are enabled and to disable those follow [this guide](https://docs.nvidia.com/deeplearning/nccl/user-guide/docs/troubleshooting.html#pci-access-control-services-acs).
    • Network accessline 276
      The following env vars are most useful during debugging NCCL-related issues such as hanging and crashing. The full list of those can be found [here](https://docs.nvidia.com/deeplearning/nccl/user-guide/docs/env.html).
    • Network accessline 352
      A worked example of using the exclusion form to route around a single problem adapter is in [How to diagnose NCCL multi-gpu and multi-node connectivity issues](#how-to-diagnose-nccl-multi-gpu-and-multi-node-connectivity-issues). The full do

    orchestration/README.md

    • Network accessline 15
      - [Slinky](https://github.com/slinkyproject) - a framework from the creators of SLURM.
    • Network accessline 16
      - [Soperator](https://github.com/nebius/soperator) - from Nebius
    • Network accessline 17
      - CoreWeave never released their [SUNK](https://www.coreweave.com/products/sunk) open source, so it's only available to its customers.
    • Network accessline 23
      - [Kubernetes](kubernetes/) - also known as K8s, is an open source system for automating deployment, scaling, and management of containerized applications. Here is a good [comparison between SLURM and K8s](https://web.archive.org/web/202503
    • Network accessline 29
      - [dstack](https://github.com/dstackai/dstack) is a lightweight, open-source alternative to Kubernetes & SLURM, simplifying AI container orchestration with multi-cloud & on-prem support. It natively supports NVIDIA, AMD, & TPU.
    • Network accessline 30
      - [SkyPilot](https://github.com/skypilot-org/skypilot) is a framework for running AI and batch workloads on any infra, offering unified execution, high cost savings, and high GPU availability.
    • Network accessline 31
      - [OpenHPC](https://github.com/openhpc/ohpc) provides a variety of common, pre-built ingredients required to deploy and manage an HPC Linux cluster including provisioning tools, resource management, I/O clients, runtimes, development tools,
    • Network accessline 32
      - [run.ai](https://www.nvidia.com/en-us/software/run-ai/) - got acquired by NVIDIA and is planned to be open sourced soon.
    • Network accessline 33
      - [Docker Swarm](https://docs.docker.com/engine/swarm/) is a container orchestration tool.
    • Network accessline 34
      - [IBM Platform Load Sharing Facility (LSF)](https://www.ibm.com/products/hpc-workload-management) Suites is a workload management platform and job scheduler for distributed high performance computing (HPC).

    orchestration/kubernetes/README.md

    • Network accessline 17
      Here is how this is done. Kubernetes 1.32 introduced the kubelet flag [`singleProcessOOMKill`](https://github.com/kubernetes/kubernetes/pull/126096), which allows you to set `memory.oom.group = 0`.

    orchestration/slurm/admin.md

    • Access to secretsline 12
      [Credential-related source omitted]
    • Access to secretsline 13
      [Credential-related source omitted]
    • Dangerous shell operationline 44
      PDSH_RCMD_TYPE=ssh pdsh -w node-[21,23-26]  "nvidia-smi --query-compute-apps=pid --format=csv,noheader | sort | uniq | xargs -n1 sudo kill -9"
    • Dangerous shell operationline 53
      sudo scontrol show config
    • Dangerous shell operationline 60
      sudo scontrol reconfigure
    • Dangerous shell operationline 141
      sudo cat /var/log/slurm/slurmctld.log

    orchestration/slurm/cron-daily.slurm

    • Executable scriptline 1
      #!/bin/bash

    orchestration/slurm/cron-hourly.slurm

    • Executable scriptline 1
      #!/bin/bash

    orchestration/slurm/example.slurm

    • Executable scriptline 1
      #!/bin/bash

    orchestration/slurm/launchers/README.md

    • Network accessline 5
      - [torchrun](torchrun-launcher.slurm) - to be used with [PyTorch distributed](https://github.com/pytorch/pytorch).
    • Network accessline 6
      - [accelerate](accelerate-launcher.slurm) - to be used with [HF Accelerate](https://github.com/huggingface/accelerate).
    • Network accessline 7
      - [lightning](lightning-launcher.slurm) - to be used with [Lightning](https://lightning.ai/) (“PyTorch Lightning” and “Lightning Fabric”).

    orchestration/slurm/launchers/accelerate-launcher.slurm

    • Executable scriptline 1
      #!/bin/bash

    orchestration/slurm/launchers/lightning-launcher.slurm

    • Executable scriptline 1
      #!/bin/bash

    orchestration/slurm/launchers/srun-launcher.slurm

    • Executable scriptline 1
      #!/bin/bash

    orchestration/slurm/launchers/torchrun-launcher.slurm

    • Executable scriptline 1
      #!/bin/bash

    orchestration/slurm/undrain-good-nodes.sh

    • Executable scriptline 1
      #!/bin/bash
    • Dangerous shell operationline 24
      PDSH_RCMD_TYPE=ssh pdsh -w $n "nvidia-smi --query-compute-apps=pid --format=csv,noheader | sort | uniq | xargs -n1 sudo kill -9"
    • Dangerous shell operationline 38
      sudo scontrol update NodeName=$n State=idle Reason="undrained by $USER"

    orchestration/slurm/users.md

    • Network accessline 113
      By default, if the cpu has [Hyper-Threads](https://en.wikipedia.org/wiki/Hyper-threading) (HT) enabled, SLURM will use it. If you don't want to use HT you have to specify `--hint=nomultithread`.
    • Network accessline 547
      More details https://slurm.schedmd.com/job_array.html
    • Network accessline 649
      But if you want to use something where you can disconnect and reconnect and continue using the program normally you'd have to use a [terminal multiplexer](https://en.wikipedia.org/wiki/Terminal_multiplexer) program like [`tmux`](https://git
    • Access to secretsline 922
      [Credential-related source omitted]
    • Access to secretsline 953
      [Credential-related source omitted]
    • Dangerous shell operationline 1112
      find $WORK/cron -name "*.out" -mtime +7 -exec rm -f {} +
    • Network accessline 1155
      I'm yet to find why this is so, but so far we have been using a kill switch workaround. You have to code it in your framework. For example, see how it was implemented in [Megatron-DeepSpeed](https://github.com/bigscience-workshop/Megatron-D
    • Dangerous shell operationline 1166
      rm $WORK/tmp/training17-kill-switch

    resources/README.md

    • Network accessline 5
      - Boris Dayma wrote [A Recipe for Training Large Models](https://wandb.ai/craiyon/report/reports/Recipe-Training-Large-Models--VmlldzozNjc4MzQz)
    • Network accessline 7
      - The HuggingFace team published [The Ultra-Scale Playbook: Training LLMs on GPU Clusters](https://huggingface.co/spaces/nanotron/ultrascale-playbook).
    • Network accessline 9
      - Jacob Austin maintains [How to Scale Your Model: A Systems View of LLMs on TPUs](https://jax-ml.github.io/scaling-book/)
    • Network accessline 11
      - The Harvard Edge group publishes [Machine Learning Systems](https://github.com/harvard-edge/cs249r_book) (CS249r textbook; site: [mlsysbook.ai](http://mlsysbook.ai/)).
    • Network accessline 16
      - [@StellaAthena](https://github.com/StellaAthena) created the [Common LLM Settings spreadsheet](https://docs.google.com/spreadsheets/d/14vbBbuRMEHoqeuMHkTfw3uiZVmyXNuoSp8s-aHvfvZk/edit#gid=0) which can be a super-useful resource when you'r
    • Network accessline 18
      - A few years back I started compiling information on [which dtype the models were trained in](https://discuss.huggingface.co/t/model-pre-training-precision-database-fp16-fp32-bf16/5671) - it only contains a handful of models but if you're 
    • Network accessline 25
      If you know of a public LLM/VLM training logbook, or a technical report with such a section, that is not on this list please kindly let me know via [an Issue](https://github.com/stas00/ml-engineering/issues) or add it via a PR. Thank you!
    • Network accessline 31
      - BigScience pre-BLOOM 108B training experiments (2021): [chronicles](https://github.com/bigscience-workshop/bigscience/blob/master/train/tr8-104B-wide/chronicles.md) |
    • Network accessline 32
      [chronicles](https://github.com/bigscience-workshop/bigscience/blob/master/train/tr8-104B-wide/chronicles.md) |
    • Network accessline 33
      [the full spec and discussions](https://github.com/bigscience-workshop/bigscience/tree/master/train/tr8-104B-wide)
    • Network accessline 34
      (backup: [1](https://github.com/stas00/bigscience-backup/blob/master/train/tr8-104B-wide/chronicles.md) | [2](https://github.com/stas00/bigscience-backup/tree/master/train/tr8-104B-wide))
    • Network accessline 35
      [1](https://github.com/stas00/bigscience-backup/blob/master/train/tr8-104B-wide/chronicles.md) |
    • Network accessline 36
      [2](https://github.com/stas00/bigscience-backup/tree/master/train/tr8-104B-wide))
    • Network accessline 41
      - BigScience BLOOM-176B (2022): [chronicles-prequel](https://github.com/bigscience-workshop/bigscience/blob/master/train/tr11-176B-ml/chronicles-prequel.md) |
    • Network accessline 42
      [chronicles-prequel](https://github.com/bigscience-workshop/bigscience/blob/master/train/tr11-176B-ml/chronicles-prequel.md) |
    • Network accessline 43
      [chronicles](https://github.com/bigscience-workshop/bigscience/blob/master/train/tr11-176B-ml/chronicles.md) |
    • Network accessline 44
      [the full spec and discussions](https://github.com/bigscience-workshop/bigscience/tree/master/train/tr11-176B-ml)
    • Network accessline 45
      (backup: [1](https://github.com/stas00/bigscience-backup/blob/master/train/tr11-176B-ml/chronicles-prequel.md) | [2](https://github.com/stas00/bigscience-backup/blob/master/train/tr11-176B-ml/chronicles.md) |
    • Network accessline 46
      [1](https://github.com/stas00/bigscience-backup/blob/master/train/tr11-176B-ml/chronicles-prequel.md) |
    • Network accessline 47
      [2](https://github.com/stas00/bigscience-backup/blob/master/train/tr11-176B-ml/chronicles.md) |
    • Network accessline 48
      [3](https://github.com/stas00/bigscience-backup/tree/master/train/tr11-176B-ml))
    • Network accessline 50
      - Meta OPT-175B (2022):  [logbook](https://github.com/facebookresearch/metaseq/tree/main/projects/OPT/chronicles) | [Video](https://www.youtube.com/watch?v=p9IxoSkvZ-M) (backup: [1](https://github.com/stas00/metaseq-backup/tree/main/project
    • Network accessline 51
      [logbook](https://github.com/facebookresearch/metaseq/tree/main/projects/OPT/chronicles) | [Video](https://www.youtube.com/watch?v=p9IxoSkvZ-M) (backup: [1](https://github.com/stas00/metaseq-backup/tree/main/projects/OPT/chronicles))
    • Network accessline 53
      - THUDM GLM-130B (2022): [en logbook](https://github.com/zai-org/GLM-130B/blob/main/logs/main-log-en.md) | [Mandarin version](https://github.com/zai-org/GLM-130B/blob/main/logs/main-log.md) (backup:  [1](https://github.com/stas00/GLM-130B-b
    • Network accessline 58
      - HuggingFace IDEFICS-80B multimodal (Flamingo repro) (2023): [Learning log](https://github.com/huggingface/m4-logs/blob/master/memos/README.md) | [Training Chronicles](https://github.com/huggingface/m4-logs/blob/master/tr-190-80b/chronicle
    • Network accessline 60
      - BloombergGPT 50B LLM - section C in [BloombergGPT: A Large Language Model for Finance](https://arxiv.org/abs/2303.17564)
    • Network accessline 65
      - [MegaScale: Scaling Large Language Model Training to More Than 10,000 GPUs](https://arxiv.org/abs/2402.15627) - the paper covers various training issues and their resolution - albeit on models that are proprietary yet just as instructiona
    • Network accessline 67
      - Imbue's [From bare metal to a 70B model: infrastructure set-up and scripts](https://imbue.com/blog/70b-infrastructure) very detailed technical post covers many training-related issues that they had to overcome while training a proprietary
    • Network accessline 69
      - Meta's [The Llama 3 Herd of Models](https://arxiv.org/abs/2407.21783) devotes [§3.3 Infrastructure, Scaling, and Efficiency](https://arxiv.org/pdf/2407.21783#page=12) to the training stack, including §3.3.4 Reliability and Operational Cha
    • Network accessline 74
      - Project Apertus (ETH Zürich, EPFL, CSCS) - [Apertus v1 Technical Report: Democratizing Open and Compliant LLMs for Global Language Environments](https://arxiv.org/abs/2509.14233) - a fully open 8B/70B suite trained on 15T tokens across 18
    • Network accessline 79
      - [Supercharging Olmo-core for Efficient and Scalable MoE Training](https://allenai.org/papers/olmocore3) - practical recommendations for training large scale MoE models in 2026!
    • Network accessline 80
      - [Marin 535B-A23B MoE live](https://mtracker.oa.dev/hero-run-535b) - each short entry goes to a details GitHub Issue where you can read the details. Finished trainings retrospectives: [8B](https://marin.readthedocs.io/en/latest/reports/mar
    • Network accessline 81
      - Project Apertus - [Apertus v1.5 Technical Report: From Open Text Models to Open Multimodal Reasoners](https://arxiv.org/abs/2610.15542) - continued multimodal pretraining of the Apertus 8B/70B models; like v1 it includes *Infrastructure, 
    • Network accessline 85
      - Imbue published a detailed log of how they have set up a 512-node IB-fat-tree cluster and made it to work: [From bare metal to a 70B model: infrastructure set-up and scripts](https://imbue.com/blog/70b-infrastructure), they also open-sour
    • Network accessline 87
      - SemiAnalysis published a great detailed writeup about [what it takes to set up a Neocloud cluster](https://newsletter.semianalysis.com/p/ai-neocloud-playbook-and-anatomy).

    skills/README.md

    • Network accessline 5
      - [Machine Learning Engineering](ml-engineering/SKILL.md) — train and operate large-scale ML models (accelerators, storage, network, orchestration, throughput, instabilities, checkpointing, inference). Canonical: https://github.com/stas00/m
    • Network accessline 6
      - [Evaluate a GPU cluster](evaluate-cluster/SKILL.md) — trial-node / acceptance loop: environment dump, sequential matmul FLOPS, intra- and inter-node all-reduce, `fio-scan` on local disk and shared FS, dated markdown report. Canonical: htt
    • Network accessline 10
      Companion skills in other books: [The Art of Debugging](https://github.com/stas00/the-art-of-debugging/blob/master/SKILL.md), [Stas' Python Cookbook](https://github.com/stas00/python-cookbook/blob/master/SKILL.md).

    skills/evaluate-cluster/SKILL.md

    • Network accessline 12
      Canonical copy: https://github.com/stas00/ml-engineering/blob/master/skills/evaluate-cluster/SKILL.md
    • Network accessline 19
      - This skill: https://github.com/stas00/ml-engineering/blob/master/skills/evaluate-cluster/SKILL.md
    • Network accessline 20
      - Raw: https://raw.githubusercontent.com/stas00/ml-engineering/master/skills/evaluate-cluster/SKILL.md
    • Network accessline 24
      This file is the whole runbook. You do not need any other document from the author's books. Scripts and spec tables are on GitHub; fetch them (commands below). Optional background: [How to evaluate the cluster](https://github.com/stas00/ml-
    • Network accessline 42
      | -------------------- | -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    • Network accessline 43
      | **MAMF**             | Maximum Achievable Matmul FLOPS: the highest any **matmul shape** (M×N×K) reaches on that GPU. The winning shapes are short bursts — the clock sits at boost and the board stays far below its power limit — so this is
    • Network accessline 44
      | **MSMF**             | Maximum Sustainable Matmul FLOPS: what is left once the matmul shape is big enough to pin the board at its power limit and the clock settles below boost. This is what back-to-back dense matmuls actually get, provide
    • Network accessline 46
      | **lemon GEMM**       | A one-off inline `torch.matmul` (not a published script) on every GPU with the same large shape, to catch a dead, slow, or throttled card.                                                                             
    • Network accessline 47
      | **all-reduce**       | Collective: every rank ends up with the sum of all ranks' tensors. Used to stress NVLink and the network.                                                                                                              
    • Network accessline 48
      | **busbw / algbw**    | Printed by [`torch-dist-bench.py`](https://github.com/stas00/ml-engineering/blob/master/network/benchmarks/torch-dist-bench.py). **busbw** = unidirectional bus bandwidth (what the fabric moves). **algbw** = algorith
    • Network accessline 52
      | **hostfile**         | Text file, one peer address per line (`10.0.0.1` or `10.0.0.1 slots=8`). DeepSpeed `-H` and `pdsh -w` read it.                                                                                                         
    • Network accessline 53
      | **pdsh**             | Parallel SSH: run one command on many hosts.                                                                                                                                                                           
    • Network accessline 54
      | **fio-scan**         | Wrapper around `fio` ([script](https://github.com/stas00/ml-engineering/blob/master/storage/fio-scan)): six timed runs (16 KiB / 1 MiB / 1 GiB × read/write). Needs [`fio-json-extract.py`](https://github.com/stas00/m
    • Network accessline 65
      RAW=https://raw.githubusercontent.com/stas00/ml-engineering/master curl -fsSL "$RAW/compute/accelerator/benchmarks/mamf-finder.py" -o mamf-finder.py
    • Network accessline 66
      curl -fsSL "$RAW/compute/accelerator/benchmarks/mamf-finder.py" -o mamf-finder.py
    • Network accessline 67
      curl -fsSL "$RAW/compute/accelerator/benchmarks/mamf-finder-all-gpus.py" -o mamf-finder-all-gpus.py
    • Network accessline 68
      # mamf-finder-all-gpus.py runs ./mamf-finder.py from its own directory — keep both in one directory. curl -fsSL "$RAW/network/benchmarks/torch-dist-bench.py" -o torch-dist-bench.py curl -fsSL "$RAW/debug/torch-distributed-gpu-test.py" -o to
    • Network accessline 69
      curl -fsSL "$RAW/network/benchmarks/torch-dist-bench.py" -o torch-dist-bench.py
    • Network accessline 70
      curl -fsSL "$RAW/debug/torch-distributed-gpu-test.py" -o torch-distributed-gpu-test.py
    • Network accessline 71
      curl -fsSL "$RAW/storage/fio-scan" -o fio-scan
    • Network accessline 72
      curl -fsSL "$RAW/storage/fio-json-extract.py" -o fio-json-extract.py
    • Network accessline 77
      Official BF16 peaks: [TFLOPS comparison table](https://github.com/stas00/ml-engineering/blob/master/compute/accelerator/README.md#tflops-comparison-table). NVLink gens: [NVLink](https://github.com/stas00/ml-engineering/blob/master/network/R
    • Network accessline 81
      **Links in the report** to those scripts and tables are absolute GitHub URLs (`https://github.com/stas00/ml-engineering/blob/master/…`). Never `../` relatives — the report may be copied elsewhere. Sibling `raw-<name>/` stays relative. Exter
    • Network accessline 105
      | GPUs per node                              | default 8                      | `nvidia-smi -L` if unknown                                                                                                   | | Local disk path + shared-FS pat
    • Network accessline 107
      | Advertised uni bandwidth / official TFLOPS | optional                       | else [accelerator tables](https://github.com/stas00/ml-engineering/blob/master/compute/accelerator/README.md) + `nvidia-smi` |
    • Network accessline 126
      # 3. Peer → peer TCP (rdzv will need this). From node 1, hit node 0's IP:22 or the container sshd port. MASTER_ADDR=$(grep -v '^#' "$HOSTFILE" | grep -v '^$' | head -1 | cut -d' ' -f1) timeout 5 bash -c "echo >/dev/tcp/$MASTER_ADDR/${SSH_PO
    • Dangerous shell operationline 128
      timeout 5 bash -c "echo >/dev/tcp/$MASTER_ADDR/${SSH_PORT:-22}" && echo OPEN
    • Network accessline 128
      timeout 5 bash -c "echo >/dev/tcp/$MASTER_ADDR/${SSH_PORT:-22}" && echo OPEN
    • Network accessline 182
      python3 -m venv "$EVAL_VENV"   # $HOME/venvs/cluster-eval, or shared FS so every node sees it "$EVAL_VENV/bin/pip" install -U pip "$EVAL_VENV/bin/pip" index versions torch --index-url https://download.pytorch.org/whl/cu130   # -> LATEST: x.
    • Network accessline 183
      "$EVAL_VENV/bin/pip" install -U pip "$EVAL_VENV/bin/pip" index versions torch --index-url https://download.pytorch.org/whl/cu130   # -> LATEST: x.y.z "$EVAL_VENV/bin/pip" install torch numpy packaging nvidia-ml-py matplotlib \
    • Network accessline 184
      "$EVAL_VENV/bin/pip" index versions torch --index-url https://download.pytorch.org/whl/cu130   # -> LATEST: x.y.z
    • Network accessline 185
      "$EVAL_VENV/bin/pip" install torch numpy packaging nvidia-ml-py matplotlib    --index-url https://download.pytorch.org/whl/cu130
    • Network accessline 186
      --index-url https://download.pytorch.org/whl/cu130
    • Dangerous shell operationline 200
      sudo apt-get update
    • Dangerous shell operationline 201
      sudo apt-get install -y infiniband-diags fio iproute2 rdma-core pdsh
    • Dangerous shell operationline 210
      sudo dnf install -y infiniband-diags fio iproute rdma-core pdsh
    • Network accessline 254
      Open Compute with the **GPUs that are here** (name, count per node, SM count, HBM GiB, TDP, official BF16 TFLOPS + [table](https://github.com/stas00/ml-engineering/blob/master/compute/accelerator/README.md#tflops-comparison-table)). Do not 
    • Network accessline 311
      Intra-node (header of [`torch-dist-bench.py`](https://github.com/stas00/ml-engineering/blob/master/network/benchmarks/torch-dist-bench.py)):
    • Dangerous shell operationline 332
      Requires passwordless SSH from the launch node to every hostfile IP. Port is cluster-specific (a wrapper on PATH may already add `-p`). If `ssh` hits the **machine** sshd (not the container), start `sshd` in the container on an unused port,
    • Network accessline 373
      1. **Nobody hosts the store.** With no `is_host`, each agent calls `_matches_machine_hostname(endpoint_host)` ([`elastic/rendezvous/utils.py`](https://github.com/pytorch/pytorch/blob/main/torch/distributed/elastic/rendezvous/utils.py)), whi
    • Network accessline 382
      ss -ltnp | grep "$MASTER_PORT" # 3. can a worker reach it?                          -> expect OPEN timeout 5 bash -c "echo > /dev/tcp/$MASTER_ADDR/$MASTER_PORT" && echo OPEN
    • Network accessline 383
      # 3. can a worker reach it?                          -> expect OPEN timeout 5 bash -c "echo > /dev/tcp/$MASTER_ADDR/$MASTER_PORT" && echo OPEN # 4. is the advertised master resolvable everywhere?
    • Dangerous shell operationline 384
      timeout 5 bash -c "echo > /dev/tcp/$MASTER_ADDR/$MASTER_PORT" && echo OPEN
    • Network accessline 384
      timeout 5 bash -c "echo > /dev/tcp/$MASTER_ADDR/$MASTER_PORT" && echo OPEN
    • Network accessline 393
      Do this **before** quoting any all-reduce number. `busbw` is already unidirectional ([directionality](https://github.com/stas00/ml-engineering/blob/master/network/README.md#unidirectional-vs-bidirectional-duplex)). Tables: [intra-node](http
    • Network accessline 402
      Map NVLink gen from per-link payload rate (or GPU family): ~53 GBps/link → **NVLink 5** (900 GBps unidirectional, B200-class); ~26.5 → **NVLink 4** (450, H100/H200-class); slower ~12.5-class is older NVLink ([table](https://github.com/stas0
    • Network accessline 422
      - `busbw / 100 GBps` (or any NIC uni rate) - `busbw * (k-1)/(n-1)` as “GBps on the wire” or “% of rail” — that factor is ring-traffic bookkeeping in [why inter-node busbw is not the wire](https://github.com/stas00/ml-engineering/blob/master
    • Network accessline 423
      - `busbw * (k-1)/(n-1)` as “GBps on the wire” or “% of rail” — that factor is ring-traffic bookkeeping in [why inter-node busbw is not the wire](https://github.com/stas00/ml-engineering/blob/master/network/README.md#real-network-throughput)
    • Network accessline 433
      **Do not let all-reduce stand for latency.** Its small-payload latency is the best of all collectives: NCCL gives only all-reduce its tree algorithm, whose latency grows with the log of the node count while the rings of the other collective
    • Network accessline 452
      - **`### Existing Partitions`:** inventory only, as a **table** — `| mount | size | type | device / server |`. Deduplicate by **backing volume**, not by `df` line. Same RAID/device, same Lustre `nid@net:/fsname`, same CSI/PVC, or a bind-mou
    • Network accessline 453
      - **`### Introduction`:** same convention as Compute and Network: a **numbered list of passes that ran**, each named by tool + path, not a list of mounts. GitHub-link [`fio-scan`](https://github.com/stas00/ml-engineering/blob/master/storage
    • Network accessline 459
      Shared network filesystems are many different products. Report **the one this allocation uses**. `df -T` is the guest-visible type (protocol or native FS); that may or may not be the vendor product. If the type is a share protocol rather th
    • Network accessline 582
      ### GPU performance benchmarks Official TFLOPS source = [TFLOPS comparison table](https://github.com/stas00/ml-engineering/blob/master/compute/accelerator/README.md#tflops-comparison-table), not a relative path. Open that section by explain
    • Network accessline 583
      Official TFLOPS source = [TFLOPS comparison table](https://github.com/stas00/ml-engineering/blob/master/compute/accelerator/README.md#tflops-comparison-table), not a relative path. Open that section by explaining the measurement before any 
    • Network accessline 605
      ### Introduction Open with a **numbered list of tools** (same shape as Compute and Storage), each explained before any number: GitHub-link [`torch-distributed-gpu-test.py`](https://github.com/stas00/ml-engineering/blob/master/debug/torch-di
    • Network accessline 606
      Open with a **numbered list of tools** (same shape as Compute and Storage), each explained before any number: GitHub-link [`torch-distributed-gpu-test.py`](https://github.com/stas00/ml-engineering/blob/master/debug/torch-distributed-gpu-tes

    skills/ml-engineering/SKILL.md

    • Network accessline 14
      needs to pick GPUs/cloud/file-systems or size inference latency/throughput.   Distilled from "Machine Learning Engineering", the latest version of which can   be found at https://github.com/stas00/ml-engineering
    • Network accessline 16
      be found at https://github.com/stas00/ml-engineering
    • Network accessline 18
      The latest SKILL.md version can be found at https://github.com/stas00/ml-engineering/blob/master/skills/ml-engineering/SKILL.md
    • Network accessline 23
      Distilled from **Machine Learning Engineering Open Book** by Stas Bekman - source: https://github.com/stas00/ml-engineering (CC BY-SA 4.0). Know-how from training BLOOM-176B, IDEFICS-80B and production RAG and RL training and inference syst
    • Network accessline 29
      Use it as an operator's runbook: figure out which resource is *actually* the bottleneck (compute? memory? network? storage? dataloader?), then jump to the targeted recipe. For pure debugging technique (gdb/strace/py-spy/CUDA), pair this wit
    • Network accessline 34
      - **Find the actual bottleneck.** A training step is gated by the slowest of: accelerator compute, memory bandwidth/capacity, inter/intra-node network, storage IO, or CPU dataloading. Optimizing anything else is wasted effort. - **At scale,
    • Network accessline 35
      - **At scale, failure is the steady state.** With hundreds/thousands of accelerators, hardware *will* fail mid-run. Design for frequent checkpoints, automatic restarts, spare nodes, and kill/save switches from day one. - **Reproduce small a
    • Network accessline 36
      - **Reproduce small and fast.** Debug on a tiny model / few layers / one node before burning cluster time - see [The Art of Debugging](https://github.com/stas00/the-art-of-debugging/blob/master/SKILL.md).
    • Network accessline 37
      - **Watch the logbooks.** Others have already hit your instability; training chronicles document the loss spikes and the fixes. See [LLM/VLM chronicles](https://github.com/stas00/ml-engineering/tree/master/resources#publicly-available-train
    • Network accessline 41
      Full chapter: [Compute](https://github.com/stas00/ml-engineering/tree/master/compute) · [Accelerators](https://github.com/stas00/ml-engineering/blob/master/compute/accelerator/README.md).
    • Network accessline 43
      - **The number that matters is achievable, not theoretical.** Real matmul FLOPS are well below spec. Measure Maximum Achievable Matmul FLOPS with [`mamf-finder.py`](https://github.com/stas00/ml-engineering/blob/master/compute/accelerator/be
    • Network accessline 44
      - **Memory capacity + bandwidth often bind before FLOPS.** Check the [accelerator memory size and speed table](https://github.com/stas00/ml-engineering/blob/master/compute/accelerator/README.md#accelerator-memory-size-and-speed) and the [TF
    • Network accessline 45
      - **Don't forget power and cooling** - throttling silently caps sustained throughput. See [power and cooling](https://github.com/stas00/ml-engineering/blob/master/compute/accelerator/README.md#power-and-cooling).
    • Network accessline 46
      - **CPU and CPU memory matter too** (dataloading, offload, pinned memory). See [CPU](https://github.com/stas00/ml-engineering/tree/master/compute/cpu) and [CPU memory](https://github.com/stas00/ml-engineering/tree/master/compute/cpu-memory)
    • Network accessline 50
      Full chapter: [Storage](https://github.com/stas00/ml-engineering/blob/master/storage/README.md).
    • Network accessline 52
      - **Pick the file system for the job:** distributed/parallel FS for shared checkpoints and datasets; fast **local** NVMe beats network storage for scratch/hot data. See [which file system to choose](https://github.com/stas00/ml-engineering/
    • Network accessline 53
      - **Benchmark IO before you trust it** (checkpoint save/load and dataset streaming are common stalls). See [storage benchmarks](https://github.com/stas00/ml-engineering/blob/master/storage/README.md#benchmarks). Pair with the [cluster evalu
    • Network accessline 54
      - **Gotchas that bite at scale:** you often get less usable capacity than sold; some clouds put backups on the same partition; always keep [checksums](https://github.com/stas00/ml-engineering/blob/master/storage/README.md#dont-forget-the-ch
    • Network accessline 58
      Full chapter: [Network](https://github.com/stas00/ml-engineering/blob/master/network/README.md).
    • Network accessline 60
      - **Inter-node speed can dominate the whole training's speed.** For sharded/parallel training, slow inter-node links stall everyone. Understand why before scaling out: [why inter-node speed is hugely important](https://github.com/stas00/ml-
    • Network accessline 61
      - **Know the two speeds:** [intra-node](https://github.com/stas00/ml-engineering/blob/master/network/README.md#intra-node-networking) (NVLink/PCIe) vs [inter-node](https://github.com/stas00/ml-engineering/blob/master/network/README.md#inter
    • Network accessline 62
      - **Benchmark real collective throughput,** not marketing numbers, with [`torch-dist-bench.py`](https://github.com/stas00/ml-engineering/blob/master/network/benchmarks/torch-dist-bench.py) (far simpler than nccl-tests). Mind the [important 
    • Network accessline 63
      - **When collectives hang or crawl:** see [network debug](https://github.com/stas00/ml-engineering/tree/master/network/debug) and [NCCL performance debug](https://github.com/stas00/ml-engineering/blob/master/debug/nccl-performance-debug.md)
    • Network accessline 67
      Full chapter: [Orchestration](https://github.com/stas00/ml-engineering/tree/master/orchestration) · [SLURM](https://github.com/stas00/ml-engineering/tree/master/orchestration/slurm) · [Kubernetes](https://github.com/stas00/ml-engineering/tr
    • Network accessline 69
      - **Verify the cluster before the big run:** every GPU on every node must talk to every other. Run [`torch-distributed-gpu-test.py`](https://github.com/stas00/ml-engineering/blob/master/debug/torch-distributed-gpu-test.py) across all nodes 
    • Network accessline 70
      - **SLURM day-to-day:** the [users cheatsheet](https://github.com/stas00/ml-engineering/blob/master/orchestration/slurm/users.md) covers `sbatch`/`srun`/`salloc`, job arrays, dependencies, and inspecting the queue; keep the allocation and r
    • Network accessline 71
      - **Launchers** (torchrun/accelerate/deepspeed under SLURM): see [launchers](https://github.com/stas00/ml-engineering/tree/master/orchestration/slurm/launchers/README.md).
    • Network accessline 75
      Full chapter: [Performance](https://github.com/stas00/ml-engineering/blob/master/training/performance/README.md).
    • Network accessline 77
      - **Start from the checklist:** [how to improve speed and save memory](https://github.com/stas00/ml-engineering/blob/master/training/performance/README.md#how-to-improve-speed-and-save-memory) enumerates the high-impact levers (parallelism 
    • Network accessline 78
      - **Fit the model:** know the [anatomy of memory usage](https://github.com/stas00/ml-engineering/blob/master/inference/README.md#anatomy-of-models-memory-usage) (weights + grads + optimizer states + activations) and profile with [memory pro
    • Network accessline 79
      - **Free throughput wins:** keep tensor dims [divisible/aligned](https://github.com/stas00/ml-engineering/blob/master/training/performance/README.md#vector-and-matrix-size-divisibility) for Tensor Cores, set [NUMA affinity](https://github.c
    • Network accessline 80
      - **Model parallelism** (DP/TP/PP/sequence/ZeRO) concepts and trade-offs: [model parallelism](https://github.com/stas00/ml-engineering/tree/master/training/model-parallelism).
    • Network accessline 84
      Full chapter: [Instabilities](https://github.com/stas00/ml-engineering/blob/master/training/instabilities/README.md).
    • Network accessline 86
      - **Loss spikes/divergence are expected at scale.** Compare against public [training logbooks](https://github.com/stas00/ml-engineering/blob/master/training/instabilities/README.md#learning-from-training-logbooks) - your symptom is probably
    • Network accessline 87
      - **Numerical hygiene:** sane [weight init / STD](https://github.com/stas00/ml-engineering/blob/master/training/instabilities/README.md#std-init), watch for [numerical instabilities](https://github.com/stas00/ml-engineering/blob/master/trai
    • Network accessline 88
      - **Catch NaN/Inf early:** [underflow/overflow detection](https://github.com/stas00/ml-engineering/blob/master/debug/underflow_overflow.md) and PyTorch [tensor debugging](https://github.com/stas00/ml-engineering/blob/master/debug/pytorch.md
    • Network accessline 89
      - **Reproducibility** for isolating a divergence: [reproducibility](https://github.com/stas00/ml-engineering/tree/master/training/reproducibility).
    • Network accessline 93
      Full chapter: [Fault tolerance](https://github.com/stas00/ml-engineering/blob/master/training/fault-tolerance/README.md) · [Checkpoints](https://github.com/stas00/ml-engineering/tree/master/training/checkpoints).
    • Network accessline 95
      - **Provision slack:** [always plan for more nodes than needed](https://github.com/stas00/ml-engineering/blob/master/training/fault-tolerance/README.md#always-plan-to-have-more-nodes-than-needed) so a dead node doesn't stop the run; [queue 
    • Network accessline 96
      - **Checkpoint often enough** that a crash costs minutes, not hours - see [frequent checkpoint saving](https://github.com/stas00/ml-engineering/blob/master/training/fault-tolerance/README.md#frequent-checkpoint-saving) and [prevention](http
    • Network accessline 97
      - **Operator controls:** a [kill switch](https://github.com/stas00/ml-engineering/blob/master/training/fault-tolerance/README.md#kill-switch) to stop a doomed run cleanly and a [save switch](https://github.com/stas00/ml-engineering/blob/mas
    • Network accessline 98
      - **Survive the cluster:** handle [forced job preemption](https://github.com/stas00/ml-engineering/blob/master/training/fault-tolerance/README.md#dealing-with-forced-job-preemption) and prefer [fixed over dynamic allocations](https://github
    • Network accessline 102
      Full chapter: [Inference](https://github.com/stas00/ml-engineering/blob/master/inference/README.md).
    • Network accessline 104
      - **Speak the metrics:** TTFT, TPOT/ITL, throughput vs latency, and how batching trades them off. See [key inference performance metrics](https://github.com/stas00/ml-engineering/blob/master/inference/README.md#key-inference-performance-met
    • Network accessline 105
      - **Size the memory:** weights + KV cache + activations - see [anatomy of model's memory usage](https://github.com/stas00/ml-engineering/blob/master/inference/README.md#anatomy-of-models-memory-usage).
    • Network accessline 106
      - **Cut cold starts:** [speeding up model loading time](https://github.com/stas00/ml-engineering/blob/master/inference/README.md#speeding-up-model-loading-time); pick a serving stack from [inference frameworks](https://github.com/stas00/ml-
    • Network accessline 110
      Full chapter: [Debugging](https://github.com/stas00/ml-engineering/tree/master/debug) · [PyTorch](https://github.com/stas00/ml-engineering/blob/master/debug/pytorch.md).
    • Network accessline 112
      - **Iterate cheaply:** shrink to tiny models/tokenizers/datasets and [fast debug of PyTorch models](https://github.com/stas00/ml-engineering/blob/master/debug/pytorch.md#faster-debug-and-development-with-tiny-models-tokenizers-and-datasets)
    • Network accessline 113
      - **Multi-node/multi-GPU hang or deadlock** (the classic scale bug):   1. Rule out comms with [`torch-distributed-gpu-test.py`](https://github.com/stas00/ml-engineering/blob/master/debug/torch-distributed-gpu-test.py).   2. Dump every rank'
    • Network accessline 114
      1. Rule out comms with [`torch-distributed-gpu-test.py`](https://github.com/stas00/ml-engineering/blob/master/debug/torch-distributed-gpu-test.py).
    • Network accessline 115
      2. Dump every rank's Python stack at once with `py-spy`; ranks stuck at *different* collectives reveal the desync. See [diagnosing crashes, hangs and tracing execution](https://github.com/stas00/ml-engineering/blob/master/debug/pytorch.md#d
    • Network accessline 116
      3. Set `NCCL_DEBUG=INFO`; escalate to [NCCL performance debug](https://github.com/stas00/ml-engineering/blob/master/debug/nccl-performance-debug.md).
    • Network accessline 117
      - **Cryptic CUDA errors:** `CUDA_LAUNCH_BLOCKING=1` for a real traceback (CUDA is async). See [The Art of Debugging - PyTorch](https://github.com/stas00/the-art-of-debugging/tree/master/pytorch#dealing-with-async-cuda-bugs).
    • Network accessline 118
      - **OOM / memory:** [memory usage](https://github.com/stas00/ml-engineering/blob/master/debug/pytorch.md#memory-usage); fragmentation via `PYTORCH_ALLOC_CONF`.
    • Network accessline 119
      - **NaN/Inf:** [underflow and overflow detection](https://github.com/stas00/ml-engineering/blob/master/debug/pytorch.md#underflow-and-overflow-detection) and [debugging tensors](https://github.com/stas00/ml-engineering/blob/master/debug/pyt
    • Network accessline 120
      - **GPU-specific faults:** [troubleshooting NVIDIA GPUs](https://github.com/stas00/ml-engineering/blob/master/compute/accelerator/nvidia/debug.md).
    • Network accessline 124
      Full chapter: [Testing](https://github.com/stas00/ml-engineering/blob/master/testing/README.md).
    • Network accessline 126
      - **Run tests surgically** (select, parametrize, repeat, control output/parallelism): [running tests](https://github.com/stas00/ml-engineering/blob/master/testing/README.md#running-tests).
    • Network accessline 127
      - **Write robust tests** (fixtures, temp dirs, RNG control for reproducibility, distributed tests): [writing tests](https://github.com/stas00/ml-engineering/blob/master/testing/README.md#writing-tests).
    • Network accessline 128
      - **When a test misbehaves:** [debugging tests](https://github.com/stas00/ml-engineering/blob/master/testing/README.md#debugging-tests).
    • Network accessline 132
      | Need | Tool | |---|---| | Verify all GPUs/nodes can talk & allocate | [`torch-distributed-gpu-test.py`](https://github.com/stas00/ml-engineering/blob/master/debug/torch-distributed-gpu-test.py) |
    • Network accessline 133
      |---|---| | Verify all GPUs/nodes can talk & allocate | [`torch-distributed-gpu-test.py`](https://github.com/stas00/ml-engineering/blob/master/debug/torch-distributed-gpu-test.py) | | Real network throughput (all-reduce busbw) | [`torch-dis
    • Network accessline 134
      | Verify all GPUs/nodes can talk & allocate | [`torch-distributed-gpu-test.py`](https://github.com/stas00/ml-engineering/blob/master/debug/torch-distributed-gpu-test.py) |
    • Network accessline 135
      | Real network throughput (all-reduce busbw) | [`torch-dist-bench.py`](https://github.com/stas00/ml-engineering/blob/master/network/benchmarks/torch-dist-bench.py) |
    • Network accessline 136
      | Actual achievable matmul FLOPS of an accelerator | [`mamf-finder.py`](https://github.com/stas00/ml-engineering/blob/master/compute/accelerator/benchmarks/mamf-finder.py) |
    • Network accessline 137
      | Tiny models/tokenizers/datasets for fast iteration | [make-tiny guide](https://github.com/stas00/ml-engineering/blob/master/debug/make-tiny-models-tokenizers-datasets.md) |
    • Network accessline 138
      | Better `trace` for distributed hangs | [NicerTrace](https://github.com/stas00/ml-engineering/blob/master/debug/tools.md) |
    • Network accessline 142
      | Symptom | Reach for | |---|---| | Low TFLOPS / MFU, "GPUs feel idle" | Find the bottleneck: `mamf-finder`, [performance checklist](https://github.com/stas00/ml-engineering/blob/master/training/performance/README.md#how-to-improve-speed-an
    • Network accessline 143
      |---|---| | Low TFLOPS / MFU, "GPUs feel idle" | Find the bottleneck: `mamf-finder`, [performance checklist](https://github.com/stas00/ml-engineering/blob/master/training/performance/README.md#how-to-improve-speed-and-save-memory), DataLoad
    • Network accessline 144
      | Low TFLOPS / MFU, "GPUs feel idle" | Find the bottleneck: `mamf-finder`, [performance checklist](https://github.com/stas00/ml-engineering/blob/master/training/performance/README.md#how-to-improve-speed-and-save-memory), DataLoader, NUMA, 
    • Network accessline 145
      | Training OOM | Memory anatomy → activation checkpointing/offload/parallelism; profile; `PYTORCH_ALLOC_CONF` | | Slow steps but GPUs busy on comms | Benchmark network (`torch-dist-bench`), check intra/inter-node, NCCL settings | | Slow dat
    • Network accessline 146
      | Slow steps but GPUs busy on comms | Benchmark network (`torch-dist-bench`), check intra/inter-node, NCCL settings | | Slow dataloading / GPU starvation | [DataLoader](https://github.com/stas00/ml-engineering/blob/master/training/performan
    • Network accessline 147
      | Slow dataloading / GPU starvation | [DataLoader](https://github.com/stas00/ml-engineering/blob/master/training/performance/README.md#dataloader), local NVMe, prefetch/workers |
    • Network accessline 149
      | Multi-node/GPU hang or deadlock | `torch-distributed-gpu-test.py` → `py-spy` all ranks → `NCCL_DEBUG=INFO` | | Node/GPU dies mid-run | Spare nodes, frequent checkpoints, auto-restart, kill/save switch | | Job keeps getting preempted | [fo
    • Network accessline 150
      | Node/GPU dies mid-run | Spare nodes, frequent checkpoints, auto-restart, kill/save switch | | Job keeps getting preempted | [forced preemption](https://github.com/stas00/ml-engineering/blob/master/training/fault-tolerance/README.md#dealin
    • Network accessline 151
      | Job keeps getting preempted | [forced preemption](https://github.com/stas00/ml-engineering/blob/master/training/fault-tolerance/README.md#dealing-with-forced-job-preemption), queue chained jobs |
    • Network accessline 152
      | Checkpoint save/load is slow | Benchmark storage, choose FS, local vs shared | | Choosing GPUs / cloud / storage | Comparison tables, MAMF, [choose a cloud provider](https://github.com/stas00/ml-engineering/blob/master/insights/how-to-cho
    • Network accessline 153
      | Choosing GPUs / cloud / storage | Comparison tables, MAMF, [choose a cloud provider](https://github.com/stas00/ml-engineering/blob/master/insights/how-to-choose-cloud-provider.md) |
    • Network accessline 162
      - **Reuse the community's hard-won lessons.** Check the training logbooks for known instabilities and fixes before re-deriving them. - **Read the linked chapter section** before applying a recipe - each has worked examples, exact commands, 
    • Network accessline 164
      - For deep single-process/tool debugging (gdb, strace, py-spy, cProfile, core files), use the companion skill: [The Art of Debugging](https://github.com/stas00/the-art-of-debugging/blob/master/SKILL.md).

    stabs/incoming.md

    • Network accessline 5
      ideas from Sam: https://github.com/saforem2: https://github.com/stas00/ml-engineering/pull/17#discussion_r1439912709
    • Network accessline 6
      https://quarto.org/, https://quarto.org/docs/gallery/, https://kevinheavey.github.io/modern-polars/, https://quarto.org/docs/output-formats/pdf-basics.html
    • Network accessline 10
      https://pytorch.org/tutorials/recipes/recipes/tuning_guide.html
    • Network accessline 12
      Dirk Groeneveld's Script that checks node pairs for speed https://github.com/allenai/OLMo/commit/f91cebdfa299bf55e815d496c367de8b59881c2e
    • Network accessline 50
      https://github.com/argonne-lcf/dlio_benchmark
    • Network accessline 66
      a good table here Scaling equations of each type of parallelism. https://www.cerebras.net/blog/cerebras-sets-record-for-largest-ai-models-ever-trained-on-single-device#summary
    • Network accessline 67
      https://www.cerebras.net/blog/cerebras-sets-record-for-largest-ai-models-ever-trained-on-single-device#summary
    • Network accessline 74
      1. nccl-tests 2. `all_reduce_bench.py` 3. https://github.com/deepspeedai/DeepSpeedExamples/tree/master/benchmarks/communication
    • Network accessline 75
      2. `all_reduce_bench.py` 3. https://github.com/deepspeedai/DeepSpeedExamples/tree/master/benchmarks/communication 4. like nccl-tests, another common set of benchmarks used at HPC sites are the OSU microbenchmarks like osu_lat, osu_bw, and o
    • Network accessline 76
      3. https://github.com/deepspeedai/DeepSpeedExamples/tree/master/benchmarks/communication
    • Network accessline 79
      https://mvapich.cse.ohio-state.edu/benchmarks/
    • Network accessline 86
      References: - [Sys Admin Pocket Survival Guide - InfiniBand](https://tin6150.github.io/psg/infiniband.html)
    • Network accessline 87
      - [Sys Admin Pocket Survival Guide - InfiniBand](https://tin6150.github.io/psg/infiniband.html)
    • Dangerous shell operationline 169
      sudo apt-get install -y automake dh-make git libcap2 libnuma-dev libtool make pkg-config udev curl librdmacm-dev rdma-core \
    • Network accessline 169
      sudo apt-get install -y automake dh-make git libcap2 libnuma-dev libtool make pkg-config udev curl librdmacm-dev rdma-core \
    • Dangerous shell operationline 171
      sudo sed -i -e 's/# OS.EnableRDMA=y/OS.EnableRDMA=y/g' /etc/waagent.conf
    • Network accessline 179
      repos to explore: https://github.com/OleHolmNielsen/Slurm_tools
    • Network accessline 180
      https://github.com/OleHolmNielsen/Slurm_tools
    • Network accessline 193
      https://github.com/LLNL/mpibind/tree/master/python
    • Network accessline 198
      This is to expand: https://github.com/stas00/ml-engineering/tree/master/fault-tolerance#is-job-hanging-watchdog
    • Network accessline 199
      https://github.com/stas00/ml-engineering/tree/master/fault-tolerance#is-job-hanging-watchdog
    • Network accessline 204
      https://github.com/LLNL/STAT - the Stack Trace Analysis Tool
    • Network accessline 205
      https://hpc.llnl.gov/software/development-environment-software/stat-stack-trace-analysis-tool
    • Network accessline 207
      https://github.com/grondo/io-watchdog
    • Network accessline 211
      https://hpc.llnl.gov/software/development-environment-software/stat-stack-trace-analysis-tool
    • Network accessline 228
      Install the SCR library (C + MPI) https://scr.readthedocs.io/en/v3.0/users/build.html#cmake
    • Network accessline 229
      https://scr.readthedocs.io/en/v3.0/users/build.html#cmake
    • Network accessline 231
      Install the scr.py module: https://github.com/LLNL/scr/tree/develop/python#installing-the-scr-python-module
    • Network accessline 232
      https://github.com/LLNL/scr/tree/develop/python#installing-the-scr-python-module
    • Network accessline 234
      Example checkpoint in python: https://github.com/LLNL/scr/blob/1878de8756c2b51882a7cda7b97b142eae4e3995/python/scr_example.py#L64-L105
    • Network accessline 235
      https://github.com/LLNL/scr/blob/1878de8756c2b51882a7cda7b97b142eae4e3995/python/scr_example.py#L64-L105

    storage/README.md

    • Network accessline 50
      **Direct** IO refers to IO that bypasses the operating system's caching buffers. This corresponds to `O_DIRECT` flag in [`open(2)`](https://man7.org/linux/man-pages/man2/open.2.html) system call.
    • Network accessline 105
      A dataset that looks like one large file may still end up doing random IO. Hugging Face `datasets` keeps its data in [Apache Arrow](https://huggingface.co/docs/datasets/en/about_arrow) files - a binary columnar format whose on-disk bytes ar
    • Network accessline 128
      footnote: Reading the shards through sequentially before the loop - `cat shard > /dev/null`, or a `cp` - leaves them in the page cache, and the shuffled case then faults against RAM: on Lustre 98.24s from cold became a 1.86s pre-read plus a
    • Network accessline 155
      - [GPFS](https://en.wikipedia.org/wiki/GPFS) (IBM), recently renamed to IBM Storage Scale, and
    • Network accessline 156
      before that it was called IBM Spectrum Scale. - [WekaIO](https://www.weka.io/) - [Lustre FS](https://www.lustre.org/) (Open Source) ([Wiki](https://wiki.lustre.org/Main_Page))
    • Network accessline 157
      - [WekaIO](https://www.weka.io/)
    • Network accessline 158
      - [Lustre FS](https://www.lustre.org/) (Open Source) ([Wiki](https://wiki.lustre.org/Main_Page))
    • Network accessline 160
      These solutions have been around for 2+ decades. They are POSIX-compliant. These are also not trivial to create - you have to setup a whole other cluster with multiple cpu-only VMs dedicated exclusively for those filesystems - only then you
    • Network accessline 164
      NASA's cluster has [a long long list of gotchas around using Lustre](https://www.nas.nasa.gov/hecc/support/kb/lustre-best-practices_226.html).
    • Network accessline 178
      - [BeeGFS](https://www.beegfs.io/)
    • Network accessline 179
      - [DAOS](https://docs.daos.io/latest/) (Distributed Asynchronous Object Storage) (Intel)
    • Network accessline 180
      - [NetApp](https://www.netapp.com)
    • Network accessline 181
      - [VAST](https://www.vastdata.com/)
    • Network accessline 195
      The most common choice is: [NFS](https://en.wikipedia.org/wiki/Network_File_System) - which has been around for 4 decades. It introduces an additional overhead and slows things down. So if there is a native client supported by your VM, you'
    • Network accessline 224
      - [GCP](https://docs.cloud.google.com/architecture/parallel-file-systems-for-hpc)
    • Network accessline 225
      - [Azure](https://learn.microsoft.com/en-us/azure/virtual-machines/disks-shared)
    • Network accessline 226
      - [AWS](https://aws.amazon.com/what-is/nas/#how-can-aws-help-with-storage-solutions--mxce5s)
    • Network accessline 255
      For example, GCP states that only [89%](https://docs.cloud.google.com/filestore/docs/known-issues#capacity_errors_before_reaching_full_provisioned_capacity) can be used reliably, albeit more than once the storage failed already at 83% for m
    • Network accessline 257
      I also talked to [Sycomp](https://sycomp.com/) engineers who provide managed IBM Storage Scale (GPFS) solutions, and according to them GPFS doesn't have this issue and the whole 100% can be reliably used.
    • Network accessline 272
      As I discover specific solution that have this unintuitive behavior I will add pointers to how you can see the actual disk usage: - [GCP FileStore](https://docs.cloud.google.com/filestore/docs/monitoring-instances#free-raw-capacity-percent)
    • Network accessline 273
      - [GCP FileStore](https://docs.cloud.google.com/filestore/docs/monitoring-instances#free-raw-capacity-percent) (but it doesn't work for Basic Tier)
    • Network accessline 293
      1. [Throughput](https://en.wikipedia.org/wiki/Network_throughput) or Bandwidth (bytes per second - can be MBps, GBps, etc.)
    • Network accessline 294
      2. [IOPS](https://en.wikipedia.org/wiki/IOPS) (Input/output operations per second that a system can perform)
    • Network accessline 295
      3. [Latency](https://en.wikipedia.org/wiki/Latency_(engineering)) (msecs or usecs)
    • Network accessline 327
      [fio - Flexible I/O tester](https://fio.readthedocs.io/en/latest/) is a commonly used IO benchmarking tool, which is relatively easy to operate. It has many options which allow you to emulate pretty much any type of a load and it provides a
    • Network accessline 344
      good read: [Fio Output Explained](https://tobert.github.io/post/2014-04-17-fio-output-explained.html) - it's an oldie but is still a goodie - if you have a more up-to-date write up please send me a link or a PR.
    • Network accessline 354
      git clone https://github.com/stas00/ml-engineering/
    • Network accessline 411
      So with file system the questions are very simple - does it feel that it takes too long to install or launch a program? Since a lot of us live in the Python world, python is known to have thousands of tiny files which are usually installed 
    • Network accessline 422
      export target_partition_path=/mnt/weka  # edit me!!! mkdir -p $target_partition_path/miniconda3 wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O $target_partition_path/miniconda3/miniconda.sh
    • Network accessline 423
      mkdir -p $target_partition_path/miniconda3 wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O $target_partition_path/miniconda3/miniconda.sh bash $target_partition_path/miniconda3/miniconda.sh -b -u -p $target_par
    • Network accessline 424
      wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O $target_partition_path/miniconda3/miniconda.sh
    • Dangerous shell operationline 426
      rm -rf $target_partition_path/miniconda3/miniconda.sh
    • Network accessline 449
      conda deactivate conda activate install-test time pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu130
    • Network accessline 451
      time pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu130
    • Dangerous shell operationline 467
      find $target_partition_path/miniconda3/pkgs -mindepth 1 -type d -exec rm -rf {} +
    • Network accessline 473
      conda create -y -n install-test python=3.12 conda activate install-test pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu130
    • Network accessline 474
      conda activate install-test pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu130 conda create -y -n install-test2 python=3.12
    • Network accessline 475
      pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu130
    • Network accessline 476
      conda create -y -n install-test2 python=3.12 conda activate install-test2 time pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu130
    • Network accessline 478
      time pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu130
    • Dangerous shell operationline 506
      sudo sync
    • Dangerous shell operationline 507
      echo 3 | sudo tee /proc/sys/vm/drop_caches
    • Dangerous shell operationline 518
      $ sudo sync
    • Dangerous shell operationline 519
      $ echo 3 | sudo tee /proc/sys/vm/drop_caches
    • Dangerous shell operationline 532
      $ sudo sync
    • Dangerous shell operationline 533
      $ echo 3 | sudo tee /proc/sys/vm/drop_caches
    • Network accessline 569
      Another time I noticed that `git status` was taking multiple seconds. I use [bash-git-prompt](https://github.com/magicmonty/bash-git-prompt) and it runs `git status` before every return of the prompt when inside a git repo clone, and it was
    • Network accessline 572
      git clone https://github.com/pytorch/pytorch
    • Network accessline 593
      - [IOR](https://github.com/hpc/ior) - the standard HPC parallel-IO benchmark. It launches many processes via MPI that read/write concurrently, so it measures the *aggregate* sequential and random bandwidth a distributed file system can sust
    • Network accessline 594
      - [DLIO](https://github.com/argonne-lcf/dlio_benchmark) - a Deep-Learning I/O benchmark that emulates the data-loading pattern of ML training without needing any accelerator: it replaces the forward/backward compute with a `sleep` of equiva
    • Network accessline 602
      - [MLPerf via MLCommons](https://mlcommons.org/) publishes various hardware benchmarks that measure training, inference, storage and other tasks' performance. The [storage results](https://mlcommons.org/benchmarks/storage/) are the relevant
    • Network accessline 615
      The cached files are usually found at `~/.cache/huggingface`, but the least error-prone way to place them elsewhere is to set the [`HF_HOME` environment variable](https://huggingface.co/docs/huggingface_hub/en/package_reference/environment_
    • Dangerous shell operationline 698
      hf cache rm model/bert-base-cased dataset/glue
    • Dangerous shell operationline 704
      hf cache rm $(hf cache ls --filter "accessed>1y" -q) -y
    • Dangerous shell operationline 712
      sudo find ~/.cache/huggingface/datasets/downloads -type f -mtime +3 -exec rm {} \+
    • Dangerous shell operationline 713
      sudo find ~/.cache/huggingface/datasets/downloads -type d -empty -delete
    • Network accessline 731
      which will ask them to add their access token from https://huggingface.co/settings/tokens - it'll save it under `~/.cache/hf_hub_token`.
    • Dangerous shell operationline 743
      rm -rf ~/.cache/pip
    • Dangerous shell operationline 744
      rm -rf ~/anaconda3/pkgs/
    • Dangerous shell operationline 767
      rm -rf ~/.cache/pip
    • Dangerous shell operationline 770
      rm -rf ~/.conda/pkgs
    • Dangerous shell operationline 797
      sudo du -ahd1 /home/* | sort -rh
    • Dangerous shell operationline 802
      sudo du -ahd1 /home/*/* | sort -rh
    • Dangerous shell operationline 806
      sudo du -ahd1 /home/foo/* | sort -rh
    • Dangerous shell operationline 909
      find /mypath/ -regextype posix-egrep -regex ".*\.(pt|pth|ckpt|safetensors)$" -mtime +30 -exec rm {} +
    • Network accessline 918
      - [dust](https://github.com/bootandy/dust) - written in Rust, it runs faster than `du` and has a built in sorting. I find the no flags output to be confusing to read as it mixes many levels together and sub-sorts them, but it might be OK to
    • Network accessline 919
      - [baobab](https://github.com/GNOME/baobab) - analyzes partitions quite quickly and provides a UI to navigate the results based on sub-folder size with easy copying of the paths useful when needing to delete a lot of old large dataset and c

    storage/fio-json-extract.py

    • Executable scriptline 1
      #!/bin/env python

    storage/fio-scan

    • Executable scriptline 1
      #!/bin/bash

    storage/mmap-io-bench.py

    • Executable scriptline 1
      #!/usr/bin/env python3

    testing/README.md

    • Network accessline 125
      You can run the tests related to the unstaged files or the current branch (according to Git) by using [pytest-picked](https://github.com/anapaulagomes/pytest-picked). This is a great way of quickly testing your changes didn't break anything
    • Network accessline 139
      [pytest-xdist](https://github.com/pytest-dev/pytest-xdist) provides a very useful feature of detecting all failed tests, and then waiting for you to modify files and continuously re-rerun those failing tests until they pass while you fix th
    • Network accessline 163
      [pytest-watcher](https://github.com/olzhasar/pytest-watcher) is an alternative implementation of this functionality. The older `pytest-watch` is widely linked but has had no commit since 2022, so prefer the former or `--looponfail` above.
    • Network accessline 188
      Since the order of executed tests is different and unpredictable, if running the test suite with `pytest-xdist` produces failures (meaning we have some undetected coupled tests), use [pytest-replay](https://github.com/ESSS/pytest-replay) to
    • Network accessline 197
      - [pytest-flakefinder](https://github.com/dropbox/pytest-flakefinder):
    • Network accessline 211
      footnote: There is another plugin [`pytest-repeat`](https://github.com/pytest-dev/pytest-repeat), which is actively maintained but cannot repeat `unittest.TestCase` tests - they "simply always run once, regardless of `--count`" and emit a w
    • Network accessline 252
      By default `--random-order-bucket=module` is implied, which will shuffle the files on the module levels. It can also shuffle on `class`, `package`, `global` and `none` levels. For the complete details please see its [documentation](https://
    • Network accessline 254
      Another randomization alternative is: [`pytest-randomly`](https://github.com/pytest-dev/pytest-randomly). This module has a very similar functionality/interface, but it doesn't have the bucket modes available in `pytest-random-order`. It ha
    • Network accessline 260
      [pytest-sugar](https://github.com/Teemu/pytest-sugar) is a plugin that improves the look-n-feel, adds a progressbar, and show tests that fail and the assert instantly. It gets activated automatically upon installation.
    • Network accessline 286
      [pytest-instafail](https://github.com/pytest-dev/pytest-instafail) shows failures and errors instantly instead of waiting until the end of test session.
    • Network accessline 382
      - [test_trainer_distributed.py](https://github.com/huggingface/transformers/blob/58e3d23e97078f361a533b9ec4a6a2de674ea52a/tests/trainer/test_trainer_distributed.py)
    • Network accessline 383
      - [test_deepspeed.py](https://github.com/huggingface/transformers/blob/58e3d23e97078f361a533b9ec4a6a2de674ea52a/tests/deepspeed/test_deepspeed.py)
    • Network accessline 446
      Most of the time if combining `pytest` and `unittest` in the same test suite works just fine. You can read [here](https://docs.pytest.org/en/stable/how-to/unittest.html) which features are supported when doing that , but the important thing
    • Network accessline 505
      The module [parameterized](https://pypi.org/project/parameterized/) works for both: `unittests` and `pytest` tests.
    • Dangerous shell operationline 643
      footnote: In order to run the equivalent of `rm -r` safely, only subdirs of the project repository checkout are allowed if an explicit `tmp_dir` is used, so that by mistake no `/tmp` or similar important part of the filesystem will get nuke
    • Network accessline 750
      More details, example and ways are [here](https://docs.pytest.org/en/stable/how-to/skipping.html).
    • Network accessline 758
      In order to test functions that write to `stdout` and/or `stderr`, the test can access those streams using the `pytest`'s [capsys system](https://docs.pytest.org/en/stable/how-to/capture-stdout-stderr.html). Here is how this is accomplished
    • Access to secretsline 902
      [Credential-related source omitted]
    • Access to secretsline 916
      [Credential-related source omitted]

    testing/testing_utils.py

    • Executable scriptline 1
      Executable file
    • Network accessline 7
      # You may obtain a copy of the License at # #     http://www.apache.org/licenses/LICENSE-2.0
    • Network accessline 8
      # #     http://www.apache.org/licenses/LICENSE-2.0 #
    • Network accessline 9
      #     http://www.apache.org/licenses/LICENSE-2.0
    • Access to secretsline 56
      [Credential-related source omitted]
    • Access to secretsline 72
      [Credential-related source omitted]
    • Network accessline 195
      if not is_bnb_available():         return unittest.skip("test requires bitsandbytes from https://github.com/facebookresearch/bitsandbytes")(
    • Network accessline 196
      return unittest.skip("test requires bitsandbytes from https://github.com/facebookresearch/bitsandbytes")(
    • Network accessline 207
      if not is_bnb_available():         raise SkipTest("Test requires bitsandbytes from https://github.com/facebookresearch/bitsandbytes")
    • Network accessline 208
      raise SkipTest("Test requires bitsandbytes from https://github.com/facebookresearch/bitsandbytes")
    • Network accessline 254
      For default values of `rtol` and `atol` which are dtype dependent, see the table at https://docs.pytorch.org/docs/stable/testing.html#torch.testing.assert_close
    • Network accessline 264
      # from https://github.com/huggingface/transformers/blob/26eb566e43148c80d0ea098c76c3d128c0281c16/src/transformers/file_utils.py#L301
    • Network accessline 522
      # adapted from https://stackoverflow.com/a/64789046/9201239
    • Dangerous shell operationline 606
      Note 1: In order to run the equivalent of ``rm -r`` safely, only subdirs of the project repository checkout are
    • Access to secretsline 613
      [Credential-related source omitted]
    • Access to secretsline 693
      [Credential-related source omitted]
    • Access to secretsline 700
      [Credential-related source omitted]
    • Access to secretsline 799
      [Credential-related source omitted]
    • Network accessline 802
      # from https://stackoverflow.com/a/34333710/9201239
    • Access to secretsline 806
      [Credential-related source omitted]
    • Access to secretsline 808
      [Credential-related source omitted]
    • Access to secretsline 819
      [Credential-related source omitted]
    • Access to secretsline 846
      [Credential-related source omitted]
    • Network accessline 1001
      # custom durations report     # note: there is no need to call pytest --durations=XX to get this separate report     # adapted from https://github.com/pytest-dev/pytest/blob/897f151e/src/_pytest/runner.py#L66
    • Network accessline 1003
      # adapted from https://github.com/pytest-dev/pytest/blob/897f151e/src/_pytest/runner.py#L66
    • Network accessline 1034
      # use ready-made report funcs, we are just hijacking the filehandle to log to a dedicated file each     # adapted from https://github.com/pytest-dev/pytest/blob/897f151e/src/_pytest/terminal.py#L814
    • Network accessline 1035
      # adapted from https://github.com/pytest-dev/pytest/blob/897f151e/src/_pytest/terminal.py#L814
    • Network accessline 1119
      # note: there is a warning for a possible deadlock when using `wait` with huge amounts of data in the pipe     # https://docs.python.org/3/library/asyncio-subprocess.html#asyncio.asyncio.subprocess.Process.wait
    • Network accessline 1120
      # https://docs.python.org/3/library/asyncio-subprocess.html#asyncio.asyncio.subprocess.Process.wait

    todo.md

    • Network accessline 13
      - **activation checkpoint offloading: follow up on HF Transformers [#48461](https://github.com/huggingface/transformers/pull/48461)** - if "act offload with full overlap" lands, update the last sentence of the paragraph in [Offloading the a
    • Dangerous shell operationline 21
      - **`ib_write_bw -c SRD` on EFA** - 193.72Gbps on one adapter, 96.9% of its 200Gbps line rate. The "unconfirmed here" footnote is gone. `perftest` needed `sudo apt-get install -y perftest` on both hosts, and without `-c SRD` the run dies at
    • Network accessline 32
      - validate the SHARP/multicast granularity on an NVL36 or NVL72 system. [The SHARP section](network/README.md#sharp) now carries measured H200 and B200 HGX sweeps (B200 added 2026-08-09): H200 selects `NVLS` from 5 GPUs up, B200 stays on `R
    • Network accessline 38
      - **Intel GPU (XPU): check that `mamf-finder.py` still runs on one** - it has never run on an Intel GPU here, and two recent changes reach it. From [#111](https://github.com/stas00/ml-engineering/pull/111) (2026-10-01) until the fix of 2026
    • Network accessline 39
      - hardware: an Intel GPU on PyTorch's XPU support list - Data Center GPU Max (Ponte Vecchio, e.g. Max 1100/1550), Arc A-series (e.g. A770) or B-series (e.g. B580), Arc Pro, or the Arc graphics of a Core Ultra (Meteor Lake, Lunar Lake, Arrow
    • Network accessline 40
      - to tell whether a Linux box qualifies: `lspci -nnk | grep -EiA3 'vga|display|3d controller'` must show vendor ID `8086` with one of the names above and `Kernel driver in use: i915` or `xe`. Then, in a throwaway venv, `python -m venv /tmp/

    training/checkpoints/README.md

    • Network accessline 3
      - [torch-checkpoint-convert-to-bf16](./torch-checkpoint-convert-to-bf16) - converts an existing fp32 torch checkpoint to bf16. If [safetensors](https://github.com/safetensors/safetensors) are found those are converted as well. Should be eas

    training/checkpoints/torch-checkpoint-convert-to-bf16

    • Executable scriptline 1
      #!/bin/bash

    training/checkpoints/torch-checkpoint-shrink.py

    • Executable scriptline 1
      #!/usr/bin/env python

    training/datasets.md

    • Network accessline 5
      HF Accelerate has a very neat container [`main_process_first`](https://huggingface.co/docs/accelerate/v0.4.0/accelerator.html#accelerate.Accelerator.main_process_first) which allows to write code like:

    training/dtype.md

    • Network accessline 18
      ([source](https://developer.nvidia.com/blog/accelerating-ai-training-with-tf32-tensor-cores/))
    • Network accessline 22
      ([source](https://docs.nvidia.com/deeplearning/transformer-engine/user-guide/examples/fp8_primer.html))
    • Network accessline 30
      There is an excellent explanation of each of these variations [here](https://github.com/jax-ml/ml_dtypes?tab=readme-ov-file#specifications-of-implemented-floating-point-formats).
    • Network accessline 32
      `float8_e8m0fnu` is the odd one out in that list - it is not an element format but the shared scale that block-scaled formats attach to a group of elements, which is why it has no mantissa. Pairing it with a 4-, 6- or 8-bit element encoding
    • Network accessline 58
      Next [mixed-precision](https://developer.nvidia.com/blog/video-mixed-precision-techniques-tensor-cores-deep-learning/) was invented using a combination of fp16 and fp32, which tremendously sped up the training speed.
    • Network accessline 62
      ([source](https://developer.nvidia.com/blog/video-mixed-precision-techniques-tensor-cores-deep-learning/))
    • Network accessline 68
      Then fp8 came and mixed precision could switch to [that](https://docs.nvidia.com/deeplearning/transformer-engine/user-guide/examples/fp8_primer.html), which makes the training even faster. See [FP8 Formats for Deep Learning](https://arxiv.o
    • Network accessline 92
      In parallel with the mixed training regime the ML community started coming up with various quantization approaches. Probably one of the best examples is Tim Dettmers' [bitsandbytes](https://github.com/bitsandbytes-foundation/bitsandbytes) w
    • Network accessline 107
      Accuracy is what separates them. A smaller block means one outlier distorts the scale of 15 neighbours rather than 31, and an `E4M3` scale can sit between powers of two where `E8M0` has to round to one. In NVIDIA's [8B-parameter, 1T-token p
    • Network accessline 134
      For more information about the actual precision loss please see [this](https://docs.pytorch.org/docs/stable/notes/cuda.html#tensorfloat-32-tf32-on-ampere-and-later-devices).
    • Network accessline 161
      * fp16 master weights and optim states can be used when using [Kahan Summation](https://en.wikipedia.org/wiki/Kahan_summation_algorithm) or [Stochastic rounding](https://en.wikipedia.org/wiki/Rounding) (introduced in [Revisiting BFloat16 Tr
    • Network accessline 163
      For an example of the latter see: [AnyPrecision optimizer](https://github.com/pytorch/torchdistx/pull/52) with the latest version found [here](https://github.com/facebookresearch/multimodal/blob/6bf3779a064dc72cde48793521a5be151695fc62/torc
    • Network accessline 170
      - Using bf16-pretrained model in fp16 regime usually fails - due to overflows (the biggest number that can be represented in fp16 is 64k) for an indepth discussion and possible workaround see this [PR](https://github.com/huggingface/transfo

    training/emulate-multi-node.md

    • Access to secretsline 20
      [Credential-related source omitted]
    • Access to secretsline 34
      [Credential-related source omitted]
    • Access to secretsline 53
      [Credential-related source omitted]
    • Access to secretsline 54
      [Credential-related source omitted]
    • Access to secretsline 57
      [Credential-related source omitted]
    • Access to secretsline 94
      [Credential-related source omitted]
    • Access to secretsline 107
      [Credential-related source omitted]
    • Access to secretsline 108
      [Credential-related source omitted]
    • Access to secretsline 119
      [Credential-related source omitted]
    • Access to secretsline 199
      [Credential-related source omitted]
    • Access to secretsline 200
      [Credential-related source omitted]
    • Access to secretsline 217
      [Credential-related source omitted]
    • Access to secretsline 218
      [Credential-related source omitted]
    • Access to secretsline 219
      [Credential-related source omitted]
    • Access to secretsline 224
      [Credential-related source omitted]
    • Network accessline 234
      With NVIDIA A100 you can use [MIG](https://www.nvidia.com/en-us/technologies/multi-instance-gpu/) to emulate up to 7 instances of GPUs on just one real GPU, but for years you couldn't use those instances for anything but standalone use - e.
    • Network accessline 236
      That has changed - [NCCL 2.31 (2026) added experimental support for communicators that span MIG instances](https://docs.nvidia.com/deeplearning/nccl/user-guide/docs/usage/communicators.html#using-mig-instances), so a single physical GPU can
    • Dangerous shell operationline 275
      sudo nvidia-smi -i 4 -mig 1      # enable MIG on GPU 4
    • Dangerous shell operationline 276
      sudo nvidia-smi mig -i 4 -cgi 1g.35gb,1g.35gb,1g.35gb,1g.35gb -C
    • Dangerous shell operationline 282
      sudo nvidia-smi mig -i 4 -dci && sudo nvidia-smi mig -i 4 -dgi
    • Dangerous shell operationline 283
      sudo nvidia-smi -i 4 -mig 0
    • Dangerous shell operationline 393
      sudo nvidia-smi -i $i -mig 1
    • Dangerous shell operationline 394
      sudo nvidia-smi mig -i $i -cgi 1g.35gb,1g.35gb,1g.35gb,1g.35gb -C
    • Dangerous shell operationline 427
      sudo nvidia-smi -i 0 -mig 1
    • Dangerous shell operationline 428
      sudo nvidia-smi mig -i 0 -cgi 1g.18gb,1g.18gb,1g.18gb,1g.18gb,1g.18gb,1g.18gb,1g.18gb -C
    • Access to secretsline 470
      [Credential-related source omitted]
    • Access to secretsline 506
      [Credential-related source omitted]
    • Access to secretsline 525
      [Credential-related source omitted]

    training/fault-tolerance/README.md

    • Network accessline 144
      The open-source library that lands closest to this idea is [`torchft`](https://github.com/meta-pytorch/torchft) (Meta / PyTorch). It treats each training step as a fault boundary across replica groups, coordinates health with a lighthouse/q
    • Network accessline 146
      Related research systems attack the same problem from other angles. [`Oobleck`](https://github.com/SymbioticLab/Oobleck) (SOSP'23) keeps logically equivalent pipeline replicas and recovers by re-instantiating precomputed pipeline templates 
    • Network accessline 176
      Before we discuss the various watchdogs it's critical that you have a mechanism that allows you to run scheduled jobs. In the Unix world this is implemented by the [`crontab` facility](https://en.wikipedia.org/wiki/Cron).
    • Network accessline 234
      Most applications do periodic logging, e.g., most training log the stats of the last N steps every few minutes. Then one could check if the log file has been updated during the expected time-frame - and if it didn't - send an alert. You cou
    • Network accessline 265
      Some programs develop tiny memory leaks which can be very difficult to debug. Do not confuse those with the usage of MMAP where the program uses the CPU memory to read quickly read data from and where the memory usage could appear to grow o
    • Network accessline 315
      footnote: don't do this unless you really have to, since caching makes things faster. Ideally figure out the fragmentation issue instead. For example, look up `max_split_size_mb` in the doc for [`PYTORCH_ALLOC_CONF`](https://docs.pytorch.or
    • Network accessline 352
      case study: you can see how this was set [in the BLOOM training job](https://github.com/bigscience-workshop/bigscience/blob/58d99c67f643d27b5765a73a2ee2d1ce0a4b2c6b/train/tr11-176B-ml/tr11-176B-ml.slurm#L97-L100) and then acted upon [here](

    training/fault-tolerance/fs-watchdog.py

    • Executable scriptline 1
      #!/usr/bin/env python

    training/fault-tolerance/fs-watchdog.slurm

    • Executable scriptline 1
      #!/bin/bash

    training/fault-tolerance/slurm-status.py

    • Executable scriptline 1
      #!/usr/bin/env python
    • Network accessline 56
      On call info: https://github.com/bigscience-workshop/bigscience/tree/master/train/tr1-13B-base#on-call
    • Network accessline 57
      Training logs: https://github.com/bigscience-workshop/bigscience/tree/master/train/tr1-13B-base#watching-the-training-logs
    • Network accessline 58
      Launching training: https://github.com/bigscience-workshop/bigscience/tree/master/train/tr1-13B-base#training-scripts

    training/fault-tolerance/slurm-status.slurm

    • Executable scriptline 1
      #!/bin/bash

    training/hparams.md

    • Network accessline 11
      - GBS: Global Batch Size - total batch size per iteration - may include gradient accumulation - PP: Pipeline Parallelism - TFLOPS: Trillion FLOPs per second - [FLOPS](https://en.wikipedia.org/wiki/FLOPS)
    • Network accessline 13
      - TFLOPS: Trillion FLOPs per second - [FLOPS](https://en.wikipedia.org/wiki/FLOPS)

    training/instabilities/README.md

    • Network accessline 20
      1. "Transformers without Tears" paper https://arxiv.org/abs/1910.05895 prescribes: `sqrt(2/(NHIDDEN*5))`
    • Network accessline 22
      2. The 530B training paper https://arxiv.org/abs/2201.11990 they used an even smaller init formula: `sqrt(1/(NHIDDEN*3))`
    • Network accessline 39
      For example, please see this very interesting [PyTorch guide on numerical stability](https://docs.pytorch.org/docs/stable/notes/numerical_accuracy.html).
    • Network accessline 43
      During 104B training experiments where fp16 mixed precision was used - the following improvement was proposed by [Corby Rosset](https://github.com/corbyrosset) to make [self-attention more stable](https://github.com/bigscience-workshop/Mega
    • Network accessline 45
      Specifically this [line](https://github.com/bigscience-workshop/Megatron-DeepSpeed/blob/c839a8aa30731f71b3738d56009be9668508e366/megatron/model/transformer.py#L303) shows that the `norm_factor` may be multiplied after the Query * Key matrix
    • Network accessline 68
      For CUDA kernel writers [CuBlas](https://docs.nvidia.com/cuda/cublas/index.html)'s `GemmStridedBatchedEx` at the time of this writing has a similar issue. It is defined as:
    • Network accessline 78
      PaLM team observed dozens of loss spikes at "highly irregular intervals" when training larger models. While they were not able to track down the root cause, they mitigated the issue by restarting from an earlier checkpoint and skipping pote
    • Network accessline 83
      [A Theory on Adam Instability in Large-Scale Machine Learning](https://arxiv.org/abs/2304.09871) performs a rigorous study of divergence spikes while training LLMs at up to 546B parameters - and suggests that the time-domain correlation lea

    training/instabilities/training-loss-patterns.md

    • Network accessline 17
      Prior to starting BLOOM-176B training we did multiple experiments with the [104B model](https://github.com/bigscience-workshop/bigscience/tree/master/train/tr8-104B-wide). We failed to figure out how to not diverge very early on.
    • Network accessline 21
      As you can see many attempts were made, many techniques were applied (see [chronicles](https://github.com/bigscience-workshop/bigscience/blob/master/train/tr8-104B-wide/chronicles.md). We think the 2 main obstacles were using fp16 and data 
    • Network accessline 28
      The [BLOOM-176B](https://github.com/bigscience-workshop/bigscience/tree/master/train/tr11-176B-ml) training had a close to perfect training loss trajectory, with a single spike that has recovered in 200 steps.
    • Network accessline 30
      You can inspect the [TB](https://huggingface.co/bigscience/tr11-176B-logs/tensorboard) to zoom in and check other plots.
    • Network accessline 37
      Some time back I was doing performance testing and run a tiny global batch size of 8 on an 8×A100 node, training llama-2-7b from scratch. (w/ DeepSpeed ZeRO-3 DP using HF Transformers [Llama](https://github.com/huggingface/transformers/tree
    • Network accessline 41
      Here one can observe a rapid loss improvement from 4 to 2.5 in just 480 samples after a very steady much slower improvements. My colleague [Gautam Mittal](https://github.com/gmittal) called it the [grokking](https://en.wikipedia.org/wiki/Gr
    • Network accessline 69
      Here is an example of [the 13B pre-BLOOM training experiment](https://github.com/bigscience-workshop/bigscience/tree/master/train/tr1-13B-base):
    • Network accessline 78
      Here is a slow recovering spike from the [IDEFICS-80B](https://github.com/huggingface/m4-logs/blob/master/tr-190-80b/chronicles.md) training:
    • Network accessline 87
      This [104B model attempt](https://github.com/bigscience-workshop/bigscience/tree/master/train/tr8-104B-wide) spiked, started recovering but decided to not recover fully and instead started diverging
    • Network accessline 91
      Here is another example from the [IDEFICS-80B](https://github.com/huggingface/m4-logs/blob/master/tr-190-80b/chronicles.md) training:
    • Network accessline 108
      All these are from the [104B model attempts](https://github.com/bigscience-workshop/bigscience/tree/master/train/tr8-104B-wide).
    • Network accessline 113
      During the [IDEFICS-80B](https://github.com/huggingface/m4-logs/blob/master/tr-190-80b/chronicles.md) training we were using 2 different dataset types mixed together:
    • Network accessline 133
      During [IDEFICS-80B](https://github.com/huggingface/m4-logs/blob/master/tr-190-80b/chronicles.md) training we had a very complicated DataLoader which was suffering from image to text ratio fluctuations when the DataLoader was getting restor
    • Network accessline 155
      [wandb](https://wandb.ai/) didn't handle resume data plotting correctly if a rollback was performed, that is it ignored all new data after the rollback until the steps of the old data have been overcome. This forced us to start a new wandb 
    • Network accessline 159
      footnote: as of 2025 wandb can do this properly - [rewinding a run](https://docs.wandb.ai/models/runs/rewind) with `wandb.init(resume_from="<run_id>?_step=N")` truncates the history at step `N` and lets you log forward under the same run id
    • Network accessline 165
      The problem came from [pytorch-lightning](https://github.com/Lightning-AI/pytorch-lightning) not handling resumes correctly wrt DataSampler automatically - basically every time you resume you start your data stream from scratch. This, of co
    • Network accessline 167
      footnote: I discussed [this issue with the PTL developers](https://github.com/Lightning-AI/pytorch-lightning/issues/18780) and they said that they tried hard to come up with a generic solution but it wasn't meant to be. So the user needs to

    training/model-parallelism/README.md

    • Network accessline 25
      1. [Data Parallelism](#data-parallelism) (DP) - the same setup is replicated multiple times, and each being fed a slice of the data. The processing is done in parallel and all setups are synchronized at the end of each training step. 2. [Te
    • Network accessline 26
      2. [TensorParallelism](#tensor-parallelism) (TP) - each tensor is split up into multiple chunks, so instead of having the whole tensor reside on a single gpu, each shard of the tensor resides on its designated gpu. During forward and backwa
    • Network accessline 32
      The introduction sections of this paper is probably one of the best explanations I have found on most common parallelism techniques [Breadth-First Pipeline Parallelism](https://arxiv.org/abs/2211.05953).
    • Network accessline 40
      For details see [DistributedDataParallel](https://docs.pytorch.org/docs/stable/generated/torch.nn.parallel.DistributedDataParallel.html)
    • Network accessline 44
      ZeRO-powered data parallelism (ZeRO-DP) is described on the following diagram from this [blog post](https://www.microsoft.com/en-us/research/blog/zero-deepspeed-new-system-optimizations-enable-training-models-with-over-100-billion-parameter
    • Network accessline 117
      Implementations of ZeRO-DP stages 1+2+3: - [DeepSpeed](https://www.deepspeed.ai/tutorials/zero/)
    • Network accessline 118
      - [DeepSpeed](https://www.deepspeed.ai/tutorials/zero/)
    • Network accessline 119
      - [PyTorch](https://docs.pytorch.org/docs/stable/fsdp.html) (originally it was implemented in [FairScale](https://github.com/facebookresearch/fairscale/) and later it was upstreamed into the PyTorch core)
    • Network accessline 120
      - [torchtitan](https://github.com/pytorch/torchtitan)
    • Network accessline 122
      DeepSpeed ZeRO Integration: - [HF Trainer integration](https://huggingface.co/docs/transformers/main_classes/deepspeed)
    • Network accessline 123
      - [HF Trainer integration](https://huggingface.co/docs/transformers/main_classes/deepspeed)
    • Network accessline 124
      - [Accelerate](https://huggingface.co/docs/accelerate/usage_guides/deepspeed)
    • Network accessline 125
      - [PyTorch Lightning](https://lightning.ai/docs/pytorch/stable/advanced/model_parallel/deepspeed.html)
    • Network accessline 126
      - [Determined.AI](https://github.com/determined-ai/determined/tree/main/docs/model-dev-guide/api-guides/apis-howto/deepspeed)
    • Network accessline 128
      FSDP Integration: - [HF Trainer integration](https://huggingface.co/docs/transformers/main/en/fsdp)
    • Network accessline 129
      - [HF Trainer integration](https://huggingface.co/docs/transformers/main/en/fsdp)
    • Network accessline 130
      - [Accelerate](https://huggingface.co/docs/accelerate/main/en/usage_guides/fsdp)
    • Network accessline 131
      - [PyTorch Lightning](https://lightning.ai/docs/pytorch/stable/advanced/model_parallel/fsdp.html)
    • Network accessline 132
      - [torchtitan](https://github.com/pytorch/torchtitan)
    • Network accessline 136
      DeepSpeed and ZeRO in general: - [ZeRO: Memory Optimizations Toward Training Trillion Parameter Models](https://arxiv.org/abs/1910.02054)
    • Network accessline 137
      - [ZeRO: Memory Optimizations Toward Training Trillion Parameter Models](https://arxiv.org/abs/1910.02054)
    • Network accessline 138
      - [ZeRO-Offload: Democratizing Billion-Scale Model Training](https://arxiv.org/abs/2101.06840)
    • Network accessline 139
      - [ZeRO-Infinity: Breaking the GPU Memory Wall for Extreme Scale Deep Learning](https://arxiv.org/abs/2104.07857)
    • Network accessline 140
      - [ZeRO++: Extremely Efficient Collective Communication for Giant Model Training](https://arxiv.org/abs/2306.10209)
    • Network accessline 141
      - [DeepSpeed Ulysses: System Optimizations for Enabling Training of Extreme Long Sequence Transformer Models](https://arxiv.org/abs/2309.14509)
    • Network accessline 142
      - [AMSP: Reducing Communication Overhead of ZeRO for Efficient LLM Training](https://arxiv.org/abs/2311.00257)
    • Network accessline 144
      PyTorch: - [PyTorch FSDP: Experiences on Scaling Fully Sharded Data Parallel](https://arxiv.org/abs/2304.11277)
    • Network accessline 145
      - [PyTorch FSDP: Experiences on Scaling Fully Sharded Data Parallel](https://arxiv.org/abs/2304.11277)
    • Network accessline 147
      Main DeepSpeed ZeRO Resources: - [Project's github](https://github.com/deepspeedai/DeepSpeed)
    • Network accessline 148
      - [Project's github](https://github.com/deepspeedai/DeepSpeed)
    • Network accessline 149
      - [Usage docs](https://www.deepspeed.ai/getting-started/)
    • Network accessline 150
      - [API docs](https://deepspeed.readthedocs.io/en/latest/index.html)
    • Network accessline 151
      - [Blog posts](https://www.microsoft.com/en-us/research/search/?q=deepspeed)
    • Network accessline 159
      - DeepSpeed ZeRO use [DeepSpeed-Ulysses](#deepspeed-ulysses-sp) - [Arctic Long Sequence Training](#arctic-long-sequence-training) - FSDP use [Paged Ring Attention](https://github.com/lucidrains/ring-attention-pytorch) ([paper](https://arxiv
    • Network accessline 161
      - FSDP use [Paged Ring Attention](https://github.com/lucidrains/ring-attention-pytorch) ([paper](https://arxiv.org/abs/2402.08268))
    • Network accessline 172
      [ZeRO++](https://arxiv.org/abs/2306.10209) solves the 2nd limitation by introducing Hierarchical Weight Partition for ZeRO (hpZ). In this approach instead of spreading whole model weights across all the gpus, each model replica is restricte
    • Network accessline 176
      PyTorch FSDP has this feature implemented in [shardingStrategy.HYBRID_SHARD](https://docs.pytorch.org/docs/stable/fsdp.html)
    • Network accessline 180
      - [ZeRO++: Extremely Efficient Collective Communication for Giant Model Training](https://arxiv.org/abs/2306.10209)
    • Network accessline 181
      - [PyTorch FSDP: Experiences on Scaling Fully Sharded Data Parallel](https://arxiv.org/abs/2304.11277)
    • Network accessline 188
      - [MiCS: Near-linear Scaling for Training Gigantic Model on Public Cloud](https://arxiv.org/abs/2205.00119) (2022)
    • Network accessline 189
      - [AMSP: Super-Scaling LLM Training via Advanced Model States Partitioning](https://arxiv.org/abs/2311.00257) (2023)
    • Network accessline 222
      The following illustration from the [GPipe paper](https://research.google/blog/introducing-gpipe-an-open-source-library-for-efficiently-training-large-scale-neural-network-models/) shows the naive MP on the top, and PP on the bottom:
    • Network accessline 246
      - sequential [Gpipe: Efficient training of giant neural networks using pipeline parallelism](https://arxiv.org/abs/1811.06965)
    • Network accessline 247
      - interleaved 1F1B [Pipedream: Fast and efficient pipeline parallel dnn training](https://arxiv.org/abs/1806.03377)
    • Network accessline 248
      - looped, depth-first [Efficient large-scale language model training on gpu clusters using Megatron-LM](https://arxiv.org/abs/2104.04473)
    • Network accessline 249
      - breadth-first [Breadth-First Pipeline Parallelism](https://arxiv.org/abs/2211.05953)
    • Network accessline 250
      - Llama 3 training used a combination of depth and breadth first for best performance and also allowed them to progressively modify the global batch size as the training progressed, which is typically very difficult to accomplish with PP. S
    • Network accessline 260
      [DeepSeek v3](https://arxiv.org/abs/2412.19437) introduced an even more efficient PP via DualPipe that reduces the bubble size and succeeds at a better compute/comms overlap. See section 3.2.1 of the paper for the specific details.
    • Network accessline 262
      ![dualpipe](images/parallelism-pp-dualpipe.png) ([source](https://arxiv.org/abs/2412.19437))
    • Network accessline 263
      ([source](https://arxiv.org/abs/2412.19437))
    • Network accessline 281
      - [Megatron-LM](https://github.com/NVIDIA/Megatron-LM) - battle-tested PP (interleaved 1F1B and related schedules); model-specific, no separate public Pipe-style API
    • Network accessline 282
      - [DeepSpeed](https://www.deepspeed.ai/tutorials/pipeline/) - PP as part of the DeepSpeed stack (often combined with ZeRO)
    • Network accessline 283
      - [torch.distributed.pipelining](https://docs.pytorch.org/docs/stable/distributed.pipelining.html) - PyTorch's current PP toolkit (migrated from [PiPPy](https://github.com/pytorch/pippy)); still **alpha** / API may change. Splits general mo
    • Network accessline 284
      - [torchtitan](https://github.com/pytorch/torchtitan) / [nanotron](https://github.com/huggingface/nanotron) - full training stacks that use modern PP
    • Network accessline 285
      - [DeepSeek DualPipe](https://github.com/deepseek-ai/DualPipe) - the schedule from [DeepSeek-V3](https://arxiv.org/abs/2412.19437) (also appears as `ScheduleDualPipeV` in `torch.distributed.pipelining`)
    • Network accessline 286
      - [SageMaker](https://arxiv.org/abs/2111.05972) - proprietary, AWS-only
    • Network accessline 291
      - [Pipeline-Parallelism: Distributed Training via Model Partitioning](https://siboehm.com/articles/22/pipeline-parallel-training)
    • Network accessline 299
      In this section we use concepts and diagrams from the [Megatron-LM](https://github.com/NVIDIA/Megatron-LM) paper: [Efficient Large-Scale Language Model Training on GPU Clusters](https://arxiv.org/abs/2104.04473).
    • Network accessline 321
      Alternative names: - DeepSpeed calls it [tensor slicing](https://www.deepspeed.ai/tutorials/large-models-w-deepspeed/)
    • Network accessline 322
      - DeepSpeed calls it [tensor slicing](https://www.deepspeed.ai/tutorials/large-models-w-deepspeed/)
    • Network accessline 324
      Implementations: - [Megatron-LM](https://github.com/NVIDIA/Megatron-LM) has an internal implementation, as it's very model-specific
    • Network accessline 325
      - [Megatron-LM](https://github.com/NVIDIA/Megatron-LM) has an internal implementation, as it's very model-specific
    • Network accessline 326
      - [PyTorch](https://docs.pytorch.org/docs/stable/distributed.tensor.parallel.html)
    • Network accessline 327
      - [SageMaker](https://arxiv.org/abs/2111.05972) - this is a proprietary solution that can only be used on AWS.
    • Network accessline 328
      - [OSLO](https://github.com/eleutherAI/Oslo) has the tensor parallelism implementation based on the Transformers.
    • Network accessline 329
      - [nanotron](https://github.com/huggingface/nanotron)
    • Network accessline 330
      - [torchtitan](https://github.com/pytorch/torchtitan)
    • Network accessline 335
      One of the deficiencies of TP is that it's difficult to overlap its comms with compute. PyTorch is proposing to overcome this with [Async-TP](https://discuss.pytorch.org/t/distributed-w-torchtitan-introducing-async-tensor-parallelism-in-pyt
    • Network accessline 337
      - [Megatron-LM](https://github.com/NVIDIA/Megatron-LM) has it implemented as well via`--tp-comm-overlap`.
    • Network accessline 342
      - [Tensor Parallelism and Sequence Parallelism: Detailed Analysis](https://insujang.github.io/2024-01-11/tensor-parallelism-and-sequence-parallelism-detailed-analysis/#sequence-parallelism)
    • Network accessline 348
      Self-Attention, which is a key component of Transformers, has quadratic compute complexity with respect to sequence length for standard dense attention. Kernels that materialize the full sequence-by-sequence attention matrix also require qu
    • Network accessline 356
      Paper: [DeepSpeed Ulysses: System Optimizations for Enabling Training of Extreme Long Sequence Transformer Models](https://arxiv.org/abs/2309.14509)
    • Network accessline 366
      [source](https://github.com/deepspeedai/DeepSpeed/tree/master/blogs/deepspeed-ulysses)
    • Network accessline 387
      You can read the specifics of the very efficient comms [here](https://github.com/deepspeedai/DeepSpeed/tree/master/blogs/deepspeed-ulysses#significant-communication-volume-reduction).
    • Network accessline 393
      Arctic Long Sequence Training ports [DeepSpeed-Ulysses](#deepspeed-ulysses-sp) to HuggingFace Transformers, while updating it to work with modern attention head mechanisms and extends it further to enable a much longer sequence length suppo
    • Network accessline 395
      - paper: https://arxiv.org/abs/2506.13996
    • Network accessline 396
      - implementation and integration: [ArcticTraining](https://github.com/snowflakedb/ArcticTraining/tree/main/projects/sequence-parallelism) and [Axolotl](https://github.com/axolotl-ai-cloud/axolotl)
    • Network accessline 400
      Paper: [Sequence parallelism: Long sequence training from system perspective](https://arxiv.org/abs/2105.13120)
    • Network accessline 406
      Paper: [Reducing Activation Recomputation in Large Transformer Models](https://arxiv.org/abs/2205.05198)
    • Network accessline 412
      Paper: [Ring Attention with Blockwise Transformers for Near-Infinite Context](https://arxiv.org/abs/2310.01889)
    • Network accessline 422
      SP Implementations: - [Megatron-LM](https://github.com/NVIDIA/Megatron-LM)
    • Network accessline 423
      - [Megatron-LM](https://github.com/NVIDIA/Megatron-LM)
    • Network accessline 424
      - [DeepSpeed](https://github.com/deepspeedai/DeepSpeed)
    • Network accessline 425
      - [Colossal-AI](https://colossalai.org/)
    • Network accessline 426
      - [torchtitan](https://github.com/pytorch/torchtitan)
    • Network accessline 432
      [DISTFLASHATTN: Distributed Memory-efficient Attention for Long-context LLMs Training](https://arxiv.org/abs/2310.03294) is reported to be many times faster than Ring Self-Attention, because it load balances the KVQ per token computation be
    • Network accessline 438
      - [Tensor Parallelism and Sequence Parallelism: Detailed Analysis](https://insujang.github.io/2024-01-11/tensor-parallelism-and-sequence-parallelism-detailed-analysis/#sequence-parallelism)
    • Network accessline 443
      TP can be combined with SP in the same process group to minimize communication costs as explained in [Reducing Activation Recomputation in Large Transformer Models](https://arxiv.org/abs/2205.05198). For example in LLMs, TP is used for embe
    • Network accessline 449
      The following diagram from the DeepSpeed [pipeline tutorial](https://www.deepspeed.ai/tutorials/pipeline/) demonstrates how one combines DP with PP.
    • Network accessline 457
      Implementations: - [DeepSpeed](https://github.com/deepspeedai/DeepSpeed)
    • Network accessline 458
      - [DeepSpeed](https://github.com/deepspeedai/DeepSpeed)
    • Network accessline 459
      - [Megatron-LM](https://github.com/NVIDIA/Megatron-LM)
    • Network accessline 460
      - [SageMaker](https://arxiv.org/abs/2111.05972)
    • Network accessline 461
      - [OSLO](https://github.com/eleutherAI/Oslo)
    • Network accessline 462
      - [nanotron](https://github.com/huggingface/nanotron)
    • Network accessline 463
      - [torchtitan](https://github.com/pytorch/torchtitan)
    • Network accessline 473
      This diagram is from a blog post [3D parallelism: Scaling to trillion-parameter models](https://www.microsoft.com/en-us/research/blog/deepspeed-extreme-scale-model-training-for-everyone/), which is a good read as well.
    • Network accessline 477
      Implementations: - [DeepSpeed](https://github.com/deepspeedai/DeepSpeed) - DeepSpeed also includes an even more efficient DP, which they call ZeRO-DP.
    • Network accessline 478
      - [DeepSpeed](https://github.com/deepspeedai/DeepSpeed) - DeepSpeed also includes an even more efficient DP, which they call ZeRO-DP.
    • Network accessline 479
      - [Megatron-LM](https://github.com/NVIDIA/Megatron-LM)
    • Network accessline 480
      - [SageMaker](https://arxiv.org/abs/2111.05972)
    • Network accessline 481
      - [OSLO](https://github.com/eleutherAI/Oslo)
    • Network accessline 482
      - [nanotron](https://github.com/huggingface/nanotron)
    • Network accessline 483
      - [torchtitan](https://github.com/pytorch/torchtitan)
    • Network accessline 500
      Implementations: - [Megatron-DeepSpeed](https://github.com/deepspeedai/Megatron-DeepSpeed) and [Megatron-DeepSpeed from BigScience](https://github.com/bigscience-workshop/Megatron-DeepSpeed), which is the fork of the former repo.
    • Network accessline 501
      - [Megatron-DeepSpeed](https://github.com/deepspeedai/Megatron-DeepSpeed) and [Megatron-DeepSpeed from BigScience](https://github.com/bigscience-workshop/Megatron-DeepSpeed), which is the fork of the former repo.
    • Network accessline 502
      - [OSLO](https://github.com/eleutherAI/Oslo)
    • Network accessline 503
      - [torchtitan](https://github.com/pytorch/torchtitan)
    • Network accessline 507
      - [Using DeepSpeed and Megatron to Train Megatron-Turing NLG 530B, A Large-Scale Generative Language Model]( https://arxiv.org/abs/2201.11990)
    • Network accessline 508
      https://arxiv.org/abs/2201.11990)
    • Network accessline 516
      For detailed explanations please see: - [DeepSpeed-MoE: Advancing Mixture-of-Experts Inference and Training to Power Next-Generation AI Scale](https://arxiv.org/abs/2201.05596)
    • Network accessline 517
      - [DeepSpeed-MoE: Advancing Mixture-of-Experts Inference and Training to Power Next-Generation AI Scale](https://arxiv.org/abs/2201.05596)
    • Network accessline 518
      - [Mixture of Experts Explained](https://huggingface.co/blog/moe#parallelism)
    • Network accessline 524
      [FlexFlow](https://github.com/flexflow/flexflow-train) also solves the parallelization problem in a slightly different approach.
    • Network accessline 526
      Paper: ["Beyond Data and Model Parallelism for Deep Neural Networks" by Zhihao Jia, Matei Zaharia, Alex Aiken](https://arxiv.org/abs/1807.05358)
    • Network accessline 542
      Layer normalization requires the mean and variance, so standard deviation and mean aren't independent operations. For an illustrative operator decomposition across 2 devices (cuda:0, cuda:1), first copy the input data to both devices, then 
    • Network accessline 567
      ![all-reduce = reduce-scatter and all-gather](images/all-reduce-reduce-scatter-all-gather.png) ([source](https://engineering.fb.com/2021/07/15/open-source/fsdp/attachment/fsdp-graph-2a/))
    • Network accessline 568
      ([source](https://engineering.fb.com/2021/07/15/open-source/fsdp/attachment/fsdp-graph-2a/))
    • Network accessline 576
      - PP: 2x send + 2x recv - overlapping with compute in the steady phase - SP: depends on implementation: with hidden size h, sequence length of N, and parallelism degree of P   * Megatron-LM: 2x all-gather and 2x reduce-scatter with volume `
    • Network accessline 577
      - SP: depends on implementation: with hidden size h, sequence length of N, and parallelism degree of P   * Megatron-LM: 2x all-gather and 2x reduce-scatter with volume `4*N*h` per transformers layer [section 3.2 in paper](https://arxiv.org/
    • Network accessline 578
      * Megatron-LM: 2x all-gather and 2x reduce-scatter with volume `4*N*h` per transformers layer [section 3.2 in paper](https://arxiv.org/abs/2309.14509)
    • Network accessline 579
      * DeepSpeed Ulysses: 2x all-to-all with volume `4*N*h/P` per transformers layer [section 3.2 in paper](https://arxiv.org/abs/2309.14509)
    • Network accessline 592
      In comparison [DistributedDataParallel](https://docs.pytorch.org/docs/stable/generated/torch.nn.parallel.DistributedDataParallel.html) (DDP) uses a single `all_reduce` call, but which requires 2x data transmission, and so a 10B param model 
    • Network accessline 603
      The comms time formula is also a first-order estimate. `comms_multiplier` is the sum of the [busbw correction factors](https://github.com/NVIDIA/nccl-tests/blob/master/doc/PERFORMANCE.md#bandwidth) of the collectives performed in a single s
    • Network accessline 605
      As an experiment let's use the data points from [IDEFICS-80B](https://huggingface.co/HuggingFaceM4/idefics-80b/) training.
    • Network accessline 662
      Also the DeepSpeed team empirically [benchmarked a 176B model](https://github.com/deepspeedai/DeepSpeed/issues/2928#issuecomment-1463041491) on 384 V100 GPUs (24 DGX-2 nodes) and found that:
    • Network accessline 668
      To remind the peak TFLOPS for NVIDIA V100 at fp16 is [125TFLOPS](https://www.nvidia.com/en-gb/data-center/tesla-v100/).
    • Network accessline 697
      1. ZeRO - Enable [Memory Centric Tiling](https://deepspeed.readthedocs.io/en/latest/zero3.html#memory-centric-tiling) (MCT). It allows you to run arbitrarily large layers by automatically splitting them and executing them sequentially. MCT 

    training/performance/README.md

    • Network accessline 35
      - 1 FLOPS (FLoating point OPeration per Second) is how many floating point operations were performed in 1 second - see [FLOPS](https://en.wikipedia.org/wiki/FLOPS)
    • Network accessline 58
      In this section I will use BLOOM's training for the exemplification. We used 80GB A100 NVIDIA GPUs and we trained in mixed bf16 regime. So let's look at the [A100 spec](https://www.nvidia.com/en-us/data-center/a100/) which tells us:
    • Network accessline 99
      The exact formula is in Equation 3 of Section 5.1 of the [Efficient Large-Scale Language Model Training on GPU Clusters Using Megatron-LM](https://arxiv.org/abs/2104.04473) paper. You can see the code [here](https://github.com/bigscience-wo
    • Network accessline 140
      [Reducing Activation Recomputation in Large Transformer Models](https://arxiv.org/abs/2205.05198) is a good paper to read about these concepts.
    • Network accessline 151
      For example [Megatron-LM](https://github.com/NVIDIA/Megatron-LM) published the following stats for A100-80GB:
    • Network accessline 162
      More recent H100+A100 MFU/HFU numbers have been published [here](https://github.com/mosaicml/llm-foundry/tree/main/scripts/train/benchmarking#mfu-and-hfu).
    • Network accessline 224
      This summary is derived from [Data Movement Is All You Need: A Case Study on Optimizing Transformers 2020](https://arxiv.org/abs/2007.00072)
    • Network accessline 249
      - 8 bytes * number of parameters for normal AdamW (maintains 2 states) - 4 bytes * number of parameters for AdamW running at bf16. See [this work](https://github.com/huggingface/transformers/pull/21312) that uses `AnyPrecisionAdamW`.
    • Network accessline 250
      - 4 bytes * number of parameters for AdamW running at bf16. See [this work](https://github.com/huggingface/transformers/pull/21312) that uses `AnyPrecisionAdamW`.
    • Network accessline 252
      - 2 bytes * number of parameters for 8-bit AdamW optimizers like [bitsandbytes](https://github.com/bitsandbytes-foundation/bitsandbytes)
    • Network accessline 282
      In the following explanation let's use the Llama-3 architecture and its [8B configuration](https://huggingface.co/meta-llama/Llama-3.1-8B-Instruct/blob/main/config.json):
    • Network accessline 367
      Another excellent resource that takes you through the memory needs and other requirements is [Transformer Math 101](https://blog.eleuther.ai/transformer-math/).
    • Network accessline 369
      The [EAI cookbook](https://github.com/EleutherAI/cookbook) contains a set of [calculation scripts](https://github.com/EleutherAI/cookbook/tree/main/calc) that can output the theoretical memory overhead for a given training or inference calc
    • Network accessline 371
      There is a very handy [GPU VRAM Estimator](https://vram.asmirnov.xyz/) from Alexander Smirnov, and [the notes to how it works](https://asmirnov.xyz/vram).
    • Network accessline 454
      Reference: [PyTorch 2.14 release blog](https://pytorch.org/blog/pytorch-2-14-release-blog/).
    • Network accessline 461
      Environment variable `PYTORCH_ALLOC_CONF` comes to help and allows you to replace the default memory allocation mechanisms with more efficient ones. For more information see [Memory management](https://docs.pytorch.org/docs/stable/notes/cud
    • Network accessline 539
      - [RTX-3090](https://github.com/huggingface/transformers/issues/14608#issuecomment-1004392537)
    • Network accessline 540
      - [A100](https://github.com/huggingface/transformers/issues/15026#issuecomment-1005033957)
    • Network accessline 557
      Also  check out this the paper: [Reducing Activation Recomputation in Large Transformer Models](https://arxiv.org/abs/2205.05198) which describes a way to avoid most activation recomputations and thus save both memory and compute.
    • Network accessline 572
      It wraps the model's checkpoint function in PyTorch's [`save_on_cpu(pin_memory=True)`](https://docs.pytorch.org/docs/stable/autograd.html#torch.autograd.graph.save_on_cpu), so any model that supports gradient checkpointing supports it. The 
    • Network accessline 578
      footnote: as of 2026-10 this is an inefficient implementation: both copies run on the compute stream, and nothing is prefetched ahead of `backward`. The [`ActivationOffloadManager`](https://github.com/Snowflake-AI-Research/Arctic-Platform/b
    • Network accessline 586
      - There are optimizers like Adafactor that need only 4 bytes. Same goes for the [LION optimizer](https://arxiv.org/abs/2302.06675).
    • Network accessline 588
      - `AnyPrecisionAdamW`. Some courageous souls try to do the whole training in BF16 (not mixed precision!), including the optimizer and thus need only 4 bytes per parameter for optim states. See [this work](https://github.com/huggingface/tran
    • Network accessline 592
      - There are quantized solutions like `bnb.optim.Adam8bit` which uses only 2 bytes instead of 8 (1 byte per momentum).  You can get it from [here](https://github.com/bitsandbytes-foundation/bitsandbytes). Once installed, if you're using HF T
    • Network accessline 594
      For speed comparisons see [this benchmark](https://github.com/huggingface/transformers/issues/22101) Speed-wise:`apex`'s `apex.optimizers.FusedAdam` optimizer is so far the fastest implementation of Adam. Since pytorch-2.0 [torch.optim.Adam
    • Network accessline 611
      The paper, [The Case for Co-Designing Model Architectures with Hardware](https://arxiv.org/abs/2401.14489) investigates the effects of transformer sizing on the underlying hardware. The [associated scripts](https://github.com/EleutherAI/coo
    • Network accessline 615
      For fully connected layers (which correspond to GEMMs), NVIDIA provides recommendations for [input/output neuron counts]( https://docs.nvidia.com/deeplearning/performance/dl-performance-fully-connected/index.html#input-features) and [batch 
    • Network accessline 617
      [Tensor Core Requirements](https://docs.nvidia.com/deeplearning/performance/dl-performance-matrix-multiplication/index.html#requirements-tc) define the multiplier based on the dtype and the hardware. For example, for fp16 a multiple of 8 is
    • Network accessline 619
      For parameters that are small, there is also [Dimension Quantization Effects](https://docs.nvidia.com/deeplearning/performance/dl-performance-matrix-multiplication/index.html#dim-quantization) to consider, this is where tiling happens and t
    • Network accessline 621
      [The Case for Co-Designing Model Architectures with Hardware](https://arxiv.org/abs/2401.14489) provides much greater detail on tile/wave quantization and the number of attention heads, but the highlights are:
    • Network accessline 643
      What this means for transformers, is that for a given ratio of `h/a`, one needs to ensure they're on the crest of a wave. If you're using NVIDIA V100/A100 GPUs, we've already done this work for you in https://arxiv.org/pdf/2401.14489
    • Network accessline 702
      Generally, it's most computationally efficient to keep the ratio of `h/a` as large as possible without accuracy degradation. A good figure from [The Case for Co-Designing Model Architectures with Hardware](https://arxiv.org/abs/2401.14489) 
    • Network accessline 709
      If you're using [Flash Attention](https://github.com/Dao-AILab/flash-attention), good news! These MHA sizing constraints are taken care of for you. Your only constraint is to have a large enough ratio of `h/a` to saturate your GPU cores:
    • Network accessline 721
      The SwiGLU-based MLP contains an additional learned matrix in its activation function. There the MLP block contains 3 matrices instead of the original 2. To preserve the total number of parameters in the MLP block the paper that introduces 
    • Network accessline 764
      - [What Shapes Do Matrix Multiplications Like?](https://www.thonking.ai/p/what-shapes-do-matrix-multiplications)
    • Network accessline 771
      [Non-uniform memory access (NUMA)](https://en.wikipedia.org/wiki/Non-uniform_memory_access) is a computer memory design used in multiprocessing, where the memory access time depends on the memory location relative to the processor. As moder
    • Network accessline 781
      footnote: the diagram was generated by `lstopo a100.png` from [hwloc](https://github.com/open-mpi/hwloc).
    • Access to secretsline 884
      [Credential-related source omitted]
    • Access to secretsline 892
      [Credential-related source omitted]
    • Access to secretsline 893
      [Credential-related source omitted]
    • Access to secretsline 894
      [Credential-related source omitted]
    • Network accessline 919
      - [HF Accelerate](https://github.com/huggingface/accelerate) has a flag `--enable_cpu_affinity` that you add to the `accelerate` launch command and it'll do this for you. Available since `accelerate>0.28.0`.
    • Network accessline 920
      - [torchrun](https://github.com/pytorch/pytorch) doesn't have it, but I showed how to do it in this [section](#numactl).
    • Dangerous shell operationline 954
      Beware that sometimes you may encounter problems using `num_workers > 0` - the pytorch Issues has a few related Issues that haven't been resolved in several years, where a worker would hang. In particular when having 2 `Dataloader`s. In fac
    • Network accessline 981
      For more background you can read [1](https://docs.pytorch.org/docs/stable/notes/cuda.html#use-pinned-memory-buffers) and [2](https://developer.nvidia.com/blog/how-optimize-data-transfers-cuda-cc/).
    • Network accessline 1045
      If you tried it and things don't work you: 1. may report it to the PyTorch team, ideally with a small reproducible example 2. can work through PyTorch's own [torch.compile troubleshooting guide](https://docs.pytorch.org/docs/stable/user_gui
    • Network accessline 1047
      2. can work through PyTorch's own [torch.compile troubleshooting guide](https://docs.pytorch.org/docs/stable/user_guide/torch_compiler/torch.compiler_troubleshooting.html), which is maintained alongside the compiler and has sections for eac
    • Network accessline 1068
      Refer to [`gc`'s manpage](https://docs.python.org/3/library/gc.html) for more nuances.
    • Network accessline 1077
      One useful tool that I developed for quick and easy profiling of each line or block of code is [IPyExperiments](https://github.com/stas00/ipyexperiments). You just need to load your code into a jupyter notebook and it'll automatically tell 

    training/performance/benchmarks/activation-memory-per-layer.py

    • Executable scriptline 1
      #!/usr/bin/env python

    training/performance/benchmarks/dataloader/num-workers-bench.py

    • Executable scriptline 1
      #!/usr/bin/env python

    training/performance/benchmarks/dataloader/pin-memory-non-block-bench.py

    • Executable scriptline 1
      #!/usr/bin/env python
    • Network accessline 12
      See: - https://pytorch.org/docs/stable/notes/cuda.html#use-pinned-memory-buffers
    • Network accessline 13
      - https://pytorch.org/docs/stable/notes/cuda.html#use-pinned-memory-buffers
    • Network accessline 14
      - https://developer.nvidia.com/blog/how-optimize-data-transfers-cuda-cc/

    training/performance/benchmarks/matrix-shape/swiglu-maf-bench.py

    • Executable scriptline 1
      #!/usr/bin/env python
    • Network accessline 19
      This benchmark was written for the paper The Case for Co-Designing Model Architectures with Hardware: https://arxiv.org/abs/2401.14489
    • Network accessline 20
      Hardware: https://arxiv.org/abs/2401.14489

    training/performance/benchmarks/numa/numa-set-pynvml.py

    • Executable scriptline 1
      Executable file
    • Network accessline 3
      # derived from # https://github.com/NVIDIA/DeepLearningExamples/blob/9dd9fcb98f56187e49c5ee280cf8dbd530dde57b/TensorFlow2/LanguageModeling/BERT/gpu_affinity.py
    • Network accessline 4
      # https://github.com/NVIDIA/DeepLearningExamples/blob/9dd9fcb98f56187e49c5ee280cf8dbd530dde57b/TensorFlow2/LanguageModeling/BERT/gpu_affinity.py
    • Access to secretsline 21
      [Credential-related source omitted]
    • Access to secretsline 22
      [Credential-related source omitted]
    • Access to secretsline 23
      [Credential-related source omitted]

    training/performance/benchmarks/numa/numa-set.sh

    • Executable scriptline 1
      #!/usr/bin/bash
    • Network accessline 3
      # this helper util performs NUMA node binding which can be used with torchrun, and other launchers # contributed by https://github.com/yifuwang
    • Network accessline 4
      # contributed by https://github.com/yifuwang

    training/performance/benchmarks/torch-compile-bench.py

    • Executable scriptline 1
      Executable file

    training/performance/distributed/torch-dist-mem-usage.py

    • Executable scriptline 1
      #!/usr/bin/env python
    • Access to secretsline 89
      [Credential-related source omitted]

    training/re-train-hub-models.md

    • Network accessline 3
      HF Transformers has awesome finetuning examples  https://github.com/huggingface/transformers/tree/main/examples/pytorch, that cover pretty much any modality and these examples work out of box.
    • Network accessline 66
      To summarize, this recipe allows you to use finetuning examples to re-train whatever model you can find on [the HF hub](https://huggingface.co/models).

    training/reproducibility/README.md

    • Network accessline 17
      if use_seed is not None: # slower speed! https://docs.pytorch.org/docs/stable/notes/randomness.html#cuda-convolution-benchmarking
    • Access to secretsline 21
      [Credential-related source omitted]
    • Access to secretsline 27
      [Credential-related source omitted]
    • Network accessline 47
      Since a silently-ignored env var is easy to miss, [`torch.cuda.is_initialized()`](https://docs.pytorch.org/docs/stable/generated/torch.cuda.is_initialized.html) is used above to `raise` instead, if `CUBLAS_WORKSPACE_CONFIG` isn't set yet an
    • Access to secretsline 64
      [Credential-related source omitted]
    • Network accessline 69
      Resources: - [NVIDIA cuBLAS docs - Reproducibility](https://docs.nvidia.com/cuda/cublas/index.html#cublasApi_reproducibility) - the canonical explanation of cuBLAS non-determinism and the accepted `CUBLAS_WORKSPACE_CONFIG` values
    • Network accessline 70
      - [NVIDIA cuBLAS docs - Reproducibility](https://docs.nvidia.com/cuda/cublas/index.html#cublasApi_reproducibility) - the canonical explanation of cuBLAS non-determinism and the accepted `CUBLAS_WORKSPACE_CONFIG` values
    • Network accessline 71
      - [`torch.use_deterministic_algorithms`](https://docs.pytorch.org/docs/stable/generated/torch.use_deterministic_algorithms.html) - the full list of affected ops and how `warn_only` works
    • Network accessline 72
      - [PyTorch CUDA environment variables reference](https://docs.pytorch.org/docs/stable/cuda_environment_variables.html) - the exact `:[SIZE]:[COUNT]` format spec for `CUBLAS_WORKSPACE_CONFIG`
    • Network accessline 73
      - [PyTorch Reproducibility notes](https://docs.pytorch.org/docs/stable/notes/randomness.html) - ties this together with seeding, `cudnn.deterministic` and `cudnn.benchmark` for the full picture
    • Network accessline 103
      As mentioned earlier, there could be many other RNGs involved in a system - for example, if you want the data to be fed in the same order for a `DataLoader`, you need [to have its seed set as well](https://docs.pytorch.org/docs/stable/notes
    • Network accessline 152
      If using `conda` an additionally useful tool is [conda-env-compare.pl](https://github.com/stas00/conda-tools/blob/master/conda-env-compare.md) which helps you to find out the exact differences 2 conda environments have.
    • Network accessline 154
      Anecdotally, me and my colleague were getting very different training TFLOPS on a cloud cluster running the exact same code - literally launching the same slurm script from the same shared directory. We first compared our conda environments

    training/tools/main_process_first.py

    • Executable scriptline 1
      Executable file
    • Network accessline 4
      For notes please see https://github.com/stas00/ml-engineering/blob/master/training/datasets.md#preprocessing-and-caching-datasets-on-the-main-process

    training/tools/multi-gpu-non-interleaved-print.py

    • Executable scriptline 1
      #!/usr/bin/env python
    • Access to secretsline 34
      [Credential-related source omitted]

    training/tools/printflock.py

    • Executable scriptline 1
      Executable file

    How the signals fit together

    Facts from a static read of the files at the pinned commit. They describe what the code does, not why.

    Some files could not be read; the facts below still hold.

    Declared and executed: 3 facts
    Signal confidence: 497 facts

    and 447 more

    Only the first 500 facts are listed.

    Works with

    Agent compatibility, from the files in this repository
    AgentStatusEvidenceInstall to
    Claude CodeCompatibleStandard SKILL.md skills/evaluate-cluster/SKILL.md.claude/skills/<skill-name>/
    CodexCompatibleStandard SKILL.md skills/evaluate-cluster/SKILL.md.agents/skills/<skill-name>/
    CursorCompatibleStandard SKILL.md skills/evaluate-cluster/SKILL.md.cursor/skills/<skill-name>/
    Gemini CLICompatibleStandard SKILL.md skills/evaluate-cluster/SKILL.md.gemini/skills/<skill-name>/
    GitHub CopilotCompatibleStandard SKILL.md skills/evaluate-cluster/SKILL.md.github/skills/<skill-name>/
    OpenCodeCompatibleStandard SKILL.md skills/evaluate-cluster/SKILL.md.opencode/skills/<skill-name>/
    • Native The repository ships a manifest, folder or frontmatter field for this agent.
    • Compatible A standard SKILL.md that this agent can read.
    • Unknown No evidence either way.

    Derived automatically from paths, manifests and frontmatter. Not tested on each agent.

    Explore alternatives and comparisons

    Add this badge to your README

    It updates every night and links to this page.

    stas00/ml-engineering: #95 on hotskills, 19.7k stars

    [![stas00/ml-engineering on hotskills](https://hotskills.dev/badge/stas00-ml-engineering.svg)](https://hotskills.dev/skill/stas00-ml-engineering/)