release: prepare 0.4.0, with the model families on Trainium2 and the device check owed

Merged
SA
2d ago
+168-73

What and why

Prepares release 0.4.0 on development, step 1 of docs/DEVELOPMENT.md's release procedure. Minor bump: new builds (--preset qwen38, glm53, dsv41).

  • trnrt.__version__ 0.3.0 → 0.4.0.
  • CHANGELOG.md: the Unreleased entries move under [0.4.0] - 2026-12-01, with a summary of what ships and of what has not run on a device since the family runs. The compiler-arguments entry said "no existing compile key moves"; it now says what the hook does (no arguments by default, so a model that gives none compiles as before).
  • README.md:
    • the "Supported hardware and models" card (docs/assets/support-{dark,light}.svg) lists Qwen3.8-27B (Preview), GLM-5.3 and DeepSeek-V4.1-Flash (Experimental) next to GLM-5.3-Flash (Supported) and "More open models", in the card's existing style; the <img alt> matches;
    • Benchmarks: a Qwen3.8-27B (preview) sub-table, the AgentX 8 / 16 / 32 user points copied from docs/RESULTS.md with their context (per 16 chips, at most 2 running per engine, the 30-minute 8-user point, both price bases, self-run, no GPU comparison), and GSM8K and the needle on the same serve;
    • Quickstart: a pointer for Qwen3.8-27B (--preset qwen38, --engines 8, its checkpoint revision, no decisions step);
    • GLM-5.3-Flash-only properties now say so: the hero cards, the 1M-token context and two-engine highlights, the hardware row, the architecture diagram, and "Where TrnRT stands";
    • the Benchmarks closing paragraph replaces the 0.3.0 sentence with what holds for 0.4.0 (below); the layout and acknowledgments name the three families.
  • docs/KNOWN_ISSUES.md "Verification status", docs/MODELS.md and docs/RESULTS.md: the family runs and GLM-5.3-Flash's graph_equiv are dated to the code before 0.4.0's last changes; DeepSeek-V4.1-Flash's status reads "ran", before a later fix to its selection; RESULTS.md's reproduction steps say that the comparison and family sections name their own build, context and duration.

No status label is raised. GLM-5.3-Flash stays Supported, Qwen3.8-27B Preview, GLM-5.3 and DeepSeek-V4.1-Flash Experimental.

What 0.4.0 ships

  • #63: Qwen3.8-27B, GLM-5.3 and DeepSeek-V4.1-Flash on Trainium2, each with its own build; Qwen3.8-27B's device kernels; the fixes the device bring-up surfaced.
  • #62: every pip install in CI, release.yml and the image reads a hash-locked file (fixes #35).
  • This PR: version, changelog, README and support card.

Graphs

  • Host-side only: no for the release as a whole (#63 adds and changes traced code). This PR touches no traced file; trnrt/__init__.py changes only __version__.

What ran on a device, and what did not

  • Ran, on #63's code before its review fixes (30 Nov - 1 Dec 2026, one trn2.48xlarge, Neuron SDK 2.32): every result in docs/RESULTS.md "The model families on Trainium2", and tools/graph_equiv.py against 0.2.0's capture for GLM-5.3-Flash's balanced, throughput and latency builds (EQUAL, ordered cache keys identical on every rank).
  • Changed after those runs, not run on a device:
    • DeepSeek-V4.1-Flash's indexer selection (trnrt/models/dsv41_select.py): NaN scores read at topk_floor, and a collapsed interval's end kept. Its dsv41 graphs move. docs/KNOWN_ISSUES.md says so.
    • Same-line edits in traced files: trnrt/engine/sampler.py (score_rows, prompt-logprob scoring only) and trnrt/models/gqa.py (the head_dim-256 routes also require a bf16 model; the qwen38 build is bf16). Comments only in trnrt/kernels/gqa_decode256.py and trnrt/models/gdn.py; host-side refusals in trnrt/engine/engine.py and request.py.
    • #62: CI and image installs only, at the same transformers 5.17.0 and tokenizers 0.23.3, now --no-deps --require-hashes. No trnrt/ file.
  • Not run on this release's commit: tools/graph_equiv.py, docker/check_image.py --device, the default build served on 32 ranks, and the family checks. v0.3.0 is the previous release, but it was never checked on a device either, so the comparison that carries evidence is against v0.2.0.

The commands for a maintainer, on a Linux x86_64 host with Docker (the graph comparison needs no NeuronCore):

REV=eb9eb208eb0d988989d07a6a12d0fdeb5f52574a   # GLM-5.3-Flash
for side in v0.2.0 v0.4.0; do
  git -C trnrt checkout -q $side
  docker build -q -f trnrt/docker/Dockerfile --build-arg TRNRT_VERSION=${side#v} \
    --build-arg TRNRT_REVISION=$(git -C trnrt rev-parse HEAD) -t trnrt:$side trnrt
done
for preset in latency balanced throughput; do
  for side in v0.2.0 v0.4.0; do
    OUT=/data/geq/$preset/$side; mkdir -p $OUT/nki        # fresh roots: capture reuses what it finds
    t() { docker run --rm -e HF_TOKEN -v $OUT:$OUT -v $OUT/nki:/var/tmp/nki-intermediate-cache trnrt:$side "$@"; }
    t compile shapes zai-org/GLM-5.3-Flash --revision $REV --out $OUT
    t compile decisions --model zai-org/GLM-5.3-Flash --revision $REV --out $OUT
    t compile capture --out $OUT -- --model $OUT/shapes --preset $preset
  done
  python trnrt/tools/graph_equiv.py /data/geq/$preset/v0.2.0 /data/geq/$preset/v0.4.0 --ref-package trnrt   # expect EQUAL
  for r in $(seq 0 31); do   # and the same ordered cache-key list on every rank
    cmp -s /data/geq/$preset/v0.2.0/capture/rank$r.json /data/geq/$preset/v0.4.0/capture/rank$r.json \
      || echo "preset $preset rank $r: keys differ"
  done
done

Then on a trn2.48xlarge with the v0.4.0 image:

  • docker/check_image.py --device;
  • the default build (balanced) compiled and served as the README's Quickstart does, two engines of TP 32;
  • DeepSeek-V4.1-Flash's 4-layer comparison from docs/RESULTS.md, rerun on the dsv41 build, because its selection changed:
M=/models/DeepSeek-V4.1-Flash; A="--model $M --preset dsv41 --num-layers 4 --requests 4 --lengths 128,512,1024,2048 --new-tokens 32"
python tools/check_mixed.py $A --device neuron --out dev.json
python tools/check_mixed.py $A --device cpu --dtype float32 --out ref.json
python tools/check_mixed.py --compare ref.json dev.json   # against docs/RESULTS.md's 4-layer row, measured on the earlier code

Checklist

  • make check on this branch: pre-commit run --all-files and mypy clean (151 files); CPU suite 2,899 passed, 506 skipped, 2 xfailed, 1 failed (macOS, Python 3.13; one timing test deselected, test_api_prompt_thread.py::test_another_stream_flows_while_a_prompt_renders, which also fails on the untouched base here and runs in CI). The one failure is tests/test_no_trace.py with the maintainers' private patterns, on two known false positives only: a provider pattern matching inside the word "unscaled", and #62's author email in its commit metadata (public, in development already). The tests that read the docs, changelog or version rerun at the final head: 413 passed, the same scan result.
  • python tools/release_plan.py --sha HEAD: "release: v0.4.0 is new: releasing it". PUBLISH_PYPI is true.
  • python -m build --no-isolation and twine check --strict: trnrt-0.4.0-py3-none-any.whl and trnrt-0.4.0.tar.gz pass (the README is the PyPI description).
  • The support card rendered in a browser in both themes and checked: text fits its row with Plex's fallbacks (system sans, Arial, Helvetica and Verdana measured).
  • One independent review of everything since v0.3.0 (git diff origin/main...HEAD) for exposure and overclaims, 9 findings. Fixed in 7cc6fda:
    • the README said 0.4.0 ran the families on Trainium2; the runs were on #63's code before its review fixes, and every doc now says so;
    • the README intro's "at their first shapes" now says GLM-5.3 at a 4,096-token context and DeepSeek-V4.1-Flash's first 4 layers;
    • the CHANGELOG's hash-lock sentence covered more than the pip installs; the kernel timing (an 8-row bucket qwen38 does not serve) gained its context;
    • RESULTS.md: the 77 s first-token p90 "includes" the queue, not "is" it; "no earlier build of GLM-5.3 ran on a device" is now "no earlier release" (a bring-up timing is recorded in trnrt/models/mla_rope.py);
    • the diagram note: serve --engines sets the engine count, the build only the degree.
      Not changed, listed as follow-ups: the README's relative image and doc links do not resolve on PyPI (true of every release so far); RESULTS.md's "every device run loaded them with the cache-hit assertion on" against the uncaptured prompt-logprob graphs (needs the person who ran it); #62's contributor email in commit metadata (public, cannot change without rewriting development).
  • Bot threads: 10, each fixed in 7cc6fda, 16d7d40 or 500790b, answered and resolved.