@synsci/cli-darwin-x64 1.1.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/skills/accelerate/SKILL.md +332 -0
- package/bin/skills/accelerate/references/custom-plugins.md +453 -0
- package/bin/skills/accelerate/references/megatron-integration.md +489 -0
- package/bin/skills/accelerate/references/performance.md +525 -0
- package/bin/skills/audiocraft/SKILL.md +564 -0
- package/bin/skills/audiocraft/references/advanced-usage.md +666 -0
- package/bin/skills/audiocraft/references/troubleshooting.md +504 -0
- package/bin/skills/autogpt/SKILL.md +403 -0
- package/bin/skills/autogpt/references/advanced-usage.md +535 -0
- package/bin/skills/autogpt/references/troubleshooting.md +420 -0
- package/bin/skills/awq/SKILL.md +310 -0
- package/bin/skills/awq/references/advanced-usage.md +324 -0
- package/bin/skills/awq/references/troubleshooting.md +344 -0
- package/bin/skills/axolotl/SKILL.md +158 -0
- package/bin/skills/axolotl/references/api.md +5548 -0
- package/bin/skills/axolotl/references/dataset-formats.md +1029 -0
- package/bin/skills/axolotl/references/index.md +15 -0
- package/bin/skills/axolotl/references/other.md +3563 -0
- package/bin/skills/bigcode-evaluation-harness/SKILL.md +405 -0
- package/bin/skills/bigcode-evaluation-harness/references/benchmarks.md +393 -0
- package/bin/skills/bigcode-evaluation-harness/references/custom-tasks.md +424 -0
- package/bin/skills/bigcode-evaluation-harness/references/issues.md +394 -0
- package/bin/skills/bitsandbytes/SKILL.md +411 -0
- package/bin/skills/bitsandbytes/references/memory-optimization.md +521 -0
- package/bin/skills/bitsandbytes/references/qlora-training.md +521 -0
- package/bin/skills/bitsandbytes/references/quantization-formats.md +447 -0
- package/bin/skills/blip-2/SKILL.md +564 -0
- package/bin/skills/blip-2/references/advanced-usage.md +680 -0
- package/bin/skills/blip-2/references/troubleshooting.md +526 -0
- package/bin/skills/chroma/SKILL.md +406 -0
- package/bin/skills/chroma/references/integration.md +38 -0
- package/bin/skills/clip/SKILL.md +253 -0
- package/bin/skills/clip/references/applications.md +207 -0
- package/bin/skills/constitutional-ai/SKILL.md +290 -0
- package/bin/skills/crewai/SKILL.md +498 -0
- package/bin/skills/crewai/references/flows.md +438 -0
- package/bin/skills/crewai/references/tools.md +429 -0
- package/bin/skills/crewai/references/troubleshooting.md +480 -0
- package/bin/skills/deepspeed/SKILL.md +141 -0
- package/bin/skills/deepspeed/references/08.md +17 -0
- package/bin/skills/deepspeed/references/09.md +173 -0
- package/bin/skills/deepspeed/references/2020.md +378 -0
- package/bin/skills/deepspeed/references/2023.md +279 -0
- package/bin/skills/deepspeed/references/assets.md +179 -0
- package/bin/skills/deepspeed/references/index.md +35 -0
- package/bin/skills/deepspeed/references/mii.md +118 -0
- package/bin/skills/deepspeed/references/other.md +1191 -0
- package/bin/skills/deepspeed/references/tutorials.md +6554 -0
- package/bin/skills/dspy/SKILL.md +590 -0
- package/bin/skills/dspy/references/examples.md +663 -0
- package/bin/skills/dspy/references/modules.md +475 -0
- package/bin/skills/dspy/references/optimizers.md +566 -0
- package/bin/skills/faiss/SKILL.md +221 -0
- package/bin/skills/faiss/references/index_types.md +280 -0
- package/bin/skills/flash-attention/SKILL.md +367 -0
- package/bin/skills/flash-attention/references/benchmarks.md +215 -0
- package/bin/skills/flash-attention/references/transformers-integration.md +293 -0
- package/bin/skills/gguf/SKILL.md +427 -0
- package/bin/skills/gguf/references/advanced-usage.md +504 -0
- package/bin/skills/gguf/references/troubleshooting.md +442 -0
- package/bin/skills/gptq/SKILL.md +450 -0
- package/bin/skills/gptq/references/calibration.md +337 -0
- package/bin/skills/gptq/references/integration.md +129 -0
- package/bin/skills/gptq/references/troubleshooting.md +95 -0
- package/bin/skills/grpo-rl-training/README.md +97 -0
- package/bin/skills/grpo-rl-training/SKILL.md +572 -0
- package/bin/skills/grpo-rl-training/examples/reward_functions_library.py +393 -0
- package/bin/skills/grpo-rl-training/templates/basic_grpo_training.py +228 -0
- package/bin/skills/guidance/SKILL.md +572 -0
- package/bin/skills/guidance/references/backends.md +554 -0
- package/bin/skills/guidance/references/constraints.md +674 -0
- package/bin/skills/guidance/references/examples.md +767 -0
- package/bin/skills/hqq/SKILL.md +445 -0
- package/bin/skills/hqq/references/advanced-usage.md +528 -0
- package/bin/skills/hqq/references/troubleshooting.md +503 -0
- package/bin/skills/hugging-face-cli/SKILL.md +191 -0
- package/bin/skills/hugging-face-cli/references/commands.md +954 -0
- package/bin/skills/hugging-face-cli/references/examples.md +374 -0
- package/bin/skills/hugging-face-datasets/SKILL.md +547 -0
- package/bin/skills/hugging-face-datasets/examples/diverse_training_examples.json +239 -0
- package/bin/skills/hugging-face-datasets/examples/system_prompt_template.txt +196 -0
- package/bin/skills/hugging-face-datasets/examples/training_examples.json +176 -0
- package/bin/skills/hugging-face-datasets/scripts/dataset_manager.py +522 -0
- package/bin/skills/hugging-face-datasets/scripts/sql_manager.py +844 -0
- package/bin/skills/hugging-face-datasets/templates/chat.json +55 -0
- package/bin/skills/hugging-face-datasets/templates/classification.json +62 -0
- package/bin/skills/hugging-face-datasets/templates/completion.json +51 -0
- package/bin/skills/hugging-face-datasets/templates/custom.json +75 -0
- package/bin/skills/hugging-face-datasets/templates/qa.json +54 -0
- package/bin/skills/hugging-face-datasets/templates/tabular.json +81 -0
- package/bin/skills/hugging-face-evaluation/SKILL.md +656 -0
- package/bin/skills/hugging-face-evaluation/examples/USAGE_EXAMPLES.md +382 -0
- package/bin/skills/hugging-face-evaluation/examples/artificial_analysis_to_hub.py +141 -0
- package/bin/skills/hugging-face-evaluation/examples/example_readme_tables.md +135 -0
- package/bin/skills/hugging-face-evaluation/examples/metric_mapping.json +50 -0
- package/bin/skills/hugging-face-evaluation/requirements.txt +20 -0
- package/bin/skills/hugging-face-evaluation/scripts/evaluation_manager.py +1374 -0
- package/bin/skills/hugging-face-evaluation/scripts/inspect_eval_uv.py +104 -0
- package/bin/skills/hugging-face-evaluation/scripts/inspect_vllm_uv.py +317 -0
- package/bin/skills/hugging-face-evaluation/scripts/lighteval_vllm_uv.py +303 -0
- package/bin/skills/hugging-face-evaluation/scripts/run_eval_job.py +98 -0
- package/bin/skills/hugging-face-evaluation/scripts/run_vllm_eval_job.py +331 -0
- package/bin/skills/hugging-face-evaluation/scripts/test_extraction.py +206 -0
- package/bin/skills/hugging-face-jobs/SKILL.md +1041 -0
- package/bin/skills/hugging-face-jobs/index.html +216 -0
- package/bin/skills/hugging-face-jobs/references/hardware_guide.md +336 -0
- package/bin/skills/hugging-face-jobs/references/hub_saving.md +352 -0
- package/bin/skills/hugging-face-jobs/references/token_usage.md +546 -0
- package/bin/skills/hugging-face-jobs/references/troubleshooting.md +475 -0
- package/bin/skills/hugging-face-jobs/scripts/cot-self-instruct.py +718 -0
- package/bin/skills/hugging-face-jobs/scripts/finepdfs-stats.py +546 -0
- package/bin/skills/hugging-face-jobs/scripts/generate-responses.py +587 -0
- package/bin/skills/hugging-face-model-trainer/SKILL.md +711 -0
- package/bin/skills/hugging-face-model-trainer/references/gguf_conversion.md +296 -0
- package/bin/skills/hugging-face-model-trainer/references/hardware_guide.md +283 -0
- package/bin/skills/hugging-face-model-trainer/references/hub_saving.md +364 -0
- package/bin/skills/hugging-face-model-trainer/references/reliability_principles.md +371 -0
- package/bin/skills/hugging-face-model-trainer/references/trackio_guide.md +189 -0
- package/bin/skills/hugging-face-model-trainer/references/training_methods.md +150 -0
- package/bin/skills/hugging-face-model-trainer/references/training_patterns.md +203 -0
- package/bin/skills/hugging-face-model-trainer/references/troubleshooting.md +282 -0
- package/bin/skills/hugging-face-model-trainer/scripts/convert_to_gguf.py +424 -0
- package/bin/skills/hugging-face-model-trainer/scripts/dataset_inspector.py +417 -0
- package/bin/skills/hugging-face-model-trainer/scripts/estimate_cost.py +150 -0
- package/bin/skills/hugging-face-model-trainer/scripts/train_dpo_example.py +106 -0
- package/bin/skills/hugging-face-model-trainer/scripts/train_grpo_example.py +89 -0
- package/bin/skills/hugging-face-model-trainer/scripts/train_sft_example.py +122 -0
- package/bin/skills/hugging-face-paper-publisher/SKILL.md +627 -0
- package/bin/skills/hugging-face-paper-publisher/examples/example_usage.md +327 -0
- package/bin/skills/hugging-face-paper-publisher/references/quick_reference.md +216 -0
- package/bin/skills/hugging-face-paper-publisher/scripts/paper_manager.py +508 -0
- package/bin/skills/hugging-face-paper-publisher/templates/arxiv.md +299 -0
- package/bin/skills/hugging-face-paper-publisher/templates/ml-report.md +358 -0
- package/bin/skills/hugging-face-paper-publisher/templates/modern.md +319 -0
- package/bin/skills/hugging-face-paper-publisher/templates/standard.md +201 -0
- package/bin/skills/hugging-face-tool-builder/SKILL.md +115 -0
- package/bin/skills/hugging-face-tool-builder/references/baseline_hf_api.py +57 -0
- package/bin/skills/hugging-face-tool-builder/references/baseline_hf_api.sh +40 -0
- package/bin/skills/hugging-face-tool-builder/references/baseline_hf_api.tsx +57 -0
- package/bin/skills/hugging-face-tool-builder/references/find_models_by_paper.sh +230 -0
- package/bin/skills/hugging-face-tool-builder/references/hf_enrich_models.sh +96 -0
- package/bin/skills/hugging-face-tool-builder/references/hf_model_card_frontmatter.sh +188 -0
- package/bin/skills/hugging-face-tool-builder/references/hf_model_papers_auth.sh +171 -0
- package/bin/skills/hugging-face-trackio/SKILL.md +65 -0
- package/bin/skills/hugging-face-trackio/references/logging_metrics.md +206 -0
- package/bin/skills/hugging-face-trackio/references/retrieving_metrics.md +223 -0
- package/bin/skills/huggingface-tokenizers/SKILL.md +516 -0
- package/bin/skills/huggingface-tokenizers/references/algorithms.md +653 -0
- package/bin/skills/huggingface-tokenizers/references/integration.md +637 -0
- package/bin/skills/huggingface-tokenizers/references/pipeline.md +723 -0
- package/bin/skills/huggingface-tokenizers/references/training.md +565 -0
- package/bin/skills/instructor/SKILL.md +740 -0
- package/bin/skills/instructor/references/examples.md +107 -0
- package/bin/skills/instructor/references/providers.md +70 -0
- package/bin/skills/instructor/references/validation.md +606 -0
- package/bin/skills/knowledge-distillation/SKILL.md +458 -0
- package/bin/skills/knowledge-distillation/references/minillm.md +334 -0
- package/bin/skills/lambda-labs/SKILL.md +545 -0
- package/bin/skills/lambda-labs/references/advanced-usage.md +611 -0
- package/bin/skills/lambda-labs/references/troubleshooting.md +530 -0
- package/bin/skills/langchain/SKILL.md +480 -0
- package/bin/skills/langchain/references/agents.md +499 -0
- package/bin/skills/langchain/references/integration.md +562 -0
- package/bin/skills/langchain/references/rag.md +600 -0
- package/bin/skills/langsmith/SKILL.md +422 -0
- package/bin/skills/langsmith/references/advanced-usage.md +548 -0
- package/bin/skills/langsmith/references/troubleshooting.md +537 -0
- package/bin/skills/litgpt/SKILL.md +469 -0
- package/bin/skills/litgpt/references/custom-models.md +568 -0
- package/bin/skills/litgpt/references/distributed-training.md +451 -0
- package/bin/skills/litgpt/references/supported-models.md +336 -0
- package/bin/skills/litgpt/references/training-recipes.md +619 -0
- package/bin/skills/llama-cpp/SKILL.md +258 -0
- package/bin/skills/llama-cpp/references/optimization.md +89 -0
- package/bin/skills/llama-cpp/references/quantization.md +213 -0
- package/bin/skills/llama-cpp/references/server.md +125 -0
- package/bin/skills/llama-factory/SKILL.md +80 -0
- package/bin/skills/llama-factory/references/_images.md +23 -0
- package/bin/skills/llama-factory/references/advanced.md +1055 -0
- package/bin/skills/llama-factory/references/getting_started.md +349 -0
- package/bin/skills/llama-factory/references/index.md +19 -0
- package/bin/skills/llama-factory/references/other.md +31 -0
- package/bin/skills/llamaguard/SKILL.md +337 -0
- package/bin/skills/llamaindex/SKILL.md +569 -0
- package/bin/skills/llamaindex/references/agents.md +83 -0
- package/bin/skills/llamaindex/references/data_connectors.md +108 -0
- package/bin/skills/llamaindex/references/query_engines.md +406 -0
- package/bin/skills/llava/SKILL.md +304 -0
- package/bin/skills/llava/references/training.md +197 -0
- package/bin/skills/lm-evaluation-harness/SKILL.md +490 -0
- package/bin/skills/lm-evaluation-harness/references/api-evaluation.md +490 -0
- package/bin/skills/lm-evaluation-harness/references/benchmark-guide.md +488 -0
- package/bin/skills/lm-evaluation-harness/references/custom-tasks.md +602 -0
- package/bin/skills/lm-evaluation-harness/references/distributed-eval.md +519 -0
- package/bin/skills/long-context/SKILL.md +536 -0
- package/bin/skills/long-context/references/extension_methods.md +468 -0
- package/bin/skills/long-context/references/fine_tuning.md +611 -0
- package/bin/skills/long-context/references/rope.md +402 -0
- package/bin/skills/mamba/SKILL.md +260 -0
- package/bin/skills/mamba/references/architecture-details.md +206 -0
- package/bin/skills/mamba/references/benchmarks.md +255 -0
- package/bin/skills/mamba/references/training-guide.md +388 -0
- package/bin/skills/megatron-core/SKILL.md +366 -0
- package/bin/skills/megatron-core/references/benchmarks.md +249 -0
- package/bin/skills/megatron-core/references/parallelism-guide.md +404 -0
- package/bin/skills/megatron-core/references/production-examples.md +473 -0
- package/bin/skills/megatron-core/references/training-recipes.md +547 -0
- package/bin/skills/miles/SKILL.md +315 -0
- package/bin/skills/miles/references/api-reference.md +141 -0
- package/bin/skills/miles/references/troubleshooting.md +352 -0
- package/bin/skills/mlflow/SKILL.md +704 -0
- package/bin/skills/mlflow/references/deployment.md +744 -0
- package/bin/skills/mlflow/references/model-registry.md +770 -0
- package/bin/skills/mlflow/references/tracking.md +680 -0
- package/bin/skills/modal/SKILL.md +341 -0
- package/bin/skills/modal/references/advanced-usage.md +503 -0
- package/bin/skills/modal/references/troubleshooting.md +494 -0
- package/bin/skills/model-merging/SKILL.md +539 -0
- package/bin/skills/model-merging/references/evaluation.md +462 -0
- package/bin/skills/model-merging/references/examples.md +428 -0
- package/bin/skills/model-merging/references/methods.md +352 -0
- package/bin/skills/model-pruning/SKILL.md +495 -0
- package/bin/skills/model-pruning/references/wanda.md +347 -0
- package/bin/skills/moe-training/SKILL.md +526 -0
- package/bin/skills/moe-training/references/architectures.md +432 -0
- package/bin/skills/moe-training/references/inference.md +348 -0
- package/bin/skills/moe-training/references/training.md +425 -0
- package/bin/skills/nanogpt/SKILL.md +290 -0
- package/bin/skills/nanogpt/references/architecture.md +382 -0
- package/bin/skills/nanogpt/references/data.md +476 -0
- package/bin/skills/nanogpt/references/training.md +564 -0
- package/bin/skills/nemo-curator/SKILL.md +383 -0
- package/bin/skills/nemo-curator/references/deduplication.md +87 -0
- package/bin/skills/nemo-curator/references/filtering.md +102 -0
- package/bin/skills/nemo-evaluator/SKILL.md +494 -0
- package/bin/skills/nemo-evaluator/references/adapter-system.md +340 -0
- package/bin/skills/nemo-evaluator/references/configuration.md +447 -0
- package/bin/skills/nemo-evaluator/references/custom-benchmarks.md +315 -0
- package/bin/skills/nemo-evaluator/references/execution-backends.md +361 -0
- package/bin/skills/nemo-guardrails/SKILL.md +297 -0
- package/bin/skills/nnsight/SKILL.md +436 -0
- package/bin/skills/nnsight/references/README.md +78 -0
- package/bin/skills/nnsight/references/api.md +344 -0
- package/bin/skills/nnsight/references/tutorials.md +300 -0
- package/bin/skills/openrlhf/SKILL.md +249 -0
- package/bin/skills/openrlhf/references/algorithm-comparison.md +404 -0
- package/bin/skills/openrlhf/references/custom-rewards.md +530 -0
- package/bin/skills/openrlhf/references/hybrid-engine.md +287 -0
- package/bin/skills/openrlhf/references/multi-node-training.md +454 -0
- package/bin/skills/outlines/SKILL.md +652 -0
- package/bin/skills/outlines/references/backends.md +615 -0
- package/bin/skills/outlines/references/examples.md +773 -0
- package/bin/skills/outlines/references/json_generation.md +652 -0
- package/bin/skills/peft/SKILL.md +431 -0
- package/bin/skills/peft/references/advanced-usage.md +514 -0
- package/bin/skills/peft/references/troubleshooting.md +480 -0
- package/bin/skills/phoenix/SKILL.md +475 -0
- package/bin/skills/phoenix/references/advanced-usage.md +619 -0
- package/bin/skills/phoenix/references/troubleshooting.md +538 -0
- package/bin/skills/pinecone/SKILL.md +358 -0
- package/bin/skills/pinecone/references/deployment.md +181 -0
- package/bin/skills/pytorch-fsdp/SKILL.md +126 -0
- package/bin/skills/pytorch-fsdp/references/index.md +7 -0
- package/bin/skills/pytorch-fsdp/references/other.md +4249 -0
- package/bin/skills/pytorch-lightning/SKILL.md +346 -0
- package/bin/skills/pytorch-lightning/references/callbacks.md +436 -0
- package/bin/skills/pytorch-lightning/references/distributed.md +490 -0
- package/bin/skills/pytorch-lightning/references/hyperparameter-tuning.md +556 -0
- package/bin/skills/pyvene/SKILL.md +473 -0
- package/bin/skills/pyvene/references/README.md +73 -0
- package/bin/skills/pyvene/references/api.md +383 -0
- package/bin/skills/pyvene/references/tutorials.md +376 -0
- package/bin/skills/qdrant/SKILL.md +493 -0
- package/bin/skills/qdrant/references/advanced-usage.md +648 -0
- package/bin/skills/qdrant/references/troubleshooting.md +631 -0
- package/bin/skills/ray-data/SKILL.md +326 -0
- package/bin/skills/ray-data/references/integration.md +82 -0
- package/bin/skills/ray-data/references/transformations.md +83 -0
- package/bin/skills/ray-train/SKILL.md +406 -0
- package/bin/skills/ray-train/references/multi-node.md +628 -0
- package/bin/skills/rwkv/SKILL.md +260 -0
- package/bin/skills/rwkv/references/architecture-details.md +344 -0
- package/bin/skills/rwkv/references/rwkv7.md +386 -0
- package/bin/skills/rwkv/references/state-management.md +369 -0
- package/bin/skills/saelens/SKILL.md +386 -0
- package/bin/skills/saelens/references/README.md +70 -0
- package/bin/skills/saelens/references/api.md +333 -0
- package/bin/skills/saelens/references/tutorials.md +318 -0
- package/bin/skills/segment-anything/SKILL.md +500 -0
- package/bin/skills/segment-anything/references/advanced-usage.md +589 -0
- package/bin/skills/segment-anything/references/troubleshooting.md +484 -0
- package/bin/skills/sentence-transformers/SKILL.md +255 -0
- package/bin/skills/sentence-transformers/references/models.md +123 -0
- package/bin/skills/sentencepiece/SKILL.md +235 -0
- package/bin/skills/sentencepiece/references/algorithms.md +200 -0
- package/bin/skills/sentencepiece/references/training.md +304 -0
- package/bin/skills/sglang/SKILL.md +442 -0
- package/bin/skills/sglang/references/deployment.md +490 -0
- package/bin/skills/sglang/references/radix-attention.md +413 -0
- package/bin/skills/sglang/references/structured-generation.md +541 -0
- package/bin/skills/simpo/SKILL.md +219 -0
- package/bin/skills/simpo/references/datasets.md +478 -0
- package/bin/skills/simpo/references/hyperparameters.md +452 -0
- package/bin/skills/simpo/references/loss-functions.md +350 -0
- package/bin/skills/skypilot/SKILL.md +509 -0
- package/bin/skills/skypilot/references/advanced-usage.md +491 -0
- package/bin/skills/skypilot/references/troubleshooting.md +570 -0
- package/bin/skills/slime/SKILL.md +464 -0
- package/bin/skills/slime/references/api-reference.md +392 -0
- package/bin/skills/slime/references/troubleshooting.md +386 -0
- package/bin/skills/speculative-decoding/SKILL.md +467 -0
- package/bin/skills/speculative-decoding/references/lookahead.md +309 -0
- package/bin/skills/speculative-decoding/references/medusa.md +350 -0
- package/bin/skills/stable-diffusion/SKILL.md +519 -0
- package/bin/skills/stable-diffusion/references/advanced-usage.md +716 -0
- package/bin/skills/stable-diffusion/references/troubleshooting.md +555 -0
- package/bin/skills/tensorboard/SKILL.md +629 -0
- package/bin/skills/tensorboard/references/integrations.md +638 -0
- package/bin/skills/tensorboard/references/profiling.md +545 -0
- package/bin/skills/tensorboard/references/visualization.md +620 -0
- package/bin/skills/tensorrt-llm/SKILL.md +187 -0
- package/bin/skills/tensorrt-llm/references/multi-gpu.md +298 -0
- package/bin/skills/tensorrt-llm/references/optimization.md +242 -0
- package/bin/skills/tensorrt-llm/references/serving.md +470 -0
- package/bin/skills/tinker/SKILL.md +362 -0
- package/bin/skills/tinker/references/api-reference.md +168 -0
- package/bin/skills/tinker/references/getting-started.md +157 -0
- package/bin/skills/tinker/references/loss-functions.md +163 -0
- package/bin/skills/tinker/references/models-and-lora.md +139 -0
- package/bin/skills/tinker/references/recipes.md +280 -0
- package/bin/skills/tinker/references/reinforcement-learning.md +212 -0
- package/bin/skills/tinker/references/rendering.md +243 -0
- package/bin/skills/tinker/references/supervised-learning.md +232 -0
- package/bin/skills/tinker-training-cost/SKILL.md +187 -0
- package/bin/skills/tinker-training-cost/scripts/calculate_cost.py +123 -0
- package/bin/skills/torchforge/SKILL.md +433 -0
- package/bin/skills/torchforge/references/api-reference.md +327 -0
- package/bin/skills/torchforge/references/troubleshooting.md +409 -0
- package/bin/skills/torchtitan/SKILL.md +358 -0
- package/bin/skills/torchtitan/references/checkpoint.md +181 -0
- package/bin/skills/torchtitan/references/custom-models.md +258 -0
- package/bin/skills/torchtitan/references/float8.md +133 -0
- package/bin/skills/torchtitan/references/fsdp.md +126 -0
- package/bin/skills/transformer-lens/SKILL.md +346 -0
- package/bin/skills/transformer-lens/references/README.md +54 -0
- package/bin/skills/transformer-lens/references/api.md +362 -0
- package/bin/skills/transformer-lens/references/tutorials.md +339 -0
- package/bin/skills/trl-fine-tuning/SKILL.md +455 -0
- package/bin/skills/trl-fine-tuning/references/dpo-variants.md +227 -0
- package/bin/skills/trl-fine-tuning/references/online-rl.md +82 -0
- package/bin/skills/trl-fine-tuning/references/reward-modeling.md +122 -0
- package/bin/skills/trl-fine-tuning/references/sft-training.md +168 -0
- package/bin/skills/unsloth/SKILL.md +80 -0
- package/bin/skills/unsloth/references/index.md +7 -0
- package/bin/skills/unsloth/references/llms-full.md +16799 -0
- package/bin/skills/unsloth/references/llms-txt.md +12044 -0
- package/bin/skills/unsloth/references/llms.md +82 -0
- package/bin/skills/verl/SKILL.md +391 -0
- package/bin/skills/verl/references/api-reference.md +301 -0
- package/bin/skills/verl/references/troubleshooting.md +391 -0
- package/bin/skills/vllm/SKILL.md +364 -0
- package/bin/skills/vllm/references/optimization.md +226 -0
- package/bin/skills/vllm/references/quantization.md +284 -0
- package/bin/skills/vllm/references/server-deployment.md +255 -0
- package/bin/skills/vllm/references/troubleshooting.md +447 -0
- package/bin/skills/weights-and-biases/SKILL.md +590 -0
- package/bin/skills/weights-and-biases/references/artifacts.md +584 -0
- package/bin/skills/weights-and-biases/references/integrations.md +700 -0
- package/bin/skills/weights-and-biases/references/sweeps.md +847 -0
- package/bin/skills/whisper/SKILL.md +317 -0
- package/bin/skills/whisper/references/languages.md +189 -0
- package/bin/synsc +0 -0
- package/package.json +10 -0
|
@@ -0,0 +1,1191 @@
|
|
|
1
|
+
# Deepspeed - Other
|
|
2
|
+
|
|
3
|
+
**Pages:** 15
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Training Overview and Features
|
|
8
|
+
|
|
9
|
+
**URL:** https://www.deepspeed.ai/training/
|
|
10
|
+
|
|
11
|
+
**Contents:**
|
|
12
|
+
- Training Overview and Features
|
|
13
|
+
- Contents
|
|
14
|
+
- Overview
|
|
15
|
+
- Distributed, Effective, and Efficient Training with Ease
|
|
16
|
+
- Speed
|
|
17
|
+
- Memory efficiency
|
|
18
|
+
- Scalability
|
|
19
|
+
- Communication efficiency
|
|
20
|
+
- Data efficiency
|
|
21
|
+
- Supporting long sequence length
|
|
22
|
+
|
|
23
|
+
Training advanced deep learning models is challenging. Beyond model design, model scientists also need to set up the state-of-the-art training techniques such as distributed training, mixed precision, gradient accumulation, and checkpointing. Yet still, scientists may not achieve the desired system performance and convergence rate. Large model sizes are even more challenging: a large model easily runs out of memory with pure data parallelism and it is difficult to use model parallelism. DeepSpeed addresses these challenges to accelerate model development and training.
|
|
24
|
+
|
|
25
|
+
The DeepSpeed API is a lightweight wrapper on PyTorch. This means that you can use everything you love in PyTorch and without learning a new platform. In addition, DeepSpeed manages all of the boilerplate state-of-the-art training techniques, such as distributed training, mixed precision, gradient accumulation, and checkpoints so that you can focus on your model development. Most importantly, you can leverage the distinctive efficiency and effectiveness benefit of DeepSpeed to boost speed and scale with just a few lines of code changes to your PyTorch models.
|
|
26
|
+
|
|
27
|
+
DeepSpeed achieves high performance and fast convergence through a combination of efficiency optimizations on compute/communication/memory/IO and effectiveness optimizations on advanced hyperparameter tuning and optimizers. For example:
|
|
28
|
+
|
|
29
|
+
DeepSpeed trains BERT-large to parity in 44 mins using 1024 V100 GPUs (64 DGX-2 boxes) and in 2.4 hours using 256 GPUs (16 DGX-2 boxes).
|
|
30
|
+
|
|
31
|
+
BERT-large Training Times
|
|
32
|
+
|
|
33
|
+
BERT code and tutorials will be available soon.
|
|
34
|
+
|
|
35
|
+
DeepSpeed trains GPT2 (1.5 billion parameters) 3.75x faster than state-of-art, NVIDIA Megatron on Azure GPUs.
|
|
36
|
+
|
|
37
|
+
Read more: GPT tutorial
|
|
38
|
+
|
|
39
|
+
DeepSpeed provides memory-efficient data parallelism and enables training models without model parallelism. For example, DeepSpeed can train models with up to 13 billion parameters on a single GPU. In comparison, existing frameworks (e.g., PyTorch’s Distributed Data Parallel) run out of memory with 1.4 billion parameter models.
|
|
40
|
+
|
|
41
|
+
DeepSpeed reduces the training memory footprint through a novel solution called Zero Redundancy Optimizer (ZeRO). Unlike basic data parallelism where memory states are replicated across data-parallel processes, ZeRO partitions model states and gradients to save significant memory. Furthermore, it also reduces activation memory and fragmented memory. The current implementation (ZeRO-2) reduces memory by up to 8x relative to the state-of-art. You can read more about ZeRO in our paper, and in our blog posts related to ZeRO-1 and ZeRO-2.
|
|
42
|
+
|
|
43
|
+
With this impressive memory reduction, early adopters of DeepSpeed have already produced a language model (LM) with over 17B parameters called Turing-NLG, establishing a new SOTA in the LM category.
|
|
44
|
+
|
|
45
|
+
For model scientists with limited GPU resources, ZeRO-Offload leverages both CPU and GPU memory for training large models. Using a machine with a single GPU, our users can run models of up to 13 billion parameters without running out of memory, 10x bigger than the existing approaches, while obtaining competitive throughput. This feature democratizes multi-billion-parameter model training and opens the window for many deep learning practitioners to explore bigger and better models.
|
|
46
|
+
|
|
47
|
+
DeepSpeed supports efficient data parallelism, model parallelism, pipeline parallelism and their combinations, which we call 3D parallelism.
|
|
48
|
+
|
|
49
|
+
DeepSpeed can run large models more efficiently, up to 10x faster for models with various sizes spanning 1.5B to hundred billion. More specifically, the data parallelism powered by ZeRO is complementary and can be combined with different types of model parallelism. It allows DeepSpeed to fit models using lower degree of model parallelism and higher batch size, offering significant performance gains compared to using model parallelism alone.
|
|
50
|
+
|
|
51
|
+
Read more: ZeRO paper, and GPT tutorial.
|
|
52
|
+
|
|
53
|
+
The figure depicts system throughput improvements of DeepSpeed (combining ZeRO-powered data parallelism with model parallelism of NVIDIA Megatron-LM) over using Megatron-LM alone.
|
|
54
|
+
|
|
55
|
+
Pipeline parallelism of DeepSpeed reduce communication volume during distributed training, which allows users to train multi-billion-parameter models 2–7x faster on clusters with limited network bandwidth.
|
|
56
|
+
|
|
57
|
+
1-bit Adam, 0/1 Adam and 1-bit LAMB reduce communication volume by up to 26x while achieving similar convergence efficiency to Adam, allowing for scaling to different types of GPU clusters and networks. 1-bit Adam blog post, 1-bit Adam tutorial, 0/1 Adam tutorial, 1-bit LAMB tutorial.
|
|
58
|
+
|
|
59
|
+
DeepSpeed Data Efficiency Library provides efficient data sampling via curriculum learning and efficient data routing via random layerwise token dropping. The composed solution enables up to 2x data and 2x time saving during GPT-3/BERT pretraining and GPT/ViT finetuning, or further improve model quality under the same data/time. See more in the tutorial.
|
|
60
|
+
|
|
61
|
+
DeepSpeed offers sparse attention kernels—an instrumental technology to support long sequences of model inputs, whether for text, image, or sound. Compared with the classic dense Transformers, it powers an order-of-magnitude longer input sequence and obtains up to 6x faster execution with comparable accuracy. It also outperforms state-of-the-art sparse implementations with 1.5–3x faster execution. Furthermore, our sparse kernels support efficient execution of flexible sparse format and empower users to innovate on their custom sparse structures. Read more here.
|
|
62
|
+
|
|
63
|
+
DeepSpeed supports advanced hyperparameter tuning and large batch size optimizers such as LAMB. These improve the effectiveness of model training and reduce the number of samples required to convergence to desired accuracy.
|
|
64
|
+
|
|
65
|
+
Read more: Tuning tutorial.
|
|
66
|
+
|
|
67
|
+
Only a few lines of code changes are needed to enable a PyTorch model to use DeepSpeed and ZeRO. Compared to current model parallelism libraries, DeepSpeed does not require a code redesign or model refactoring. It also does not put limitations on model dimensions (such as number of attention heads, hidden sizes, and others), batch size, or any other training parameters. For models of up to 13 billion parameters, you can use ZeRO-powered data parallelism conveniently without requiring model parallelism, while in contrast, standard data parallelism will run out of memory for models with more than 1.4 billion parameters. In addition, DeepSpeed conveniently supports flexible combination of ZeRO-powered data parallelism with custom model parallelisms, such as tensor slicing of NVIDIA’s Megatron-LM.
|
|
68
|
+
|
|
69
|
+
Below we provide a brief feature list, see our detailed feature overview for descriptions and usage.
|
|
70
|
+
|
|
71
|
+
title: “Feature Overview” layout: single permalink: /features/ toc: true toc_label: “Contents” —
|
|
72
|
+
|
|
73
|
+
Enable 16-bit (FP16) training by in the deepspeed_config JSON.
|
|
74
|
+
|
|
75
|
+
Easily switch between single-GPU, single-node multi-GPU, or multi-node multi-GPU execution by specifying resources with a hostfile.
|
|
76
|
+
|
|
77
|
+
The script <client_entry.py> will execute on the resources specified in <hostfile>.
|
|
78
|
+
|
|
79
|
+
DeepSpeed provides pipeline parallelism for memory- and communication- efficient training. DeepSpeed supports a hybrid combination of data, model, and pipeline parallelism and has scaled to over one trillion parameters using 3D parallelism. Pipeline parallelism can also improve communication efficiency and has accelerated training by up to 7x on low-bandwidth clusters.
|
|
80
|
+
|
|
81
|
+
DeepSpeed supports all forms of model parallelism including tensor slicing based approaches such as the Megatron-LM. It does so by only requiring the model parallelism framework to provide a model parallelism unit (mpu) that implements a few bookkeeping functionalities:
|
|
82
|
+
|
|
83
|
+
DeepSpeed is fully compatible with Megatron. Please see the Megatron-LM tutorial for details.
|
|
84
|
+
|
|
85
|
+
The Zero Redundancy Optimizer (ZeRO) is at the heart of DeepSpeed and enables large model training at a scale that is simply not possible with model parallelism alone. When enabled, ZeRO allows training models with over 13 billion parameters without any model parallelism, and up to 200 billion parameter models with model parallelism on current generation hardware.
|
|
86
|
+
|
|
87
|
+
For more details see the ZeRO paper, GPT tutorial on integration with DeepSpeed.
|
|
88
|
+
|
|
89
|
+
Optimizer State and Gradient Partitioning in ZeRO reduces the memory consumption of the model states (optimizer states, gradients and parameters) by 8x compared to standard data parallelism by partitioning these states across data parallel process instead of replicating them.
|
|
90
|
+
|
|
91
|
+
Activation Partitioning is a memory optimization in ZeRO that can reduce the memory consumed by activations during model parallel training (MP). In MP certain activations maybe required by all MP processes, resulting in a replication of activations across MP GPUs. Activation Partitioning stores these activations in a partitioned state once they are used for computation in the forward propagation. These activations are allgathered right before they are needed again during the backward propagation. By storing activations in a partitioned state, ZeRO in DeepSpeed can reduce the activation memory footprint proportional to the MP degree.
|
|
92
|
+
|
|
93
|
+
CBO enables high network and memory throughput while restricting memory usage to a constant size. For memory- and network-bound operations such as normalization or allreduce collectives, the performance depends on the size of the operand. Simply fusing all operands into a single large operand can enable great throughput at the expense of unnecessary memory overhead. CBO in DeepSpeed fuses smaller operands into approximately a pre-defined sized buffer large enough to achieve great performance without the unnecessary memory overhead.
|
|
94
|
+
|
|
95
|
+
CMO reduces memory fragmentation during training, preventing out of memory errors due to lack of contiguous memory. Memory fragmentation is a result of interleaving between short lived and long lived memory objects. During the forward propagation activation checkpoints are long lived but the activations that recomputed are short lived. Similarly, during the backward computation, the activation gradients are short lived while the parameter gradients are long lived. CMO transfers activation checkpoints and parameter gradients to contiguous buffers preventing memory fragmentation.
|
|
96
|
+
|
|
97
|
+
ZeRO-Offload pushes the boundary of the maximum model size that can be trained efficiently using minimal GPU resources, by exploiting computational and memory resources on both GPUs and their host CPUs. It allows training up to 13-billion-parameter models on a single NVIDIA V100 GPU, 10x larger than the state-of-the-art, while retaining high training throughput of over 30 teraflops per GPU.
|
|
98
|
+
|
|
99
|
+
For more details see the ZeRO-Offload release blog, and tutorial on integration with DeepSpeed.
|
|
100
|
+
|
|
101
|
+
Gradient accumulation allows running larger batch size with limited memory by breaking an effective batch into several sequential micro-batches, and averaging the parameter gradients across these micro-batches. Furthermore, instead of averaging the gradients of each micro-batch across all GPUs, the gradients are averaged locally during each step of the sequence, and a single allreduce is done at the end of the sequence to produce the averaged gradients for the effective batch across all GPUs. This strategy significantly reduces the communication involved over the approach of averaging globally for each micro-batch, specially when the number of micro-batches per effective batch is large.
|
|
102
|
+
|
|
103
|
+
During back propagation, DeepSpeed can overlap the communication required for averaging parameter gradients that have already been computed with the ongoing gradient computation. This computation-communication overlap allows DeepSpeed to achieve higher throughput even at modest batch sizes.
|
|
104
|
+
|
|
105
|
+
The DeepSpeed core API consists of just a handful of methods:
|
|
106
|
+
|
|
107
|
+
DeepSpeed supports most of the features described in this document, via the use of these API, along with a deepspeed_config JSON file for enabling and disabling the features. Please see the core API doc for more details.
|
|
108
|
+
|
|
109
|
+
DeepSpeed’s Activation Checkpointing API supports activation checkpoint partitioning, cpu checkpointing, and contiguous memory optimizations, while also allowing layerwise profiling. Please see the core API doc for more details.
|
|
110
|
+
|
|
111
|
+
DeepSpeed handles gradient clipping under the hood based on the max gradient norm specified by the user. Please see the core API doc for more details.
|
|
112
|
+
|
|
113
|
+
DeepSpeed internally handles loss scaling for mixed precision training. The parameters for loss scaling can be specified in the deepspeed_config JSON file. Please see the core API doc for more details.
|
|
114
|
+
|
|
115
|
+
DeepSpeed has three communication-efficient optimizers called 1-bit Adam, 0/1 Adam and 1-bit LAMB. They offer the same convergence as Adam/LAMB, incur up to 26x less communication that enables up to 6.6x higher throughput for BERT-Large pretraining and up to 2.7x higher throughput for SQuAD fine-tuning on bandwidth-limited clusters. For more details on usage and performance, please refer to the 1-bit Adam tutorial, 1-bit Adam blog post, 0/1 Adam tutorial and 1-bit LAMB tutorial. For technical details, please refer to the 1-bit Adam paper, 0/1 Adam paper and 1-bit LAMB paper.
|
|
116
|
+
|
|
117
|
+
With DeepSpeed, the user can choose to use a high performance implementation of ADAM from NVIDIA, or any training optimizer that extends torch’s torch.optim.Optimizer class.
|
|
118
|
+
|
|
119
|
+
We introduce an efficient implementation of Adam optimizer on CPU that improves the parameter-update performance by nearly an order of magnitude. We use the AVX SIMD instructions on Intel-x86 architecture for the CPU-Adam implementation. We support both AVX-512 and AVX-2 instruction sets. DeepSpeed uses AVX-2 by default which can be switched to AVX-512 by setting the build flag, DS_BUILD_AVX512 to 1 when installing DeepSpeed. Using AVX-512, we observe 5.1x to 6.5x speedups considering the model-size between 1 to 10 billion parameters with respect to torch-adam.
|
|
120
|
+
|
|
121
|
+
Mixed precision training is handled by the DeepSpeed FP16 Optimizer. This optimizer not only handles FP16 training but is also highly efficient. The performance of weight update is primarily dominated by the memory bandwidth, and the achieved memory bandwidth is dependent on the size of the input operands. The FP16 Optimizer is designed to maximize the achievable memory bandwidth by merging all the parameters of the model into a single large buffer, and applying the weight updates in a single kernel, allowing it to achieve high memory bandwidth.
|
|
122
|
+
|
|
123
|
+
DeepSpeed makes it easy to train with large batch sizes by enabling the LAMB Optimizer. For more details on LAMB, see the LAMB paper.
|
|
124
|
+
|
|
125
|
+
DeepSpeed can train models with up to 13 billion parameters without model parallelism, and models with up to 200 billion parameters with 16-way model parallelism. This leap in model size is possible through the memory efficiency achieved via the ZeRO Optimizer. For more details see ZeRO paper .
|
|
126
|
+
|
|
127
|
+
DeepSpeed can simplify checkpointing for you regardless of whether you are using data parallel training, model parallel training, mixed-precision training, a mix of these three, or using the zero optimizer to enable larger model sizes. Please see the Getting Started guide and the core API doc for more details.
|
|
128
|
+
|
|
129
|
+
DeepSpeed supports multiple Learning Rate Schedules to enable faster convergence for large batch scaling.
|
|
130
|
+
|
|
131
|
+
Please refer to the Learning Rate Range Test tutorial.
|
|
132
|
+
|
|
133
|
+
Please refer to the 1Cycle Learning Rate Schedule tutorial.
|
|
134
|
+
|
|
135
|
+
DeepSpeed abstracts away data parallelism and model parallelism from the user when it comes to data loading. Users simply provide a PyTorch dataset, and DeepSpeed data loader can automatically handle batch creation appropriately.
|
|
136
|
+
|
|
137
|
+
Please refer to the Data Efficiency tutorial.
|
|
138
|
+
|
|
139
|
+
Please refer to the Curriculum Learning tutorial. Note that the Data Efficiency Library above provides more general curriculum learning support. This legacy curriculum learning feature is still supported but we recommend to use the Data Efficiency Library.
|
|
140
|
+
|
|
141
|
+
DeepSpeed provides a set of tools for performance analysis and debugging.
|
|
142
|
+
|
|
143
|
+
DeepSpeed provides a detailed breakdown of the time spent in different parts of the training. This can be enabled by setting the following in the deepspeed_config file.
|
|
144
|
+
|
|
145
|
+
When activation checkpointing is enabled, profiling the forward and backward time of each checkpoint function can be enabled in the deepspeed_config file.
|
|
146
|
+
|
|
147
|
+
The DeepSpeed flops profiler measures the time, flops and parameters of a PyTorch model and shows which modules or layers are the bottleneck. When used with the DeepSpeed runtime, the flops profiler can be configured in the deepspeed_config file as follows:
|
|
148
|
+
|
|
149
|
+
The flops profiler can also be used as a standalone package. Please refer to the Flops Profiler tutorial for more details.
|
|
150
|
+
|
|
151
|
+
The DeepSpeed Autotuner uses model information, system information, and heuristics to efficiently tune Zero stage, micro batch size, and other Zero configurations. Using the autotuning feature requires no code change from DeepSpeed users. While "autotuning": {"enabled": true} is the minimal required to enable autotuning, there are other parameters users can define to configure the autotuning process. Below shows major parameters and their default values in the autotuning configuration. Please refer to the Autotuning tutorial for more details.
|
|
152
|
+
|
|
153
|
+
The flops profiler can also be used as a standalone package. Please refer to the Flops Profiler tutorial for more details.
|
|
154
|
+
|
|
155
|
+
The DeepSpeed Monitor logs live training metrics to one or more monitoring backends, including PyTorch’s TensorBoard, WandB, or simply to CSV files. The Monitor can be configured with one or more backends in the deepspeed_config file as follows:
|
|
156
|
+
|
|
157
|
+
The Monitor can also be added to log custom metrics and client codes. Please refer to the Monitor tutorial for more details.
|
|
158
|
+
|
|
159
|
+
DeepSpeed provides logging of all communication operations launched within deepspeed.comm. The communication logger can be configured in the deepspeed_config file as follows:
|
|
160
|
+
|
|
161
|
+
Client codes can then print a summary with a call to deepspeed.comm.log_summary(). For more details and example usage, see the Communication Logging tutorial.
|
|
162
|
+
|
|
163
|
+
DeepSpeed offers sparse attention to support long sequences. Please refer to the Sparse Attention tutorial.
|
|
164
|
+
|
|
165
|
+
To learn more about training Mixture of Experts (MoE) models with DeepSpeed, see our tutorial for more details.
|
|
166
|
+
|
|
167
|
+
**Examples:**
|
|
168
|
+
|
|
169
|
+
Example 1 (unknown):
|
|
170
|
+
```unknown
|
|
171
|
+
"fp16": {
|
|
172
|
+
"enabled": true,
|
|
173
|
+
"loss_scale": 0,
|
|
174
|
+
"loss_scale_window": 1000,
|
|
175
|
+
"hysteresis": 2,
|
|
176
|
+
"consecutive_hysteresis": false,
|
|
177
|
+
"min_loss_scale": 1
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Example 2 (unknown):
|
|
182
|
+
```unknown
|
|
183
|
+
deepspeed --hostfile=<hostfile> \
|
|
184
|
+
<client_entry.py> <client args> \
|
|
185
|
+
--deepspeed --deepspeed_config ds_config.json
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
Example 3 (unknown):
|
|
189
|
+
```unknown
|
|
190
|
+
mpu.get_model_parallel_rank()
|
|
191
|
+
mpu.get_model_parallel_group()
|
|
192
|
+
mpu.get_model_parallel_world_size()
|
|
193
|
+
|
|
194
|
+
mpu.get_data_parallel_rank()
|
|
195
|
+
mpu.get_data_parallel_group()
|
|
196
|
+
mpu.get_data_parallel_world_size()
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Example 4 (unknown):
|
|
200
|
+
```unknown
|
|
201
|
+
{
|
|
202
|
+
"gradient_clipping": 1.0
|
|
203
|
+
}
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## Latest News
|
|
209
|
+
|
|
210
|
+
**URL:** https://www.deepspeed.ai/
|
|
211
|
+
|
|
212
|
+
**Contents:**
|
|
213
|
+
- Latest News
|
|
214
|
+
- Contents
|
|
215
|
+
- Extreme Speed and Scale for DL Training
|
|
216
|
+
- DeepSpeed Adoption
|
|
217
|
+
- Contributing
|
|
218
|
+
- Contributor License Agreement
|
|
219
|
+
- Code of Conduct
|
|
220
|
+
- Publications
|
|
221
|
+
- Videos
|
|
222
|
+
|
|
223
|
+
[2025/10] SuperOffload: Unleashing the Power of Large-Scale LLM Training on Superchips
|
|
224
|
+
|
|
225
|
+
[2025/10] Study of ZenFlow and ZeRO offload performance with DeepSpeed CPU core binding
|
|
226
|
+
|
|
227
|
+
[2025/08] ZenFlow: Stall-Free Offloading Engine for LLM Training
|
|
228
|
+
|
|
229
|
+
[2025/06] Arctic Long Sequence Training (ALST) with DeepSpeed: Scalable And Efficient Training For Multi-Million Token Sequences
|
|
230
|
+
|
|
231
|
+
[2025/06] DeepNVMe: Affordable I/O scaling for Deep Learning Applications
|
|
232
|
+
|
|
233
|
+
DeepSpeed enabled the world’s most powerful language models (at the time of this writing) such as MT-530B and BLOOM. DeepSpeed offers a confluence of system innovations, that has made large scale DL training effective, and efficient, greatly improved ease of use, and redefined the DL training landscape in terms of scale that is possible. These innovations include ZeRO, 3D-Parallelism, DeepSpeed-MoE, ZeRO-Infinity, etc.
|
|
234
|
+
|
|
235
|
+
DeepSpeed has been used to train many different large-scale models. Below is a list of several examples that we are aware of (if you’d like to include your model please submit a PR):
|
|
236
|
+
|
|
237
|
+
DeepSpeed has been integrated with several different popular open-source DL frameworks such as:
|
|
238
|
+
|
|
239
|
+
DeepSpeed is an integral part of Microsoft’s AI at Scale initiative to enable next-generation AI capabilities at scale.
|
|
240
|
+
|
|
241
|
+
DeepSpeed welcomes your contributions! Please see our contributing guide for more details on formatting, testing, etc.
|
|
242
|
+
|
|
243
|
+
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
|
|
244
|
+
|
|
245
|
+
When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
|
|
246
|
+
|
|
247
|
+
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
|
|
248
|
+
|
|
249
|
+
Xinyu Lian, Sam Ade Jacobs, Lev Kurilenko, Masahiro Tanaka, Stas Bekman, Olatunji Ruwase, Minjia Zhang. (2024) Universal Checkpointing: Efficient and Flexible Checkpointing for Large Scale Distributed Training arXiv:2406.18820
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
253
|
+
## Supporting efficient large model training on AMD Instinct GPUs with DeepSpeed
|
|
254
|
+
|
|
255
|
+
**URL:** https://www.deepspeed.ai/2022/03/20/amd-support.html
|
|
256
|
+
|
|
257
|
+
**Contents:**
|
|
258
|
+
- Supporting efficient large model training on AMD Instinct GPUs with DeepSpeed
|
|
259
|
+
- Contents
|
|
260
|
+
|
|
261
|
+
Updated: March 20, 2022
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
## DeepSpeed Configuration JSON
|
|
266
|
+
|
|
267
|
+
**URL:** https://www.deepspeed.ai/docs/config-json/
|
|
268
|
+
|
|
269
|
+
**Contents:**
|
|
270
|
+
- DeepSpeed Configuration JSON
|
|
271
|
+
- Contents
|
|
272
|
+
- Batch Size Related Parameters
|
|
273
|
+
- Optimizer Parameters
|
|
274
|
+
- Scheduler Parameters
|
|
275
|
+
- Communication options
|
|
276
|
+
- FP16 training options
|
|
277
|
+
- BFLOAT16 training options
|
|
278
|
+
- Automatic mixed precision (AMP) training options
|
|
279
|
+
- Gradient Clipping
|
|
280
|
+
|
|
281
|
+
Note: train_batch_size must be equal to train_micro_batch_size_per_gpu * gradient_accumulation_steps * number of GPUs. For simplicity, you can choose to only specify two of the three parameters, the last one will be inferred automatically by DeepSpeed.
|
|
282
|
+
|
|
283
|
+
train_batch_size: [integer]
|
|
284
|
+
|
|
285
|
+
train_micro_batch_size_per_gpu: [integer]
|
|
286
|
+
|
|
287
|
+
gradient_accumulation_steps: [integer]
|
|
288
|
+
|
|
289
|
+
optimizer: [dictionary]
|
|
290
|
+
|
|
291
|
+
Example of optimizer with Adam
|
|
292
|
+
|
|
293
|
+
The Adam optimizer also supports the following two params keys/values in addition to the standard parameters from torch.optim.Adam:
|
|
294
|
+
|
|
295
|
+
Another example of optimizer with 1-bit Adam specific parameters is as follows.
|
|
296
|
+
|
|
297
|
+
The 1-bit Adam optimizer supports the following three params keys/values in addition to the standard Adam (learn more in our tutorial):
|
|
298
|
+
|
|
299
|
+
A variant optimizer for 1-bit Adam is 0/1 Adam, which further optimizes 1-bit Adam via adaptive variance freezing and 1-bit synchronization over optimizer states.
|
|
300
|
+
|
|
301
|
+
0/1 Adam supports the following params key/values in addition to standard Adam (learn more in our tutorial.)
|
|
302
|
+
|
|
303
|
+
Another example of optimizer with 1-bit LAMB
|
|
304
|
+
|
|
305
|
+
The 1-bit LAMB optimizer supports the following params keys/values in addition to the standard LAMB (learn more in our tutorial):
|
|
306
|
+
|
|
307
|
+
DeepSpeed calls the step() method of the scheduler at every training step when model_engine.step() is executed.
|
|
308
|
+
|
|
309
|
+
scheduler: [dictionary]
|
|
310
|
+
|
|
311
|
+
communication_data_type: [string]
|
|
312
|
+
|
|
313
|
+
prescale_gradients: [boolean]
|
|
314
|
+
|
|
315
|
+
gradient_predivide_factor: [float]
|
|
316
|
+
|
|
317
|
+
sparse_gradients: [boolean]
|
|
318
|
+
|
|
319
|
+
Note: this mode cannot be combined with the amp mode described below.
|
|
320
|
+
|
|
321
|
+
fp16:enabled: [boolean]
|
|
322
|
+
|
|
323
|
+
fp16:auto_cast: [boolean]
|
|
324
|
+
|
|
325
|
+
fp16:loss_scale: [float]
|
|
326
|
+
|
|
327
|
+
fp16:initial_scale_power: [integer]
|
|
328
|
+
|
|
329
|
+
fp16:loss_scale_window: [integer]
|
|
330
|
+
|
|
331
|
+
fp16:hysteresis: [integer]
|
|
332
|
+
|
|
333
|
+
fp16:consecutive_hysteresis: [boolean]
|
|
334
|
+
|
|
335
|
+
fp16:min_loss_scale: [integer]
|
|
336
|
+
|
|
337
|
+
Note: this mode cannot be combined with the amp mode described below.
|
|
338
|
+
|
|
339
|
+
Note: this mode cannot be combined with the fp16 mode described above.
|
|
340
|
+
|
|
341
|
+
bf16:enabled: [boolean]
|
|
342
|
+
|
|
343
|
+
Note: this mode cannot be combined with the fp16 mode described above. In addition this mode is not currently compatible with ZeRO.
|
|
344
|
+
|
|
345
|
+
amp:enabled: [boolean]
|
|
346
|
+
|
|
347
|
+
amp params: [various]
|
|
348
|
+
|
|
349
|
+
gradient_clipping: [float]
|
|
350
|
+
|
|
351
|
+
Enabling and configuring ZeRO memory optimizations
|
|
352
|
+
|
|
353
|
+
zero_optimization: [dictionary]
|
|
354
|
+
|
|
355
|
+
allgather_partitions: [boolean]
|
|
356
|
+
|
|
357
|
+
allgather_bucket_size: [integer]
|
|
358
|
+
|
|
359
|
+
overlap_comm: [boolean]
|
|
360
|
+
|
|
361
|
+
reduce_scatter: [boolean]
|
|
362
|
+
|
|
363
|
+
reduce_bucket_size: [integer]
|
|
364
|
+
|
|
365
|
+
contiguous_gradients: [boolean]
|
|
366
|
+
|
|
367
|
+
load_from_fp32_weights: [boolean]
|
|
368
|
+
|
|
369
|
+
grad_hooks: [boolean]
|
|
370
|
+
|
|
371
|
+
round_robin_gradients: [boolean]
|
|
372
|
+
|
|
373
|
+
offload_param: [dictionary]
|
|
374
|
+
|
|
375
|
+
offload_optimizer: [dictionary]
|
|
376
|
+
|
|
377
|
+
stage3_max_live_parameters: [integer]
|
|
378
|
+
|
|
379
|
+
stage3_max_reuse_distance: [integer]
|
|
380
|
+
|
|
381
|
+
stage3_prefetch_bucket_size: [integer]
|
|
382
|
+
|
|
383
|
+
stage3_param_persistence_threshold: [integer]
|
|
384
|
+
|
|
385
|
+
stage3_gather_16bit_weights_on_model_save: [boolean]
|
|
386
|
+
|
|
387
|
+
stage3_module_granularity_threshold: [integer] | Description | Default | |——————————————————————————————————————————————————————————————————————————————————————————–| ——- | | The granularity of a module is determined by the ratio of parameter_count / (1 + descendant_count). ZeRO3 classifies modules with a granularity below the threshold as fine-grained, treating them as integral units during parameter fetching. This reduces host and communication overhead from separate hooks. | 0 |
|
|
388
|
+
|
|
389
|
+
zero_hpz_partition_size: [integer]
|
|
390
|
+
|
|
391
|
+
zero_quantized_weights: [boolean]
|
|
392
|
+
|
|
393
|
+
zero_quantized_gradients: [boolean]
|
|
394
|
+
|
|
395
|
+
log_trace_cache_warnings: [boolean]
|
|
396
|
+
|
|
397
|
+
cpu_offload: [boolean]
|
|
398
|
+
|
|
399
|
+
Deprecated: cpu_offload is deprecated and will be removed in future, please use offload_optimizer instead.
|
|
400
|
+
|
|
401
|
+
Enabling and configuring ZeRO optimization of parameter offloading to CPU/NVMe. Available only with ZeRO stage 3. Note that if the value of “device” is not specified or not supported, an assertion will be triggered.
|
|
402
|
+
|
|
403
|
+
pin_memory: [boolean]
|
|
404
|
+
|
|
405
|
+
buffer_count: [integer]
|
|
406
|
+
|
|
407
|
+
buffer_size: [integer]
|
|
408
|
+
|
|
409
|
+
max_in_cpu: [integer]
|
|
410
|
+
|
|
411
|
+
Enabling and configuring ZeRO optimization of offloading optimizer computation to CPU and state to CPU/NVMe. CPU offloading is available with ZeRO stage 1, 2, 3. NVMe offloading is available only with ZeRO stage 3. Note that if the value of “device” is not specified or not supported, an assertion will be triggered.
|
|
412
|
+
|
|
413
|
+
pin_memory: [boolean]
|
|
414
|
+
|
|
415
|
+
buffer_count: [integer]
|
|
416
|
+
|
|
417
|
+
Configuring the asynchronous I/O module for offloading parameter and optimizer states to persistent (NVMe) storage. This module uses Linux native asynchronous I/O (libaio).
|
|
418
|
+
|
|
419
|
+
block_size: [integer]
|
|
420
|
+
|
|
421
|
+
queue_depth: [integer]
|
|
422
|
+
|
|
423
|
+
thread_count: [integer]
|
|
424
|
+
|
|
425
|
+
single_submit: [boolean]
|
|
426
|
+
|
|
427
|
+
overlap_events: [boolean]
|
|
428
|
+
|
|
429
|
+
ignore_unused_parameters: [boolean]
|
|
430
|
+
|
|
431
|
+
steps_per_print: [integer]
|
|
432
|
+
|
|
433
|
+
wall_clock_breakdown: [boolean]
|
|
434
|
+
|
|
435
|
+
dump_state: [boolean]
|
|
436
|
+
|
|
437
|
+
results_dir: [string]
|
|
438
|
+
|
|
439
|
+
start_profile_step: [integer]
|
|
440
|
+
|
|
441
|
+
end_profile_step: [integer]
|
|
442
|
+
|
|
443
|
+
max_train_batch_size: [int]
|
|
444
|
+
|
|
445
|
+
num_tuning_micro_batch_sizes: [integer]
|
|
446
|
+
|
|
447
|
+
tuner_early_stopping: [integer]
|
|
448
|
+
|
|
449
|
+
tuner_num_trials: [integer]
|
|
450
|
+
|
|
451
|
+
profile_step: [integer]
|
|
452
|
+
|
|
453
|
+
module_depth: [integer]
|
|
454
|
+
|
|
455
|
+
top_modules: [integer]
|
|
456
|
+
|
|
457
|
+
output_file: [string]
|
|
458
|
+
|
|
459
|
+
partition_activations: [boolean]
|
|
460
|
+
|
|
461
|
+
cpu_checkpointing: [boolean]
|
|
462
|
+
|
|
463
|
+
contiguous_memory_optimization: [boolean]
|
|
464
|
+
|
|
465
|
+
number_checkpoints: [integer]
|
|
466
|
+
|
|
467
|
+
synchronize_checkpoint_boundary: [boolean]
|
|
468
|
+
|
|
469
|
+
sparse_attention: [dictionary]
|
|
470
|
+
|
|
471
|
+
Example of sparse_attention
|
|
472
|
+
|
|
473
|
+
DeepSpeed Data Efficiency Library includes two techniques: curriculum learning and random layerwise token dropping (random-LTD). Read more about how to use the DeepSpeed Data Efficiency Library in our tutorial.
|
|
474
|
+
|
|
475
|
+
data_efficiency: [dictionary]
|
|
476
|
+
|
|
477
|
+
data_routing: [dictionary]
|
|
478
|
+
|
|
479
|
+
data_sampling: [dictionary]
|
|
480
|
+
|
|
481
|
+
random_ltd: [dictionary]
|
|
482
|
+
|
|
483
|
+
curriculum_learning: [dictionary]
|
|
484
|
+
|
|
485
|
+
Note: On 12/12/2022, we released DeepSpeed Data Efficiency Library which provides a more general curriculum learning support. This legacy curriculum learning feature below is still supported but we recommend to use the Data Efficiency Library.
|
|
486
|
+
|
|
487
|
+
curriculum_type: [string]
|
|
488
|
+
|
|
489
|
+
min_difficulty: [integer]
|
|
490
|
+
|
|
491
|
+
max_difficulty: [integer]
|
|
492
|
+
|
|
493
|
+
schedule_type: [string]
|
|
494
|
+
|
|
495
|
+
total_curriculum_step: [integer]
|
|
496
|
+
|
|
497
|
+
difficulty_step: [integer]
|
|
498
|
+
|
|
499
|
+
root_degree: [integer]
|
|
500
|
+
|
|
501
|
+
difficulty: [list of integer]
|
|
502
|
+
|
|
503
|
+
max_step: [list of integer]
|
|
504
|
+
|
|
505
|
+
Note: Deepspeed logs to TensorBoard through PyTorch. Logging to TensorBoard requires that the tensorboard package is installed (read more in the PyTorch documentation).
|
|
506
|
+
|
|
507
|
+
Note: Logging to WandB requires that the wandb package is installed (read more in the WandB documentation).
|
|
508
|
+
|
|
509
|
+
Note: Logging to Comet requires that the comet_ml package is installed (read more in the Comet documentation).
|
|
510
|
+
|
|
511
|
+
Deepspeed’s Monitor module can log training details into a Tensorboard-compatible file, to WandB, to Comet or to simple CSV files. Below is an overview of what DeepSpeed will log automatically.
|
|
512
|
+
|
|
513
|
+
tensorboard: [dictionary]
|
|
514
|
+
|
|
515
|
+
Example of tensorboard configuration:
|
|
516
|
+
|
|
517
|
+
Example of wandb configuration:
|
|
518
|
+
|
|
519
|
+
Example of comet configuration:
|
|
520
|
+
|
|
521
|
+
csv_monitor: [dictionary]
|
|
522
|
+
|
|
523
|
+
Example of csv_monitor configuration:
|
|
524
|
+
|
|
525
|
+
DeepSpeed provides a flexible communication logging tool which can automatically detect and record communication operations launched via deepspeed.comm. NOTE: All logging communication calls are synchronized in order to provide accurate timing information. This may hamper performance if your model heavily uses asynchronous communication operations.
|
|
526
|
+
|
|
527
|
+
Once the logs are populated, they can be summarized with deepspeed.comm.log_summary(). For more detail and example usage, see the tutorial
|
|
528
|
+
|
|
529
|
+
comms_logger: [dictionary]
|
|
530
|
+
|
|
531
|
+
Example of recommended comms_logger configuration:
|
|
532
|
+
|
|
533
|
+
Example of comms_logger configuration for logging specific operations only:
|
|
534
|
+
|
|
535
|
+
Note: Compression has seven different components, including layer reduction, weight quantization, activation quantization, sparse pruning, row pruning, head pruning, and channel pruning. We explain them one by one with simple json examples. Read more about how to use the DeepSpeed Compression library in our tutorial.
|
|
536
|
+
|
|
537
|
+
Note: Layer reduction works much better when using knowledage distillation (learn more in our tutorial):
|
|
538
|
+
|
|
539
|
+
layer_reduction: [dictionary]
|
|
540
|
+
|
|
541
|
+
shared_parameters: [dictionary]
|
|
542
|
+
|
|
543
|
+
Shared parameters for all weight quantization groups.
|
|
544
|
+
|
|
545
|
+
different_groups: [dictionary]
|
|
546
|
+
|
|
547
|
+
Different quantization sets, this is used for different quantization parameters. In this example, we give two different sets. In practice, you can choose the number of sets based on your requirements.
|
|
548
|
+
|
|
549
|
+
shared_parameters: [dictionary]
|
|
550
|
+
|
|
551
|
+
Shared parameters for all activation quantization groups.
|
|
552
|
+
|
|
553
|
+
different_groups: [dictionary]
|
|
554
|
+
|
|
555
|
+
Different quantization sets, this is used for different quantization parameters. In this example, we give one set. In practice, you can choose the number of sets based on your requirements.
|
|
556
|
+
|
|
557
|
+
shared_parameters: [dictionary]
|
|
558
|
+
|
|
559
|
+
Shared parameters for all sparse pruning groups.
|
|
560
|
+
|
|
561
|
+
different_groups: [dictionary]
|
|
562
|
+
|
|
563
|
+
Different pruning sets, this is used for different pruning parameters. In this example, we give one set. In practice, you can choose the number of sets based on your requirements. Note for snip_momentum method, you can leave it as empty.
|
|
564
|
+
|
|
565
|
+
Note: Row Pruning is a feature designed for two back-to-back linear layers (e.g., Feed Forward Network in Transformers). As such, we suggested use row pruning for the first linear layer (i.e., the intermediate.dense layer for BERT). Reducing the row dimension of this matrix can help reducing the column of the follow-up matrix (i.e., layer.\\w+.output.dense layer for BERT). It should also work for other linear layers as well.
|
|
566
|
+
|
|
567
|
+
shared_parameters: [dictionary]
|
|
568
|
+
|
|
569
|
+
Shared parameters for all row pruning groups.
|
|
570
|
+
|
|
571
|
+
different_groups: [dictionary]
|
|
572
|
+
|
|
573
|
+
Different pruning sets, this is used for different pruning parameters. In this example, we give one set. In practice, you can choose the number of sets based on your requirements.
|
|
574
|
+
|
|
575
|
+
Note: Head Pruning is a feature designed for two attention layers (e.g., Multi Head Attention in Transformers). For now, it can only be applied to output matrix of the Transformer (i.e., attention.output.dense in BERT). Pruning the output matrix can lead to the pruning of Query/Key/Value matrix as well.
|
|
576
|
+
|
|
577
|
+
shared_parameters: [dictionary]
|
|
578
|
+
|
|
579
|
+
Shared parameters for all head pruning groups.
|
|
580
|
+
|
|
581
|
+
different_groups: [dictionary]
|
|
582
|
+
|
|
583
|
+
Different pruning sets, this is used for different pruning parameters. In this example, we give one set. In practice, you can choose the number of sets based on your requirements.
|
|
584
|
+
|
|
585
|
+
Note: Channel Pruning is a feature designed for two back-to-back CONV2d layers (e.g., residual connection in ResNet). As such, we suggested use channel pruning for the first CONV2d layer. Reducing the number of output channels of this layer can help reducing the number of input channels the follow-up layer. It should also work for other CONV2d layers as well.
|
|
586
|
+
|
|
587
|
+
shared_parameters: [dictionary]
|
|
588
|
+
|
|
589
|
+
Shared parameters for all channel pruning groups.
|
|
590
|
+
|
|
591
|
+
different_groups: [dictionary]
|
|
592
|
+
|
|
593
|
+
Different pruning sets, this is used for different pruning parameters. In this example, we give one set. In practice, you can choose the number of sets based on your requirements.
|
|
594
|
+
|
|
595
|
+
load_universal: [boolean]
|
|
596
|
+
|
|
597
|
+
use_node_local_storage: [boolean]
|
|
598
|
+
|
|
599
|
+
pipeline_stage: [boolean]
|
|
600
|
+
|
|
601
|
+
**Examples:**
|
|
602
|
+
|
|
603
|
+
Example 1 (unknown):
|
|
604
|
+
```unknown
|
|
605
|
+
"optimizer": {
|
|
606
|
+
"type": "Adam",
|
|
607
|
+
"params": {
|
|
608
|
+
"lr": 0.001,
|
|
609
|
+
"betas": [
|
|
610
|
+
0.8,
|
|
611
|
+
0.999
|
|
612
|
+
],
|
|
613
|
+
"eps": 1e-8,
|
|
614
|
+
"weight_decay": 3e-7
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
```
|
|
618
|
+
|
|
619
|
+
Example 2 (unknown):
|
|
620
|
+
```unknown
|
|
621
|
+
"optimizer": {
|
|
622
|
+
"type": "OneBitAdam",
|
|
623
|
+
"params": {
|
|
624
|
+
"lr": 0.001,
|
|
625
|
+
"betas": [
|
|
626
|
+
0.8,
|
|
627
|
+
0.999
|
|
628
|
+
],
|
|
629
|
+
"eps": 1e-8,
|
|
630
|
+
"weight_decay": 3e-7,
|
|
631
|
+
"freeze_step": 400,
|
|
632
|
+
"cuda_aware": false,
|
|
633
|
+
"comm_backend_name": "nccl"
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
```
|
|
637
|
+
|
|
638
|
+
Example 3 (unknown):
|
|
639
|
+
```unknown
|
|
640
|
+
"optimizer": {
|
|
641
|
+
"type": "ZeroOneAdam",
|
|
642
|
+
"params": {
|
|
643
|
+
"lr": 1e-3,
|
|
644
|
+
"weight_decay": 0.01,
|
|
645
|
+
"bias_correction": false,
|
|
646
|
+
"var_freeze_step": 1000,
|
|
647
|
+
"var_update_scaler": 16,
|
|
648
|
+
"local_step_scaler": 1000,
|
|
649
|
+
"local_step_clipper": 16,
|
|
650
|
+
"cuda_aware": false,
|
|
651
|
+
"comm_backend_name": "nccl"
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
```
|
|
655
|
+
|
|
656
|
+
Example 4 (unknown):
|
|
657
|
+
```unknown
|
|
658
|
+
"optimizer": {
|
|
659
|
+
"type": "OneBitLamb",
|
|
660
|
+
"params": {
|
|
661
|
+
"lr": 11e-3,
|
|
662
|
+
"weight_decay": 0.01,
|
|
663
|
+
"bias_correction": false,
|
|
664
|
+
"max_coeff": 0.3,
|
|
665
|
+
"min_coeff": 0.01,
|
|
666
|
+
"freeze_step": 1000,
|
|
667
|
+
"cuda_aware": false,
|
|
668
|
+
"comm_backend_name": "nccl",
|
|
669
|
+
"coeff_beta": 0.9,
|
|
670
|
+
"factor_max": 4.0,
|
|
671
|
+
"factor_min": 0.5,
|
|
672
|
+
"factor_threshold": 0.1
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
```
|
|
676
|
+
|
|
677
|
+
---
|
|
678
|
+
|
|
679
|
+
## DeepSpeed ZeRO-3 Offload
|
|
680
|
+
|
|
681
|
+
**URL:** https://www.deepspeed.ai/2021/03/07/zero3-offload.html
|
|
682
|
+
|
|
683
|
+
**Contents:**
|
|
684
|
+
- DeepSpeed ZeRO-3 Offload
|
|
685
|
+
- Contents
|
|
686
|
+
- Overview of ZeRO family of technology
|
|
687
|
+
- ZeRO-3 Offload
|
|
688
|
+
- Unprecedented model scale
|
|
689
|
+
- Ease of supporting very large models
|
|
690
|
+
- Excellent training efficiency
|
|
691
|
+
- How to use ZeRO-3 Offload
|
|
692
|
+
|
|
693
|
+
Today we are announcing the release of ZeRO-3 Offload, a highly efficient and easy to use implementation of ZeRO Stage 3 and ZeRO Offload combined, geared towards our continued goal of democratizing AI by making efficient large-scale DL training available to everyone. The key benefits of ZeRO-3 Offload are:
|
|
694
|
+
|
|
695
|
+
The ZeRO Redundancy Optimizer (abbreviated ZeRO) is a family of memory optimization technologies for large-scale distributed deep learning. Unlike data parallelism (that is efficient but can only support a limited model size) or model parallelism (that can support larger model sizes but requires significant code refactoring while adding communication overhead that limits efficiency), ZeRO allows fitting larger models in memory without requiring code refactoring while remaining very efficient. ZeRO does so by eliminating the memory redundancy that is inherent in data parallelism while limiting the communication overhead to a minimum. ZeRO removes the memory redundancies across data-parallel processes by partitioning the three model states (optimizer states, gradients, and parameters) across data-parallel processes instead of replicating them. By doing this, it boosts memory efficiency compared to classic data-parallelism while retaining its computational granularity and communication efficiency. There are three stages in ZeRO corresponding to three model states, as shown in the Figure 1: the first stage (ZeRO-1) partitions only the optimizer states, the second stage (ZeRO-2) partitions both the optimizer states and the gradients and the final stage (ZeRO-3) partitions all three model states (for more details see the ZeRO paper).
|
|
696
|
+
|
|
697
|
+
Figure 1. Overview of ZeRO memory savings
|
|
698
|
+
|
|
699
|
+
In addition to these three stages, ZeRO family of technology also consists of ZeRO-2 Offload. ZeRO-2 Offload is a heterogeneous DL training technology that works in conjunction with ZeRO-2 to offload partitioned optimizer states and gradients to CPU memory. ZeRO-2 Offload offers the full memory advantage of ZeRO-2 even on a single GPU, while at the same time offering great scalability of ZeRO-2 on multi-GPU setup. DeepSpeed library has been offering ZeRO-2 Offload since Sept 2020. For details, please see below:
|
|
700
|
+
|
|
701
|
+
With today’s release of ZeRO-3 Offload, we are adding support for partitioning and offloading parameters in addition to optimizer states and gradients partitioning already supported by ZeRO-2 Offload in DeepSpeed. With parameter partitioning ZeRO-3 Offload implements the full set of features in the three stages of ZeRO, that allows for a linear growth in model size with the number of GPUs. In addition, ZeRO-3 Offload can also optionally offload all these model states to CPU to further reduce GPU memory consumption, leveraging both CPU and GPU to maximize memory and compute efficiency of the entire system.
|
|
702
|
+
|
|
703
|
+
We believe ZeRO-3 Offload offers a massive leap for large model training, in three regards:
|
|
704
|
+
|
|
705
|
+
i) Unprecedented model scale,
|
|
706
|
+
|
|
707
|
+
ii) Ease of supporting very-large models, and
|
|
708
|
+
|
|
709
|
+
iii) Achieving excellent training efficiency.
|
|
710
|
+
|
|
711
|
+
Unlike ZeRO-2 and ZeRO-Offload where the parameters have to fit in the memory of a single GPU, ZeRO-3 Offload can partition the parameters across GPUs, and offload them to CPU, supporting model sizes that are much larger than the memory on a single GPU. Furthermore, ZeRO-3 Offload goes beyond the state-of-the-art hybrid 3D-parallelism (data, model and pipeline parallelism combined). While 3D Parallelism is limited by the aggregate GPU memory, ZeRO-3 Offload can exploit both GPU and CPU memory, the latter of which is much larger and cheaper compared to GPU memory. This allows ZeRO-3 Offload to train larger model sizes with the given GPU and CPU resources than any other currently available technology.
|
|
712
|
+
|
|
713
|
+
Model Scale on Single GPU: ZeRO-3 Offload can train models with over 40B parameters efficiently on a single GPU (e.g., 32GB V100 GPU + 1.5TB CPU memory). This is 3x larger than what is possible with ZeRO-2 Offload, the current state-of-the art.
|
|
714
|
+
|
|
715
|
+
Model Scale on Multi-GPUs: With ZeRO-3 Offload you can train a trillion and two trillion parameter models on NVIDIA 32GB V100 DGX-2 cluster with 256 GPUs and 512 GPUs, respectively. In contrast, the state-of-art 3D Parallelism requires 800 GPUs, and 1600 GPUs, respectively, to fit the same sized models. This represents a 3x reduction in GPUs required to fit models with over a trillion parameters.
|
|
716
|
+
|
|
717
|
+
From a system perspective, training models with hundreds of billions and trillions of parameters is extremely challenging. Data parallelism cannot scale the model size much further beyond a billion parameters, model parallelism (with tensor slicing) cannot be used to scale model size efficiently beyond a single node boundary due to massive communication overheads, and pipeline parallelism cannot scale beyond the number of layers available in a model, which limits both the model size and the number of GPUs that it can scale to.
|
|
718
|
+
|
|
719
|
+
The only existing parallel technology available that can scale to over a trillion parameters on massively parallel GPU clusters is the 3D parallelism that combines data, model and pipeline parallelism in complex ways. While such a system can be very efficient, it requires major model code refactoring from data scientists to split the model into load balanced pipeline stages. This also makes 3D parallelism inflexible in the type of models that it can support, since models with complex dependency graphs cannot be easily converted into a load balanced pipeline.
|
|
720
|
+
|
|
721
|
+
ZeRO-3 Offload address these challenges in two ways:
|
|
722
|
+
|
|
723
|
+
i) With ground-breaking memory efficiency, ZeRO-3 and ZeRO-3 Offload are the only DL parallel technology that can efficiently scale to over a trillion parameters by itself, without requiring a hybrid parallelism strategy, greatly simplifying the system stack for DL training.
|
|
724
|
+
|
|
725
|
+
ii) ZeRO-3 Offload requires virtually no model refactoring from model scientists, liberating data scientists to scale up complex models to hundreds of billions to trillions of parameters.
|
|
726
|
+
|
|
727
|
+
High-performance per-GPU throughput on multiple nodes: ZeRO-3 Offload offers excellent training efficiency for multi-billion and trillion parameter models on multiple nodes. It achieves a sustained throughput of up to 50 Tflops per GPU running on 32 DGX2 nodes comprising 512 NVIDIA V100 GPUs (see Figure 2). In comparison, the standard data parallel training with PyTorch can only achieve 30 TFlops per GPU for a 1.2B parameter model, the largest model that can be trained using data parallelism alone.
|
|
728
|
+
|
|
729
|
+
Figure 2. ZeRO-3 Offload: Multi-billion and trillion parameter model throughput on 512 V100 GPUs
|
|
730
|
+
|
|
731
|
+
ZeRO-3 Offload obtains high efficiency despite the 50% communication overhead of ZeRO Stage 3 compared to standard data parallel training for a fixed batch size. This is made possible through a communication overlap centric design and implementation, which allows ZeRO-3 Offload to hide nearly all of the communication volume with computation, while taking advantage of a larger batch size for improved efficiency resulting from better GPU memory efficiency.
|
|
732
|
+
|
|
733
|
+
Efficient multi-billion parameter model training on a single GPU: ZeRO-3 Offload further democratizes AI by enabling efficient training of multi-billion parameter models on a single GPU. For single GPU training, ZeRO-3 Offload provides benefits over ZeRO-2 Offload along two dimensions. First, ZeRO-3 Offload increases the size of models trainable on a single V100 from 13B to 40B. Second, for ZeRO-3 Offload provides speedups (e.g., 2.3X for 13B) compared to ZeRO-2 Offload for model sizes trainable by both solutions. These results are summarized in Figure 3.
|
|
734
|
+
|
|
735
|
+
Figure 3. Multi-billion parameter model training on one V100 GPU
|
|
736
|
+
|
|
737
|
+
Super-Linear scalability across GPUs: Additionally, ZeRO-3 Offload also preserves the super-linear scalability characteristics that we have demonstrated with all our previous ZeRO technologies (ZeRO Stage 1, ZeRO Stage 2 and ZeRO Offload). ZeRO-3 Offload can exploit the aggregate PCI-E bandwidth between GPU and CPU across all the GPUs in multi-GPU training configuration, and at the same time, it can also exploit the aggregate CPU compute across all the nodes. As a result, the CPU-GPU-CPU communication time as well as the optimizer update time decreases linearly with number of GPUs and nodes, respectively, allowing ZeRO-3 Offload to exhibit super-linear scaling (see Figure 4).
|
|
738
|
+
|
|
739
|
+
Figure 4. ZeRO-3 Offload Superlinear Scalability for a 200B parameter model.
|
|
740
|
+
|
|
741
|
+
As with many other existing DeepSpeed features, once the user model has been converted to use DeepSpeed, enabling ZeRO-3 Offload is as easy as turning on a couple of flags in DeepSpeed Config file. Supporting advanced features like weight sharing, or enabling extremely large models that requires to be partitioned across GPUs/nodes to fit in GPU/CPU memory, can be done with just a couple of additional lines of code change using the ZeRO-3 Offload API.
|
|
742
|
+
|
|
743
|
+
If you are already a DeepSpeed user, you can find our detailed tutorial on ZeRO-3 Offload below. If you are new to DeepSpeed, we recommend that you start at the getting started page before trying out our ZeRO-3 Offload Tutorial.
|
|
744
|
+
|
|
745
|
+
DeepSpeed: Getting Started Page
|
|
746
|
+
|
|
747
|
+
ZeRO-3 Offload Documentation, Tutorial
|
|
748
|
+
|
|
749
|
+
The DeepSpeed Team is very excited to share ZeRO-3 Offload with the DL community.
|
|
750
|
+
|
|
751
|
+
Updated: March 7, 2021
|
|
752
|
+
|
|
753
|
+
---
|
|
754
|
+
|
|
755
|
+
## DeepSpeed: Advancing MoE inference and training to power next-generation AI scale
|
|
756
|
+
|
|
757
|
+
**URL:** https://www.deepspeed.ai/2022/01/18/moe-inference.html
|
|
758
|
+
|
|
759
|
+
**Contents:**
|
|
760
|
+
- DeepSpeed: Advancing MoE inference and training to power next-generation AI scale
|
|
761
|
+
- Contents
|
|
762
|
+
|
|
763
|
+
Updated: January 18, 2022
|
|
764
|
+
|
|
765
|
+
---
|
|
766
|
+
|
|
767
|
+
## Azure empowers easy-to-use, high-performance, and hyperscale model training using DeepSpeed
|
|
768
|
+
|
|
769
|
+
**URL:** https://www.deepspeed.ai/2022/07/25/deepspeed-azure.html
|
|
770
|
+
|
|
771
|
+
**Contents:**
|
|
772
|
+
- Azure empowers easy-to-use, high-performance, and hyperscale model training using DeepSpeed
|
|
773
|
+
- Contents
|
|
774
|
+
- Introduction
|
|
775
|
+
- Making distributed training faster and easier on Azure using DeepSpeed
|
|
776
|
+
- Key Performance Benefits
|
|
777
|
+
- Experimental Setup
|
|
778
|
+
- Hardware (Azure instances)
|
|
779
|
+
- Training setup using AzureML
|
|
780
|
+
- Training setup using Azure VMSS
|
|
781
|
+
- Performance Evaluation on Various Model Configurations
|
|
782
|
+
|
|
783
|
+
Large-scale transformer-based deep learning models trained on large amounts of data have shown great results in recent years in several cognitive tasks and are behind new products and features that augment human capabilities. These models have grown several orders of magnitude in size during the last five years. Starting from a few million parameters of the original transformer model all the way to the latest 530 billion-parameter Megatron-Turing model as shown in Figure 1. There is a growing need for customers to train and fine tune large models at an unprecedented scale.
|
|
784
|
+
|
|
785
|
+
Figure 1: Landscape of large models and hardware capabilities
|
|
786
|
+
|
|
787
|
+
To train these models, users needed to set up and maintain a complex distributed training infrastructure that usually required several manual and error-prone steps. These lead to a subpar experience both in terms of usability and performance. We recently announced how we are making great strides to simplify this and enable easy-to-use and high-performance training at 1K+ GPU scale on Azure.
|
|
788
|
+
|
|
789
|
+
In this extended post, we share the details of how DeepSpeed users can train trillion-parameter models with a new easy-to-use, streamlined, scalable, and high-performance distributed training experience on Azure. We also share details of the experimental setup, model configurations, additional performance trends, and guide our users on how to run these experiments in their own environments.
|
|
790
|
+
|
|
791
|
+
We compare the existing manual and error-prone workflow with our proposed easy-to-use workflow for DeepSpeed on Azure in Figure 2. Customers can now use easy-to-use training pipelines to launch training jobs at scale. The new workflow reduces the number of steps from 11 to just 1 if users rely on the recommended AzureML recipes.
|
|
792
|
+
|
|
793
|
+
Figure 2: An easy-to-use and streamlined distributed training experience with DeepSpeed on Azure
|
|
794
|
+
|
|
795
|
+
For users who have custom environments built using Azure VMs or Azure VMSS, only two steps are needed:
|
|
796
|
+
|
|
797
|
+
We already shared a summary of our key performance results in the Azure announcement. We enable the capability to train 2x larger model sizes (2 trillion vs. 1 trillion parameters), scale to 2x more GPUs (1024 vs. 512), and offer up to 1.8x higher compute throughput/GPU (150 TFLOPs vs. 81 TFLOPs) compared to other cloud providers.
|
|
798
|
+
|
|
799
|
+
DeepSpeed on Azure offers near-linear scalability both in terms of increase in model size as well as increase in number of GPUs. As shown in Figure 3a, together with the DeepSpeed ZeRO-3, its novel CPU offloading capabilities, and a high-performance Azure stack powered by InfiniBand interconnects and A100 GPUs, we were able to maintain an efficient throughput/GPU (>157 TFLOPs) in a near-linear fashion as the model size increases from 175 billion parameters to 2 trillion parameters. On the other hand, for a given model size, e.g., 175B, we achieve near-linear scaling as we increase the number of GPUs from 128 all the way to 1024 as shown in Figure 3b. The key takeaway is that Azure and DeepSpeed together are breaking the GPU memory wall and enabling our customers to easily and efficiently train trillion-parameter models at scale.
|
|
800
|
+
|
|
801
|
+
Figure 3: (a) Near-perfect throughput/GPU as we increase the model size from 175 billion to 2 trillion parameters (BS/GPU=8). (b) Near-perfect performance scaling with the increase in number of GPU devices for the 175B model (BS/GPU=16). The sequence length is 1024 for both cases.
|
|
802
|
+
|
|
803
|
+
We share the details of our experimental setup and some of the best practices we followed. The users can either directly use them to reproduce our results or modify them to fit their own setup in terms of model scale as well as the scale of Azure hardware being provisioned.
|
|
804
|
+
|
|
805
|
+
We used NDm A100 v4-series instances in our experiments. Each instance includes two socket AMD EPYC 7V12 64-Core CPUs, 1.7TB main memory and eight A100 80GB GPUs. The system has a balanced PCIe topology connecting 4 GPU devices to each CPU socket. Each GPU within the VM is provided with its own dedicated, topology-agnostic 200 Gb/s NVIDIA Mellanox HDR InfiniBand connection providing an accelerated 200 Gbps high speed fabric. The DeepSpeed library exploits offload capabilities where the activation and optimizer states are allocated in the main memory. Hence, 1.7TB memory capacity per node helps us to scale to large model sizes.
|
|
806
|
+
|
|
807
|
+
Users can directly use the AzureML studio and use our published recipes to run experiments without any additional setup. This is the easiest and recommended way of running experiments on Azure.
|
|
808
|
+
|
|
809
|
+
Existing VMSS customers and others who have custom Azure VM based environments can follow the setup as follows. The scripts to make these steps easy will be released in the coming weeks. A cluster is created using Azure Virtual Machine Scale Sets (VMSS) to provision the desired number of compute nodes running the new Azure HPAI VM image specialized for extreme-scale deep learning applications using the software stack listed in Table 1.
|
|
810
|
+
|
|
811
|
+
Table 1: Detailed version information of the software packages in the Azure HPC VM image
|
|
812
|
+
|
|
813
|
+
Users can create a VMSS with up to 600 VM instances enabling up to 4,800 A100 GPUs. In addition to the VMSS for the compute nodes, we provision a distinct login node using an inexpensive D4s v4 (or similar) instance with 4-core Intel VCPU, running the same image, for compiling, launching, and monitoring jobs. The login node, compute nodes, and a shared storage filesystem are grouped within an Azure Virtual Network (vnet) allowing VMs to connect to each other over SSH and to shared NFS volume shown in Figure 4.
|
|
814
|
+
|
|
815
|
+
Figure 4: Organization of our VMSS-based experimental setup
|
|
816
|
+
|
|
817
|
+
We ran our experiments with four different model sizes – 175B, 530B, 1T, and 2T – using the configurations shown in Table 2.
|
|
818
|
+
|
|
819
|
+
Table 2: Model configuration
|
|
820
|
+
|
|
821
|
+
For each of these configurations, we report peak throughput of the system using TFLOPs/GPU as the main performance metric. To calculate TFLOPs, we use the formula used by the Megatron paper as shown below.
|
|
822
|
+
|
|
823
|
+
FLOPs/GPU = 96 * B * s * l * h2 * (1 + s/6h + V/(16*l*h))
|
|
824
|
+
|
|
825
|
+
B is batch size, s is sequence length, l is the number of layers, h is hidden size, and V is vocabulary size.
|
|
826
|
+
|
|
827
|
+
Figures 5a and 5b show the results of 175B model with sequence length 512 and 1024, respectively. We only scale to 512 GPUs for seq-length 512 as adding more GPUs shows similar performance. On the other hand, with sequence length 1024, we saw linear performance increase to 1024 GPUs. Overall, the peak throughput of 204.49 TFLOPs/GPU was achieved on 256 GPUs with a micro batch size of 32 and sequence length of 512.
|
|
828
|
+
|
|
829
|
+
Figure 5: Performance characteristics of 175B model on 512 and 1K GPUs respectively. The colored columns signify different micro batch sizes.
|
|
830
|
+
|
|
831
|
+
Next, we report the 530B model scaling. Previous results on the 530B MT-NLG model using DeepSpeed and Megatron-LM on 280 DGX A100 servers on the Selene supercomputer showed the peak throughput of 126 TFLOPS/GPU. However, we were able to surpass that throughput and achieved up to 171.37 TFLOPs/GPU on 128 NDm A100 v4-series A100 systems (i.e., 1024 GPUs) as shown in Figure 6.
|
|
832
|
+
|
|
833
|
+
The benefit of this 530B model is its simpler parallelization configuration as there is no tensor/pipeline parallelism. With ZeRO powered data parallelism, there are fewer heuristics required to optimally configure the distributed model. In addition, the consistent steady state performance of more than 140 TFLOPs/GPU for micro batch sizes >1 demonstrates a robust software and hardware platform.
|
|
834
|
+
|
|
835
|
+
Figure 6: Throughput achieved with a 530B parameter model on 512 and 1024 GPUs for micro-batch sizes per GPU of 1, 2, 4, and 8, with sequence length 1,024.
|
|
836
|
+
|
|
837
|
+
The 1T parameter model contains 128 layers with 160 attention heads. Training such an extreme-scale model is not an easy task. Figure 7 shows the throughput achieved for each of the model configurations we explored on 512 and 1024 GPUs. Peak throughput achieved was 165.36 TFLOPs/GPU for micro batch size of 8 across 1024 GPUs and the model reached steady state performance within the first 3-4 iterations.
|
|
838
|
+
|
|
839
|
+
Figure 7: Performance characteristics of 1T parameter model on 512 and 1024 GPUs with 1, 2, 4, and 8 micro batch sizes, with sequence length 1,024.
|
|
840
|
+
|
|
841
|
+
The 2T parameter model consists of 160 layers, 32k hidden dimension, and 128 attention heads. Given the large size of the model and the significant time required on 1024 GPUs, we limited our benchmark runs for the 2T model to a batch size of 8 per GPU with a sequence length of 1024. We were able to achieve 157 TFLOPs/GPU on 1,024 GPUs.
|
|
842
|
+
|
|
843
|
+
We recognize that DeepSpeed users are diverse and have different environments. In this tutorial, our focus is on making things simpler for users who plan to run large model training experiments on Azure.
|
|
844
|
+
|
|
845
|
+
The easiest way to do model training on Azure is via the Azure ML recipes. The job submission and data preparation scripts have been made available here. Users simply need to setup their Azure ML workspace following the guide and submit experiment using the aml_submit.py file.
|
|
846
|
+
|
|
847
|
+
Some users have customized environments built on top of Azure VMs and VMSS based clusters. To simplify training on such setups, we are working on an easy-to-use cluster setup script that will be published in the next few weeks. If you already have a cluster setup running, you can use the azure recipes for the 175B and the 1T model. The recipes can easily be modified to train other model configurations.
|
|
848
|
+
|
|
849
|
+
This blog post was written by the DeepSpeed team in collaboration with the AzureML and the AzureHPC team. We would like to acknowledge several individuals who made this work possible:
|
|
850
|
+
|
|
851
|
+
Updated: July 25, 2022
|
|
852
|
+
|
|
853
|
+
---
|
|
854
|
+
|
|
855
|
+
## DeepSpeed Data Efficiency: A composable library that makes better use of data, increases training efficiency, and improves model quality
|
|
856
|
+
|
|
857
|
+
**URL:** https://www.deepspeed.ai/2022/12/11/data-efficiency.html
|
|
858
|
+
|
|
859
|
+
**Contents:**
|
|
860
|
+
- DeepSpeed Data Efficiency: A composable library that makes better use of data, increases training efficiency, and improves model quality
|
|
861
|
+
- Contents
|
|
862
|
+
- Efficient Data Sampling via Curriculum Learning
|
|
863
|
+
- Motivation
|
|
864
|
+
- Design
|
|
865
|
+
- Evaluation Results
|
|
866
|
+
- Efficient Data Routing via Random Layerwise Token Dropping
|
|
867
|
+
- Motivation
|
|
868
|
+
- Design
|
|
869
|
+
- Evaluation Results
|
|
870
|
+
|
|
871
|
+
Recently, large-scale deep learning models are empowering us to achieve more in many ways, such as improving programming efficiency by code generation and providing art inspiration by text-to-image generation. To enable these services and keep improving the quality, deep learning model architecture evolves rapidly, and the model size is also growing at a tremendous speed. For example, from GPT to GPT-3 the model size increased 1500x in 2 years. The increasing model size leads to unprecedented training cost, making it challenging for many AI practitioners to train their own models. On the other hand, a less-emphasized perspective is that data scale is actually increasing at a similar speed as model scale, and the training cost is proportional to both of them. In Figure 1 below we plot the model and data scales of several representative language models in the last 5 years. From the oldest model on the left to the newest models on the right, both the model and data scales increase at similar speed. This demonstrates the importance of improving data efficiency: achieve same model quality with less data and reduced training cost, or achieve better model quality with the same amount of data and similar training cost.
|
|
872
|
+
|
|
873
|
+
Figure 1: Model scale (number of parameters) and data scale (number of tokens consumed during training) of representative language models in the last 5 years.
|
|
874
|
+
|
|
875
|
+
There are two popular research directions among existing data efficiency techniques: Data sampling techniques aim to improve the convergence speed by sampling the most suitable next data batch from the whole data pool; Data routing techniques aim to reduce the computation by routing each data to only a subset of the model components. These techniques improve data and training efficiency, but existing solutions on them have limitations on extensibility, flexibility, and composability. They are commonly designed for specific training tasks, making them hard to be extended with customized strategies and making them less flexible to be applied on diverse workloads from different users. Furthermore, different techniques are implemented separately, making it challenging to compose multiple solutions to further improve data and training efficiency.
|
|
876
|
+
|
|
877
|
+
To address these challenges, we, the DeepSpeed team as part of Microsoft’s AI at Scale initiative, are proud to announce DeepSpeed Data Efficiency Library – a composable framework that makes better use of data, increases training efficiency, and improves model quality. DeepSpeed Data Efficiency takes extensibility, flexibility, and composability into consideration, and it specifically demonstrates the following innovations:
|
|
878
|
+
|
|
879
|
+
Efficient data sampling via curriculum learning. Curriculum learning (CL) improves data efficiency by sampling from easier data. We present a general curriculum learning library which enables users to employ curriculum learning to their models at maximum extensibility: users can easily analyze, index, and sample their training data based on various customizable strategies. Using this library, we were able to explore different CL strategies for GPT-3 and BERT pretraining and identify the best solution that provides up to 1.5x data saving while still maintaining similar model quality.
|
|
880
|
+
|
|
881
|
+
Efficient data routing via random layerwise token dropping. We present a novel data routing technique called random layerwise token dropping (random-LTD) to skip the computation of a subset of the input tokens at all middle layers. Random-LTD employs a simple yet effective routing strategy and requires minimal model architecture change. It is flexible to apply random-LTD to various tasks (GPT-3/BERT pretraining and GPT/ViT finetuning), and we achieve great data efficiency improvement (up to 1.5x data saving while still maintaining the model quality).
|
|
882
|
+
|
|
883
|
+
Seamlessly composing multiple methods. The proposed DeepSpeed Data Efficiency framework seamlessly composes the curriculum learning and random-LTD techniques, and only requires minimal changes on the user code side. Furthermore, by composing both methods we can achieve even better data and training efficiency: for GPT-3 1.3B pretraining, we achieve 2x data and 2x time savings together with better or similar model quality compared to the baseline training. When using the same amount of data, our approach further improves the model quality over the baseline. Users can also extend and contribute to the library by adding additional data efficiency techniques to compose together.
|
|
884
|
+
|
|
885
|
+
Each of these advances is explored further in the blog post below. For more about the technical details, please read our papers, “Random-LTD: Random and Layerwise Token Dropping Brings Efficient Training for Large-scale Transformers” which describes the random-LTD technique, and “DeepSpeed Data Efficiency: Improving Deep Learning Model Quality and Training Efficiency via Efficient Data Sampling and Routing” which describes the curriculum learning technique and overall DeepSpeed Data Efficiency framework.
|
|
886
|
+
|
|
887
|
+
Curriculum learning aims to improve training convergence speed by presenting relatively easier or simpler examples earlier during training. Building a curriculum learning solution usually requires two components: the difficulty metric (i.e., how to quantify the difficulty of each data sample) and the pacing function (i.e., how to decide the curriculum difficulty range when sampling next training data batch). Curriculum learning has been successfully applied to various training tasks, and last year we also released a specific curriculum learning technique (sequence length warmup) for GPT-style model pretraining (see technical details in our paper “The Stability-Efficiency Dilemma: Investigating Sequence Length Warmup for Training GPT Models” published in NeurIPS 2022). However, one common limitation among existing works is that there does not exist a generalized and extensible curriculum learning library, which allows practitioners to easily apply custom curriculum difficulty metrics, the combination of metrics, and pacing functions.
|
|
888
|
+
|
|
889
|
+
To solve the limitation of existing solutions, we design and implement a general curriculum learning library emphasizing the extensibility. It consists of three components as shown in Figure 2 below (top part). First, we use a data analyzer to perform the offline CPU-only data analysis which indexes the whole data pool based on any difficulty metric such as the sequence length, the vocabulary rarity, or anything defined by user. Next, during training, the curriculum scheduler determines the difficulty threshold for the current step based on a pacing function such as linear, rooted, or any strategy provided by users. Then the data sampler will sample the data with desired difficulty from the indexed data pool. Overall, this general implementation would enable users to explore curriculum learning on their workloads with maximum customizability (more technical details in our DeepSpeed Data Efficiency paper).
|
|
890
|
+
|
|
891
|
+
Figure 2: Design of the DeepSpeed Data Efficiency framework.
|
|
892
|
+
|
|
893
|
+
Using this general and extensible curriculum learning solution for GPT-3 and BERT-Large model pretraining, we are able to easily analyze and index the huge training data based on up to 7 difficulty metrics and enable better data and training efficiency. For GPT-3 pretraining, our solution with the best difficulty metric (combination of truncation-based sequence length and vocabulary rarity) achieves 1.5x data and training cost saving while still maintaining model quality as baseline (Table 1 Case (8) vs. (1)). For BERT-Large pretraining, our solution with the best difficulty metric (vocabulary rarity) achieves 1.5x saving while still maintaining model quality (Table 2 Case (8) vs. (1)). On the other hand, our solutions can further improve model quality when using the same amount of data as baseline (Table 1 Case (2) to (6), Table 2 Case (2) to (6)).
|
|
894
|
+
|
|
895
|
+
Table 1: GPT-3 1.3B pretraining data consumption and average evaluation accuracy on 19 tasks.
|
|
896
|
+
|
|
897
|
+
Table 2: BERT-Large pretraining data consumption and average GLUE finetuning score on 8 tasks.
|
|
898
|
+
|
|
899
|
+
Standard data routing usually feeds the full images/sequences into all layers of a model. However, this process may not be optimal for training efficiency since some parts of an image (or words of a sentence) do not require a frequent feature update. As such, the token dropping method has been proposed, which is illustrated in Figure 3 (b) below, to skip the compute of some tokens/words (i.e., G-2 tokens in Figure 3 (b)) of a sentence in order to save the compute cost.
|
|
900
|
+
|
|
901
|
+
Although existing methods show promising results, they also exhibit several caveats: (1) most works solely focus on BERT (encoder-only on text data) pretraining and do not include decoder pretraining and/or other modalities (e.g., images); (2) the ability to skip layers is limited, which bounds the total amount of compute saving. By analyzing existing methods, we found out the potential main issue that limits their skipping and coverage abilities is the loss of attention mechanism for G-2 tokens for all skipped layers, since multi-head attention focuses on different tokens at different layer depths and the attention map aligns with the dependency relation most strongly in the middle of transformer architectures.
|
|
902
|
+
|
|
903
|
+
To resolve this main issue, we propose random-LTD, a random and layerwise token dropping mechanism, which processes only a subset of tokens among the entire data batch for all middle layers in order to save compute cost (see more details in our Random-LTD paper). As such, each token rarely bypasses all middle layers and its dependency with other tokens can be captured by the model. The illustration of random-LTD compared to baseline is shown in Figure 3 below, where random-LTD splits the input tokens into two groups and only the first group involves the compute.
|
|
904
|
+
|
|
905
|
+
Figure 3: Comparison between baseline, existing token dropping methods, and random-LTD. Note that for random-LTD, only part of the inputs (Group 1) is used for Layer i.
|
|
906
|
+
|
|
907
|
+
Random-LTD is simple yet very effective. Particularly, compared to other existing token dropping methods, random-LTD (1) does a purely random selection for each layer for two different groups, as such we do not require any expert design for the selection criterion; (2) is able to apply to all middle layers to achieve better saving ratio; (3) demonstrates great generalizability for both encoder and decoder models; and (4) is easy to use without much modeling change. These advantages enable maximum flexibility when applying random-LTD to various workloads.
|
|
908
|
+
|
|
909
|
+
Thanks to its great flexibility, we were able to apply random-LTD method to broader applications, including BERT and GPT pretraining as well as ViT and GPT finetuning tasks. For all cases, random-LTD achieves similar model quality as baseline while using less data, and/or achieve better model quality while using the same amount of data (Table 3 to 6). For GPT-3 and BERT-Large pretraining, random-LTD achieves 1.5-2x data saving while still maintaining the same model quality. For GPT-3 we also tested random-LTD with full data which further improves the model quality compared to baseline.
|
|
910
|
+
|
|
911
|
+
Table 3: GPT-3 1.3B pretraining data consumption and average evaluation accuracy on 19 tasks.
|
|
912
|
+
|
|
913
|
+
Table 4: BERT-Large pretraining data consumption and average GLUE finetuning score on 8 tasks.
|
|
914
|
+
|
|
915
|
+
Table 5: Finetuning result of ViT on ImageNet.
|
|
916
|
+
|
|
917
|
+
Table 6: GPT-2 350M finetuning result on the PTB task.
|
|
918
|
+
|
|
919
|
+
The curriculum learning and random-LTD techniques are complementary. Inside DeepSpeed Data Efficiency framework, we seamlessly compose the two techniques as shown in Figure 2 above, where curriculum learning helps to sample the next data batch and random-LTD helps to decide how to route each sampled data inside the model. DeepSpeed Data Efficiency solves several complexities when composing the two techniques so that users can easily apply each technique or both to their training pipeline. The composability of DeepSpeed Data Efficiency also applies to data sampling and routing techniques in general, so that it provides a platform to implement and compose additional data efficiency techniques.
|
|
920
|
+
|
|
921
|
+
The composed DeepSpeed Data Efficiency solution leverages both data efficiency techniques and achieves even better data and training efficiency. Take the GPT-3 pretraining task as an example, composing CL and random-LTD, with 100% data, leads to the best model quality in our experiments (Table 7 Case (1) to (4)). When pretraining with 50% data, the baseline training results in worse zero-shot and 10-shot evaluation accuracy, and using either CL or random-LTD can only recover part of the 10-shot accuracy loss. On the other hand, the composed data efficiency solution achieves the same or better accuracy results as baseline with 100% data, demonstrating a 2x data and 2x time saving (Case (5) to (8)). Similar benefit such as 2x data saving was also observed when applying our solution to BERT pretraining.
|
|
922
|
+
|
|
923
|
+
Table 7: GPT-3 1.3B pretraining data/time consumption and average evaluation accuracy on 19 tasks.
|
|
924
|
+
|
|
925
|
+
We are very excited to share DeepSpeed Data Efficiency library with the community and improve it with your feedback. Please find the code, tutorial, and documents at the DeepSpeed GitHub, and website. And for more technical details please read our Random-LTD paper and DeepSpeed Data Efficiency paper. We believe that our composable library and novel data efficiency techniques will help users reduce training cost while maintaining model quality or achieve better quality under similar cost. And we hope DeepSpeed Data Efficiency could become a platform that motivates and accelerates future research on deep learning data efficiency.
|
|
926
|
+
|
|
927
|
+
Updated: December 11, 2022
|
|
928
|
+
|
|
929
|
+
---
|
|
930
|
+
|
|
931
|
+
## DeepSpeed Inference: Multi-GPU inference with customized inference kernels and quantization support
|
|
932
|
+
|
|
933
|
+
**URL:** https://www.deepspeed.ai/2021/03/15/inference-kernel-optimization.html
|
|
934
|
+
|
|
935
|
+
**Contents:**
|
|
936
|
+
- DeepSpeed Inference: Multi-GPU inference with customized inference kernels and quantization support
|
|
937
|
+
- Contents
|
|
938
|
+
- Multi-GPU Inference with Adaptive Parallelism
|
|
939
|
+
- Customized Inference Kernels for Boosted Compute Efficiency of Transformer Blocks
|
|
940
|
+
- Kernel-Fusion
|
|
941
|
+
- Seamless pipeline from training to inference with automatic kernel-injection
|
|
942
|
+
- Flexible quantization support
|
|
943
|
+
- Performance results
|
|
944
|
+
|
|
945
|
+
While DeepSpeed supports training advanced large-scale models, using these trained models in the desired application scenarios is still challenging due to three major limitations in existing inference solutions: 1) lack of support for multi-GPU inference to fit large models and meet latency requirements, 2) limited GPU kernel performance when running inference with small batch sizes, and 3) difficulties in exploiting quantization, which includes both quantizing the model to reduce the model size and latency as well as supporting high-performance inference of quantized models without specialized hardware.
|
|
946
|
+
|
|
947
|
+
To handle these challenges, we introduce DeepSpeed Inference, which seamlessly adds high-performance inference support to large models trained in DeepSpeed with three key features: inference-adapted parallelism for multi-GPU inference, inference-optimized kernels tuned for small batch sizes, and flexible support for quantize-aware training and inference kernels for quantized models.
|
|
948
|
+
|
|
949
|
+
Parallelism is an effective approach to fit large models and reduce per-device memory consumption for both training and inference. However, simply applying training parallelism choices and degree to inference does not work well. The MP and PP configuration is normally set during the model training, apart from the data parallelism (DP), based on the memory footprint and computation style, and resource budget. On one hand, inference computation intrinsically requires less memory, so it can afford a larger partition per device. It helps reduce the degree of parallelism needed for model deployment. On the other hand, optimizing latency or meeting latency requirements is often a first-class citizen in inference while training optimizes throughput.
|
|
950
|
+
|
|
951
|
+
To obtain desired latency, DeepSpeed Inference automatically adapts MP as an effective approach to reduce model latency, and its parallelism degree is often determined first. With MP, we can split the mode and parallelize computational operations across multiple devices (GPUs) to reduce latency, but it reduces computation granularity and increases communication that may hurt throughput. Once the latency target has been met, DeepSpeed can apply pipeline parallelism to maximize the throughput. Overall, DeepSpeed Inference supports flexible adaptation of both parallelism approach and degree choices from training to inference, minimizing latency while saving deployment costs.
|
|
952
|
+
|
|
953
|
+
To achieve high compute efficiency, DeepSpeed-inference offers inference kernels tailored for Transformer blocks through operator fusion, taking model-parallelism for multi-GPU into account. The main difference between our kernel-fusion scheme and similar approaches is that we not only fuse element-wise operations (such as bias-add, residual, and activation function), but also merge the General matrix multiply (GeMM) operations with other operations. To do this, we design an efficient implementation for the vector-matrix or skinny matrix-matrix multiplication that allows us to fuse more operations at the reduction boundary of GeMM operations.
|
|
954
|
+
|
|
955
|
+
We take two main policies for fusing operations: 1) keeping the access-pattern of inputs and outputs intact throughout the sequence of operations fused together; 2) fusing operations at each all-reduce boundary. The first policy ensures that different thread-blocks won’t encounter transferring data between Streaming-Multiprocessors (SMs). This is due to no straight-forward communication among SMs other than using the main memory which adds the block-synching overhead because of non-deterministic behavior of memory access. The reason behind the second policy is that we cannot continue the execution unless the partial results are reduced among the model-parallel GPUs.
|
|
956
|
+
|
|
957
|
+
Figure 1: Transformer Layer with Megatron-style model-parallelism all-reduce components. The figure illustrates the parts of layer fused together with broken lines (width of line shows the fusion depth).
|
|
958
|
+
|
|
959
|
+
Figure 1 shows the different components of a Transformer layer, and the groups of operations considered for fusion in our inference optimization. We also consider the NVIDIA Megatron-LM style of parallelism that partitions attention (Attn) and feed-forward (FF) blocks across multiple GPUs. Thus, we include the two all-reduce operations that reduce the results among parallel GPUs after Attn and FF blocks. As Figure 1 shows, we fuse the operations inside a Transformer layer at four main regions:
|
|
960
|
+
|
|
961
|
+
To fuse these operations, we exploit shared-memory as an intermediate cache for transferring data between reduction operations used in layer-norm and GeMM, and the element-wise operations. Moreover, we use the warp-level instructions to communicate data between threads when reducing partial computations. In addition, we use a new schedule for GeMM operations, which allows for fusing as many operations as needed for the third kernel-fusion. We also combine the GeMMs for the attention computation in the second kernel-fusion, by using an implicit matrix transformation in order to reduce the memory pressure. Compared to the unfused computation style using cuBLAS GeMM, we improve the performance by 1.5x, 2.9x. 3x, and 1.2x for all these kernel-fusions, respectively.
|
|
962
|
+
|
|
963
|
+
To run the model in Inference mode, DeepSpeed simply requires the location of the model checkpoints and the desired parallelism configuration, i.e., MP/PP degree. DeepSpeed Inference kernels can also be enabled for many well-known model architectures such as HuggingFace (Bert and GPT-2) or Megatron GPT-based models using a pre-defined policy map that maps the original parameters to the parameters in the inference kernels. For other transformer-based models, user can specify their own policy map. Note that DS-Inference can run independent of the training pipeline as long as it receives all model checkpoints, and the DeepSpeed Transformer kernels for inference can be injected into any Transformer model if the right mapping policy is defined. For more information on how to enable Transformer inference kernel as well as specifying parallelism, please refer to out inference tutorial.
|
|
964
|
+
|
|
965
|
+
To further reduce the inference cost for large-scale models, we created the DeepSpeed Quantization Toolkit, supporting flexible quantize-aware training and high-performance kernels for quantized inference.
|
|
966
|
+
|
|
967
|
+
For training, we introduce a novel approach called Mixture of Quantization (MoQ), which is inspired by mixed-precision training while seamlessly applying quantization. With MoQ, we can control the precision of the model by simulating the impact of quantization when updating the parameters at each step of training. Moreover, it supports flexible quantization policies and schedules—we find that by dynamically adjusting the number of quantization bits during training, the final quantized model provides higher accuracy under the same compression ratio. To adapt to different tasks, MoQ can also leverage the second order information of models to detect their sensitivity to precision and adjust the quantization schedule and target accordingly.
|
|
968
|
+
|
|
969
|
+
To maximize the performance gains from the quantization model, we provide inference kernels tailored for quantized models that reduce latency through optimizing data movement but do not require specialized hardware. Finally, our toolkit does not require any code changes on the client side, making it easy to use.
|
|
970
|
+
|
|
971
|
+
Boosting throughput and reducing inference cost. Figure 3 shows the inference throughput per GPU for the three model sizes corresponding to the three Transformer networks, GPT-2, Turing-NLG, and GPT-3. DeepSpeed Inference increases in per-GPU throughput by 2 to 4 times when using the same precision of FP16 as the baseline. By enabling quantization, we boost throughput further. We reach a throughput improvement of 3x for GPT-2, 5x for Turing-NLG, and 3x for a model that is similar in characteristics and size to GPT-3, which directly translates to 3–5x inference cost reduction on serving these large models. In addition, we achieve these throughput and cost improvements without compromising latency as shown in Figure 5.
|
|
972
|
+
|
|
973
|
+
Figure 3: Inference throughput for different model sizes. DeepSpeed Inference achieves 3x to 5x higher throughput than baseline.
|
|
974
|
+
|
|
975
|
+
One source of inference cost reduction is through reducing the number of GPUs for hosting large models as shown in Figure 4. The optimized GPU resources comes from 1) using inference-adapted parallelism, allowing users to adjust the model and pipeline parallelism degree from the trained model checkpoints, and 2) shrinking model memory footprint by half with INT8 quantization. As shown in this figure, we use 2x less GPUs to run inference for the 17B model size by adapting the parallelism. Together with INT8 quantization through DeepSpeed MoQ, we use 4x and 2x fewer GPUs for 17B and 175B sizes respectively.
|
|
976
|
+
|
|
977
|
+
Figure 4: Number of GPUs used for running inference on the different model sizes shown in Figure 4.
|
|
978
|
+
|
|
979
|
+
Reducing inference latency. For the application scenarios where inference latency is critical, we can increase model parallelism degree in DeepSpeed Inference to reduce inference latency further. As Figure 5 depicts, we can reduce the latency by 2.3x compared to PyTorch as we increase the model-parallelism size to 4. Furthermore, we can still have high latency improvement with a fewer number of GPUs by adapting the parallelism at inference and using MoQ to quantize the model. We obtain 1.3x and 1.9x speedups while using 4x and 2x lower resources than baseline, respectively.
|
|
980
|
+
|
|
981
|
+
For the application scenarios where inference latency is critical, we can increase model parallelism degree in DeepSpeed Inference to reduce inference latency further. As Figure 5 depicts, we can reduce the latency by 2.3x compared to PyTorch as we increase the model-parallelism size to 4. Furthermore, we can still have high latency improvement with a fewer number of GPUs by adapting the parallelism at inference and using MoQ to quantize the model. We obtain 1.3x and 1.9x speedups while using 4x and 2x lower resources than baseline, respectively.
|
|
982
|
+
|
|
983
|
+
Figure 5. Inference latency for the 17B model using different parallelism configuration to optimize latency.
|
|
984
|
+
|
|
985
|
+
Updated: March 15, 2021
|
|
986
|
+
|
|
987
|
+
---
|
|
988
|
+
|
|
989
|
+
## Inference Overview and Features
|
|
990
|
+
|
|
991
|
+
**URL:** https://www.deepspeed.ai/inference/
|
|
992
|
+
|
|
993
|
+
**Contents:**
|
|
994
|
+
- Inference Overview and Features
|
|
995
|
+
- Contents
|
|
996
|
+
|
|
997
|
+
DeepSpeed-Inference v2 is here and it’s called DeepSpeed-FastGen! For the best performance, latest features, and newest model support please see our DeepSpeed-FastGen release blog!
|
|
998
|
+
|
|
999
|
+
DeepSpeed-Inference introduces several features to efficiently serve transformer-based PyTorch models. It supports model parallelism (MP) to fit large models that would otherwise not fit in GPU memory. Even for smaller models, MP can be used to reduce latency for inference. To further reduce latency and cost, we introduce inference-customized kernels. Finally, we propose a novel approach to quantize models, called MoQ, to both shrink the model and reduce the inference cost at production. For more details on the inference related optimizations in DeepSpeed, please refer to our blog post.
|
|
1000
|
+
|
|
1001
|
+
DeepSpeed provides a seamless inference mode for compatible transformer based models trained using DeepSpeed, Megatron, and HuggingFace, meaning that we don’t require any change on the modeling side such as exporting the model or creating a different checkpoint from your trained checkpoints. To run inference on multi-GPU for compatible models, provide the model parallelism degree and the checkpoint information or the model which is already loaded from a checkpoint, and DeepSpeed will do the rest. It will automatically partition the model as necessary, inject compatible high performance kernels into your model and manage the inter-gpu communication. For list of compatible models please see here.
|
|
1002
|
+
|
|
1003
|
+
To get started with DeepSpeed-Inference, please checkout our tutorial.
|
|
1004
|
+
|
|
1005
|
+
---
|
|
1006
|
+
|
|
1007
|
+
## Mixture-of-Quantization: A novel quantization approach for reducing model size with minimal accuracy impact
|
|
1008
|
+
|
|
1009
|
+
**URL:** https://www.deepspeed.ai/2021/05/04/MoQ.html
|
|
1010
|
+
|
|
1011
|
+
**Contents:**
|
|
1012
|
+
- Mixture-of-Quantization: A novel quantization approach for reducing model size with minimal accuracy impact
|
|
1013
|
+
- Contents
|
|
1014
|
+
- A unified suite for quantization-aware training and inference
|
|
1015
|
+
- Quantization methodology
|
|
1016
|
+
- Quantized Inference Kernels
|
|
1017
|
+
- Ease of use
|
|
1018
|
+
- Improving quantization accuracy.
|
|
1019
|
+
|
|
1020
|
+
Running large-scale models on multi-GPU might help reduce latency but increases the deployment cost significantly, especially as the model size grows bigger. To mitigate this issue, we resort to model compression techniques and introduce a new methodology that quantizes Transformer networks with a minimal impact on accuracy. Our technique achieves similar or better performance thanFP16 models through customized inference kernels on lower or equal number of GPUs.
|
|
1021
|
+
|
|
1022
|
+
Our scheme is flexible in the sense that it provides users the ability to experiment with any quantization configuration, such as the target number of bits used for quantization precision, and the scheduling by which the model gets quantized during training. Furthermore, we combine both the FP16 and quantized precision as a mixed-precision mechanism to smooth the transition from a high to low precision. Finally, we use the second-order gradient (eigenvalue) of the parameters to adjust the quantization schedule during training.
|
|
1023
|
+
|
|
1024
|
+
There are two main approaches of applying quantization: offline quantization on the trained model and quantization-aware training (QAT) that reduces the data-precision during training. Unlike the former scheme, QAT gets the model trained by taking the impact of precision loss into account during the training optimization. This will result in significant improvement of the quantized model accuracy. MoQ is designed on top QAT approach, with the difference that we use a mixture of precisions to train the model toward target quantization, as well as defining a scheduling for reducing the precision.
|
|
1025
|
+
|
|
1026
|
+
All existing QAT approaches quantize the model with a certain precision (number of bits) from the beginning of training until completion. However, even by using a relatively high quantization precision (8-bit), there will be some drop in model accuracy, which might not be acceptable for some downstream tasks. For instance, the Q8BERT work tries QAT for the BERT network, which results in good accuracy for some tasks while others (like SQuAD) lose 0.8% in the F1 score. Other techniques, such as Q-BERT, use grouped quantization with a large grouping size (128) when quantizing a parameter matrix to gain higher accuracy, but they are still inferior to the baseline.
|
|
1027
|
+
|
|
1028
|
+
Here, we present MoQ as a flexible solution for linear quantization that allows users to define a schedule as the model trains. Similar to iterative pruning to inject sparsity, we start quantization from a higher precision (16-bit quantization or FP16) and gradually reduce the quantization bits or the mixed-precision ratio for the FP16 part until reaching a target precision (8-bit). To control the precision transition, we define a hyperparameter, called quantization period, that indicates when the precision reduction should happen. We observe that by using such a schedule, we get the closest accuracy to the baseline. Note that in order to reach a certain precision, we need to define the starting bits and period in a way that within the number of samples to train, the model eventually gets quantized using the target number of bits. Please refer to the quantization tutorial for more information.
|
|
1029
|
+
|
|
1030
|
+
In order to dynamically adjust quantization precision, we employ eigenvalue as a metric that shows the sensitivity of training to the precision change. Eigenvalue has been previously used (Q-BERT) for quantization to choose the precision bits on different parts of the network. To combine this with MoQ, we cluster the eigenvalues into several regions based on their absolute values and tune the quantization period for each region accordingly, the higher the magnitude of eigenvalue, the larger the factor and the slower the precision decreases.
|
|
1031
|
+
|
|
1032
|
+
Figure 1. Quantization scheduling of one of the GLUE tasks (QNLI), using the eigenvalue of different layers. Different colors show the layers from 0 to 11 for Bert-Base.
|
|
1033
|
+
|
|
1034
|
+
Figure 1 shows the result of combining eigenvalue with MoQ for a 12-layer Bert Base model. As we see, the first few layers (0-4) tend to be more sensitive to reduced precision than the last layers, as their quantization period is an order of magnitude larger than the rest. Another observation from this figure is that the neighbor layers reduce the precision in the same way. For instance, layers 9, 10, and 11 on the left chart, and layers 0 and 4 and 1 and 3 on the right chart of Figure 1 get similar schedule. This is due to having similar eigenvalues for these layers throughout the training.
|
|
1035
|
+
|
|
1036
|
+
Figure 2: Mixed-precision quantization for the QNLI using target quantization period as 4 bits.
|
|
1037
|
+
|
|
1038
|
+
Figure 2 shows another mixed-precision quantization that sets target bits as 4, however the quantization period keeps updated through the eigenvalues of each layer. As we see, the end quantization bits are different for all layers. The first layers still get to 8-bit quantization as the training samples is not enough to decrease the quantization bits. On the other hand, the last layers keep reducing the precision. We finally reduce the average precision to 6 bits for the entire network while maintaining the accuracy of the model (0.3% drop in accuracy).
|
|
1039
|
+
|
|
1040
|
+
Figure 3: Mixed-precision quantization with MoQ for Bert SQuAD plus.
|
|
1041
|
+
|
|
1042
|
+
As another example, we use eigenvalue-based MoQ to quantize Bert-Large for SQuAD finetuning. Figure 3 shows the number of bits we get to at the end of finetuning on each layer. Here, we see slightly different precision spectrum compared to BertBase on GLUE tasks. As the figure shows, we can reduce the precision on the first few layers more aggressively than the middle ones. Also, the last few layers can tolerate very low precision similar to the beginning layers. This way of quantization finally results in 90.56 F1 Score which is pretty similar to the baseline.
|
|
1043
|
+
|
|
1044
|
+
By using other quantization methodologies, after the model is quantized, it can only have performance benefit if there is hardware support for integer-based operations. For this reason, the inputs and output of all GeMM operations need to be quantized. However, since the range of input may vary request by request, finding a range of data for each input at inference time is challenging. On the other hand, using a static range for all inputs can impact the inference accuracy.
|
|
1045
|
+
|
|
1046
|
+
To alleviate this problem, we introduce inference custom kernels that neither require the hardware support nor the input quantization. These kernels read quantized parameters and dequantize them on-the-fly and use the floating-point units of GPU cores for the GeMM operations. The main benefit of using these kernels is that they reduce the memory footprint required to load a model so that we can run inference on fewer number of GPUs, while improving the performance by saving the memory bandwidth required to run the inference on GPU.
|
|
1047
|
+
|
|
1048
|
+
Regarding the quantization implementation, we use different algorithms to quantize a value based on the range of data and the rounding policy. We support both symmetric and asymmetric quantization as the two mostly used schemes. We applied both techniques for QAT and see very similar results, however since symmetric approach is simpler to implement, we implement our inference kernels based on that. Regarding the rounding, we support stochastic rounding as another option besides the normal rounding. We have seen that for reducing the precision to as low as 4-bit or lower, stochastic rounding is more helpful as it has an unbiased random behavior during training.
|
|
1049
|
+
|
|
1050
|
+
For enabling quantization through Deepspeed, we only need to pass the scheduling through a JSON configuration file. To add the impact of quantization, we quantize and dequantize the parameters just before they are updated in the optimizer. Thus, we do not incur any change on the modeling side to quantize a model. Instead, we simulate the quantization impact by lowering the precision of data saved in FP16 format. By using this kind of implementation, we have the full flexibility of changing the precision using the training characteristics such as number of steps, and eigenvalue of the parameters and the original FP16 data format. As shown in this blog post, we can improve the quality of a quantized model by adaptively changing the scheduling of the quantization throughout training. For more information on how to use MoQ scheme, please look at our quantization tutorial.
|
|
1051
|
+
|
|
1052
|
+
To show how our quantization scheme preserves accuracy, we have experimented MoQ on several tasks and networks: GLUE tasks on Bert-Base and SQuAD on Bert-Large. Table 1 shows the accuracy results for the baseline without quantization (w/o Quant), basic quantization without using any scheduling during training (Basic Quant), and our MoQ scheme. Without using any scheduling, the accuracy for 8-bit quantization is often inferior to the baseline, and in this workload, it suffers from a drop of 1.02 point in accuracy (ACC). In contrast, MoQ powers 8-bit quantization to obtain comparable accuracy as the FP16 baseline, even with a slightly higher ACC, demonstrating the effectiveness of our quantization approach.
|
|
1053
|
+
|
|
1054
|
+
---
|
|
1055
|
+
|
|
1056
|
+
## DeepSpeed: Accelerating large-scale model inference and training via system optimizations and compression
|
|
1057
|
+
|
|
1058
|
+
**URL:** https://www.deepspeed.ai/2021/05/14/inference-release.html
|
|
1059
|
+
|
|
1060
|
+
**Contents:**
|
|
1061
|
+
- DeepSpeed: Accelerating large-scale model inference and training via system optimizations and compression
|
|
1062
|
+
- Contents
|
|
1063
|
+
|
|
1064
|
+
Updated: May 14, 2021
|
|
1065
|
+
|
|
1066
|
+
---
|
|
1067
|
+
|
|
1068
|
+
## Autotuning: Automatically discover the optimal DeepSpeed configuration that delivers good training speed
|
|
1069
|
+
|
|
1070
|
+
**URL:** https://www.deepspeed.ai/2021/11/16/autotuning.html
|
|
1071
|
+
|
|
1072
|
+
**Contents:**
|
|
1073
|
+
- Autotuning: Automatically discover the optimal DeepSpeed configuration that delivers good training speed
|
|
1074
|
+
|
|
1075
|
+
We introduce a new feature called Autotuning to automatically discover the optimal DeepSpeed configuration that delivers good training speed. One pain point in model training is to figure out good performance-relevant configurations such as micro-batch size to fully utilize the hardware and achieve a high throughput number. This configuration exploring process is commonly done manually but is important since model training is repeated many times and benefits from using a good configuration. Not only is the hand-tuning process time-consuming, but the outcome is hardware-dependent. This means that a good configuration on one hardware might not be the best on another different hardware. The user thus has to hand tune the configuration again. With DeepSpeed, there are more configuration parameters that could potentially affect the training speed, thus making it more tedious to manually tune the configuration.
|
|
1076
|
+
|
|
1077
|
+
The DeepSpeed Autotuner mitigates this pain point and automatically discovers the optimal DeepSpeed configuration that delivers good training speed. It not only reduces the time and resources users spend on tuning, but also can discover configurations better than hand-tuned methods. DeepSpeedExamples would demonstrate the effectiveness of autotuning across different models.
|
|
1078
|
+
|
|
1079
|
+
Updated: November 16, 2021
|
|
1080
|
+
|
|
1081
|
+
---
|
|
1082
|
+
|
|
1083
|
+
## Contributing
|
|
1084
|
+
|
|
1085
|
+
**URL:** https://www.deepspeed.ai/contributing/
|
|
1086
|
+
|
|
1087
|
+
**Contents:**
|
|
1088
|
+
- Contributing
|
|
1089
|
+
- Contents
|
|
1090
|
+
- Prerequisites
|
|
1091
|
+
- Testing
|
|
1092
|
+
- Unit Tests
|
|
1093
|
+
- Model Tests
|
|
1094
|
+
- Contributor License Agreement
|
|
1095
|
+
- Code of Conduct
|
|
1096
|
+
|
|
1097
|
+
DeepSpeed welcomes your contributions!
|
|
1098
|
+
|
|
1099
|
+
DeepSpeed uses pre-commit to ensure that formatting is consistent across DeepSpeed. First, ensure that pre-commit is installed from either installing DeepSpeed or pip install pre-commit. Next, the pre-commit hooks must be installed once before commits can be made:
|
|
1100
|
+
|
|
1101
|
+
Afterwards, our suite of formatting tests run automatically before each git commit. You can also run these manually:
|
|
1102
|
+
|
|
1103
|
+
If a formatting test fails, it will fix the modified code in place and abort the git commit. After looking over the changes, you can git add <modified files> and then repeat the previous git commit command.
|
|
1104
|
+
|
|
1105
|
+
DeepSpeed tracks two types of tests: unit tests and more costly model convergence tests. The model convergence tests train DeepSpeedExamples and measure end-to-end convergence and related metrics. Unit tests are found in tests/unit/ and the model convergence tests are found in tests/model/.
|
|
1106
|
+
|
|
1107
|
+
PyTest is used to execute tests. PyTest can be installed from PyPI via pip install pytest. Simply invoke pytest --forked to run the unit tests:
|
|
1108
|
+
|
|
1109
|
+
You can also provide the -v flag to pytest to see additional information about the tests. Note that pytest-forked and the --forked flag are required to test CUDA functionality in distributed tests.
|
|
1110
|
+
|
|
1111
|
+
Model tests require four GPUs and training data downloaded for DeepSpeedExamples.
|
|
1112
|
+
|
|
1113
|
+
To execute model tests, first install DeepSpeed. The DeepSpeedExamples repository is cloned as part of this process. Next, execute the model test driver:
|
|
1114
|
+
|
|
1115
|
+
Note that the --forked flag is not necessary for the model tests.
|
|
1116
|
+
|
|
1117
|
+
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
|
|
1118
|
+
|
|
1119
|
+
When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
|
|
1120
|
+
|
|
1121
|
+
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
|
|
1122
|
+
|
|
1123
|
+
**Examples:**
|
|
1124
|
+
|
|
1125
|
+
Example 1 (unknown):
|
|
1126
|
+
```unknown
|
|
1127
|
+
pre-commit install
|
|
1128
|
+
```
|
|
1129
|
+
|
|
1130
|
+
Example 2 (unknown):
|
|
1131
|
+
```unknown
|
|
1132
|
+
pre-commit run --all-files
|
|
1133
|
+
```
|
|
1134
|
+
|
|
1135
|
+
Example 3 (unknown):
|
|
1136
|
+
```unknown
|
|
1137
|
+
pytest --forked tests/unit/
|
|
1138
|
+
```
|
|
1139
|
+
|
|
1140
|
+
Example 4 (unknown):
|
|
1141
|
+
```unknown
|
|
1142
|
+
cd tests/model/
|
|
1143
|
+
pytest run_sanity_check.py
|
|
1144
|
+
```
|
|
1145
|
+
|
|
1146
|
+
---
|
|
1147
|
+
|
|
1148
|
+
## Latest News
|
|
1149
|
+
|
|
1150
|
+
**URL:** https://www.deepspeed.ai
|
|
1151
|
+
|
|
1152
|
+
**Contents:**
|
|
1153
|
+
- Latest News
|
|
1154
|
+
- Contents
|
|
1155
|
+
- Extreme Speed and Scale for DL Training
|
|
1156
|
+
- DeepSpeed Adoption
|
|
1157
|
+
- Contributing
|
|
1158
|
+
- Contributor License Agreement
|
|
1159
|
+
- Code of Conduct
|
|
1160
|
+
- Publications
|
|
1161
|
+
- Videos
|
|
1162
|
+
|
|
1163
|
+
[2025/10] SuperOffload: Unleashing the Power of Large-Scale LLM Training on Superchips
|
|
1164
|
+
|
|
1165
|
+
[2025/10] Study of ZenFlow and ZeRO offload performance with DeepSpeed CPU core binding
|
|
1166
|
+
|
|
1167
|
+
[2025/08] ZenFlow: Stall-Free Offloading Engine for LLM Training
|
|
1168
|
+
|
|
1169
|
+
[2025/06] Arctic Long Sequence Training (ALST) with DeepSpeed: Scalable And Efficient Training For Multi-Million Token Sequences
|
|
1170
|
+
|
|
1171
|
+
[2025/06] DeepNVMe: Affordable I/O scaling for Deep Learning Applications
|
|
1172
|
+
|
|
1173
|
+
DeepSpeed enabled the world’s most powerful language models (at the time of this writing) such as MT-530B and BLOOM. DeepSpeed offers a confluence of system innovations, that has made large scale DL training effective, and efficient, greatly improved ease of use, and redefined the DL training landscape in terms of scale that is possible. These innovations include ZeRO, 3D-Parallelism, DeepSpeed-MoE, ZeRO-Infinity, etc.
|
|
1174
|
+
|
|
1175
|
+
DeepSpeed has been used to train many different large-scale models. Below is a list of several examples that we are aware of (if you’d like to include your model please submit a PR):
|
|
1176
|
+
|
|
1177
|
+
DeepSpeed has been integrated with several different popular open-source DL frameworks such as:
|
|
1178
|
+
|
|
1179
|
+
DeepSpeed is an integral part of Microsoft’s AI at Scale initiative to enable next-generation AI capabilities at scale.
|
|
1180
|
+
|
|
1181
|
+
DeepSpeed welcomes your contributions! Please see our contributing guide for more details on formatting, testing, etc.
|
|
1182
|
+
|
|
1183
|
+
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
|
|
1184
|
+
|
|
1185
|
+
When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
|
|
1186
|
+
|
|
1187
|
+
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
|
|
1188
|
+
|
|
1189
|
+
Xinyu Lian, Sam Ade Jacobs, Lev Kurilenko, Masahiro Tanaka, Stas Bekman, Olatunji Ruwase, Minjia Zhang. (2024) Universal Checkpointing: Efficient and Flexible Checkpointing for Large Scale Distributed Training arXiv:2406.18820
|
|
1190
|
+
|
|
1191
|
+
---
|