Type something to search...
Colossal AI

Colossal AI

Colossal AI

37.9k 4.2k
03 May, 2024

What is Colossal-AI ?

Maximize the runtime performance of your large neural networks with distributed techniques of Colossal-AI.

Colossal-AI Features

Colossal-AI provides a collection of parallel components for you. We aim to support you to write your

distributed deep learning models just like how you write your model on your laptop. We provide user-friendly tools to kickstart

distributed training and inference in a few lines.

Colossal-AI in the Real World


  • One half-day of training using a few hundred dollars yields similar results to mainstream large models, open-source and commercial-free domain-specific LLM solution.



[HuggingFace model weights]

[Modelscope model weights]

BackboneTokens ConsumedMMLUCMMLUAGIEvalGAOKAOCEval
Baichuan-7B-1.2T42.32 (42.30)44.53 (44.02)38.7236.7442.80
Baichuan-13B-Base-1.4T50.51 (51.60)55.73 (55.30)47.2051.4153.60
Baichuan2-7B-Base-2.6T46.97 (54.16)57.67 (57.07)45.7652.6054.00
Baichuan2-13B-Base-2.6T54.84 (59.17)62.62 (61.97)52.0858.2558.10
ChatGLM-6B-1.0T39.67 (40.63)41.17 (-)40.1036.5338.90
ChatGLM2-6B-1.4T44.74 (45.46)49.40 (-)46.3645.4951.70
InternLM-7B-1.6T46.70 (51.00)52.00 (-)44.7761.6452.80
Qwen-7B-2.2T54.29 (56.70)56.03 (58.80)52.4756.4259.60
Llama-2-7B-2.0T44.47 (45.30)32.97 (-)32.6025.46-


ColossalChat: An open-source solution for cloning ChatGPT with a complete RLHF pipeline.





  • Up to 10 times faster for RLHF PPO Stage3 Training

  • Up to 7.73 times faster for single server training and 1.42 times faster for single-GPU inference

  • Up to 10.3x growth in model capacity on one GPU

  • A mini demo training process requires only 1.62GB of GPU memory (any consumer-grade GPU)

  • Increase the capacity of the fine-tuning model by up to 3.7 times on a single GPU

  • Keep at a sufficiently high running speed


Acceleration of AIGC (AI-Generated Content) models such as Stable Diffusion v1 and Stable Diffusion v2.

  • Training: Reduce Stable Diffusion memory consumption by up to 5.6x and hardware cost by up to 46x (from A100 to RTX3060).

  • Inference: Reduce inference GPU memory consumption by 2.5x.


Acceleration of AlphaFold Protein Structure

  • FastFold: Accelerating training and inference on GPU Clusters, faster data processing, inference sequence containing more than 10000 residues.

  • xTrimoMultimer: accelerating structure prediction of protein monomers and multimer by 11x.

Parallel Training Demo


  • 70 billion parameter LLaMA2 model training accelerated by 195%




  • 65-billion-parameter large model pretraining accelerated by 38%




  • Enhanced MoE parallelism, Open-source MoE model training can be 9 times more efficient




  • Save 50% GPU resources and 10.7% acceleration


  • 11x lower GPU memory consumption, and superlinear scaling efficiency with Tensor Parallelism
  • 24x larger model size on the same hardware

  • over 3x acceleration


  • 2x faster training, or 50% longer sequence length



  • Open Pretrained Transformer (OPT), a 175-Billion parameter AI language model released by Meta, which stimulates AI programmers to perform various downstream tasks and application deployments because of public pre-trained model weights.

  • 45% speedup fine-tuning OPT at low cost in lines. [Example] [Online Serving]

Please visit our documentation and examples for more details.


  • 14x larger batch size, and 5x faster training for Tensor Parallelism = 64

Recommendation System Models

  • Cached Embedding, utilize software cache to train larger embedding tables with a smaller GPU memory budget.

Single GPU Training Demo


  • 20x larger model size on the same hardware

  • 120x larger model size on the same hardware (RTX 3080)


  • 34x larger model size on the same hardware

Inference (Energon-AI) Demo

  • Energon-AI: 50% inference acceleration on the same hardware

  • OPT Serving: Try 175-billion-parameter OPT online services

  • BLOOM: Reduce hardware deployment costs of 176-billion-parameter BLOOM by more than 10 times.



If you encounter any problem with installation, you may want to raise an issue in this repository.

Install from PyPI

You can easily install Colossal-AI with the following command. By default, we do not build PyTorch extensions during installation.

Terminal window
pip install colossalai

Note: only Linux is supported for now.

However, if you want to build the PyTorch extensions during installation, you can set CUDA_EXT=1 .

Terminal window
CUDA_EXT=1 pip install colossalai

Otherwise, CUDA kernels will be built during runtime when you actually need them.

We also keep releasing the nightly version to PyPI every week. This allows you to access the unreleased features and bug fixes in the main branch.

Installation can be made via

Terminal window
pip install colossalai-nightly

Download From Source

The version of Colossal-AI will be in line with the main branch of the repository. Feel free to raise an issue if you encounter any problems. :)

Terminal window
git clone https://github.com/hpcaitech/ColossalAI.git
cd ColossalAI
# install colossalai
pip install .

By default, we do not compile CUDA/C++ kernels. ColossalAI will build them during runtime.

If you want to install and enable CUDA kernel fusion (compulsory installation when using fused optimizer):

Terminal window
CUDA_EXT=1 pip install .

For Users with CUDA 10.2, you can still build ColossalAI from source. However, you need to manually download the cub library and copy it to the corresponding directory.

Terminal window
# clone the repository
git clone https://github.com/hpcaitech/ColossalAI.git
cd ColossalAI
# download the cub library
wget https://github.com/NVIDIA/cub/archive/refs/tags/1.8.0.zip
unzip 1.8.0.zip
cp -r cub-1.8.0/cub/ colossalai/kernel/cuda_native/csrc/kernels/include/
# install
CUDA_EXT=1 pip install .

Use Docker

Pull from DockerHub

You can directly pull the docker image from our DockerHub page. The image is automatically uploaded upon release.

Build On Your Own

Run the following command to build a docker image from Dockerfile provided.

Building Colossal-AI from scratch requires GPU support, you need to use Nvidia Docker Runtime as the default when doing docker build . More details can be found here.

We recommend you install Colossal-AI from our project page directly.

Terminal window
cd ColossalAI
docker build -t colossalai ./docker

Run the following command to start the docker container in interactive mode.

Terminal window
docker run -ti --gpus all --rm --ipc=host colossalai bash