Kimi K3: --colocate-memory-peak-device — overlap the trainer/rollout handoff on the GPU - #1922
Open
yueming-yuan wants to merge 1 commit into
Open
Kimi K3: --colocate-memory-peak-device — overlap the trainer/rollout handoff on the GPU#1922yueming-yuan wants to merge 1 commit into
yueming-yuan wants to merge 1 commit into
Conversation
yueming-yuan
requested review from
Shi-Dong,
Zhichenzzz,
fzyzcjy,
guapisolo,
jybsuper,
maocheng23 and
yushengsu-thu
as code owners
July 29, 2026 00:28
Contributor
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
yueming-yuan
force-pushed
the
kimi-k3-colocate-peak-device
branch
from
July 29, 2026 00:49
641d6f7 to
78f5771
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on the
kimi-k3branch (#1825). One squashed commit. The persistent CUDA-IPC LoRA transfer buffer was split out to #1923.What
--colocate-memory-peak-device {cpu,gpu}(defaultcpu= existing behavior).In colocated RL, each trainer<->rollout handoff briefly holds two host copies:
the engine's weight mirror (built when the engine releases its weights under
--enable-weights-cpu-backup) and the trainer's own TMS backup. On hosts wherethe two together exceed the memory budget (GB300: 4x140 GB mirror + trainer
backup vs the job cgroup),
gpumode reorders both handoffs so the overlaplives on the GPU instead and the host copies never coexist:
wake the trainer while the engine weights are still resident, then release
the weights — their mirror replaces the trainer's just-freed backup.
LoRA grad-buffer region to the device, the engine resumes its weights, and
only then does the trainer sleep into the space the mirror vacated.
(their mirror cannot coexist with the load's footprint).
RolloutManagergains splitoffload_kv/offload_weights/onload_weights;the trainer actor gains an idempotent
sleep/wake_uppair plusoffload_grad_buffer; the K3 launcher hardcodesgpu.Validation
16 nodes x 4 GPU (GB300), full Kimi-K3 LoRA RL (together with #1923): both
handoffs stable cycle over cycle, host anon+shmem peaking ~770 GB of the
898 GB cgroup with a single large host copy at any time;
eval/aime0.367 -> 0.467 by the second eval. This is the configuration inside the
released
radixark/miles:kimi-k3image, which the Reproduce section of#1825 describes.