Checkpoint-engine is a simple middleware to update model weights in LLM inference engines – a critical step in reinforcement learning.
We provide an efficient and lightweight implementation for inplace weight update:
updating our Kimi-K2 model (1 Trillion parameters) across thousands of GPUs takes about 20s.
Architecture
The core weight update logic is in ParameterServer class, a service colocated with inference engines. It provides two implementations of weight update: Broadcast and P2P.
Broadcast: Used when a large number of inference instances need to update weights in synchronous. This is the fastest implementation and should be used as the default update method. See _update_per_bucket.
P2P: Used when new inference instances are dynamically added (due to restarts or dynamic availability) while the existing instances are already serving requests. Under this scenario, to avoid affecting the workloads on existing instances, we use the mooncake-transfer-engine to P2P send weights from CPUs in existing instances to GPUs in new instances. See _update_per_bucket_p2p.
Optimized Weight Broadcast
In the Broadcast implementation, the checkpoint-engine holds references to sharded weights in CPU memory, and need to efficiently broadcast them to a cluster of inference instances, often under a different sharding pattern.
We arrange the data transfer into 3 stages:
H2D: moving weights to GPU memory. These weights may come from disk or the training engine.
broadcast: broadcast among checkpoint engine workers; the data results in a CUDA IPC buffer shared with inference engine.
reload: inference engine decides what subset of weights to copy from the broadcasted data.
Checkpoint-engine orchestrates the entire transfer process. It first gathers necessary metadata to create a plan, including deciding the proper bucket size for data transfer.
It then executes the transfer, where it controls the inference engine through a ZeroMQ socket. To maximize performance, it organizes the data transfers into a pipeline with overlapped communication and copy, illustrated below. The details can be found in Kimi-K2 Technical Report.
Pipelining naturally requires more GPU memory. When memory is not enough, checkpoint-engine will fallback to serial execution.
Device Info: we tested various combination of devices and parallelism setups. For example, a 256-GPU TP16 setup means that we deploy 16 vLLM instances, each with 16-way tensor parallelism.
Since update duration is related to IPC bucket size, we provide the bucket size in the table.
The P2P time were tested for updating no more than two nodes (16 GPUs) (ParameterServer.update(ranks=range(0, 16))) out of the entire cluster.
Installation
Use the fastest broadcast implementation
pip install checkpoint-engine
Use the flexible P2P implementation, notice this will install mooncake-transfer-engine to support RDMA transfer between different ranks.
pip install 'checkpoint-engine[p2p]'
If set NCCL_IB_HCA env, checkpoint-engine will use it to auto select net devices for different ranks. If not set, it will read all RDMA devices and try to divide them into each rank.
Getting Started
Prepare an H800 or H20 machine with 8 GPUs with latest vLLM. Be sure to include /collective_rpc API endpoint commit (available in main branch) since checkpoint-engine will use this endpoint to update weights.
Start vLLM in dev mode and set --load-format dummy. Notice that we also set --worker-extension-cls=checkpoint_engine.worker.VllmColocateWorkerExtension
Meanwhile, use this command to update weights by checkpoint-engine. No need to wait for vLLM to get ready.
torchrun --nproc-per-node 8 examples/update.py --update-method all --checkpoint-path /opt/models/Qwen/Qwen3-235B-A22B-Instruct-2507/
Reuse weights from existing instances
New checkpoint-engine instances can join existing instances and reuse their weights. This is simple to achieve.
First, start the existing instances with --save-metas-file global_metas.pkl to save global metas to a file and use --sleep-time 300 to make sure they stay alive.
FP8 quantization currently do not natively work in vLLM when updating weights.
We provide a simple patch in patches/vllm_fp8.patch to handle the correct weight update.
Notice this patch is only tested in DeepSeek-V3.1 and Kimi-K2. Other models may meet some compatible issues.
A PR is opened to the vLLM project and waiting to discuss and review.
Test
Run a simple correctness test for checkpoint_engine
torchrun --nproc-per-node 8 tests/test_update.py
Limitations and Future Work
This project is currently only tested with vLLM. But it is easy to integrate with other frameworks like SGLang.
The perfect three-stage pipeline mentioned in our paper is currently not implemented. This could be useful for architectures where H2D and broadcast do not conflict in PCIE.
The P2P update method is currently not the optimal implementation since it will receive data only in rank 0 and broadcast to others synchronizely. This is a potential optimization in the future.
Checkpoint Engine
Checkpoint-engine is a simple middleware to update model weights in LLM inference engines – a critical step in reinforcement learning. We provide an efficient and lightweight implementation for inplace weight update: updating our Kimi-K2 model (1 Trillion parameters) across thousands of GPUs takes about 20s.
Architecture
The core weight update logic is in
ParameterServerclass, a service colocated with inference engines. It provides two implementations of weight update: Broadcast and P2P._update_per_bucket.mooncake-transfer-engineto P2P send weights from CPUs in existing instances to GPUs in new instances. See_update_per_bucket_p2p.Optimized Weight Broadcast
In the Broadcast implementation, the checkpoint-engine holds references to sharded weights in CPU memory, and need to efficiently broadcast them to a cluster of inference instances, often under a different sharding pattern. We arrange the data transfer into 3 stages:
Checkpoint-engine orchestrates the entire transfer process. It first gathers necessary metadata to create a plan, including deciding the proper bucket size for data transfer. It then executes the transfer, where it controls the inference engine through a ZeroMQ socket. To maximize performance, it organizes the data transfers into a pipeline with overlapped communication and copy, illustrated below. The details can be found in Kimi-K2 Technical Report.
Pipelining naturally requires more GPU memory. When memory is not enough, checkpoint-engine will fallback to serial execution.
Benchmark
All results above are tested by
examples/update.pyand use vLLM v0.10.2rc1 as inference engine. Some notes:ParameterServer.update(ranks=range(0, 16))) out of the entire cluster.Installation
Use the fastest broadcast implementation
Use the flexible P2P implementation, notice this will install
mooncake-transfer-engineto support RDMA transfer between different ranks.If set
NCCL_IB_HCAenv, checkpoint-engine will use it to auto select net devices for different ranks. If not set, it will read all RDMA devices and try to divide them into each rank.Getting Started
Prepare an H800 or H20 machine with 8 GPUs with latest vLLM. Be sure to include /collective_rpc API endpoint commit (available in main branch) since checkpoint-engine will use this endpoint to update weights.
Install checkpoint-engine
We use
Qwen/Qwen3-235B-A22B-Instruct-2507(BF16) as the test modelStart vLLM in dev mode and set
--load-format dummy. Notice that we also set--worker-extension-cls=checkpoint_engine.worker.VllmColocateWorkerExtensionMeanwhile, use this command to update weights by checkpoint-engine. No need to wait for vLLM to get ready.
Reuse weights from existing instances
New checkpoint-engine instances can join existing instances and reuse their weights. This is simple to achieve.
First, start the existing instances with
--save-metas-file global_metas.pklto save global metas to a file and use--sleep-time 300to make sure they stay alive.After a checkpoint is registered, new instances can obtain a copy of the checkpoint by setting
--load-metas-file global_metas.pkl.FP8 quantization
FP8 quantization currently do not natively work in vLLM when updating weights. We provide a simple patch in
patches/vllm_fp8.patchto handle the correct weight update. Notice this patch is only tested in DeepSeek-V3.1 and Kimi-K2. Other models may meet some compatible issues.A PR is opened to the vLLM project and waiting to discuss and review.
Test
Run a simple correctness test for checkpoint_engine
Limitations and Future Work
Acknowledgments
This open source project uses the same vLLM interface in https://github.com/vllm-project/vllm/pull/24295 . Thanks for the comments and insights from youkaichao.