Skip to content

release: v0.4.0 - #65

Merged
sanchitmonga22 merged 3 commits into
mainfrom
development
Dec 1, 2026
Merged

sanchitmonga22 merged 3 commits into
mainfrom
development

Conversation

@sanchitmonga22

@sanchitmonga22 sanchitmonga22 commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Merging this releases v0.4.0

This is the promotion of development into main. On the push to main, release.yml plans from trnrt.__version__ (0.4.0, no tag yet), creates the tag v0.4.0 on the merge commit and the GitHub release (sdist, wheel, SHA256SUMS), and publishes to PyPI (PUBLISH_PYPI is on). A PyPI version can never be reused or taken back. The container image is not pushed (PUBLISH_IMAGE is unset).

An admin merges it with a merge commit after one approval.

What ships

Gates

After the merge

release.yml writes the plan to the run summary. If the PyPI step fails, the tag and GitHub release stay; re-run the failed job from the Actions tab.


Summary by cubic

Promotes development to main and releases v0.4.0, adding the first on-device runs of three model families on Trainium2. An admin merges this with a merge commit; the merge creates the tag v0.4.0 and a GitHub release (sdist, wheel, SHA256SUMS) and publishes to PyPI, where a published version can never be reused. The container image is not pushed, and the device check on a trn2.48xlarge was not run for this commit.

Model families

  • Qwen3.8-27B is in preview on Trainium2 (--preset qwen38); GLM-5.3 (glm53) and DeepSeek-V4.1-Flash (dsv41) run experimentally at their first shapes.
  • Each family gets its own build, with device kernels for Qwen3.8-27B (Gated DeltaNet decode, head_dim-256 attention, fp32 output head) and device-driven compile fixes for all three.
  • Plain-decoder models gain prompt logprobs scoring (prompt_logprobs, prompt_logprobs_start).

CI and release

Written for commit 0633bf3. Summary will update on new commits.

View guided diff Turn on auto-fix

AmanSwar and others added 3 commits December 1, 2026 12:54
…#63)

* builds: qwen38, Qwen3.8-27B's build, which runs none of GLM-5.3-Flash's kernel routes

* docs: the qwen38 build in the configuration guide

* tests: the hardware-DMA knob and the decode families cover the qwen38 build

* builds: a model runs only its own builds on a NeuronCore, and the refusal names the build it needs

* models: GLM-5.3's router keeps NaN and -inf out of the device top-k, clamps the expert ids, and skips the group step with one group

* models: GLM-5.3's rope rows are stored evens first and rotated as contiguous halves, and the indexer query is two matmuls, never concatenated

* models: GLM-5.3's replicated latent and indexer projections are dequantized once at load, not in the graph at every call

* builds: glm53, GLM-5.3's build: one tp-64 engine a box, FP8 KV, its experts expert-parallel

* docs: the glm53 build in the configuration guide

* models: GLM-5.3's router top-ks are sorted, which neuronx-cc lowers to TopK; unsorted lowered to a sort, refused on trn2

* models: GLM-5.3's indexer selects through the exact NKI selection kernel on a NeuronCore, and refuses a row the kernel does not hold

* builds: glm53 serves the 4,096-token context its device selection holds, every graph shape checked against the kernel's limit

* docs: the glm53 build's context in the configuration guide

* builds: glm53 prefills in chunks of at most 1,024 rows, whose graphs fit a NeuronCore's HBM beside the decode graphs

* docs: the glm53 build's prefill chunk in the configuration guide

* kernels: a Gated DeltaNet decode step kernel, routed from the decode form behind TRNRT_QWEN_GDN_DECODE_KERNEL

* tools: check the Gated DeltaNet decode kernel on a NeuronCore against the KDA decode kernel

* tools: check_mixed dumps each finished request's recurrent state from every rank, behind TRNRT_DUMP_STATE

* kernels: head_dim-256 prefill attention over the bundled segmented kernel, routed from the chunk form behind TRNRT_QWEN_ATTN256

* tools: check the head_dim-256 prefill attention route on a NeuronCore against its emulation and a neutral recompile

* kernels: head_dim-256 decode attention over the bundled token-generation kernel, routed from the decode form behind TRNRT_QWEN_ATTN256

* tools: check the head_dim-256 decode attention route on a NeuronCore against its emulation, a neutral recompile and the torch form

* models: the head_dim-256 attention routes take a knob each, TRNRT_QWEN_ATTN256_PREFILL and TRNRT_QWEN_ATTN256_DECODE

* kernels: an fp32-output vocabulary head, PlainDecoder._head's form behind TRNRT_FP32_HEAD

* tools: check the fp32-output vocabulary head on a NeuronCore against fp32, a neutral recompile and today's bf16 head

* models: PlainDecoder samples on each rank's vocabulary shard behind TRNRT_VP_SAMPLER, DecoderForCausalLM's form

* builds: dsv41, DeepSeek-V4.1-Flash's build: one tp-64 engine a box, 4,096 tokens, bf16 KV, without the released activation roundings

* docs: the dsv41 build in the configuration guide

* runner: a prefill chunk's padding rows sit at the chunk's first position for a model that asks, as DeepSeek-V4.1-Flash does

* models: DeepSeek-V4.1-Flash's vocabulary head places its shard by a one-hot multiply, the form that ran right on trn2

* runner, engine: a model's host-computed ids reach its graphs as ngram_ids, and such a model is stepped without overlap

* models: DeepSeek-V4.1-Flash's Engram ids are hashed on the host, its rows looked up once in a call's first graph, no int64 hash or history row in the graphs

* models: DeepSeek-V4.1-Flash's Engram key and value are two products of weights transposed at load, not a split of one

* models: DeepSeek-V4.1-Flash's indexer selects by bisection with short rows taking their reachable entries, the form that ran right on trn2

* runner: a model may add neuronx-cc arguments per graph, by graph kind and rows (extra_compiler_args); none by default, so no key moves

* models: DeepSeek-V4.1-Flash compiles every graph at -O1 and its prefill graphs with the 30M instruction limit

* models: DeepSeek-V4.1-Flash's mHC collapse and expand sum one stream at a time above 512 rows, with no [rows, hc, hc, dim] temporary

* models: DeepSeek-V4.1-Flash's deferred cache writes are one plain index_copy_ per tensor; no destination a flush names twice needs an order

* docs: DeepSeek-V4.1-Flash's device forms and what is still open before a full-model device run

* changelog: the dsv41 build, the per-graph compiler arguments, host-computed ids and DeepSeek-V4.1-Flash's device forms

* tests, tools: the Qwen kernel checks pass ruff's lint and format

* kernels: the head_dim-256 decode attention stops at its longest row's context on the 128K and 256K rungs at up to 4 rows

* tests: the decode attention's early exit, its 64-token block view and where it is used

* tools: compare the decode attention's early exit with the rung-wide form, and size the chain plant against fp32

* models: Gated DeltaNet decode keeps the torch form at one row, where the decode kernel is slower

* tests: the Gated DeltaNet decode kernel route starts at two rows

* kernels: the decode attention's early exit never runs past its window

* tests: a padded row past the rung clamps the decode attention's early exit to the window

* builds: qwen38 runs its device kernels and a 10 GiB KV pool, and the family builds an fp32 head and vocabulary-parallel sampler

* docs: the qwen38 build's kernels and KV pool in the configuration guide

* models: prompt logprobs for PlainDecoder models in their own module, scored on each rank's vocabulary shard

* models: PlainDecoder.post_prefill hands plp_targets to models/plp.py, moving no line

* sampler: score_rows, the rank, logprob and top N of given tokens

* request: prompt_logprobs and prompt_logprobs_start, and the rows still to score

* scheduler: the prefix cache serves only the pages before a request's first scored prompt row

* runner: a prefill chunk holding wanted prompt positions takes the scored post graph

* engine: keep the prompt logprobs a scored prefill chunk returns

* tests: prompt logprobs against transformers' teacher-forced ones at tp 1 and 2

* tools: check_mixed scores a free run through the prefill's prompt logprobs and compares decode with it per page rung

* tests: check_mixed's scoring and decode-vs-prefill statistic, with a shift and a divergence planted

* builds: dsv41 runs its experts on the XLA path, the only one its port has

* tools: check_mixed's --compare-plp pools what --compare pools, position 0 in and divergences out

* tests: --compare-plp's pooled mean and p99 equal --compare's

* runner: a model with CC_REPLACE_OPT takes its own optimization level in place of the platform's -O2

* models: GLM-5.3 compiles every graph at -O1, the level its device checks ran at

* models: DeepSeek-V4.1-Flash transposes its Engram key and value weights on the host, which a Neuron device tensor refuses

* models: Qwen3.8-27B compiles its 4-row decode graphs at -O1, where -O2 hit an allocator assertion

* serve: engines start at i x their build's tensor-parallel degree, not serve's bare --tp default

* builds: qwen38 decodes 1 or 2 rows a step, at most 2 running per engine

* docs: qwen38's decode buckets, and the stall of 4- and 8-row decode graphs after the early-exit graphs

* changelog: the families on Trainium2, their builds, kernels and fixes

* builds: qwen38's decode buckets comment says what stalls: an 8-row graph after larger-window graphs, exit on or off

* docs: the 8-row decode stall follows larger-window graphs, not the early exit

* docs: the 8-row decode stall's signature, and its cause under investigation

* docs: the three families on Trainium2 in MODELS.md: what ran, the checks and their results, what is open

* docs: the 8-row decode stall's minimal trigger, a 2-row step at the 256K window before it

* docs: the decode stall is a triple of graphs, whichever runs last stalls

* docs: the three families on Trainium2 in RESULTS.md: the checks, accuracy, and Qwen3.8-27B's AgentX run

* docs: MODELS.md ends with one newline

* tools: check_head_fp32 names its frexp exponent ex, not the except block's e

* tools: check_mixed's dump hook says why it assigns ModelRunner._exec

* request: SamplingParams declares its prompt-logprob fields last, so the released fields keep their positions

* tools: check_gqa_prefill256 refuses a rung the pool cannot hold, and a chunk no start fits is no result

* tools: check_gqa_decode256 refuses a rung the pool cannot hold

* tools: check_gdn_decode takes at least one row bucket and one chain, so nothing run is never a pass

* tests: the device check tools refuse a rung the pool cannot hold and an empty row selection

* docs: RESULTS.md names the AgentX client, completes the GLM-5.3 HBM breakdown, and marks the DeepSeek control as decode

* docs: MODELS.md gives each family's mean logprob difference for decode and prefill

* docs: KNOWN_ISSUES.md gives the Qwen stall's instance and build, and lists what review found in the model families and left for later

* tools: the gqa checks hold only their regular path to --pages and --pool; --chain has its own

* tests: the gqa chain gates are not refused for the regular rungs' pool

* docs: RESULTS.md gives GLM-5.3's decode timings their workload, call counts and no baseline

* models: DeepSeek-V4.1-Flash's bisection selection reads a NaN score at topk_floor, as the top-k form does

A long indexer row holding NaN (a cache row a query can reach that nothing wrote) gave the bisection NaN bounds, and
the row selected the wrong entries or none. select_short_rows now reads NaN at topk_floor before topk_mask, as
safe_topk does. This changes the dsv41 build's graphs; GLM-5.3-Flash's files are untouched.

* engine: prompt logprobs the prefill would refuse are refused when added, and their rank is counted in fp32

- add_request refuses prompt logprobs on a model other than the plain decoder (GLM-5.3-Flash's decoder raises
  NotImplementedError in its prefill) and beside a token mask or penalties (ModelRunner.prefill raises): a ValueError,
  so a 400, instead of a failure mid-step. Host code only.
- sampler.score_rows counts the target's rank in fp32 instead of over a boolean tensor, the vocabulary-parallel
  scorer's form (models/plp.py). The edit stays on its own line: no op in sampler.py moves, so no other graph's cache
  key changes.

* models: Qwen3.8-27B's head_dim-256 attention routes require a bf16 model, and the docstrings say the kernel routes ran

prefill256_takes and decode256_takes checked for an FP8 cache but not for bf16, so a float32 run with either knob set
handed a float32 cache to bf16-only kernels; both now also require model.dtype bf16. gdn.py and gqa.py no longer call
their decode kernel routes unrun on a device.

Every edit replaces lines in place: no line of gqa.py or gdn.py moves, and a bf16 model takes the same routes, so the
qwen38 build's graphs keep their cache keys. GLM-5.3-Flash does not import either file.

* tools: the gqa and head checks refuse a position range or chain plant outside the run, and a recompile must match every output

- check_gqa_decode256 refuses a --pos-frac outside 0 <= low < high <= 1 (it crashed, or placed rows past the rung).
- check_head_fp32 refuses a --plant-call outside 1 .. --chain-calls - 1 (it crashed outside the case handler), and its
  docstring's --chain command carries the three registered thresholds it needs.
- check_gqa_prefill256's chain compares the neutral recompile on the chain's q and v as well as its output.

* tools: check_mixed pairs state dumps only of the same requests, and scores without a tokenizer

- --compare-state refuses (exit 2) two dumps whose common request tags differ in index, prompt length, output length
  or turn: they are not the same requests.
- --score writes an empty text on a token-id-only engine instead of failing on its missing tokenizer.
- Its tests: a uniform shift fails the mean and two large ones the p99 alone (the old test showed only the overall
  FAIL), both ranks' conv pools are counted, and a mispaired dump is refused.

* tests: GLM-5.3's router is watched at every top-k, and the fp32 head's layout is checked off the CPU

- The hostile top-k test patches both call forms and fails if NaN or -inf reaches a top-k over expert scores (the
  group top-k's documented overflow excepted); clamping has its own test.
- load_model on the meta device lays out head_t [hidden, vocab rows] only with TRNRT_FP32_HEAD.

* changelog: the review fixes to DeepSeek-V4.1-Flash's selection, prompt logprobs and Qwen3.8-27B's attention routes

* models: restore the space dsv41_select's picked line lost, and the NaN test covers every long row

* tools: check_mixed pairs state dumps by their prompts' tokens, and refuses to start without a tokenizer

- Each dump's index entry records a hash of the request's prompt ids, and --compare-state refuses two dumps whose
  common tags hold different prompts of the same length (dumps without the field still pair by length).
- Every mode builds its prompts from text (prompt_sets), so a model directory without a tokenizer is refused at
  start with that reason instead of failing in the tokenizer call.

* models: DeepSeek-V4.1-Flash's bisection keeps a collapsed interval's end, as GLM-5.3-Flash's topk.py does

_split halves each end apart, and just above the smallest normal float the halves round down: the split of lo == hi
== b (b the float after 2^-126) came out one float below, lo left the k-th score, and a row of [a, b, b] selected 3 of
k = 2. The split now clamps its mean into the interval and keeps a collapsed interval's end, the three lines of
models/topk.py's _split. A change to the dsv41 build's graphs only.

* engine: add_request refuses prompt logprobs for DeepSeek-V4.1-Flash and outside 0 to 20 alternatives

DeepSeek-V4.1-Flash's vocabulary head is fp32 shards that models/plp.py does not read: a bf16 run failed in the prefill
on mismatched dtypes. A count below 0 or above NUM_TOP_LOGPROBS passed admission and was sliced silently. Both are now a
ValueError (a 400) when the request is added. GLM-5.3 scores them (within 4e-6 of transformers on the CPU).

* kernels, tools: the head_dim-256 attention's notes say where a number came from without private run ids or paths

Run labels and a scratch path that only meant something in private notes are replaced by what they stood for (a trn2
run on 30 Nov, a serving simulation), and check_mixed's verdict line names its statistic. kernels/gqa_decode256.py is
edited in place: no line moves.

* docs: the README gives each family's status on Trainium2, and the evidence claims say what was measured

- README: Qwen3.8-27B is in preview and served on Trainium2; GLM-5.3 and DeepSeek-V4.1-Flash are experimental and run
  there at their first shapes (it still said none had run on a device).
- MODELS.md: Qwen3.8-27B's long-context check ran on the 256K page rung with prompts up to 200,000 tokens, not at a
  256K context; DeepSeek-V4.1-Flash's agreement gap points to bf16 arithmetic, not shown position by position.
- KNOWN_ISSUES.md lists what review found and left for later; CHANGELOG.md the fixes.

* engine: prompt_logprobs must be an int from 0 to 20; 1.5 or True passed admission and failed in the step

* docs: the README's family statuses link their device results

---------

Co-authored-by: Sanchit Monga <sanchitmonga22@gmail.com>
* chore: pin pip installs by hash in CI and image (fixes #35)

Pin all pip installs behind --require-hashes so CI and the image
install exactly the reviewed packages: hash-locked requirements
for CI tools, tests and the image, generated with
pip-compile --generate-hashes, and install with --require-hashes.

Verified in a fresh Python 3.13 venv: pip install --require-hashes
-r requirements/test.txt exits 0 (52 packages incl. torch 2.15.0+cpu,
transformers 5.17.0, setuptools 84.2.1) and pip check is clean.
setuptools is pinned explicitly because pip-compile otherwise drops
it as unsafe while torch 2.15 requires setuptools>=77.0.3.

Fixes #35

* ci: lock the build backend and pin torch in the hash-locked installs

Address the CodeRabbit and Cubic review comments on the hash-locking PR:
the package builds run with python -m build --no-isolation so the
setuptools backend comes from the hashed ci-tools lock (setuptools 84.2.1
is now pinned there), torch is pinned to 2.15.0+cpu in test.in so a
regeneration cannot drift to a CUDA build, the image re-hash commands pin
the Linux x86_64 platform and fetch sdists with curl, the changelog names
the two local-checkout installs as exceptions, and the stale pip-compile
warning block is dropped from test.txt.

Verified in a fresh Python 3.13 venv: both lockfiles install with
--require-hashes, pip check is clean, python -m build --no-isolation
builds the sdist and wheel, and the corrected re-hash commands reproduce
all four hashes in image.txt. pre-commit run --all-files passes.

* tests: the image's transformers pin is read from the locked file the Dockerfile installs

* requirements: the README's ci-tools command keeps setuptools, and a failed sdist download stops the re-hash

* tests: the image's pins are read in install order, so a later downgrade of the locked transformers is seen

* release: a change to requirements/image.txt alone runs the image build on its pull request

* requirements: the README says the locks are regenerated on Linux x86-64, where the CPU torch wheel exists

---------

Co-authored-by: Sanchit Monga <sanchitmonga22@gmail.com>
…device check owed (#64)

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

- trnrt.__version__ 0.3.0 -> 0.4.0; CHANGELOG's Unreleased entries move under [0.4.0] - 2026-12-01,
  with a summary of what ships and what has not run on a device since the family runs.
- README: the supported hardware and models card lists Qwen3.8-27B (Preview), GLM-5.3 and
  DeepSeek-V4.1-Flash (Experimental) next to GLM-5.3-Flash; Qwen3.8-27B's AgentX table under
  Benchmarks, copied from docs/RESULTS.md with its context; a Quickstart pointer for
  --preset qwen38; GLM-5.3-Flash-only properties (1M context, two TP 32 engines, the hero
  cards, the diagram) say so.
- KNOWN_ISSUES, MODELS and RESULTS: 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 selection fix is not yet run on
  a device. The changelog's compile-key sentence says what the hook does.

* docs: date the family runs to #63's code before its review fixes, and scope three claims

- README, KNOWN_ISSUES, MODELS and RESULTS name the code the device runs used (pull request #63
  before its review fixes) instead of attributing the runs to 0.4.0.
- The README intro says what each experimental family runs (GLM-5.3 at 4,096 tokens,
  DeepSeek-V4.1-Flash's first 4 layers); the diagram note says serve --engines sets the count.
- CHANGELOG: the hash-lock sentence covers the pip install commands only; the kernel timing names
  its 8-row bucket, which qwen38 does not serve yet.
- RESULTS: the 77 s first-token p90 includes the queue; no earlier release of GLM-5.3 ran on a device.

* changelog: 0.4.0's summary names the code the runs used and points each figure at its conditions

* docs: scope graph_equiv to GLM-5.3-Flash's builds and the hash lock to package downloads, and say 4,096-token context
@greptile-apps

greptile-apps Bot commented Dec 1, 2026

Copy link
Copy Markdown

Target branch main is not in the allowed branches list.

@coderabbitai

coderabbitai Bot commented Dec 1, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review: 1

  • development

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@github-advanced-security

Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

@github-actions github-actions Bot added serve OpenAI-compatible API and server engine Engine, scheduler and compile kernels NKI kernels models Model code docs Documentation ci CI, packaging and repo tooling graphs-changed Changes traced code; needs graph-equivalence evidence labels Dec 1, 2026

@shubhammalhotra28 shubhammalhotra28 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Checked at 0633bf3: it is #64's squash commit and its tree equals the head reviewed there (500790b); version 0.4.0, CHANGELOG [0.4.0] - 2026-12-01; the dry-run release plan says v0.4.0 is new; every required check green, Promotion source included; no open threads. The device check of this commit is owed and stated as such here, in #64, the CHANGELOG and docs/KNOWN_ISSUES.md.

@sanchitmonga22
sanchitmonga22 merged commit cd5d311 into main Dec 1, 2026
33 of 37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci CI, packaging and repo tooling docs Documentation engine Engine, scheduler and compile graphs-changed Changes traced code; needs graph-equivalence evidence kernels NKI kernels models Model code serve OpenAI-compatible API and server

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants