liveBook · Manning

DeepSpeed

As explained in Domain-Specific Small Language Models

An open-source deep learning optimization library that supports distributed training and inference and is used here to speed up and memory-optimize Transformer models.

DeepSpeed is an open-source deep learning optimization library for reducing compute and memory use during distributed training and inference. It supports PyTorch and integrates with Transformers and Accelerate, helping larger Transformer models fit on one GPU or a cluster. section 4.3.4

Its main optimization mechanisms include:

  • ZeRO, mixed-precision training, custom model parallelism, and inference-specific kernels. section 4.3.4
  • Automatic model partitioning, kernel injection, and inter-GPU communication management in inference mode. section 4.3.4
  • An 18% reduction in GPT-Neo inference latency compared with a baseline implementation. section 4.4

GPT-Neo inference

A notebook initializes distributed settings, loads GPT-Neo 2.7B in float16, wraps it with deepspeed.init_inference, and generates text on a CUDA device. The example reports lower average and P95 latency than the vanilla model. section 4.3.4

How Domain-Specific Small Language Models covers it

How deep it goes
Explains major mechanisms and demonstrates notebook inference, but does not detail ZeRO internals or distributed training procedures.
Examples
Uses GPT-Neo 2.7B, a T4 GPU, float16 loading, CUDA inference, generated text, and latency measurements.
What it assumes
Assumes familiarity with PyTorch, Transformers, GPU execution, and notebook environment variables.
What you can do after
Operate/configure DeepSpeed inference for a compatible Transformer model and compare its latency with a baseline.
How it connects
Connects model parallelism, mixed precision, kernel injection, ZeRO, PyTorch, Transformers, and Accelerate.

Also explained in

Compare how 2 books explain DeepSpeed →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Domain-Specific Small Language Models. The section links point to the parts of the book it draws on.