Skip to content

tools+docs: a spec-decode arm's server dies with the arm, and PARD-2's repos are weights-only (borrow the target's tokenizer) - #1509

Merged
bong-water-water-bong merged 1 commit into
mainfrom
npu/amd-drafters-2
Nov 8, 2026
Merged

bong-water-water-bong merged 1 commit into
mainfrom
npu/amd-drafters-2

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

Two lessons from the run that produced the 1.50× HRX row, both of which cost something real.

1. A server must not outlive its arm

tools/spec_decode_speedup.sh starts one llama-server per arm and killed it at the end — but an interrupt (Ctrl-C, a ticket timeout, a timeout wrapper firing) left the server running. On 2026-11-08 an orphaned 14 h llama-server held 51 GiB of GTT and knocked the PR-agent LLM off the iGPU — a fleet incident, not a leak. The script now tracks CUR_PID and traps EXIT INT TERM HUP, so the arm's server dies with the arm however the arm ends. No behaviour change for a completed run; the trap only fires on the paths that used to orphan it.

2. PARD-2's repos are weights-only — borrow the target's tokenizer

amd/PARD2-* ship README.md, config.json, model.safetensors, warp_model.bin and nothing else — no tokenizer files. A converter pointed at such a repo dies with

FileNotFoundError: File not found: …/tokenizer.model
NotImplementedError: BPE pre-tokenizer was not recognized - update get_vocab_base_pre()

which reads exactly like a broken converter and is not. The draft must borrow its target's tokenizer, and the identity check that makes that safe is one number: config.json has vocab_size 151936, the Qwen3 family's. With a Qwen3 tokenizer beside the repo's own weights (weights untouched), the stock converter succeeds first try — recipe now in docs/amd-drafters.md.

Two further facts from measuring it: warp_model.bin (34–70 MB) is not in the GGUF — it is PARD-2's extra module, so the converted artifact gives AR-mode drafting only and a parallel-mode implementation needs that file; and the same 1024-hidden / 28-layer draft serves both the 8B and 14B targets, which is what "target-aligned but target-independent" looks like in practice.

Measured while establishing (2)

amd/PARD2-Qwen3-8B (Q4_K_M 462 MB) -> Qwen3-4B target, greedy, token-exact, CPU
  rounds 11, tokens/round 2.182, accepted drafts/round 1.364
  per round: [0,2,1,3,0,2,3,0,0,0,4]

Below PARD's 2.67 tokens/round on its own family — correctly: PARD-2 is target-aligned to Qwen3-8B acceptance, so a 4B target is off its pair. Recorded as such, not as a verdict on PARD-2; the fair row needs an 8B target, which this box does not have.

Verified

bash -n tools/spec_decode_speedup.sh        -> ok
tools/copyright.py --check (tree staged)    -> rc 0
git add <paths> only                        -> yes (two files)

refs #1423, refs #1470 (which landed the harness), TAMDCOL.

…s repos are weights-only (borrow the target's tokenizer)

Two lessons from the run that produced the 1.50x HRX row, both of which cost something real.

1. A SERVER MUST NOT OUTLIVE ITS ARM. tools/spec_decode_speedup.sh starts one llama-server per arm and killed it at the end --
   but an interrupt (Ctrl-C, a ticket timeout, a `timeout` wrapper firing) left it running. On 2026-11-08 an orphaned 14 h
   llama-server held 51 GiB of GTT and knocked the PR-agent LLM off the iGPU: a fleet incident, not a leak. The script now
   sets CUR_PID and traps EXIT INT TERM HUP, so the arm's server dies with the arm however the arm ends.

2. PARD-2's repos ARE WEIGHTS-ONLY. amd/PARD2-* ship README.md, config.json, model.safetensors, warp_model.bin and nothing
   else -- no tokenizer files at all -- so a converter dies with `FileNotFoundError: .../tokenizer.model` and then
   `NotImplementedError: BPE pre-tokenizer was not recognized`, which reads exactly like a broken converter and is not. The
   draft must borrow its target's tokenizer, and the identity check that makes that safe is one number: config.json has
   vocab_size 151936, the Qwen3 family's. With a Qwen3 tokenizer beside the repo's own weights, the stock converter succeeds
   first try. docs/amd-drafters.md now carries the recipe, plus two facts from measuring it: warp_model.bin (34-70 MB) is NOT
   in the GGUF (AR-mode drafting only from the converted artifact; parallel mode needs that file), and the same 1024-hidden /
   28-layer draft serves both the 8B and 14B targets.

Measured while establishing (2): amd/PARD2-Qwen3-8B (Q4_K_M) -> Qwen3-4B gives 2.18 tokens/round, 1.36 accepted drafts/round,
per-round [0,2,1,3,0,2,3,0,0,0,4] -- below PARD's 2.67 on its own family, correctly: PARD-2 is target-ALIGNED to Qwen3-8B
acceptance, so a 4B target is off its pair. Recorded as such rather than as a verdict on PARD-2.

Verified: bash -n on the script; tools/copyright.py --check rc 0 with the tree staged; `git add <paths>` only. No behaviour
change for a completed run -- the trap only fires on the paths where the old version orphaned the server.
@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

#1509 ready for review at 7d955f6

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

The trap is proven by measurement, not just by bash -n

I interrupted the harness mid-arm and counted the server before and after:

script started (arm A's server up)          servers on 18120/18121 = 1
kill -TERM <script pid>, wait 6 s           servers on 18120/18121 = 0

and a timeout 25 wrapper around the same run also left no orphan. With the merged version the child outlived both — the
script only killed it after the request loop, so any interrupt (Ctrl-C, timeout, a gpu-hold expiring) stranded it, which is
the same shape as the 14 h / 51 GiB server that took the PR-agent LLM off the iGPU.

No behaviour change on a completed run (arm A produced its usual 25.4-26.2 tok/s medians in the same test), and the pre/post
counts above are the evidence that the EXIT INT TERM HUP trap fires on the paths that used to orphan it.

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT: CHANGES at 7d955f62ef — one hole in the trap, everything else verified (including both docs claims).

1. The trap kills the server but does not end the script — so a ticket timeout can still leave a new orphan

This is the case the PR exists for, and it is the one the current shape does not close. With a single
trap cleanup EXIT INT TERM HUP, a handler for INT/TERM/HUP runs and then execution continues: cleanup kills
$CUR_PID and sets it to "", and the arm's for i in $(seq 1 $((REQS+1))) loop keeps going against a dead port, after which
the script proceeds to the next arm and starts a new llama-server — now running with the gpu-hold ticket already ended.
That is the exact shape of the incident in the docstring (ticket timeout → server outlives the ticket), just moved one arm later.

The two-line fix keeps the same mechanism:

trap 'cleanup; exit 130' INT TERM HUP      # a signal must not return into the arm loop
trap cleanup EXIT                          # normal exit / set -e / early return

Verified from the script as it stands: arm() sets CUR_PID=$pid after waitup, clears it on the failure path and at the end
of a successful arm, so cleanup at EXIT is a no-op for a completed run — the only change is that a signalled run now stops
instead of walking into the next arm.

2. The PARD-2 claim is true, checked against the repos rather than the prose

amd/PARD2-Qwen3-8B and amd/PARD2-Qwen3-14B, file lists + config today:

5 files each: .gitattributes, README.md, config.json, model.safetensors (1503 MB), warp_model.bin (33.6 / 41.9 MB)
config.json: vocab_size 151936, hidden_size 1024, num_hidden_layers 28

— weights-only, no tokenizer files, and the identity number the doc points at is exactly 151936, with the same 1024/28 draft for
both targets. (Small note: the doc says warp_model.bin (34-70 MB); the two repos I can see are 33.6 and 41.9 MB, so the range is
right but the lower bound is a hair optimistic for the 8B.)

Not claimed

No run of the script from me (it needs a GPU ticket and a spec-decode build); the review is the trap semantics plus the repository
evidence above. The 1.50× row and the acceptance numbers are the author's measurements, not re-derived here.

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT: READY at 7d955f62efced70977dfafc194bcc04d71381546

The trap is aimed at exactly the incident that has just cost the fleet an LLM, and the PARD-2 recipe is checkable on this box — I checked both halves.

The recipe works as written here (paths and the identity claim are real):

~/models/npu/Qwen3-0.6B/tokenizer.json          present
~/models/npu/Qwen3-0.6B/tokenizer_config.json   present
config.json: vocab_size 151936                  <- the Qwen3 family's, as the paragraph says

so "the draft must borrow its target's tokenizer, and the check that makes that safe is cheap: vocab_size 151936" is a claim someone can act on with two cps, and the failure it avoids is named precisely (FileNotFoundError: …/tokenizer.model then NotImplementedError: BPE pre-tokenizer was not recognized — "which reads exactly like a broken converter and is not"). Recording that warp_model.bin (34–70 MB) is not in the GGUF, so a converted artifact gives AR-mode drafting only, is the honest limit statement.

The cleanup covers its own script and I would harden one thing about it. In spec_decode_speedup.sh the server is BIN=${BIN:-/usr/bin/llama-server} started directly, so kill -9 "$CUR_PID" kills the process that holds the GTT, and trap cleanup EXIT INT TERM HUP plus clearing CUR_PID after each arm and on the waitup failure path is the right bookkeeping — a normal exit, a Ctrl-C and a TERM all land in the trap.

The hardening, because BIN is env-overridable and the header itself suggests pointing it at a different llama-server path: a wrapper does not die with its child. There is a live example of exactly that shape on this box right now —

pid 3566314  …/1bit/1bit serve -m Qwen3-4B-Q4_K_M.gguf --device hrx --port 8095
pid 3566316    └── …/1bit/hrx/llama/bin/llama-server -m Qwen3-4B-Q4_K_M.gguf --device HRX0 -ngl 99

— so kill -9 on the parent leaves the child, which is the process holding the memory. If BIN may ever be a wrapper, start it with setsid and kill the group (kill -9 -"$CUR_PID"), which is the same shape ~/lb/supreme's bench uses. With BIN=llama-server directly, as the default is, what is here is sufficient — hence READY rather than CHANGES.

bash -n clean on the script.

Not run: an arm (needs the model, a GPU window and llama-server from an HRX build). What I verified is the documentation's paths/ids and the trap's structure.

@bong-water-water-bong
bong-water-water-bong merged commit 8d73e3a into main Nov 8, 2026
8 of 9 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the npu/amd-drafters-2 branch November 8, 2026 17:09
bong-water-water-bong added a commit that referenced this pull request Nov 8, 2026
…arm and start a new server (closes the hole #1509 left) (#1516)

pi-verify's CHANGES verdict on #1509 was right and the PR merged before I could act on it, so the hole is in main today:

  trap cleanup EXIT INT TERM HUP

A handler for INT/TERM/HUP runs and then execution CONTINUES. So a signalled run killed the current llama-server, walked the
rest of the arm loop against a dead port, and then started the NEXT arm's server -- with the gpu-hold ticket already ended. That
is the exact orphan the trap exists to prevent (the 14 h / 51 GiB server that took the PR-agent LLM off the iGPU on 11-08), just
moved one arm later.

The two-line shape the reviewer asked for:

  trap 'cleanup; exit 130' INT TERM HUP      # a signal must not return into the arm loop
  trap cleanup EXIT                          # normal exit / early return

Proven on the signal path, not by reading it:

  servers during arm A                         1
  kill -TERM <script pid>                      script exit = 130
  servers 5 s later                            0
  arm B started?                               0    <- the merged version started it, with no ticket left

Also corrects the warp_model.bin range the review checked: it is 33.6 MB for PARD2-Qwen3-8B, 41.9 MB for PARD2-Qwen3-14B and
70 MB for PARD2-Llama-3.1-8B (the doc said "34-70 MB", a hair optimistic at the lower bound for the 8B repo).

closes the CHANGES on #1509, refs #1423, TAMDCOL.

Co-authored-by: bong-water-water-bong <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant