---
title: "Optimization story: Bloom inference"
description: "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\"."
url: "https://swe.quest/articles/optimization-story-bloom-inference-d6344942eb1d22f2"
canonical: "https://huggingface.co/blog/bloom-inference-optimization"
source: "Hugging Face"
published: "2022-10-12"
difficulty: "hard"
kind: "Case study"
reading_minutes: 22
tags: ["inference","llms","performance","python"]
---

# Optimization story: Bloom inference

A post on [Hugging Face](https://swe.quest/sources/hugging-face.md), published 2022-10-12, 22 min read, Case study. Original: [https://huggingface.co/blog/bloom-inference-optimization](https://huggingface.co/blog/bloom-inference-optimization)

## Summary

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.

Written by swe.quest, not by the author.

**Difficulty:** Hard: written for specialists in the field

## Topics

- [Inference & serving](https://swe.quest/tags/inference.md) (AI & ML)
- [LLMs](https://swe.quest/tags/llms.md) (AI & ML)
- [Performance engineering](https://swe.quest/tags/performance.md) (Reliability & operations)
- [Python](https://swe.quest/tags/python.md) (Languages)

## Prerequisites

- transformer architecture ([easy posts on System design](https://swe.quest/tags/system-design.md?difficulty=easy))
- GPU model parallelism ([easy posts on Hardware](https://swe.quest/tags/hardware.md?difficulty=easy))
- PyTorch
- LLM text generation ([easy posts on LLMs](https://swe.quest/tags/llms.md?difficulty=easy))

## Keywords

BLOOM, transformers, Accelerate, DeepSpeed, JAX, Megatron-DeepSpeed, Locust, A100

## Related posts

- [Incredibly Fast BLOOM Inference with DeepSpeed and Accelerate](https://swe.quest/articles/incredibly-fast-bloom-inference-with-deepspeed-and-accelerate-7d1957ba474cbad5.md): Hugging Face · 2022-09-16 · Hard · 9 min read · Inference & serving, LLMs, Performance engineering, Hardware
  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.
- [Fast Inference on Large Language Models: BLOOMZ on Habana Gaudi2 Accelerator](https://swe.quest/articles/fast-inference-on-large-language-models-bloomz-on-habana-gaudi2-accelerator-b18b18c9b1b881f4.md): Hugging Face · 2023-03-28 · Medium · 8 min read · Inference & serving, LLMs, Hardware, Performance engineering
  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.
- [Optimizing inference speed and costs: Lessons learned from large-scale deployments](https://swe.quest/articles/optimizing-inference-speed-and-costs-lessons-learned-from-large-scale-1e80b28572985147.md): Together AI · 2026-01-22 · Easy · 6 min read · Inference & serving, LLMs, Cost optimization, Performance engineering
  Lower LLM inference latency and cost come mainly from how inference runs rather than from buying more GPUs.
- [The Technology Behind BLOOM Training](https://swe.quest/articles/the-technology-behind-bloom-training-8acc1cff08e9a54f.md): Hugging Face · 2022-07-14 · Hard · 25 min read · Model training, LLMs, Distributed systems, Hardware
  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.
- [Optimizing your LLM in production](https://swe.quest/articles/optimizing-your-llm-in-production-aa5bbb901928fa57.md): Hugging Face · 2023-09-15 · Medium · 31 min read · Inference & serving, LLMs, Performance engineering, Python
  Serving billion-parameter LLMs efficiently comes down to three levers: lower precision, Flash Attention, and inference-friendly architectures such as ALiBi, rotary embeddings, Multi-Query Attention and Grouped-Query Attention.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
