首页 > AI前沿 > Layerwise Repacking: Variable-Length Hybrid-Attention Training without an Extra Redistribution Pass

Layerwise Repacking: Variable-Length Hybrid-Attention Training without an Extra Redistribution Pass

arXiv机器学习 2026-10-26 20:07 3 阅读 查看原文
Let me analyze the text and create a semantic HTML fragment following the rules: 1. Only output HTML fragment, no Markdown fences, no explanations 2. Each natural paragraph wrapped in `

`, use `

`/`

` for sections 3. Lists with `
  • `, quotes with `
    `, code with `
    `, important sentences with ``
    4. Keep all original information, no additions, deletions, or modifications
    5. No ``/``/`` tags
    
    Let me break down the text into logical sections:
    
    1. The problem: Variable-length training creates conflicting parallelism requirements
    2. The solution: Layerwise Repacking
    3. Results
    
    Let me structure this:
    
    Section 1 (h2): The Challenge - Variable-Length Training Parallelism
    - Paragraph about the problem
    
    Section 2 (h2): Layerwise Repacking Solution
    - Paragraph about the solution
    
    Section 3 (h2): Results
    - Paragraph about the results
    
    Let me carefully go through the text:
    
    "Variable-length training creates conflicting parallelism requirements across the layers of a hybrid-attention model."
    
    "The longest samples require wide sequence-parallel (SP) groups of 16 or 32 ranks for full attention, whose cost grows quadratically with sequence length."
    
    "Sparse-attention layers, dominated by near-linear MoE work, can instead balance most evaluated workloads within node-local SP8 groups."
    
    "Reusing the wide groups for these layers pushes their all-to-all communication across nodes, where the observed effective rate is 7.0x lower."
    
    "Yet switching to smaller groups changes which ranks own each sample; a separate redistribution at every full-sparse boundary would introduce another data transfer."
    
    "Layerwise Repacking keeps each SP16/32 parent for full attention and repacks its samples into node-local sparse children at SP{1, 2, 4, 8}, where hidden states persist between full layers."
    
    "The layout change rides on the two existing full-layer Ulysses sites: at each, one variable-size all-to-all performs both the head exchange and the sample repacking, so no redistribution pass is added."
    
    "Because the balance the children can reach depends on which samples share a parent, an auxiliary parent solver rebalances parent membership before the children are formed."
    
    "On all 22 steps with SP16/32 parents among the first 200 training steps of a 1F3S hybrid-attention model (one full-attention layer per three sparse-attention layers), repacking alone reduces the mean end-to-end time by 5.95% and raises model FLOPs utilization (MFU) by 3.75 percentage points over the baseline with repacking disabled; with the improved solver, end-to-end time falls by 7.61% and MFU rises by 4.83 percentage points."
    
    Now let me structure this into HTML:
    
    I'll use h2 for the main sections and h3 for sub-sections where appropriate.
    
    Section 1: The Challenge
    - The conflicting parallelism requirements
    
    Section 2: The Solution - Layerwise Repacking
    - How it works
    
    Section 3: Results
    - The experimental results
    
    Let me think about what to bold. Important sentences and key terms:
    - "Variable-length training creates conflicting parallelism requirements" - key problem statement
    - "Layerwise Repacking" - the core solution name
    - Key metrics in the results
    
    Let me draft the HTML:
    
    ```html
    

    The Challenge: Conflicting Parallelism Requirements

    Variable-length training creates conflicting parallelism requirements across the layers of a hybrid-attention model. The longest samples require wide sequence-parallel (SP) groups of 16 or 32 ranks for full attention, whose cost grows quadratically with sequence length. Sparse-attention layers, dominated by near-linear MoE work, can instead balance most evaluated workloads within node-local SP8 groups.

    Reusing the wide groups for these layers pushes their all-to-all communication across nodes, where the observed effective rate is 7.0x lower. Yet switching to smaller groups changes which ranks own each sample; a separate redistribution at every full-sparse boundary would introduce another data transfer.

    Layerwise Repacking

    Layerwise Repacking keeps each SP16/32 parent for full attention and repacks its samples into node-local sparse children at SP{1, 2, 4, 8}, where hidden states persist between full layers.

    The layout change rides on the two existing full-layer Ulysses sites: at each, one variable-size all-to-all performs both the head exchange and the sample repacking, so no redistribution pass is added.

    Because the balance the children can reach depends on which samples share a parent, an auxiliary parent solver rebalances parent membership before the children are formed.

    Results

    On all 22 steps with SP16/32 parents among the first 200 training steps of a 1F3S hybrid-attention model (one full-attention layer per three sparse-attention layers), repacking alone reduces the mean end-to-end time by 5.95% and raises model FLOPs utilization (MFU) by 3.75 percentage points over the baseline with repacking disabled; with the improved solver, end-to-end time falls by 7.61% and MFU rises by 4.83 percentage points.

    ``` Wait, let me reconsider. The SP{1, 2, 4, 8} part could be rendered as a list or as code. Let me think about this... It's mentioned as "SP{1, 2, 4, 8}" - this looks like it could be code. Let me use `` for it since it's a notation. Actually, looking at it again, "SP{1, 2, 4, 8}" is a notation representing a set of possible SP values. I could render it as `SP{1, 2, 4, 8}` since it looks like a code/notation reference. Also, let me reconsider the structure. The text has a clear flow: 1. Problem statement (parallelism conflicts) 2. Why naive solutions don't work 3. The Layerwise Repacking solution 4. Implementation details 5. Results Let me refine: ```html

    The Challenge: Conflicting Parallelism Requirements

    Variable-length training creates conflicting parallelism requirements across the layers of a hybrid-attention model. The longest samples require wide sequence-parallel (SP) groups of 16 or 32 ranks for full attention, whose cost grows quadratically with sequence length. Sparse-attention layers, dominated by near-linear MoE work, can instead balance most evaluated workloads within node-local SP8 groups.

    Reusing the wide groups for these layers pushes their all-to-all communication across nodes, where the observed effective rate is 7.0x lower. Yet switching to smaller groups changes which ranks own each sample; a separate redistribution at every full-sparse boundary would introduce another data transfer.

    Layerwise Repacking

    Layerwise Repacking keeps each SP16/32 parent for full attention and repacks its samples into node-local sparse children at SP{1, 2, 4, 8}, where hidden states persist between full layers.

    The layout change rides on the two existing full-layer Ulysses sites: at each, one variable-size all-to-all performs both the head exchange and the sample repacking, so no redistribution pass is added.

    Because the balance the children can reach depends on which samples share a parent, an auxiliary parent solver rebalances parent membership before the children are formed.

    Results