Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Hugging Face 25 min read Deep dive hardMaster

The Technology Behind BLOOM Training

BLOOM, a 176B-parameter multilingual GPT-3-style model, was trained over 3.5 months on 384 A100 80GB GPUs on the Jean Zay supercomputer using Megatron-DeepSpeed's 3D parallelism. ZeRO data parallelism shards parameters, gradients and optimizer states across GPUs. Megatron-LM tensor parallelism splits GEMMs column-wise then row-wise, needing two all-reduces per layer, so it should stay within a single node's fast interconnect. Pipeline parallelism uses micro-batches (chunks/GAS) to shrink the idle bubble, with global batch size computed as mbs*chunks*dp_degree. Hardware, checkpoint sizes (2.3TB full, 329GB bf16 weights) and dataset details are also covered.

Related posts

  • Incredibly Fast BLOOM Inference with DeepSpeed and Accelerate

    Hugging Face hardMaster

    Running the 176B-parameter BLOOM model (352GB in bf16) for inference is benchmarked across HuggingFace Accelerate, DeepSpeed-Inference and DeepSpeed ZeRO-Inference on an 8x80GB A100 node, with 8-bit quantized variants via BitsAndBytes and DeepSpeed. DeepSpeed-Inference reaches under 1 ms per token at batch size 128, thanks to tensor parallelism and fused CUDA kernels, and its pre-sharded checkpoints load in about a minute. Accelerate's naive pipeline parallelism leaves most GPUs idle but works with almost any model, and it offloads to CPU or disk when GPU memory runs out. ZeRO can run independent streams on each GPU, and int8 halves the memory needed (4 GPUs suffice) at a modest throughput cost. Setup and run commands for each approach are included.

  • Optimization story: Bloom inference

    Hugging Face hardMaster

    Hugging Face's BLOOM (176B parameters, 352GB in bf16) inference server reached 5x lower latency and 50x higher throughput over several weeks, starting from 0.3 req/s and 350ms/token on 16xA100 40GB with pipeline parallelism via Accelerate's device_map="auto". A FLOPs estimate (~17 TFLOP per forward pass, a theoretical floor of about 3ms/token) showed how far off that baseline was. The team weighed tensor parallelism against pipeline parallelism and tried a JAX/Flax port on TPUs, ONNX/TensorRT and DeepSpeed. Lessons include using small test models and fixed greedy-generation prompt suites to catch numerical drift, and staying within PyTorch for flexibility after DeepSpeed proved unstable under webserver load.

  • Fast Inference on Large Language Models: BLOOMZ on Habana Gaudi2 Accelerator

    Hugging Face mediumAdept

    BLOOMZ (176B parameters, 352 GB in 16-bit) runs inference on a single 8-HPU Habana Gaudi2 server using Optimum Habana with Habana's DeepSpeed-inference fork, HPU graphs and a KV cache. In batch-1 greedy generation of 100 tokens, Gaudi2 is 1.42x faster than an 8x A100 80GB setup on the 176B model (3.1 s vs 4.4 s) and 2.89x faster on BLOOMZ-7B. Unlike A100, Gaudi2 benefits from model parallelism on the 7B model. First-gen Gaudi (AWS DL1, about $13/hr) offers better price-performance than A100 for the 7B checkpoint, and the post includes commands to reproduce the benchmark or run generation over any Hugging Face dataset.

  • Ulysses Sequence Parallelism: Training with Million-Token Contexts

    Hugging Face hardMaster

    Ulysses Sequence Parallelism, part of Snowflake's Arctic Long Sequence Training protocol, enables training on contexts of hundreds of thousands to millions of tokens. Each GPU holds a shard of the sequence, and all-to-all collectives regroup the data so each GPU computes attention over every position for a subset of heads. That costs O(n·d/P) communication per GPU, versus O(n·d) over P−1 serial hops for Ring Attention. Ulysses is now integrated into Hugging Face Accelerate (ParallelismConfig with a DeepSpeed backend), the Transformers Trainer and TRL's SFTTrainer, which handle dataloader sharding, shifted labels and token-weighted loss aggregation automatically. Practical guidance covers padding to a multiple of sp_size, the num_heads ≥ sp_size constraint, choosing FlashAttention versions, ZeRO-3 offload, expandable_segments, Liger-Kernel, and balancing SP against DP across GPU counts.

  • How Meta trains large language models at scale

    Meta Engineering easyNovice

    Training LLMs at Meta shifted workloads from many small recommendation jobs to a few enormous GPU jobs, forcing changes across hardware, data center layout, reliability, networking and storage. Meta adapted its Grand Teton H100 platform (700W TDP, HBM3, still air-cooled), repacked data halls for GPU density, and tracks common failure modes such as GPUs dropping off PCIe, DRAM/SRAM uncorrectable errors and network cable faults. Instead of choosing between fabrics, it built two 24K-GPU clusters, one RoCE and one InfiniBand, and tuned both to equivalent performance for Llama 3 training. The tuning relied on topology-aware placement of parallelism traffic, custom collectives such as recursive doubling/halving in place of rings, and load balancing to handle fat flows.

The quest for software engineering knowledge.

Look:
Layout: