Inspect · Source & workspace
Requested workspace inspection and file and log inspection related to source & workspace.
2 calls · #0001–#0002
echo <val>ls -l -a <path> <n> > <path>head -n <n>ls -l -a <val>Claude Opus 5 · Serving
SGLang Qwen3-14B system serving 2dev · Joint Optimization
01 / PROCESS MAP
Each row shows one agent’s tool events in its own recorded order. Colors show broad activities; bar widths do not represent duration.
Main agentClaude Opus 5 · 167 visible calls
02 / EVENT SEQUENCE
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.
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>.
Requested workspace inspection and file and log inspection related to source & workspace.
2 calls · #0001–#0002
echo <val>ls -l -a <path> <n> > <path>head -n <n>ls -l -a <val>Requested file and log inspection and workspace inspection related to task requirements.
4 calls · #0003–#0006
Read <path>cd <val>ls -l -a <val> <val> <val> <val> <val> <path><command> <args>cat <val>echoRequested file and log inspection related to source & workspace.
1 call · #0007–#0007
Read <path>Requested file and log inspection related to runtime processes.
1 call · #0008–#0008
Read <path>Requested file and log inspection related to task requirements.
1 call · #0009–#0009
Read <path>Requested file and log inspection and workspace inspection related to source & workspace.
2 calls · #0010–#0011
Read <path>lsecho <flag>ls <path>ls -l -a <path> <n> >& <path>headRequested environment setup or inspection and source searches related to parallelism & communication.
1 call · #0012–#0012
envgrep -i -E <val>sortRequested file and log inspection and runtime inspection related to device memory.
1 call · #0013–#0013
cat <val>echo <val>npu-smi info <n> >& <path>head -n <n>Requested workspace inspection, script or workload execution and dependency and build commands related to dependencies & build setup.
1 call · #0014–#0014
ls -l -a <val> <val> <n> >& <path>echo <flag>python3 -c <script> <n> >& <path>pip list <n> > <path>grep -i -E <val>Requested script or workload execution, execution waits and file and log inspection related to benchmark & validation setup.
2 calls · #0015–#0016
cd <val>nohup <val> <path> > <path> <n> >& <path>echo <val> <val>sleep <n>tail -n <n> <path>echo <val>ls -l -a <val>tail -n <n> <path> <n> > <path>Requested source searches and file and log inspection related to source & workspace.
1 call · #0017–#0017
cd <path>grep -r -n <val> --include <path>head -n <n>Requested file and log inspection related to runtime processes.
1 call · #0018–#0018
sed -n <val> <path>Requested workspace inspection, source searches and file and log inspection related to source & workspace.
2 calls · #0019–#0020
ls <path>echo <val>grep -r -l -n <val> --include <path> <path>head -n <n>wc -l <path>sed -n <val> <path>Requested source searches and file and log inspection related to benchmark & validation setup.
1 call · #0021–#0021
grep -a -E <val> <path> <n> > <path>tail -n <n>echo <flag>wc -c <path>Requested file and log inspection and source searches related to parallelism & communication.
1 call · #0022–#0022
cat <path>echo <val>grep -n -i <val> <path>head -n <n>Requested source searches, file and log inspection and workspace inspection related to batching & scheduling.
1 call · #0023–#0023
grep -a -o -E <val> <path>sortuniq -chead -n <n>echols <val>Requested file and log inspection related to source & workspace.
1 call · #0024–#0024
sed -n <val> <path>Requested source searches, file and log inspection and runtime inspection related to device memory.
1 call · #0025–#0025
grep -a -o -E <val> <path>tailecho <val>npu-smi infogrep -E <path>headRequested file and log inspection related to source & workspace.
1 call · #0026–#0026
sed -n <val> <path>Requested source searches, file and log inspection and runtime inspection related to device memory.
1 call · #0027–#0027
grep -a -o -E <val> <path>tail -n <n>echo <val>npu-smi infogrep -E <val>head -n <n>Requested file and log inspection and workspace inspection related to source & workspace.
1 call · #0028–#0028
cat <path>ls <path>Requested source searches, file and log inspection and workspace inspection related to attention kernels.
2 calls · #0029–#0030
cd <path>grep -a -o -E <val> <path>tail -n <n>echo <val>ls <path>grep -i -E <val>grep -r -l -n <val> <path>echo <flag>grep -r -n <val> <path> <path> <n> > <path>headRequested source searches and file and log inspection related to batching & scheduling.
1 call · #0031–#0031
grep -a -o -E <val> <path>tail -n <n>echo <val>tail -n <n> <path>Requested execution waits, source searches and file and log inspection related to batching & scheduling.
1 call · #0032–#0032
sleep <n>grep -a -o -E <val> <path>tail -n <n>echo <val>grep -a -c <val> <path>Requested file and log inspection related to source & workspace.
1 call · #0033–#0033
cd <path>sed -n <val> <path>Requested source searches and file and log inspection related to batching & scheduling.
1 call · #0034–#0034
grep -a -o -E <val> <path>tail -n <n>echo <val>grep -a -c <val> <path>Requested file and log inspection and source searches related to runtime processes.
2 calls · #0035–#0036
cd <path>sed -n <val> <path>echo <val>grep -n <val> <path>headRequested source searches, file and log inspection and workspace inspection related to batching & scheduling.
1 call · #0037–#0037
grep -a -o -E <val> <path>tail -n <n>echo <val>grep -a -c <val> <path>ls <val>Requested script or workload execution related to task requirements.
1 call · #0038–#0038
cd <val>python3 -c <script>Requested script or workload execution and file and log inspection related to task requirements.
1 call · #0039–#0039
cd <val>python3 -c <script> <n> >& <path>head -n <n>Requested source searches and file and log inspection related to batching & scheduling.
1 call · #0040–#0040
date -uecho <val>grep -a -o -E <val> <path>tail -n <n>grep -a -c <val> <path>Requested source searches and file and log inspection related to runtime processes.
1 call · #0041–#0041
cd <path>grep -r -n <val> --include <path> <path>headecho <val>grep -r -n <val> <path>grep -i <val>Requested file and log inspection related to source & workspace.
1 call · #0042–#0042
cd <path>sed -n <val> <path>Requested source searches, file and log inspection and workspace inspection related to batching & scheduling.
1 call · #0043–#0043
date -ugrep -a -o -E <val> <path>tail -n <n>echo <val>grep -a -c <val> <path>ls <val>Requested workspace file updates and workspace inspection related to source & workspace.
1 call · #0044–#0044
mkdir -p <path>ls <path>Requested code edits related to source & workspace.
2 calls · #0045–#0046
Write <path>Requested source searches, workspace inspection and script or workload execution related to batching & scheduling.
2 calls · #0047–#0048
date -ugrep -a -c <val> <path>ls <val>echo <val>python3 -c <script>env <vars>grep -a -o -E <val> <val>tail -n <n>grep -a -c <val> <val>Requested execution waits, environment setup or inspection and source searches related to batching & scheduling.
2 calls · #0049–#0050
sleep <n>date -uenv <vars>echo <val>grep -a -o -E <val> <val>tail -n <n>ls <val>tail -n <n> <path>Requested environment setup or inspection, source searches and file and log inspection related to batching & scheduling.
2 calls · #0051–#0052
date -uenv <vars>echo <val>grep -a -o -E <val> <val>tail -n <n><command> <args>ls <val>Requested script or workload execution related to latency & request handling.
1 call · #0053–#0053
python3 -c <script>Requested source searches and file and log inspection related to attention kernels.
2 calls · #0054–#0055
cd <path>grep -n <val> <path>sed -n <val> <path>echo <val>Requested script or workload execution and file and log inspection related to prefix caching.
1 call · #0056–#0056
cd <path>timeout <n> <val> -c <path> <n> >& <path>tail -n <n>Requested workspace file updates, script or workload execution and workspace inspection related to benchmark & validation setup.
4 calls · #0057–#0060
cd <val>rm -rf <path> <path>mkdir -p <path>nohup <val> <path> > <path> <n> >& <path>echo <val>cp <path> <path>ls -l -a <path>cd <path>lsrm -f <val> <val> <val> <val> <val>echo <flag>ls -l -asleep <n>date -uRequested file and log inspection, script or workload execution and workspace inspection related to runtime processes.
1 call · #0061–#0061
date -ucat <path> <n> > <path>python3 -c <script> <n> > <path>echo <val>ls <path>Requested script or workload execution and workspace inspection related to benchmark & validation setup.
1 call · #0062–#0062
date -upython3 -c <script>echo <val>ls <path>Requested workspace inspection related to source & workspace.
1 call · #0063–#0063
ls -l -a <path> <val> <flag>ls <path> <n> > <path>Requested workspace file updates, workspace inspection and script or workload execution related to benchmark & validation setup.
5 calls · #0064–#0068
rm -rf <path>cd <path>rm -f <val> <val> <val>ls <path> <path>cd <val>nohup <val> <path> > <path> <n> >& <path>echo <val>sleep <n>date -uls <path>env <vars>ls <val>grep -a -o -E <val> <val> <n> > <path>tail -n <n>Requested execution waits, environment setup or inspection and source searches related to device memory.
1 call · #0069–#0069
sleep <n>date -uenv <vars>grep -a -o -E <val> <val>tail -n <n>echo <val>npu-smi infogrep -E <val>Requested execution waits, environment setup or inspection and source searches related to batching & scheduling.
1 call · #0070–#0070
sleep <n>date -uenv <vars>grep -a -o -E <val> <val>tail -n <n>echo <val>Requested execution waits, environment setup or inspection and source searches related to batching & scheduling.
1 call · #0071–#0071
sleep <n>date -uenv <vars>grep -a -o -E <val> <val>tail -n <n>echo <val>ls <path>Requested execution waits, environment setup or inspection and source searches related to batching & scheduling.
1 call · #0072–#0072
sleep <n>date -uenv <vars>grep -a -o -E <val> <val>tail -n <n>echo <val>ls <val>Requested script or workload execution related to benchmark & validation setup.
1 call · #0073–#0073
date -upython3 -c <script>Requested code edits related to source & workspace.
1 call · #0074–#0074
Write <path>Requested code edits related to runtime processes.
1 call · #0075–#0075
Write <path>Requested workspace file updates, process termination and execution waits related to benchmark & validation setup.
1 call · #0076–#0076
chmod <val> <path>pkill -f <val> <n> > <path>sleep <n>nohup <val> <path> <val> <path> > <path> <n> >& <path>echo <val>date -uRequested workspace inspection, file and log inspection and runtime inspection related to runtime processes.
3 calls · #0077–#0079
date -uls -l -a <path>tail -n <n> <path> <n> > <path>echo <val>pgrep <flag> <args>headnohup <val> <val> <path> <val> <path> > <path> <n> >& <path> < <path><command> <args>sleep <n>head -n <n>grep -q <val>grep -a -o -E <val> <path>tail -n <n>Requested script or workload execution and file and log inspection related to task requirements.
1 call · #0080–#0080
cd <path>date -utimeout <n> <val> <path> <flag> <args>tail -n <n>Requested script or workload execution and file and log inspection related to task requirements.
1 call · #0081–#0081
cd <path>timeout <n> <val> <path> <flag> <args>tail -n <n>python3 -c <script>date -uRequested file and log inspection, process termination and execution waits related to device memory.
1 call · #0082–#0082
date -u<command> <args>head <flag>echo <val>kill <flag> <args>sleep <n>npu-smi infogrep <val>Requested script or workload execution, execution waits and source searches related to runtime processes.
4 calls · #0083–#0086
date -unohup <val> <val> <path> <val> <path> > <path> <n> >& <path> < <path><command> <args>sleep <n>grep -q <val>grep -a -o -E <val> <path>tail -n <n>curl -s <flag> <args>head -c <n>echopgrep -c -f <val>Requested file and log inspection, runtime inspection and source searches related to device memory.
1 call · #0087–#0087
date -utail -c <n> <path>echo <val>npu-smi infogrep -E <val>Requested runtime inspection, execution waits and file and log inspection related to runtime processes.
6 calls · #0088–#0093
date -upgrep -f <val>xargs -r <val> <flag> <args>sleep <n><command> <args>pgrep <flag> <args>head -n <n>cut <flag>echo <flag>ls -l -a <path>tail -c <n> <path> <n> > <path>rm -rf <path>bash <script> <val> <path>pgrep -c -f <val>grep -a -o -E <val> <path> <n> > <path>tail -n <n>grep -q <val>grep -a -o -E <val> <path>Requested script or workload execution and file and log inspection related to task requirements.
1 call · #0094–#0094
cd <path>date -utimeout <n> <val> <path> <flag> <args>tail -n <n>Requested script or workload execution related to benchmark & validation setup.
1 call · #0095–#0095
cd <path>python3 -c <script>Requested script or workload execution and file and log inspection related to task requirements.
1 call · #0096–#0096
cd <path>timeout <n> <val> <path> <flag> <args>tail -n <n>python3 -c <script>date -uRequested code edits related to source & workspace.
1 call · #0097–#0097
Edit <path>Requested source searches and file and log inspection related to source & workspace.
2 calls · #0098–#0099
cd <path>grep -n <val> <path>head -n <n>grep -r -n <val> --include <path> <path>headRequested file and log inspection related to runtime processes.
1 call · #0100–#0100
sed -n <val> <path>Requested code edits related to source & workspace.
1 call · #0101–#0101
Edit <path>Requested source searches, file and log inspection and runtime inspection related to runtime processes.
2 calls · #0102–#0103
cd <path>grep -n <val> <path>head -n <n>echo <flag>grep -r -n <val> <path> <path> <n> > <path>date -upgrep <flag> <args>Requested process termination, execution waits and runtime inspection related to runtime processes.
1 call · #0104–#0104
<command> <args>tr -d <val>echo <val>kill <flag> <args>sleep <n>pgrep <flag> <args>headRequested source searches, file and log inspection and runtime inspection related to device memory.
1 call · #0105–#0105
echo <val>echo <flag><command> <args>grep -E <val>headnpu-smi info <n> > <path>head -n <n>Requested workspace inspection and file and log inspection related to source & workspace.
1 call · #0106–#0106
echo <val>ls -l -a <val> <n> > <path>head -n <n>ls -l -a <path> <n> > <path>Requested script or workload execution, workspace file updates and workspace inspection related to benchmark & validation setup.
2 calls · #0107–#0108
cd <path>python3 - <script>mkdir -p <path>cp <path> <path> <path> <n> > <path>ls -l -a <path>echo <val>ls -l -a <path> <n> > <path>head -n <n>Requested file and log inspection related to runtime processes.
1 call · #0109–#0109
Read <path>Requested workspace file updates, script or workload execution and execution waits related to runtime processes.
2 calls · #0110–#0111
rm -rf <path> <path>bash <script> <val> <path> > <path> <n> >& <path>sleep <n>tail -n <n> <path>echo <path>grep -i -E <val> <path>tail -n <n>Requested workspace inspection, file and log inspection and runtime inspection related to runtime processes.
2 calls · #0112–#0113
ls -l -a <path>echo <val>wc -c <path>head -n <n> <path>pgrep <flag> <args>grep -v <val>headcat -n <path>Requested file and log inspection, source searches and execution waits related to runtime processes.
3 calls · #0114–#0116
wc -c <path> <n> > <path>echo <val>grep -i -E <val> <path> <n> > <path>tail -n <n>tail -c <n> <path> <n> > <path><command> <args>sleep <n>echo <path>grep <flag> <args>date -ucd <path>python3 <script> <val> <n> >& <path>Requested environment setup or inspection, workspace inspection and script or workload execution related to task requirements.
1 call · #0117–#0117
cd <path>env <vars>ls -l -a <val><command> <args>python3 <script> <flag> <args>tail -n <n>Requested script or workload execution related to source & workspace.
1 call · #0118–#0118
cd <path>python3 - <script>Requested script or workload execution related to task requirements.
1 call · #0119–#0119
cd <path>python3 - <script>Requested file and log inspection and workspace inspection related to benchmark & validation setup.
2 calls · #0120–#0121
cd <path>echo <val>cat -n <path>echocd <val>sed -n <val> <path>ls <path>Requested file and log inspection, process termination and execution waits related to runtime processes.
1 call · #0122–#0122
<command> <args>head <flag>echo <val>tr -d <val>kill <flag> <args>sleep <n>pgrep -f <val>headecho <flag>grep <n>date -uRequested runtime inspection, source searches and file and log inspection related to device memory.
1 call · #0123–#0123
pgrep <flag> <args>grep -v <path>headecho <flag>npu-smi info <n> > <path>grep -E <path>head -n <n>date -uRequested workspace inspection, workspace file updates and script or workload execution related to benchmark & validation setup.
3 calls · #0124–#0126
cd <val>ls -d <val> <n> > <path>rm -rf <val> <val> <val>echo <flag>rm -f <val> <val> <val> <val> <val> <val> <val> <val>ls -l -adate -ubash <script> > <path> <n> >& <path>echo <val><command> <args>sleep <n>tail -c <n> <path> <n> > <path>Requested workspace file updates, workspace inspection and runtime inspection related to device memory.
1 call · #0127–#0127
cd <val>rm -rf <val> <val>ls -d <val> <n> > <path>echo <flag>npu-smi info <n> > <path>grep -E <path>head -n <n>date -uRequested script or workload execution related to benchmark & validation setup.
1 call · #0128–#0128
bash <script> > <path> <n> >& <path>echo <val>date -uRequested execution waits, file and log inspection and script or workload execution related to benchmark & validation setup.
2 calls · #0129–#0130
<command> <args>sleep <n>date -uecho <val>tail -c <n> <path> <n> > <path>cd <path>python3 - <script>Requested script or workload execution related to runtime processes.
1 call · #0131–#0131
bash <script> <val> <path>Requested repository inspection, workspace inspection and script or workload execution related to source & workspace.
1 call · #0132–#0132
git status <flag>echo <val>ls -l -a <path>python3 -c <script>Requested execution waits, source searches and file and log inspection related to runtime processes.
1 call · #0133–#0133
<command> <args>sleep <n>date -ugrep <flag> <args>tail -n <n>Requested environment setup or inspection and file and log inspection related to task requirements.
1 call · #0134–#0134
cd <path>env <vars><command> <args>tail -n <n>date -uRequested source searches and file and log inspection related to runtime processes.
2 calls · #0135–#0136
grep -n <val> <path>head -n <n>Read <path>Requested source searches and file and log inspection related to attention kernels.
2 calls · #0137–#0138
grep -n <val> -A <n> <path>head -n <n>Requested file and log inspection related to runtime processes.
1 call · #0139–#0139
sed -n <val> <path>echo <val>Requested source searches, file and log inspection and workspace inspection related to attention kernels.
3 calls · #0140–#0142
grep -r -n <val> <path>head -n <n>echo <val>grep -r -n <val> <path> <path> <n> > <path>headfind <path> -name <val>grep -r -l -n <val> <path>grep -n <val> <path>Requested source searches, file and log inspection and process termination related to runtime processes.
1 call · #0143–#0143
grep -r -l -n <val> <path>headecho <flag> <args><command> <args>head <flag>tr -d <val>kill <flag> <args>echo <val>sleep <n>pgrep -f <val>date -uRequested runtime inspection, file and log inspection and source searches related to runtime processes.
1 call · #0144–#0144
pgrep <flag> <args>headecho <flag>grep -n <val> <path>Requested environment setup or inspection, script or workload execution and execution waits related to runtime processes.
2 calls · #0145–#0146
export <vars>bash <script> <val> <path><command> <args>sleep <n>date -ugrep <flag> <args>tail -n <n>Requested environment setup or inspection and file and log inspection related to task requirements.
1 call · #0147–#0147
cd <path>env <vars><command> <args>tail -n <n>date -uRequested file and log inspection, process termination and execution waits related to runtime processes.
1 call · #0148–#0148
<command> <args>head <flag>tr -d <val>kill <flag> <args>echo <val>sleep <n>ls -l -a <val>date -uRequested runtime inspection, source searches and file and log inspection related to device memory.
1 call · #0149–#0149
npu-smi info <n> > <path>grep -E <path>head -n <n>export <vars>bash <script> <val> <path>Requested source searches and file and log inspection related to task requirements.
2 calls · #0150–#0151
cd <path>grep -n <val> <path>head -n <n>sed -n <val> <path>echo <val>Requested file and log inspection and source searches related to task requirements.
1 call · #0152–#0152
cat > <path> <script>echo <val>grep <flag> <args>tail -n <n>date -uRequested execution waits, source searches and file and log inspection related to runtime processes.
1 call · #0153–#0153
<command> <args>sleep <n>date -ugrep <flag> <args>tail -n <n>Requested script or workload execution and file and log inspection related to source & workspace.
1 call · #0154–#0154
cd <path>timeout <n> <path> <path> <path> <n> >& <path>tail -n <n>date -uRequested file and log inspection, process termination and source searches related to runtime processes.
1 call · #0155–#0155
<command> <args>head <flag>tr -d <val>kill <flag> <args>echo <val>cat -n <path>grep -n <val> -A <n> <path>sed -n <val>Requested workspace file updates, workspace inspection and runtime inspection related to device memory.
1 call · #0156–#0156
mkdir -p <path>cp <path> <path> <path> <path> <n> > <path>ls <path>echo <val>pgrep -f <val>headnpu-smi info <n> > <path>grep -E <path>head -n <n>date -uRequested file and log inspection related to source & workspace.
1 call · #0157–#0157
Read <path>Requested code edits related to source & workspace.
2 calls · #0158–#0159
Edit <path>Requested script or workload execution and environment setup or inspection related to batching & scheduling.
1 call · #0160–#0160
python3 -c <script>env <vars> python3 -c <script>date -uRequested script or workload execution and file and log inspection related to source & workspace.
1 call · #0161–#0161
bash <script> <n> >& <path>tail -n <n>echo <val>date -uRequested workspace inspection, script or workload execution and repository inspection related to benchmark & validation setup.
1 call · #0162–#0162
echo <val>ls -l -a <val>echopython3 -c <script>git status <flag>echo <path>date -uRequested environment setup or inspection, workspace inspection and file and log inspection related to device memory.
1 call · #0163–#0163
env <vars>ls -l -a <val> <n> > <path>echo <val>cat <path> <n> > <path>Requested code edits related to device memory.
3 calls · #0164–#0166
Write <path>Requested runtime inspection, file and log inspection and source searches related to device memory.
1 call · #0167–#0167
echo <val>pgrep <flag> <args>headnpu-smi info <n> > <path>grep -E <path>head -n <n><command> <args>grep <val>git status <flag>find <path> -type <val>sortgit status <flag> <args>date -u03 / CANDIDATE ARTIFACT
Read code changes as Git diffs. Identifying strings are masked; binary files are listed by their full relative names.
Base commit: 340db9201005fc64635bb25db1d2538f955761c3
@@ -0,0 +1,10 @@+"""Task-owned deployment entrypoints for fixed serving contracts.++Each module in this package owns the internal execution plan (process+graph, parallel layout, scheduling, graph capture, memory sizing) for one+fixed model/hardware deployment, behind the public host ABI: the host+supplies only ``--model-path``, ``--tokenizer-path``,+``--served-model-name``, ``--host``, ``--port``, ``--device-ids`` and+``--runtime-dir``, and expects an OpenAI-compatible SGLang HTTP service on+that port.+"""@@ -0,0 +1,312 @@+"""Framework-owned deployment plan for the two-device Qwen3-14B service.++The host contract is narrow: it launches this module with only the model+projection, the public bind address, the assigned device ids and a+runtime scratch directory, then waits for an OpenAI-compatible SGLang+HTTP service on that port. Everything behind that boundary -- process+graph, parallel layout, scheduler sizing, graph capture, memory split and+NPU/HCCL runtime tuning -- is chosen here.++Plan for Qwen3-14B (BF16, 40 layers, 40 Q heads / 8 KV heads, d_head 128)+on two Ascend 910B1 devices, serving a 32-way concurrent mixed+prefill/decode workload:++* ``TP=2`` single replica. The workload is decode-dominated (the mixed+ profile emits 73 728 output tokens against 278 528 prompt tokens), and+ decode at these batch sizes is bound by weight traffic per step. TP=2+ halves the per-device weight read (~29.6 GB -> ~14.8 GB) and therefore+ roughly halves decode step time; two independent single-device replicas+ would each still pay the full weight read per step for half the batch,+ yielding no aggregate decode gain while doubling weight memory.+* Full NPU graph capture for decode. Measured on the reference plan,+ eager decode costs ~84 ms per step at batch 4 *and* at batch 32, i.e.+ the step is dominated by fixed per-step host launch cost across 40+ layers, not by device work. Capturing one NPU graph per decode batch+ size removes that cost. Prefill stays eager: prefill shapes are large+ and compute-bound, so capture buys nothing and costs startup time.+* KV pool sized for the real concurrency envelope. 32 concurrent+ requests of 2048+64 tokens need ~67.6k resident tokens; the reference+ plan capped the pool at 32 768, so the scheduler had to hold requests+ back and ran below the requested concurrency. At 80 KiB per token per+ device (40 layers x 4 local KV heads x 128 x {K,V} x 2 B) a 131 072+ token pool costs ~10 GiB per device, which fits comfortably beside the+ ~14.8 GiB of local weights.+* Radix cache stays off: prompts across the workload are disjoint, so+ prefix matching only adds bookkeeping, and leaving it off keeps the KV+ pool fully available to running requests.++Sampling-visible settings (greedy, BF16 weights and activations, seed,+context length, page size) are held at the values the public reference+plan uses.++Determinism note, measured rather than assumed+----------------------------------------------+Every plan change *except* decode graph capture is output-neutral. With+``cuda-graph-backend-decode`` forced to ``disabled`` and the rest of this+plan intact (TP=2, 131 072-token pool, mem-fraction 0.87, chunked prefill+16 384), replaying the formal HTTP cases reproduced the public reference+plan's projection digest exactly -- ``sha256:23fabdff...``, stable across+three runs -- so the pool, prefill and memory choices do not perturb+completions at all.++With decode graph capture enabled, replaying the same input twice differs+in a single token of one of the eight formal cases (a near-tie argmax at+one sampled position). NPU graph replay reduces a decode step through+BF16 accumulation whose ordering is not invariant across replays, so a+request's tokens can depend on the state of the step it shared. Greedy+sampling, seed, dtype and request isolation are unchanged; what is not+guaranteed is bit-identical repetition of a near-tie token.++This is a deliberate, quantified tradeoff, not an oversight. Graph+capture is the dominant source of throughput here: on the mixed profile,+this plan measures 1.9902 req/s with decode capture and 0.9282 req/s+without it, everything else held equal -- so the remaining plan changes+account for ~1.04x and capture for ~2.14x. The task's own correctness+command passes on the shipped configuration. ``ascend`` appears in+``DETERMINISTIC_ATTENTION_BACKEND_CHOICES``, but the NPU attention+backend contains no deterministic code path, so+``--enable-deterministic-inference`` would not close this gap on this+hardware. To trade the throughput back for bit-exactness, set+``cuda-graph-backend-decode`` to ``disabled`` in the override below.+"""++from __future__ import annotations++import argparse+import json+import os+import sys+from pathlib import Path+from typing import Any, Dict, List, Optional++# Fixed public deployment contract.+MODEL_ID = "Qwen/Qwen3-14B"+PUBLIC_HOST = "127.0.0.1"+CONTEXT_LENGTH = 4096+RANDOM_SEED = 20260819+DEVICE_COUNT = 2++# Decode graph tiers: every batch size from 1 to the concurrency ceiling.+#+# A sparse tier list would be cheaper to capture, but it pads each decode+# batch up to the next captured size, and the padded rows change the GEMM+# shapes the batch is reduced through. With BF16 accumulation that makes+# a request's own tokens depend on how many requests happened to share its+# step, so identical input replays produce different greedy completions.+# Capturing every size keeps each step at its exact batch size, which+# removes that padding-induced variance: measured over the formal HTTP+# cases, replaying the same input twice went from differing in two of+# eight cases (sparse tiers) to differing in one token of one case.+# Capture is startup work and the timing contract excludes startup, so+# the extra tiers cost nothing at serve time (73.5 s to capture all 32,+# and the measured score is unchanged: geomean 2.8002 vs 2.7996).+#+# See the determinism note at the end of the module docstring for the+# variance that graph replay itself still contributes.+DECODE_GRAPH_BATCH_SIZES = tuple(range(1, 33))++# KV pool budget in tokens. See module docstring for the sizing.+MAX_TOTAL_TOKENS = 131072++# Scheduler sizing.+MAX_RUNNING_REQUESTS = 32+CHUNKED_PREFILL_SIZE = 16384+MAX_PREFILL_TOKENS = 16384+MEM_FRACTION_STATIC = 0.87++# NPU / HCCL runtime environment applied before torch is imported.+RUNTIME_ENVIRONMENT: Dict[str, str] = {+ # Run HCCL collectives on the AI vector cores. Required for the+ # collectives inside a captured NPU graph to replay without host+ # participation, and cheaper per op than the default expansion.+ "HCCL_OP_EXPANSION_MODE": "AIV",+ # Collective staging buffer (MiB). The TP=2 all-reduces in this model+ # are small; 200 MiB is ample and avoids per-op resize.+ "HCCL_BUFFSIZE": "200",+ # Plan attention metadata on a side stream so the host-side plan of+ # step N+1 overlaps device work of step N.+ "SGLANG_ENABLE_OVERLAP_PLAN_STREAM": "1",+ # Keep NPU allocator segments non-expandable: graph capture records+ # absolute device addresses, and expandable segments can move them+ # between capture and replay.+ "PYTORCH_NPU_ALLOC_CONF": "",+}++# Development-only escape hatch. Unset in the scored path; when set it+# must contain a JSON object of ServerArgs CLI overrides, e.g.+# '{"cuda-graph-backend-decode": "disabled"}'. A null value drops the+# option entirely.+PLAN_OVERRIDE_ENV = "SGLANG_QWEN3_14B_PLAN_OVERRIDE_JSON"+ENV_OVERRIDE_ENV = "SGLANG_QWEN3_14B_ENV_OVERRIDE_JSON"+++def parse_args(argv: List[str]) -> argparse.Namespace:+ parser = argparse.ArgumentParser(+ prog="sglang.srt.deployment.qwen3_14b",+ description="Two-device Qwen3-14B SGLang serving deployment.",+ )+ parser.add_argument("--model-path", required=True)+ parser.add_argument("--tokenizer-path", required=True)+ parser.add_argument("--served-model-name", required=True)+ parser.add_argument("--host", required=True)+ parser.add_argument("--port", required=True, type=int)+ parser.add_argument("--device-ids", required=True)+ parser.add_argument("--runtime-dir", required=True)+ args = parser.parse_args(argv)++ if args.served_model_name != MODEL_ID:+ raise ValueError(f"served model name differs from the contract: {args.served_model_name}")+ if args.host != PUBLIC_HOST:+ raise ValueError(f"public host differs from the contract: {args.host}")+ if not 1 <= args.port <= 65535:+ raise ValueError("public port is invalid")+ devices = [item for item in args.device_ids.split(",") if item != ""]+ if len(devices) != DEVICE_COUNT or len(set(devices)) != DEVICE_COUNT:+ raise ValueError(f"deployment requires exactly {DEVICE_COUNT} assigned devices")+ for item in devices:+ if not item.isdigit():+ raise ValueError("assigned device ids are invalid")+ args.devices = devices+ return args+++def _json_object(name: str) -> Dict[str, Any]:+ raw = os.environ.get(name)+ if not raw:+ return {}+ value = json.loads(raw)+ if not isinstance(value, dict):+ raise ValueError(f"{name} must contain one JSON object")+ return value+++def runtime_environment() -> Dict[str, Optional[str]]:+ """Environment applied to this process before torch/torch_npu load."""+ plan: Dict[str, Optional[str]] = dict(RUNTIME_ENVIRONMENT)+ for name, value in _json_object(ENV_OVERRIDE_ENV).items():+ plan[str(name)] = None if value is None else str(value)+ return plan+++def apply_runtime_environment(plan: Dict[str, Optional[str]]) -> None:+ for name, value in plan.items():+ if value is None or value == "":+ os.environ.pop(name, None)+ else:+ os.environ[name] = value+++def server_argv(args: argparse.Namespace) -> List[str]:+ """Build the internal ServerArgs command line for the chosen plan."""+ options: Dict[str, Any] = {+ # --- public projection -------------------------------------------+ "model-path": args.model_path,+ "tokenizer-path": args.tokenizer_path,+ "served-model-name": MODEL_ID,+ "host": PUBLIC_HOST,+ "port": str(args.port),+ # --- fixed numerics: keep completions deterministic --------------+ "dtype": "bfloat16",+ "context-length": str(CONTEXT_LENGTH),+ "random-seed": str(RANDOM_SEED),+ "device": "npu",+ "attention-backend": "ascend",+ # --- parallel layout --------------------------------------------+ "tp-size": str(DEVICE_COUNT),+ "dp-size": "1",+ "pp-size": "1",+ # --- scheduling / memory ----------------------------------------+ "schedule-policy": "fcfs",+ "max-running-requests": str(MAX_RUNNING_REQUESTS),+ "max-total-tokens": str(MAX_TOTAL_TOKENS),+ "chunked-prefill-size": str(CHUNKED_PREFILL_SIZE),+ "max-prefill-tokens": str(MAX_PREFILL_TOKENS),+ "mem-fraction-static": str(MEM_FRACTION_STATIC),+ "disable-radix-cache": True,+ # --- graph capture ----------------------------------------------+ "cuda-graph-backend-decode": "full",+ "cuda-graph-max-bs-decode": str(MAX_RUNNING_REQUESTS),+ "cuda-graph-bs-decode": " ".join(str(bs) for bs in DECODE_GRAPH_BATCH_SIZES),+ "cuda-graph-backend-prefill": "disabled",+ # Every decode batch size is captured, so this never forces an eager+ # fallback; it states the invariant and stops the runner from padding+ # a batch into a wider captured graph.+ "disable-cuda-graph-padding": True,+ }++ for name, value in _json_object(PLAN_OVERRIDE_ENV).items():+ key = str(name)+ if value is None:+ options.pop(key, None)+ else:+ options[key] = value if isinstance(value, bool) else str(value)++ argv: List[str] = []+ for name, value in options.items():+ if value is True:+ argv.append(f"--{name}")+ elif value is False or value is None:+ continue+ else:+ argv.append(f"--{name}")+ argv.extend(str(value).split(" ") if " " in str(value) else [str(value)])+ return argv+++def write_plan_record(runtime_dir: Path, record: Dict[str, Any]) -> None:+ try:+ runtime_dir.mkdir(parents=True, exist_ok=True)+ (runtime_dir / "deployment-plan.json").write_text(+ json.dumps(record, indent=2, sort_keys=True) + "\n", encoding="utf-8"+ )+ except OSError:+ # The plan record is observability only; never block the service.+ pass+++def main(argv: Optional[List[str]] = None) -> int:+ args = parse_args(list(sys.argv[1:] if argv is None else argv))++ environment = runtime_environment()+ apply_runtime_environment(environment)++ inner_argv = server_argv(args)+ write_plan_record(+ Path(args.runtime_dir),+ {+ "schema_version": 1,+ "kind": "sglang_qwen3_14b_deployment_plan",+ "model": MODEL_ID,+ "devices": args.devices,+ "process_graph": "single tokenizer/HTTP process, TP=2 scheduler workers",+ "parallel_layout": {"tp": DEVICE_COUNT, "dp": 1, "pp": 1, "ep": 1},+ "server_argv": inner_argv,+ "environment": {+ name: value for name, value in environment.items() if value+ },+ },+ )++ # Imported after the runtime environment is in place so torch_npu and+ # HCCL observe the selected settings at import time.+ from sglang.srt.plugins import load_plugins+ from sglang.srt.server_args import prepare_server_args+ from sglang.srt.utils import kill_process_tree+ from sglang.srt.utils.common import suppress_noisy_warnings++ suppress_noisy_warnings()+ load_plugins()++ server_args = prepare_server_args(inner_argv)++ from sglang.srt.entrypoints.http_server import launch_server++ try:+ launch_server(server_args)+ finally:+ kill_process_tree(os.getpid(), include_parent=False)+ return 0+++if __name__ == "__main__":+ raise SystemExit(main())