Kimi K3 · Training

T04 · Training joint

Valid

Qwen3-8B system training 4dev · Joint Optimization

1.17×PERFORMANCE RATIO
173TOOL EVENTS
1TEXT PATCHES
0BINARY NAMES

01 / PROCESS MAP

Tool activity

Each row shows one agent’s tool events in its own recorded order. Colors show broad activities; bar widths do not represent duration.

Main agentKimi K3 · 173 visible calls

InspectEditValidateExecuteBuildProfileRollbackOther
125Inspect
11Edit
1Build
20Validate
1Execute
15Other

02 / EVENT SEQUENCE

Event timeline

Requests are grouped by agent, activity and topic. Delegations open into child branches. Summaries describe visible requests; tool errors and missing responses are flagged. A recorded response does not establish command success or a performance improvement.

Show event timelineHide event timeline105 groups · 173 calls

Scroll within this panel to view all events. Command sketches retain familiar programs and options. Values become <val> or <n>; paths, addresses and script bodies are hidden as <path>, <url> and <script>.

Main agent

  1. Inspect · Task requirements

    Requested workspace inspection and file and log inspection related to task requirements.

    4 calls · #0001–#0004

    echo <val>ls -l -a <val> <n> > <path>ls -l -a <path> <n> > <path>find <path> -maxdepth <n> -name <val> <flag> <args>headRead <path>
    2 more command sketches
    cd <path>ls -R <val> <val> <val> <val> <val>
  2. Inspect · Source & workspace

    Requested file and log inspection related to source & workspace.

    1 call · #0005–#0005

    Read <path>
  3. Inspect · Task requirements

    Requested file and log inspection related to task requirements.

    3 calls · #0006–#0008

    Read <path>
  4. Inspect · Source & workspace

    Requested file and log inspection related to source & workspace.

    10 calls · #0009–#0018

    Read <path>sed -n <val> <path>
  5. Inspect · Benchmark & validation setup

    Requested file and log inspection related to benchmark & validation setup.

    1 call · #0019–#0019

    cd <path>cat <path> <path> <path> <path> <path> <path>
  6. Inspect · Source & workspace

    Requested task coordination related to source & workspace.

    1 call · #0020–#0020

    Update task list <tasks>
  7. Inspect · Device memory

    Requested environment setup or inspection, source searches and runtime inspection related to device memory.

    1 call · #0021–#0021

    envgrep -E <val>sortecho <flag>npu-smi info <n> >& <path>head -n <n>
    1 more command sketches
    ls <path>
  8. Inspect · Source & workspace

    Requested workspace inspection, file and log inspection and script or workload execution related to source & workspace.

    4 calls · #0022–#0025

    ls <path>echo <flag>ls <path> <n> > <path>cat <path>ls <path> <path> <n> > <path>Read <path>
    2 more command sketches
    bash <script> <n> >& <path>tail -n <n>
  9. Validate · Benchmark & validation setup

    Requested script or workload execution related to benchmark & validation setup.

    1 call · #0026–#0026

    bash <script> > <path> <n> > <path>echo <val>
  10. Inspect · Source & workspace

    Requested source searches, file and log inspection and workspace inspection related to source & workspace.

    7 calls · #0027–#0033

    Search <pattern> <path>cat <path> <n> > <path>head -n <n>ls <path>echo <flag>sed -n <val> <path>
    5 more command sketches
    cd <path>git status --shortheadgit log --oneline <flag>Read <path>
  11. Validate · Benchmark & validation setup

    Requested file and log inspection and workspace inspection related to benchmark & validation setup.

    1 call · #0034–#0034

    tail -n <n> <path> <n> > <path>echo <val>ls <path> <n> > <path>
  12. Inspect · Source & workspace

    Requested file and log inspection and source searches related to source & workspace.

    1 call · #0035–#0035

    wc -l <path> <path>grep -r -n <val> <path> --include <path>head -n <n>
  13. Inspect · Parallelism & communication

    Requested file and log inspection related to parallelism & communication.

    1 call · #0036–#0036

    sed -n <val> <path>echo <val>
  14. Inspect · Source & workspace

    Requested task coordination related to source & workspace.

    1 call · #0037–#0037

    Update task list <tasks>
  15. Inspect · Parallelism & communication

    Requested workspace inspection, source searches and file and log inspection related to parallelism & communication.

    1 call · #0038–#0038

    ls <path> <n> > <path>grep -r -n <val> <path>head
  16. Inspect · Source & workspace

    Requested source searches related to source & workspace.

    1 call · #0039–#0039

    Search <pattern> <path>
  17. Inspect · Benchmark & validation setup

    Requested file and log inspection related to benchmark & validation setup.

    1 call · #0040–#0040

    tail -n <n> <path>echo <val>
  18. Inspect · Source & workspace

    Requested source searches related to source & workspace.

    1 call · #0041–#0041

    Search <pattern> <path>
  19. Inspect · Parallelism & communication

    Requested source searches related to parallelism & communication.

    1 call · #0042–#0042

    Search <pattern> <path>
  20. Validate · Benchmark & validation setup

    Requested file and log inspection, source searches and workspace inspection related to benchmark & validation setup.

    1 call · #0043–#0043

    cat <path> <n> > <path>echo <val>grep -E <val> <path>tail -n <n>ls <path> <n> > <path>grep -c <val> <path>
  21. Edit · Source & workspace

    Requested code edits related to source & workspace.

    1 call · #0044–#0044

    Write <path>
  22. Other · Source & workspace

    Requested workspace file updates and script or workload execution related to source & workspace.

    1 call · #0045–#0045

    chmod <val> <path>bash <script> <val> <n> <n> <n> <n>
  23. Inspect · Source & workspace

    1 tool error

    Requested file and log inspection and source searches related to source & workspace.

    4 calls · #0046–#0049

    sed -n <val> <path>tail -n <n> <path> <n> > <path>grep <flag> <args>grep -E <val> <path>head -n <n>
  24. Edit · Source & workspace

    Requested code edits related to source & workspace.

    1 call · #0050–#0050

    Edit <path>
  25. Other · Source & workspace

    Requested script or workload execution related to source & workspace.

    1 call · #0051–#0051

    bash <script> <val> <n> <n> <n> <n>
  26. Inspect · Source & workspace

    Requested file and log inspection, execution waits and source searches related to source & workspace.

    2 calls · #0052–#0053

    cat <path>echo <val>head -n <n>sleep <n>tail -n <n> <path>grep -E <path> <path>
    1 more command sketches
    tail -n <n>
  27. Other · Source & workspace

    Requested script or workload execution related to source & workspace.

    1 call · #0054–#0054

    bash <script> <val> <n> <n> <n> <n> <flag>
  28. Edit · Source & workspace

    Requested code edits related to source & workspace.

    1 call · #0055–#0055

    Write <path>
  29. Inspect · Source & workspace

    Requested execution waits, source searches and file and log inspection related to source & workspace.

    1 call · #0056–#0056

    sleep <n>grep -E <path> <path> <n> > <path>tail -n <n>tail -n <n> <path> <n> > <path>
  30. Inspect · Parallelism & communication

    Requested file and log inspection and source searches related to parallelism & communication.

    1 call · #0057–#0057

    cat <path>echo <val>grep -r -n <val> <path>head
  31. Edit · Source & workspace

    1 tool error

    Requested code edits and source searches related to source & workspace.

    2 calls · #0058–#0059

    sed -i <path> <path>grep -n <val> <path>Edit <path>
  32. Inspect · Source & workspace

    Requested file and log inspection related to source & workspace.

    1 call · #0060–#0060

    Read <path>
  33. Edit · Source & workspace

    Requested code edits related to source & workspace.

    1 call · #0061–#0061

    Edit <path>
  34. Other · Source & workspace

    Requested environment setup or inspection related to source & workspace.

    1 call · #0062–#0062

    env <vars> bash <script> <val> <n> <n> <n> <n> <flag>
  35. Inspect · Source & workspace

    Requested task coordination related to source & workspace.

    1 call · #0063–#0063

    Update task list <tasks>
  36. Inspect · Parallelism & communication

    Requested file and log inspection related to parallelism & communication.

    1 call · #0064–#0064

    sed -n <val> <path>
  37. Inspect · Source & workspace

    Requested source searches, file and log inspection and execution waits related to source & workspace.

    5 calls · #0065–#0069

    grep -r -n <val> <path> -r --include <path>sed <path>sorthead -n <n>grep -E <val> <path>echo <val>
    6 more command sketches
    grep -r -n <val> <path> <n> > <path>sleep <n>grep -E <path> <path> <n> > <path>tail -n <n>tail -n <n> <path> <n> > <path>grep <flag> <args>
  38. Other · Source & workspace

    Requested script or workload execution related to source & workspace.

    1 call · #0070–#0070

    bash <script> <val> <n> <n> <n> <n> <flag>
  39. Inspect · Source & workspace

    Requested source searches related to source & workspace.

    1 call · #0071–#0071

    Search <pattern> <path>
  40. Inspect · Optimizer & gradients

    Requested source searches, file and log inspection and workspace inspection related to optimizer & gradients.

    2 calls · #0072–#0073

    grep -r -n <val> <path> <path> <n> > <path>head -n <n>sed -n <val> <path>grep -r -n <val> <path> -r <n> > <path>headls <path>
  41. Inspect · Source & workspace

    Requested execution waits, source searches and file and log inspection related to source & workspace.

    1 call · #0074–#0074

    sleep <n>grep -E <path> <path> <n> > <path>tail -n <n>grep -E <val> <path>tail -n <n> <path>
  42. Other · Source & workspace

    Requested script or workload execution related to source & workspace.

    1 call · #0075–#0075

    bash <script> <val> <n> <n> <n> <n> <flag>
  43. Inspect · Source & workspace

    Requested source searches, execution waits and file and log inspection related to source & workspace.

    1 call · #0076–#0076

    grep -n <val> <path>sleep <n>grep -E <path> <path> <n> > <path>tail -n <n>tail -n <n> <path>
  44. Inspect · Device memory

    Requested source searches and file and log inspection related to device memory.

    1 call · #0077–#0077

    grep -E <val> <path>sortuniq -csort <flag>head -n <n>
  45. Other · Source & workspace

    Requested script or workload execution related to source & workspace.

    1 call · #0078–#0078

    bash <script> <val> <n> <n> <n> <n> <flag> <args>
  46. Inspect · Source & workspace

    Requested file and log inspection and source searches related to source & workspace.

    4 calls · #0079–#0082

    cd <path><command> <args>tail -n <n>sed -n <val> <path>echo <val>grep -r -n <val> --include <path> <path>
    9 more command sketches
    grep -v <val>head -n <n>cat -A <path>wc -l <path>grep -E <path> <path>tail -n <n> <path>grep -r -n <val> <path>headgrep -r -n <val> <path> <path> <n> > <path>
  47. Other · Source & workspace

    Requested script or workload execution related to source & workspace.

    1 call · #0083–#0083

    bash <script> <val> <n> <n> <n> <n> <flag> <args>
  48. Inspect · Source & workspace

    Requested file and log inspection, task coordination and execution waits related to source & workspace.

    4 calls · #0084–#0087

    sed -n <val> <path>Update task list <tasks>sleep <n>grep -E <path> <path> <n> > <path>tail -n <n>tail -n <n> <path>
    3 more command sketches
    grep -E <val> <path>grep -v <val>head -n <n>
  49. Other · Source & workspace

    Requested script or workload execution related to source & workspace.

    1 call · #0088–#0088

    bash <script> <val> <n> <n> <n> <n> <flag> <args>
  50. Inspect · Checkpoints & weight state

    Requested script or workload execution related to checkpoints & weight state.

    1 call · #0089–#0089

    cd <path>python3 - <script>
  51. Inspect · Source & workspace

    Requested execution waits, source searches and file and log inspection related to source & workspace.

    1 call · #0090–#0090

    sleep <n>grep -E <path> <path> <n> > <path>tail -n <n>tail -n <n> <path>
  52. Inspect · Checkpoints & weight state

    Requested source searches and file and log inspection related to checkpoints & weight state.

    1 call · #0091–#0091

    grep -E <val> <path>tail -n <n>
  53. Inspect · Parallelism & communication

    Requested source searches and file and log inspection related to parallelism & communication.

    1 call · #0092–#0092

    grep -n <val> <path> <path> <n> > <path>head -n <n>grep -r -n <val> <path>
  54. Inspect · Source & workspace

    Requested source searches and file and log inspection related to source & workspace.

    1 call · #0093–#0093

    grep -r -n <val> <path> <n> > <path>head -n <n>
  55. Inspect · Parallelism & communication

    Requested file and log inspection and source searches related to parallelism & communication.

    3 calls · #0094–#0096

    sed -n <val> <path>grep -n <val> <path>headsed -n <path> <path>
  56. Other · Source & workspace

    Requested script or workload execution related to source & workspace.

    1 call · #0097–#0097

    bash <script> <val> <n> <n> <n> <n> <flag> <args>
  57. Inspect · Source & workspace

    Requested file and log inspection related to source & workspace.

    1 call · #0098–#0098

    Read <path>
  58. Edit · Source & workspace

    Requested code edits related to source & workspace.

    1 call · #0099–#0099

    Edit <path>
  59. Inspect · Source & workspace

    Requested script or workload execution, file and log inspection and source searches related to source & workspace.

    3 calls · #0100–#0102

    cd <path>python3 -c <script> <n> >& <path>tail -n <n>grep -E <path> <path>tail -n <n> <path>
  60. Inspect · Dependencies & build setup

    Requested source searches, file and log inspection and dependency and build commands related to dependencies & build setup.

    1 call · #0103–#0103

    grep -r -l -n <val> <path> <path> <path> <n> > <path>headpip list <n> > <path>grep -i <val>
  61. Inspect · Source & workspace

    Requested source searches and file and log inspection related to source & workspace.

    2 calls · #0104–#0105

    grep <flag> <args>grep -E <val>head -n <n>sed -n <val> <path>
  62. Edit · Source & workspace

    Requested code edits related to source & workspace.

    1 call · #0106–#0106

    Edit <path>
  63. Validate · Benchmark & validation setup

    Requested script or workload execution related to benchmark & validation setup.

    1 call · #0107–#0107

    bash <script> > <path> <n> > <path>echo <val>
  64. Inspect · Optimizer & gradients

    Requested source searches, file and log inspection and workspace inspection related to optimizer & gradients.

    1 call · #0108–#0108

    grep -r -n <val> <path>head -n <n>sed -n <val> <path> <n> > <path>ls <path>
  65. Inspect · Benchmark & validation setup

    Requested file and log inspection and source searches related to benchmark & validation setup.

    1 call · #0109–#0109

    cat <path>grep -E <path> <path>tail -n <n>
  66. Validate · Benchmark & validation setup

    Requested workspace file updates and script or workload execution related to benchmark & validation setup.

    1 call · #0110–#0110

    rm -rf <path>bash <script> > <path> <n> > <path>echo <val>
  67. Inspect · Source & workspace

    Requested file and log inspection related to source & workspace.

    1 call · #0111–#0111

    sed -n <val> <path>
  68. Inspect · Optimizer & gradients

    Requested source searches related to optimizer & gradients.

    1 call · #0112–#0112

    Search <pattern> <path>
  69. Validate · Benchmark & validation setup

    Requested execution waits, file and log inspection and source searches related to benchmark & validation setup.

    1 call · #0113–#0113

    sleep <n>tail -n <n> <path>echo <val>grep -E <path> <path>tail -n <n>
  70. Inspect · Benchmark & validation setup

    Requested file and log inspection related to benchmark & validation setup.

    1 call · #0114–#0114

    cat <path>
  71. Other · Optimizer & gradients

    Requested script or workload execution related to optimizer & gradients.

    1 call · #0115–#0115

    bash <script> <val> <n> <n> <n> <n> <flag> <args>
  72. Inspect · Source & workspace

    Requested task coordination, execution waits and source searches related to source & workspace.

    11 calls · #0116–#0126

    Update task list <tasks>sleep <n>grep -E <path> <path> <n> > <path>tail -n <n>tail -n <n> <path>grep <flag> <args>
    11 more command sketches
    grep -v -E <val>head -n <n>grep -n <val> <path> <path>sed -n <val> <path>echo <val>grep -r -n <val> <path> <path>grep -r -n <val> <path>grep -r -n <val> <path> <path> -rheadgrep -n <val> <path>sed -n <path> <path>
  73. Validate · Benchmark & validation setup

    Requested workspace file updates related to benchmark & validation setup.

    1 call · #0127–#0127

    rm -rf <path> <path> <val> <path> > <path> <n> > <path>echo <val>
  74. Inspect · Source & workspace

    Requested source searches and file and log inspection related to source & workspace.

    3 calls · #0128–#0130

    Search <pattern> <path>grep -r -n <val> <path> --include <path>grep -v <path>headgrep -r -n <val> <path> -rhead -n <n>
  75. Validate · Benchmark & validation setup

    1 tool error

    Requested execution waits, file and log inspection and source searches related to benchmark & validation setup.

    2 calls · #0131–#0132

    sleep <n>tail -n <n> <path> <n> > <path>grep -E <path> <path> <n> > <path>tail -n <n>ls <path>grep <val>
  76. Validate · Checkpoints & weight state

    Requested workspace inspection, source searches and file and log inspection related to checkpoints & weight state.

    1 call · #0133–#0133

    ls -l -a <path>grep -E <val>tail -n <n> <path> <n> > <path>ls <path> <n> > <path>
  77. Validate · Benchmark & validation setup

    Requested file and log inspection, runtime inspection and source searches related to benchmark & validation setup.

    1 call · #0134–#0134

    tail -n <n> <path>ps <val>grep -E <val>grep -v <val>awk <val>head -n <n>
  78. Validate · Checkpoints & weight state

    Requested execution waits, workspace inspection and source searches related to checkpoints & weight state.

    1 call · #0135–#0135

    sleep <n>du <flag> <args>ls <path>grep <val>grep -E <path> <path> <n> > <path>tail -n <n>
  79. Validate · Benchmark & validation setup

    Requested execution waits, source searches and file and log inspection related to benchmark & validation setup.

    1 call · #0136–#0136

    sleep <n>grep -E <path> <path> <n> > <path>tail -n <n>echo <val>tail -n <n> <path> <n> > <path>
  80. Inspect · Source & workspace

    Requested task coordination related to source & workspace.

    1 call · #0137–#0137

    Update task list <tasks>
  81. Validate · Benchmark & validation setup

    Requested execution waits, source searches and file and log inspection related to benchmark & validation setup.

    2 calls · #0138–#0139

    sleep <n>grep -E <path> <path> <n> > <path>tail -n <n> <path> <n> > <path>cat <path>echocat <path> <n> > <path>
    2 more command sketches
    python3 -m <module>head -n <n>
  82. Execute · Benchmark & validation setup

    Requested workspace file updates related to benchmark & validation setup.

    1 call · #0140–#0140

    rm -rf <path> <path> <val> <path> > <path> <n> > <path>echo <val>
  83. Inspect · Source & workspace

    1 tool error

    Requested workspace inspection and file and log inspection related to source & workspace.

    1 call · #0141–#0141

    find <path> -maxdepth <n> -type <val> <n> > <path>head -n <n>du <flag> <args>headecho <val>find <path> -name <val> -path <val> <n> > <path>
    1 more command sketches
    ls <path> <n> > <path>
  84. Build · Dependencies & build setup

    Requested workspace inspection, source searches and file and log inspection related to dependencies & build setup.

    1 call · #0142–#0142

    ls -l -a <path>grep -v -E <val>head -n <n>find <path> -maxdepth <n> -name <val> <flag> <args>headls <path> <n> > <path>
  85. Inspect · Source & workspace

    Requested source searches, file and log inspection and execution waits related to source & workspace.

    2 calls · #0143–#0144

    grep -E <val> <path>head -n <n>echo <val> <val>grep <flag> <args>headecho <val>
    6 more command sketches
    grep -n <path> <path> <path>sleep <n>tail -n <n> <path> <n> > <path>ls <path> <n> > <path>grep -E <path> <path> <n> > <path>tail -n <n>
  86. Inspect · Benchmark & validation setup

    Requested file and log inspection, script or workload execution and source searches related to benchmark & validation setup.

    3 calls · #0145–#0147

    cat <path>python3 -m <module> <n> > <path>head -n <n>echo <val>tail -n <n> <path>python3 -c <script>
    2 more command sketches
    grep -n -E <path> <path>tail -n <n>
  87. Inspect · Runtime processes

    Requested environment setup or inspection, execution waits and file and log inspection related to runtime processes.

    2 calls · #0148–#0149

    cd <path><command> <args>env <vars>sleep <n>wc <flag>echo <val>
    6 more command sketches
    wait <val> <n> >& <path>tail -n <n>grep -n <val> <path> <path> <n> > <path>headgrep -r -n <val> <path>head -n <n>
  88. Inspect · Optimizer & gradients

    Requested source searches and file and log inspection related to optimizer & gradients.

    1 call · #0150–#0150

    grep -r -n <val> <path> --include <path>grep -v <val>headgrep -r -n <val> <path>
  89. Inspect · Source & workspace

    1 tool error

    Requested execution waits, file and log inspection and source searches related to source & workspace.

    2 calls · #0151–#0152

    sleep <n>tail -n <n> <path> <n> > <path>grep -E <path> <path> <n> > <path>tail -n <n>
  90. Other · Source & workspace

    Requested file and log inspection and execution waits related to source & workspace.

    2 calls · #0153–#0154

    Read task output <task>Wait for <task>
  91. Inspect · Source & workspace

    Requested file and log inspection related to source & workspace.

    1 call · #0155–#0155

    Read <path>
  92. Edit · Source & workspace

    Requested code edits related to source & workspace.

    2 calls · #0156–#0157

    Write <path>Edit <path>
  93. Inspect · Source & workspace

    Requested task coordination related to source & workspace.

    1 call · #0158–#0158

    Update task list <tasks>
  94. Edit · Source & workspace

    Requested code edits related to source & workspace.

    1 call · #0159–#0159

    Edit <path>
  95. Inspect · Source & workspace

    1 tool error

    Requested file and log inspection and workspace file updates related to source & workspace.

    1 call · #0160–#0160

    sed <path> <path> > <path>chmod <val> <path>diff <path> <path>
  96. Other · Source & workspace

    Requested script or workload execution related to source & workspace.

    1 call · #0161–#0161

    bash <script> <val> <n> <n> <n> <n> <flag> <args>
  97. Inspect · Source & workspace

    Requested execution waits, workspace inspection and source searches related to source & workspace.

    2 calls · #0162–#0163

    sleep <n>ls <path> <n> > <path>grep -E <path> <path>tail -n <n>grep -E <val> <path>
  98. Validate · Checkpoints & weight state

    Requested workspace file updates and script or workload execution related to checkpoints & weight state.

    1 call · #0164–#0164

    rm -rf <path> <path> <path>bash <script> > <path> <n> > <path>echo <val>
  99. Inspect · Source & workspace

    Requested file and log inspection related to source & workspace.

    1 call · #0165–#0165

    Read <path>
  100. Validate · Benchmark & validation setup

    Requested execution waits, source searches and file and log inspection related to benchmark & validation setup.

    2 calls · #0166–#0167

    sleep <n>grep -E <path> <path> <n> > <path>tail -n <n>ls <flag> <args>grep -E <val>
  101. Validate · Checkpoints & weight state

    Requested file and log inspection and runtime inspection related to checkpoints & weight state.

    1 call · #0168–#0168

    tail -n <n> <path>du <flag> <args>pgrep <flag> <args>head -n <n>date <val>
  102. Validate · Benchmark & validation setup

    Requested execution waits, file and log inspection and source searches related to benchmark & validation setup.

    1 call · #0169–#0169

    sleep <n>cat <path> <n> > <path>echogrep -E <path> <path> <n> > <path>tail -n <n>date <val>
  103. Other · Source & workspace

    Requested execution waits related to source & workspace.

    1 call · #0170–#0170

    Wait for <task>
  104. Inspect · Benchmark & validation setup

    Requested file and log inspection related to benchmark & validation setup.

    1 call · #0171–#0171

    cat <path>date <val>
  105. Inspect · Source & workspace

    Requested repository inspection, script or workload execution and task coordination related to source & workspace.

    2 calls · #0172–#0173

    cd <path>git status --shortpython3 -m <module> <script> <script> <script>echo <val>Update task list <tasks>

03 / CANDIDATE ARTIFACT

Text patches & binary names

Read code changes as Git diffs. Identifying strings are masked; binary files are listed by their full relative names.

mindspeed_llm · 3 changed files

Base commit: 72c49a6260c73669678b8f39b1ba41a4789bb555

diff --git a/mindspeed_llm/__init__.py b/mindspeed_llm/__init__.pyindex 7de8d340c493b265b21ff5fd44f8789d3dce38cb..c000bbd5e55db4cc4151b437d537af742dbde588 100644--- a/mindspeed_llm/__init__.py+++ b/mindspeed_llm/__init__.py@@ -13,7 +13,20 @@ # See the License for the specific language governing permissions and # limitations under the License. import os+import importlib  backend = os.environ.get("TRAINING_BACKEND", "mcore").lower()-if backend == "mcore":-    from mindspeed_llm.tasks import megatron_adaptor_v2 as megatron_adaptor+++def __getattr__(name):+    # Lazily resolve ``mindspeed_llm.megatron_adaptor`` so that importing the+    # package (e.g. when running a lightweight supervisor module with+    # ``python -m mindspeed_llm.training.qwen3_8b_4dev``) does not pay the+    # cost of importing torch/megatron. Any attribute access, including+    # ``from mindspeed_llm import megatron_adaptor``, still triggers the real+    # import and applies all patches exactly as before.+    if name == "megatron_adaptor" and backend == "mcore":+        module = importlib.import_module("mindspeed_llm.tasks.megatron_adaptor_v2")+        globals()["megatron_adaptor"] = module+        return module+    raise AttributeError(f"module {__name__!r} has no attribute {name!r}")diff --git a/mindspeed_llm/training/qwen3_8b_4dev.py b/mindspeed_llm/training/qwen3_8b_4dev.pynew file mode 100644index 0000000000000000000000000000000000000000..04b0410846ee7eb5dbb72eca0df687cfd989aa8c--- /dev/null+++ b/mindspeed_llm/training/qwen3_8b_4dev.py@@ -0,0 +1,178 @@+# coding=utf-8+# Copyright (c) 2024, HUAWEI CORPORATION.  All rights reserved.+#+# Licensed under the Apache License, Version 2.0 (the "License");+# you may not use this file except in compliance with the License.+# You may obtain a copy of the License at+#+#     http://www.apache.org/licenses/LICENSE-2.0+#+# Unless required by applicable law or agreed to in writing, software+# distributed under the License is distributed on an "AS IS" BASIS,+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+# See the License for the specific language governing permissions and+# limitations under the License.+"""Framework entrypoint for the four-device Qwen3-8B training task.++The task controller invokes this module as a foreground supervisor:++    python -B -m mindspeed_llm.training.qwen3_8b_4dev \+        --run-spec <spec.json> --device-ids 0,1,2,3 \+        --master-addr 127.0.0.1 --master-port <port> \+        --runtime-dir <fresh dir> --output-dir <dir> \+        [--checkpoint-dir <dir>] [--save-at N] [--resume]++It builds the training command for the supplied run specification and+execs ``torch.distributed.run`` so the supervisor process itself becomes+the launcher; worker stdout/stderr are forwarded to this process'+stdout/stderr by torchrun and all children exit when training finishes.+"""++import argparse+import json+import os+import sys+from pathlib import Path++# Parallel layout for four Ascend 910B devices (world size 4).+# Same TP1/PP2/DP2 data flow as the reference launcher, plus an interleaved+# pipeline schedule (two 9-layer virtual chunks per stage) which shrinks the+# pipeline bubble and measurably improves steady-state throughput.+TENSOR_MODEL_PARALLEL_SIZE = 1+PIPELINE_MODEL_PARALLEL_SIZE = 2+CONTEXT_PARALLEL_SIZE = 1+MICRO_BATCH_SIZE = 1+EXTRA_ARGS = ("--num-layers-per-virtual-pipeline-stage", "9")+++def _parse_args(argv=None):+    parser = argparse.ArgumentParser(+        description="Four-device Qwen3-8B training supervisor",+        allow_abbrev=False,+    )+    parser.add_argument("--run-spec", required=True)+    parser.add_argument("--device-ids", required=True)+    parser.add_argument("--master-addr", required=True)+    parser.add_argument("--master-port", required=True)+    parser.add_argument("--runtime-dir", required=True)+    parser.add_argument("--output-dir", required=True)+    parser.add_argument("--checkpoint-dir", default=None)+    parser.add_argument("--save-at", type=int, default=None)+    parser.add_argument("--resume", action="store_true")+    return parser.parse_args(argv)+++def _load_run_spec(path):+    with open(path, "r", encoding="utf-8") as handle:+        spec = json.load(handle)+    if not isinstance(spec, dict):+        raise ValueError("run spec must be a JSON object")+    for section in ("model", "optimizer", "work"):+        if section not in spec:+            raise ValueError(f"run spec is missing '{section}'")+    return spec+++def _build_argv(args, spec):+    model = spec["model"]+    optimizer = spec["optimizer"]+    work = spec["work"]+    train_iters = int(work["optimizer_updates"])+    device_ids = [item for item in str(args.device_ids).split(",") if item.strip()]+    if not 1 <= len(device_ids) <= 4:+        raise ValueError("device ids must list between one and four devices")+    repo_root = Path(__file__).resolve().parents[2]+    argv = [+        sys.executable,+        "-m",+        "torch.distributed.run",+        f"--nproc_per_node={len(device_ids)}",+        "--nnodes=1",+        "--node_rank=0",+        f"--master_addr={args.master_addr}",+        f"--master_port={args.master_port}",+        str(repo_root / "mindspeed_llm" / "training" / "qwen3_8b_4dev_worker.py"),+        "--use-mcore-models",+        "--spec", "mindspeed_llm.tasks.models.spec.qwen3_spec", "layer_spec",+        "--transformer-impl", "local",+        "--distributed-backend", "nccl",+        "--tensor-model-parallel-size", str(TENSOR_MODEL_PARALLEL_SIZE),+        "--pipeline-model-parallel-size", str(PIPELINE_MODEL_PARALLEL_SIZE),+        "--context-parallel-size", str(CONTEXT_PARALLEL_SIZE),+        "--num-layers", str(model["num_layers"]),+        "--hidden-size", str(model["model_width"]),+        "--ffn-hidden-size", str(model["ffn_width"]),+        "--num-attention-heads", str(model["num_attention_heads"]),+        "--group-query-attention",+        "--num-query-groups", str(model["num_query_groups"]),+        "--kv-channels", str(model["kv_channels"]),+        "--qk-layernorm",+        "--seq-length", str(work["sequence_length"]),+        "--max-position-embeddings", str(work["sequence_length"]),+        "--micro-batch-size", str(MICRO_BATCH_SIZE),+        "--global-batch-size", str(work["global_batch_size"]),+        "--train-iters", str(train_iters),+        "--lr", str(optimizer["learning_rate"]),+        "--min-lr", str(optimizer["minimum_learning_rate"]),+        "--lr-decay-style", str(optimizer["learning_rate_decay_style"]),+        "--weight-decay", str(optimizer["weight_decay"]),+        "--adam-beta1", str(optimizer["adam_beta1"]),+        "--adam-beta2", str(optimizer["adam_beta2"]),+        "--clip-grad", str(optimizer["clip_grad"]),+        "--attention-dropout", "0.0",+        "--hidden-dropout", "0.0",+        "--seed", str(spec["seed"]),+        "--bf16",+        "--mock-data",+        "--tokenizer-type", "NullTokenizer",+        "--vocab-size", str(model["vocab_size"]),+        "--make-vocab-size-divisible-by", "1",+        "--position-embedding-type", "rope",+        "--use-rotary-position-embeddings",+        "--rotary-base", str(model["rotary_base"]),+        "--disable-bias-linear",+        "--normalization", "RMSNorm",+        "--norm-epsilon", "1e-6",+        "--swiglu",+        "--attention-softmax-in-fp32",+        "--use-flash-attn",+        "--use-fused-rotary-pos-emb",+        "--use-fused-swiglu",+        "--use-fused-rmsnorm",+        "--no-masked-softmax-fusion",+        "--no-gradient-accumulation-fusion",+        "--use-distributed-optimizer",+        "--reuse-fp32-param",+        "--overlap-grad-reduce",+        "--overlap-param-gather",+        "--use-ascend-coc",+        "--log-interval", str(work.get("log_interval", 1)),+        "--eval-iters", "0",+        "--eval-interval", str(train_iters),+    ]+    argv.extend(EXTRA_ARGS)+    if args.checkpoint_dir is not None and args.resume:+        argv.extend(("--load", str(args.checkpoint_dir)))+    elif args.checkpoint_dir is not None and args.save_at is not None:+        argv.extend(+            (+                "--save", str(args.checkpoint_dir),+                "--save-interval", str(args.save_at),+                "--exit-interval", str(args.save_at),+            )+        )+    return argv+++def main(argv=None):+    args = _parse_args(argv)+    spec = _load_run_spec(args.run_spec)+    command = _build_argv(args, spec)+    # Replace this supervisor with the launcher so the process group the+    # controller observes is exactly the training process tree, and the+    # launcher exit status propagates directly.+    os.execvpe(command[0], command, os.environ)+++if __name__ == "__main__":+    main()diff --git a/mindspeed_llm/training/qwen3_8b_4dev_worker.py b/mindspeed_llm/training/qwen3_8b_4dev_worker.pynew file mode 100644index 0000000000000000000000000000000000000000..03ee6ee750f220be0e293c0ab9e760ff44b5501a--- /dev/null+++ b/mindspeed_llm/training/qwen3_8b_4dev_worker.py@@ -0,0 +1,61 @@+# coding=utf-8+# Copyright (c) 2024, HUAWEI CORPORATION.  All rights reserved.+#+# Licensed under the Apache License, Version 2.0 (the "License");+# you may not use this file except in compliance with the License.+# You may obtain a copy of the License at+#+#     http://www.apache.org/licenses/LICENSE-2.0+#+# Unless required by applicable law or agreed to in writing, software+# distributed under the License is distributed on an "AS IS" BASIS,+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+# See the License for the specific language governing permissions and+# limitations under the License.+"""Worker entry for the four-device Qwen3-8B training task.++Runs the regular ``pretrain_gpt`` program and then exits the process+immediately with ``os._exit``. All training output (including every+iteration record) and any checkpoint writes are completed and flushed+before this point; skipping the slow interpreter teardown (garbage+collection of large device tensors, communicator and device finalization)+shortens the shutdown phase substantially while the device driver reclaims+resources as usual when the process dies. The exit status is preserved so+the launcher keeps observing genuine success/failure.+"""++import os+import sys+from pathlib import Path+++def _flush_and_exit(code):+    try:+        sys.stdout.flush()+    finally:+        sys.stderr.flush()+    os._exit(code)+++def main():+    repo_root = str(Path(__file__).resolve().parents[2])+    if repo_root not in sys.path:+        sys.path.insert(0, repo_root)+    import pretrain_gpt++    try:+        pretrain_gpt.main()+    except SystemExit as exc:+        if isinstance(exc.code, str):+            print(exc.code, file=sys.stderr)+        code = exc.code if isinstance(exc.code, int) else (0 if exc.code is None else 1)+        _flush_and_exit(code)+    except BaseException:+        import traceback+        traceback.print_exc()+        _flush_and_exit(1)+    _flush_and_exit(0)+++if __name__ == "__main__":+    main()