Repository navigation
Conversation
…P > 1 - Loop Transformer: re-execute a span of decoder layers several times per forward pass with scaled residuals (loop_start_layer, loop_end_layer, num_loop_iterations, loop_residual_scale, loop_type, loop_block_size, loop_gdn_key_lora_rank). - Checkpoint conversion: expand the loop span into separate HF layers, fold loop_residual_scale and the per-iteration GDN key LoRA into the weights, dedup shared tensors for safetensors, expert-TP-aware TP sharding. - Per-module gradient norm logging. - Fix mRoPE position_ids on intermediate pipeline stages in train_qwen35.py. - Reference config for Qwen3.6-35B-A3B Loop Transformer training. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
PR Category
Train
PR Types
New Features / Bug Fixes
PR Description
This PR adds Loop Transformer support for Qwen3.6-35B-A3B,
Loop Transformer
Re-executes a contiguous span of decoder layers several times per forward pass, scaling each sublayer residual inside the span. All behavior is controlled by training config and disabled by default.
New training parameters:
loop_start_layerloop_end_layernum_loop_iterationsloop_residual_scaleloop_typemodule-wise,sdpa-wiseloop_block_sizeloop_gdn_key_lora_rankChanges:
flagscale/models/megatron/qwen3_vl/language_transformer_block.py: loop-awareLanguageTransformerBlockwith per-iteration residual scaling, including the full-recompute (checkpointed) path.tools/checkpoint/qwen35/: the Megatron → HF converter reads the loop config and expands the loop span into separate HF layers.flagscale/train/megatron/training/training.py: optional per-module gradient norm logging.examples/qwen36/conf/train_fsa_recursive_sdpawise_depth.yamlandexamples/qwen36/conf/train/35b_a3b_llm_fsa_recursive_sdpawise_depth.yaml: reference config for Qwen3.6-35B-A3B (TP2, EP4, 8 nodes × 8 GPUs, DeepEP flex dispatcher,sdpa-wiseloop over layers 0–35 with 4 iterations). Site-specific paths are replaced with/path/to/...placeholders.Bug fix: mRoPE
position_idson intermediate pipeline stagesFixed in
train_qwen35.py(get_batch_textandis_dataset_built_on_rank). With mRoPE, intermediate stages now build the dataset, read the batch, broadcastposition_ids(andattention_maskwhen it is built in the dataloader) across the TP group, and apply the same CP slicing as the first and last stages.train_gpt.pyis not modified.