GPT-5.6 Sol · Training

T04 · Training joint

Valid

Qwen3-8B system training 4dev · Joint Optimization

1.27×PERFORMANCE RATIO
122TOOL 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 agentGPT-5.6 Sol · 122 visible calls

InspectEditValidateExecuteBuildProfileRollbackOther
64Inspect
5Edit
35Validate
15Execute
3Other

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 timeline79 groups · 122 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, environment setup or inspection and source searches related to task requirements.

    3 calls · #0001–#0003

    pwdprintenv <vars>rg --files -g <val> -g <path> <path> <n> > <path>sed -n <val>wc -l <path> <path>sed -n <val> <path>
    5 more command sketches
    git status --shortgit -C <path> <val> --shortfind <path> -type <val> -maxdepth <n> <flag> <args>sortfind <path> <path> <path> <path> <path> -maxdepth <n> -type <val> <flag> <args>
  2. Validate · Task requirements

    Requested file and log inspection related to task requirements.

    1 call · #0004–#0004

    <command> <args>sed -n <val> <val>
  3. Inspect · Source & workspace

    Requested file and log inspection related to source & workspace.

    4 calls · #0005–#0008

    wc -l <path>sed -n <val> <path>
  4. Inspect · Device memory

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

    1 call · #0009–#0009

    envrg <val>sortnpu-smi info <n> >& <path>sed -n <val>
  5. Validate · Benchmark & validation setup

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

    1 call · #0010–#0010

    ps <flag> <args>rg <val>sed -n <val><command> <args>tail -n <n> <val>
  6. Validate · Device memory

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

    1 call · #0011–#0011

    npu-smi info <n> > <path>rg <path>sed -n <val>tail -n <n> <path>
  7. Validate · Checkpoints & weight state

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

    2 calls · #0012–#0013

    du <flag> <args>truetail -n <n> <path>ps -o <val> -p <val>find <path> -maxdepth <n> -type <val> <flag> <args>sort
    3 more command sketches
    sed -n <val>npu-smi info <n> > <path>rg <path>
  8. Inspect · Checkpoints & weight state

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

    1 call · #0014–#0014

    free -hdf -h <val>ps -o <val> -p <val>find <path> -maxdepth <n> <flag> <args>sed -n <val>
  9. Inspect · Precision & numerical checks

    Requested source searches and file and log inspection related to precision & numerical checks.

    1 call · #0015–#0015

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

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

    3 calls · #0016–#0018

    sed -n <val> <path>sed -n <val>rg -n -i <val> <path> --glob <path> --glob <val> --glob <val> --glob <val> <args>
  11. Inspect · Checkpoints & weight state

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

    1 call · #0019–#0019

    ps -o <val> -p <val>du <flag> <args>truefind <path> -type <val> <flag> <args>sort -ntail -n <n>
    2 more command sketches
    rg -n <val> <path> <val> <path>sed -n <val>
  12. Validate · Benchmark & validation setup

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

    1 call · #0020–#0020

    ps <flag> <args>rg <path>sed -n <val>ls -l <path> <n> > <path>truetail -n <n> <path> <n> > <path>
  13. Inspect · Parallelism & communication

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

    2 calls · #0021–#0022

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

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

    1 call · #0023–#0023

    rg -n <val> <path> <path> <path> <path>sed -n <val>
  15. Inspect · Parallelism & communication

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

    2 calls · #0024–#0025

    sed -n <val> <path>rg -n <val> <path> <path> -g <path>sed -n <val>
  16. Inspect · Benchmark & validation setup

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

    1 call · #0026–#0026

    tail -n <n> <path>ps -o <val> -p <val>
  17. Inspect · Optimizer & gradients

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

    1 call · #0027–#0027

    rg -n -i <val> <path> <path> <val>sed -n <val>rg -n <val> <path> <path> --glob <path>
  18. Inspect · Source & workspace

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

    1 call · #0028–#0028

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

    1 tool error

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

    5 calls · #0029–#0033

    rg -n <val> <path> <path> <val>sed -n <val>rg -n <val> <path> <path> --glob <path>sed -n <val> <path>rg -n <val> <val> <path>python - <script>
    1 more command sketches
    rg -n <val> <path>
  20. Inspect · Parallelism & communication

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

    1 call · #0034–#0034

    rg -n <val> <path> <path>sed -n <val>sed -n <val> <path>
  21. Inspect · Checkpoints & weight state

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

    1 call · #0035–#0035

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

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

    2 calls · #0036–#0037

    sed -n <val> <path>rg -n <val> <path> <path> <val> <path>sed -n <val>rg -n <val> <path> <path> --glob <path>
  23. Validate · Device memory

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

    1 call · #0038–#0038

    ps -o <val> -p <val>tail -n <n> <path>npu-smi info <n> > <path>rg <path>sed -n <val>
  24. Validate · Benchmark & validation setup

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

    2 calls · #0039–#0040

    bash <script>env <vars>mkdir -p <val>find <val> -maxdepth <n> -type <val> <val> -name <val> -o -name <val> <args>find <val> -maxdepth <n> -type <val> <flag> <args>sort
    3 more command sketches
    sed -n <val> <path>git status --shortgit -C <path> <val> --short
  25. Execute · Benchmark & validation setup

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

    1 call · #0041–#0041

    ps <flag> <args>rg <path>sed -n <val><command> <args>tail -n <n> <val>
  26. Inspect · Source & workspace

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

    1 call · #0042–#0042

    tail -n <n> <path>ps <flag> <args>awk <val>sed -n <val>
  27. Execute · Benchmark & validation setup

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

    1 call · #0043–#0043

    ls -l <path> <n> > <path>truetail -n <n> <path> <n> > <path>ps <flag> <args>rg <val>sed -n <val>
  28. Other · Benchmark & validation setup

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

    1 call · #0044–#0044

    bash <script>
  29. Execute · Benchmark & validation setup

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

    1 call · #0045–#0045

    tail -n <n> <path>env <vars>find <val> -maxdepth <n> -type <val> <val> -name <val> -o -name <val> <args>find <val> -maxdepth <n> -type <val> <flag> <args>sortsed -n <val>
  30. Inspect · Source & workspace

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

    3 calls · #0046–#0048

    find <path> -maxdepth <n> -type <val> <flag> <args>sortsed -n <val>git -C <path> <val> <flag> <args>rg -n <val> <path> <path> <path> <path>rg -n <val> <path> <path>
    1 more command sketches
    sed -n <val> <path>
  31. Edit · Source & workspace

    Requested code edits related to source & workspace.

    1 call · #0049–#0049

    Apply patch <patch>
  32. Inspect · Source & workspace

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

    3 calls · #0050–#0052

    ps <flag> <args>rg <path>sed -n <val>sed -n <val> <path>git -C <path> <val> --shortgit -C <path> <val> --check
    8 more command sketches
    git -C <path> <val> --statpython -B - <script>env <vars> python -B -m <module> --helpbash <script>kill <flag> <args>truesleep <n>rg <val>
  33. Edit · Source & workspace

    Requested code edits related to source & workspace.

    1 call · #0053–#0053

    Apply patch <patch>
  34. Validate · Benchmark & validation setup

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

    3 calls · #0054–#0056

    ps <flag> <args>rg <path>sed -n <val>tail -n <n> <path> <n> > <path>true<command> <args>
    3 more command sketches
    git -C <path> <val> --checkbash <script>rg <val>
  35. Validate · Checkpoints & weight state

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

    1 call · #0057–#0057

    tail -n <n> <path>du <flag> <args>trueps <flag> <args>sed -n <val>
  36. Inspect · Optimizer & gradients

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

    1 call · #0058–#0058

    rg -n <val> <path>tail -n <n>
  37. Inspect · Checkpoints & weight state

    1 tool error

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

    3 calls · #0059–#0061

    du <flag> <args>truefind <path> -type <val> <flag> <args>sort -ntail -n <n>ps <flag> <args>
    3 more command sketches
    awk <val>sed -n <val>ps -o <val> -p <val>
  38. Validate · Benchmark & validation setup

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

    1 call · #0062–#0062

    ps <flag> <args>rg <val>sed -n <val>tail -n <n> <path> <n> > <path>true
  39. Inspect · Benchmark & validation setup

    1 tool error

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

    2 calls · #0063–#0064

    tail -n <n> <path>ps -o <val> -p <val>
  40. Validate · Benchmark & validation setup

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

    1 call · #0065–#0065

    <command> <args>env <vars>bash <script>
  41. Execute · Benchmark & validation setup

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

    2 calls · #0066–#0067

    tail -n <n> <path> <n> > <path>trueps <flag> <args>rg <val>sed -n <val>
  42. Validate · Benchmark & validation setup

    Requested environment setup or inspection, workspace file updates and workspace inspection related to benchmark & validation setup.

    1 call · #0068–#0068

    env <vars>mkdir -p <val>find <val> -maxdepth <n> -type <val> <val> -name <val> -o -name <val> <args><command> <args>bash <script>
  43. Execute · Parallelism & communication

    1 tool error

    Requested environment setup or inspection, workspace file updates and workspace inspection related to parallelism & communication.

    1 call · #0069–#0069

    env <vars>mkdir -p <val>find <val> -maxdepth <n> -type <val> <val> -name <val> -o -name <val> <args><command> <args>python -B - <path> <val> > <path> <n> > <path> <script>rg <path> <path>
    1 more command sketches
    tail -n <n> <path>
  44. Inspect · Source & workspace

    Requested file and log inspection related to source & workspace.

    2 calls · #0070–#0071

    tail -n <n> <path>printf <val> <val>
  45. Execute · Parallelism & communication

    Requested environment setup or inspection, script or workload execution and source searches related to parallelism & communication.

    1 call · #0072–#0072

    env <vars><command> <args>python -B - <path> <val> > <path> <n> > <path> <script>rg <path> <path>tail -n <n> <path>
  46. Inspect · Source & workspace

    Requested file and log inspection related to source & workspace.

    1 call · #0073–#0073

    tail -n <n> <path>
  47. Execute · Parallelism & communication

    Requested environment setup or inspection, script or workload execution and source searches related to parallelism & communication.

    6 calls · #0074–#0079

    env <vars><command> <args>python -B - <path> <val> > <path> <n> > <path> <script>rg <path> <path>tail -n <n> <path>
  48. Inspect · Source & workspace

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

    1 call · #0080–#0080

    rg -n <val> <path>sed -n <val>
  49. Inspect · Parallelism & communication

    Requested file and log inspection related to parallelism & communication.

    1 call · #0081–#0081

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

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

    1 call · #0082–#0082

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

    Requested source searches related to optimizer & gradients.

    1 call · #0083–#0083

    rg -n -C <n> <val> <path> <path> <path>
  52. Inspect · Parallelism & communication

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

    1 call · #0084–#0084

    rg -n -C <n> <val> <path> <path> <path>head -n <n>rg -n <val> <path> <path> --glob <path>
  53. Inspect · Source & workspace

    Requested environment setup or inspection, source searches and workspace inspection related to source & workspace.

    2 calls · #0085–#0086

    envrg <val>sortfind <path> -maxdepth <n> -type <val> <flag> <args>tail -n <n>sed -n <val> <path>
    3 more command sketches
    ps -o <val> -p <val> -o <val> -p <val>tr -d <val> <n> > <path>true
  54. Inspect · Parallelism & communication

    Requested environment setup or inspection, source searches and file and log inspection related to parallelism & communication.

    1 call · #0087–#0087

    envrg <val>truesed -n <val> <path>tail -n <n> <path>git -C <path> <val> <flag> <args>
  55. Edit · Source & workspace

    Requested code edits related to source & workspace.

    1 call · #0088–#0088

    Apply patch <patch>
  56. Inspect · Benchmark & validation setup

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

    1 call · #0089–#0089

    python -m <module> <script> <script>rg -n <val> <path>tail -n <n>git -C <path> <val> --checkgit -C <path> <val> --short
  57. Inspect · Source & workspace

    Requested workspace inspection related to source & workspace.

    1 call · #0090–#0090

    find <val> -maxdepth <n> -type <val> <flag> <args>sort
  58. Validate · Benchmark & validation setup

    1 tool error

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

    2 calls · #0091–#0092

    bash <script>ps <flag> <args>rg <path>rg -v <val>ls -l <path> <n> > <path>true
    2 more command sketches
    find <val> -maxdepth <n> -type <val> <flag> <args>sort
  59. Inspect · Benchmark & validation setup

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

    1 call · #0093–#0093

    tail -n <n> <path>
  60. Validate · Benchmark & validation setup

    1 tool error

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

    2 calls · #0094–#0095

    <command> <args>bash <script>ps <flag> <args>rg <path>rg -v <val>true
    2 more command sketches
    rg <val>tail -n <n> <path>
  61. Inspect · Source & workspace

    Requested source searches related to source & workspace.

    1 call · #0096–#0096

    rg -n -C <n> <val> <path> <path>
  62. Edit · Source & workspace

    Requested code edits related to source & workspace.

    1 call · #0097–#0097

    Apply patch <patch>
  63. Validate · Benchmark & validation setup

    1 tool error

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

    1 call · #0098–#0098

    mv <path> <path>bash <script>
  64. Edit · Source & workspace

    Requested code edits related to source & workspace.

    1 call · #0099–#0099

    Apply patch <patch>
  65. Validate · Checkpoints & weight state

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

    1 call · #0100–#0100

    rg -n <val> <path> <path>head -n <n>python -m <module> <script> <script>git -C <path> <val> --check
  66. Validate · Benchmark & validation setup

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

    1 call · #0101–#0101

    tail -n <n> <path> <n> > <path>trueps <flag> <args>rg <val>rg -v <val>wc -l
  67. Validate · Checkpoints & weight state

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

    4 calls · #0102–#0105

    rg -n <path> <path> <path> <n> > <path>tail -n <n>ps <flag> <args>rg <path>rg -v <val>head -n <n>
    10 more command sketches
    tail -n <n> <path>rg <val>truestat -c <val> <path> <path>du <flag> <args>wc -lfind <path> -type <val> <flag> <args>sort <flag>headsed -n <val>
  68. Other · Source & workspace

    Requested runtime inspection related to source & workspace.

    1 call · #0106–#0106

    date -u <val>ps -o <val> -p <n>
  69. Inspect · Checkpoints & weight state

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

    1 call · #0107–#0107

    du <flag> <args>truefind <path> -type <val> <flag> <args>sort <flag>head -n <n>ps -o <val> -p <n>
    1 more command sketches
    date -u <val>
  70. Validate · Checkpoints & weight state

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

    1 call · #0108–#0108

    du <flag> <args>truetail -n <n> <path>rg <val>ps -o <val> -p <n> <n> > <path>date -u <val>
  71. Validate · Benchmark & validation setup

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

    1 call · #0109–#0109

    ps <flag> <args>rg <path>rg -v <val>head -n <n>stat -c <val> <path> <n> > <path>true
    2 more command sketches
    tail -n <n> <path>head
  72. Validate · Checkpoints & weight state

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

    3 calls · #0110–#0112

    tail -n <n> <path>rg <val>trueps -o <val> -p <val>date -u <val>
  73. Validate · Benchmark & validation setup

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

    2 calls · #0113–#0114

    <command> <args>bash <script>tail -n <n> <path>rg <val>truedate -u <val>
  74. Inspect · Attention kernels

    Requested file and log inspection, source searches and runtime inspection related to attention kernels.

    2 calls · #0115–#0116

    tail -n <n> <path> <n> > <path>rg <val>trueps <flag> <args>rg <path>rg -v <val>
    2 more command sketches
    head -n <n>date -u <val>
  75. Inspect · Source & workspace

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

    1 call · #0117–#0117

    tail -n <n> <path> <n> > <path>rg <val>trueps <flag> <args>rg <path>rg -v <val>
    2 more command sketches
    head -n <n>date -u <val>
  76. Execute · Benchmark & validation setup

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

    2 calls · #0118–#0119

    tail -n <n> <path>rg <val>truedate -u <val><command> <args>bash <script>
  77. Other · Source & workspace

    Requested repository inspection related to source & workspace.

    1 call · #0120–#0120

    git -C <path> <val> --shortgit -C <path> <val> --checkgit -C <path> <val> --statgit -C <path> <val> <flag> <args>true
  78. Inspect · Source & workspace

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

    1 call · #0121–#0121

    bash <script>ps <flag> <args>rg <val>rg -v <val>true<command> <args>
    2 more command sketches
    python -m <module> <script> <script> <script>git -C <path> <val> --check
  79. Validate · Optimizer & gradients

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

    1 call · #0122–#0122

    <command> <args>sed -n <val>rg <val>find <val> -maxdepth <n> -type <val> <flag> <args>sortgit -C <path> <val> --short

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..4ce2b2cb22c86b4fc516f0b467595cdd63c2032f 100644--- a/mindspeed_llm/__init__.py+++ b/mindspeed_llm/__init__.py@@ -13,7 +13,15 @@ # See the License for the specific language governing permissions and # limitations under the License. import os+import sys  backend = os.environ.get("TRAINING_BACKEND", "mcore").lower()-if backend == "mcore":+# The four-device task launcher only validates its controller-owned arguments+# before replacing itself with torchrun. Avoid importing the full framework in+# that transient process; torchrun workers do not have these launcher options+# and therefore still install the normal adaptor before importing Megatron.+is_qwen3_task_launcher = all(+    option in sys.argv for option in ("--run-spec", "--device-ids", "--runtime-dir")+)+if backend == "mcore" and not is_qwen3_task_launcher:     from mindspeed_llm.tasks import megatron_adaptor_v2 as megatron_adaptordiff --git a/mindspeed_llm/training/qwen3_8b_4dev.py b/mindspeed_llm/training/qwen3_8b_4dev.pynew file mode 100644index 0000000000000000000000000000000000000000..cfc74f2425c694aeb6c95b3cf9332cbd79fe4976--- /dev/null+++ b/mindspeed_llm/training/qwen3_8b_4dev.py@@ -0,0 +1,320 @@+"""Task entrypoint for deterministic Qwen3-8B training on four NPUs.++The task controller owns the public run specification and process group.  This+module validates that interface, translates it to the existing Megatron/MindSpeed+training program, and then replaces itself with ``torchrun`` so signals and exit+status continue to belong to the controller's foreground process group.+"""++from __future__ import annotations++import argparse+import json+import os+from pathlib import Path+import sys+from typing import Any+++_MODEL_KEYS = {+    "num_layers",+    "model_width",+    "ffn_width",+    "num_attention_heads",+    "num_query_groups",+    "kv_channels",+    "vocab_size",+    "rotary_base",+}+_OPTIMIZER_KEYS = {+    "learning_rate",+    "minimum_learning_rate",+    "learning_rate_decay_style",+    "weight_decay",+    "adam_beta1",+    "adam_beta2",+    "clip_grad",+}+_WORK_KEYS = {+    "sequence_length",+    "global_batch_size",+    "optimizer_updates",+    "log_interval",+}+++def _parser() -> argparse.ArgumentParser:+    parser = argparse.ArgumentParser(description=__doc__)+    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, type=int)+    parser.add_argument("--runtime-dir", required=True)+    parser.add_argument("--output-dir", required=True)+    parser.add_argument("--checkpoint-dir")+    parser.add_argument("--save-at", type=int)+    parser.add_argument("--resume", action="store_true")+    return parser+++def _regular_json_file(raw: str) -> tuple[Path, dict[str, Any]]:+    path = Path(raw)+    if not path.is_absolute() or not path.is_file() or path.is_symlink():+        raise ValueError("--run-spec must name an absolute regular file")+    value = json.loads(path.read_text(encoding="utf-8"))+    if not isinstance(value, dict):+        raise ValueError("run specification must contain a JSON object")+    return path, value+++def _existing_directory(raw: str, option: str) -> Path:+    path = Path(raw)+    if not path.is_absolute() or not path.is_dir() or path.is_symlink():+        raise ValueError(f"{option} must name an absolute directory")+    return path+++def _require_keys(value: object, keys: set[str], label: str) -> dict[str, Any]:+    if not isinstance(value, dict) or set(value) != keys:+        raise ValueError(f"invalid {label} section in run specification")+    return value+++def _positive_int(value: object, label: str) -> int:+    if type(value) is not int or value <= 0:+        raise ValueError(f"{label} must be a positive integer")+    return value+++def _finite_number(value: object, label: str) -> float:+    if type(value) not in (int, float):+        raise ValueError(f"{label} must be numeric")+    number = float(value)+    if not (number == number and abs(number) != float("inf")):+        raise ValueError(f"{label} must be finite")+    return number+++def _validated_spec(raw: dict[str, Any]) -> dict[str, Any]:+    if set(raw) != {"schema_version", "kind", "seed", "model", "optimizer", "work"}:+        raise ValueError("run specification has an invalid top-level shape")+    if raw["schema_version"] != 1 or raw["kind"] != "mindspeed_training_run_spec":+        raise ValueError("unsupported run specification")+    if type(raw["seed"]) is not int or raw["seed"] < 0:+        raise ValueError("seed must be a non-negative integer")++    model = _require_keys(raw["model"], _MODEL_KEYS, "model")+    optimizer = _require_keys(raw["optimizer"], _OPTIMIZER_KEYS, "optimizer")+    work = _require_keys(raw["work"], _WORK_KEYS, "work")+    for key in _MODEL_KEYS:+        _positive_int(model[key], f"model.{key}")+    for key in ("sequence_length", "global_batch_size", "optimizer_updates", "log_interval"):+        _positive_int(work[key], f"work.{key}")+    for key in _OPTIMIZER_KEYS - {"learning_rate_decay_style"}:+        _finite_number(optimizer[key], f"optimizer.{key}")+    if optimizer["learning_rate_decay_style"] != "cosine":+        raise ValueError("only the task's cosine learning-rate schedule is supported")+    return raw+++def _device_ids(raw: str) -> tuple[int, ...]:+    parts = raw.split(",")+    if len(parts) != 4 or any(not item.isdigit() for item in parts):+        raise ValueError("--device-ids must contain four comma-separated device ids")+    values = tuple(int(item) for item in parts)+    if len(set(values)) != len(values):+        raise ValueError("--device-ids contains duplicates")+    return values+++def _training_argv(+    *,+    spec: dict[str, Any],+    devices: tuple[int, ...],+    master_addr: str,+    master_port: int,+    checkpoint: Path | None,+    save_at: int | None,+    resume: bool,+) -> list[str]:+    model = spec["model"]+    optimizer = spec["optimizer"]+    work = spec["work"]+    updates = int(work["optimizer_updates"])+    source_root = Path(__file__).resolve().parents[2]+    training_program = source_root / "pretrain_gpt.py"+    if not training_program.is_file():+        raise ValueError("pretrain_gpt.py is unavailable")++    argv = [+        sys.executable,+        "-B",+        "-m",+        "torch.distributed.run",+        f"--nproc_per_node={len(devices)}",+        "--nnodes=1",+        "--node_rank=0",+        f"--master_addr={master_addr}",+        f"--master_port={master_port}",+        str(training_program),+        "--use-mcore-models",+        "--spec",+        "mindspeed_llm.tasks.models.spec.qwen3_spec",+        "layer_spec",+        "--transformer-impl",+        "local",+        "--distributed-backend",+        "nccl",+        "--tensor-model-parallel-size",+        "1",+        "--pipeline-model-parallel-size",+        "2",+        "--num-layers-per-virtual-pipeline-stage",+        "3",+        "--context-parallel-size",+        "1",+        "--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",+        "1",+        "--global-batch-size",+        str(work["global_batch_size"]),+        "--train-iters",+        str(updates),+        "--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",+        "--use-distributed-optimizer",+        "--reuse-fp32-param",+        "--overlap-grad-reduce",+        "--overlap-param-gather",+        "--use-ascend-coc",+        "--num-workers",+        "0",+        "--log-interval",+        str(work["log_interval"]),+        "--eval-iters",+        "0",+        "--eval-interval",+        str(updates),+    ]+    if resume:+        assert checkpoint is not None+        argv.extend(("--load", str(checkpoint)))+    elif save_at is not None:+        assert checkpoint is not None+        argv.extend(+            (+                "--save",+                str(checkpoint),+                "--save-interval",+                str(save_at),+                "--exit-interval",+                str(save_at),+            )+        )+    return argv+++def main(argv: list[str] | None = None) -> int:+    args = _parser().parse_args(argv)+    _, raw_spec = _regular_json_file(args.run_spec)+    spec = _validated_spec(raw_spec)+    devices = _device_ids(args.device_ids)+    _existing_directory(args.runtime_dir, "--runtime-dir")+    _existing_directory(args.output_dir, "--output-dir")+    if args.master_addr not in {"127.0.0.1", "localhost"}:+        raise ValueError("--master-addr must be loopback")+    if not 1 <= args.master_port <= 65535:+        raise ValueError("--master-port is outside the TCP port range")+    if args.resume and args.save_at is not None:+        raise ValueError("--resume and --save-at are mutually exclusive")++    checkpoint: Path | None = None+    if args.checkpoint_dir is not None:+        checkpoint = Path(args.checkpoint_dir)+        if not checkpoint.is_absolute() or checkpoint.is_symlink():+            raise ValueError("--checkpoint-dir must be an absolute non-symlink path")+    if args.resume:+        if checkpoint is None or not checkpoint.is_dir():+            raise ValueError("--resume requires an existing checkpoint directory")+    if args.save_at is not None:+        updates = int(spec["work"]["optimizer_updates"])+        if checkpoint is None or not 1 <= args.save_at <= updates:+            raise ValueError("--save-at requires a checkpoint path and a valid update")++    command = _training_argv(+        spec=spec,+        devices=devices,+        master_addr=args.master_addr,+        master_port=args.master_port,+        checkpoint=checkpoint,+        save_at=args.save_at,+        resume=args.resume,+    )+    environment = os.environ.copy()+    environment["MINDSPEED_QWEN3_BENCHMARK_FAST_EXIT"] = "1"+    os.execve(sys.executable, command, environment)+    return 127+++if __name__ == "__main__":+    raise SystemExit(main())diff --git a/pretrain_gpt.py b/pretrain_gpt.pyindex 5a8506bb3f73e23ca5e1c1e2562d0a861c433cfb..0e1bf42e16d70bd8a0365a02c14a35c8f42e29a8 100644--- a/pretrain_gpt.py+++ b/pretrain_gpt.py@@ -3,6 +3,7 @@ """Pretrain GPT."""  import os+import sys from functools import partial from typing import Union @@ -305,5 +306,27 @@ def main():              forward_step)  +def _fast_benchmark_worker_exit():+    """Exit without Python's expensive NPU-context finalizers.++    The benchmark launcher enables this only for its short-lived workers.  At+    this point ``pretrain`` has returned, so the optimizer update and normal+    training observations are complete.  Synchronizing the device and all+    ranks before flushing output preserves that completion boundary, while+    ``os._exit`` avoids spending several seconds finalizing already-disposable+    process-local NPU and data-loader state.+    """+    if os.environ.get("MINDSPEED_QWEN3_BENCHMARK_FAST_EXIT") != "1":+        return++    torch.npu.synchronize()+    if torch.distributed.is_available() and torch.distributed.is_initialized():+        torch.distributed.barrier()+    sys.stdout.flush()+    sys.stderr.flush()+    os._exit(0)++ if __name__ == "__main__":     main()+    _fast_benchmark_worker_exit()