Skip to content
Back to Blog

trnRT · · 26 min read

The fastest GLM-5.3-Flash engine on Trainium now serves Qwen3.8-27B, GLM-5.3 and DeepSeek-V4.1-Flash

TrnRT 0.4.0 takes our open inference engine for AWS Trainium2 from one model to four. Qwen3.8-27B is served on one trn2.48xlarge, at 25.3 agent requests a minute on SemiAnalysis's AgentX (self-run) and 97.42% on GSM8K. All 753 billion parameters of GLM-5.3 run on the same box, and DeepSeek-V4.1-Flash's first layers run on Trainium2.

By Aman Swar and Sanchit Monga

The fastest GLM-5.3-Flash engine on Trainium now serves Qwen3.8-27B, GLM-5.3 and DeepSeek-V4.1-Flash

TrnRT, the fastest inference engine for GLM-5.3-Flash on Trainium, just got an upgrade. In November we wrote about serving GLM-5.3-Flash on one Trainium2 box with NKI layer megakernels, and until this week it was the only model TrnRT ran. Release 0.4.0 brings three new frontier models: Qwen3.8-27B, a dense 27B hybrid of linear and gated attention; GLM-5.3, a 753B MoE with latent attention and 256 experts; and DeepSeek-V4.1-Flash, a MoE with compressed sparse attention and MXFP4 experts. Qwen3.8-27B is served on one trn2.48xlarge, measured on AgentX and GSM8K, and checked against an fp32 reference. The whole of GLM-5.3 runs on the same box, and so do DeepSeek-V4.1-Flash's first 4 layers.

Four cards, one per model family in TrnRT 0.4.0 on one trn2.48xlarge. GLM-5.3-Flash, Supported: 320B MoE, 18B active: KDA linear and DSA sparse attention, FP8; builds latency, balanced, throughput; 2 engines x 32 logical cores, 1M-token context; Served; AgentX on one trn2.48xlarge. Qwen3.8-27B, Preview: Dense: Gated DeltaNet and gated attention, BF16; build qwen38; 8 engines x 8 logical cores, 262,144-token context; Served; self-run AgentX; GSM8K 97.42%. GLM-5.3, Experimental: MoE: latent attention, shared sparse indexer, 256 experts, FP8; build glm53; 1 engine x 64 logical cores, 4,096-token context; Whole model runs; 4-layer check passes logprobs only. DeepSeek-V4.1-Flash, Experimental: MoE: compressed sparse attention, Engram, MXFP4 experts; build dsv41; 1 engine x 64 logical cores, 4,096-token context; First 4 layers ran, before a later selection fix.

The four model families in TrnRT 0.4.0, each on its own build on one trn2.48xlarge: GLM-5.3-Flash and Qwen3.8-27B are served, the whole of GLM-5.3 runs, and DeepSeek-V4.1-Flash runs its first 4 layers.

Key results (one AWS trn2.48xlarge, 16 Trainium2 chips, Neuron SDK 2.32; device runs on 30 November and 1 December 2026)

  • Qwen3.8-27B is served on one box. Eight engines of 8 logical NeuronCores, each with the model's full 262,144-token context. On SemiAnalysis's AgentX benchmark (self-run, agentx-harness 1.0.12) the box served 25.3 requests a minute at 32 users, 20.1 at 16 and 12.5 at 8. On the same serve it scored 97.42% on GSM8K, where InferenceX reports 97.04% for the model's FP8 checkpoint on H100, and found all 3 codes in the needle test.
  • Qwen3.8-27B matches fp32. All 64 layers on Trainium2 agree with the same engine in fp32 on the CPU on 0.979 of tokens, against a bar of 0.95 fixed before the run. On prompts of up to 200,000 tokens, decode against prefill showed no divergence.
  • New Qwen3.8-27B kernels. Its Gated DeltaNet decode and head_dim-256 attention kernels took a decode step with 8 requests from 52.95 ms to 25.45 ms. The served build doesn't run that 8-request bucket yet.
  • All of GLM-5.3 on one box. 753 billion parameters, 78 layers and 256 experts, in FP8. A new expert-parallel NKI kernel gives each of the box's 64 ranks 4 whole experts. The whole model runs 16 requests at once at a 4,096-token context, with the fullest NeuronCore at 20.65 of its 24 GiB.
  • DeepSeek-V4.1-Flash's first 4 layers run on Trainium2. Its checkpoint reader equals DeepSeek's own converter bit for bit on FP8 dequantization, the MXFP4 experts and the model-parallel cut. The whole model waits on an FP8 layout for its experts.

How to read these numbers

  • The AgentX results are self-run, one run per point. They are not official InferenceX results.
  • The device runs used the code just before 0.4.0's last review fixes. One of those fixes changes DeepSeek-V4.1-Flash's indexer selection, which has not run on a device yet.
  • The qwen38 build runs at most 2 requests per engine, so one box decodes 16 at once and the rest wait.
  • GLM-5.3's and DeepSeek-V4.1-Flash's numbers are bring-up measurements. We claim no served throughput for either.

The code is at github.com/RunanywhereAI/trnrt (Apache-2.0), and pip install trnrt==0.4.0 installs it. Release 0.4.0's docs/RESULTS.md has every table in this post with how it was measured.

From one model to four

TrnRT is our open-source inference engine for AWS Trainium2. It serves an OpenAI-compatible API from one trn2.48xlarge: 16 Trainium2 chips with 96 GiB of HBM each, 64 logical NeuronCores at Trainium2's default LNC = 2. The November post covers why we chose Trainium2, GLM-5.3-Flash's layer megakernels and where its decode time goes.

The engine had grown around GLM-5.3-Flash, which mixes linear and sparse attention, carries four residual streams and keeps a recurrent state per session.

ModelShapeWhat it needs from the engine
Qwen3.8-27BDense, 64 layers, BF16Gated DeltaNet linear attention with a recurrent state, gated softmax attention with 256-wide heads, one residual stream
GLM-5.3MoE, 78 layers, FP8Latent attention with RoPE, a sparse indexer shared across layers, 256 experts, no recurrent state at all
DeepSeek-V4.1-FlashMoE, 40 layers, FP8 and MXFP4Compressed sparse attention over a sliding window, n-gram embedding tables, four residual streams, MXFP4 experts

Architectures as released by each model's authors, read from their config.json files and reference code.

They went in over two releases. Release 0.3.0 (30 November) added the three model families as code, each checked against its authors' reference on CPU. Release 0.4.0 (1 December) gave each one a Trainium2 build, with the kernels and fixes its device runs needed. Each family has its own build, set with --preset, and a model runs only its own builds on a NeuronCore.

One box, four layouts

How each build carves one trn2.48xlarge, 16 Trainium2 chips with 4 logical NeuronCores each at LNC = 2. GLM-5.3-Flash: 2 engines, each tensor-parallel over 32 logical cores on 8 chips, behind a session-affine router. Qwen3.8-27B: 8 engines of 8 logical cores, 2 chips each, at most 2 requests decoding per engine, 16 per box. GLM-5.3: 1 engine of 64 logical cores, 4,096-token context, 16 requests at once. DeepSeek-V4.1-Flash: 1 engine of 64; its first 4 layers ran.

Every outline is one engine, a full copy of the model: 2 for GLM-5.3-Flash, 8 for Qwen3.8-27B, 1 each for GLM-5.3 and DeepSeek-V4.1-Flash.

Each build sets its tensor-parallel degree, and trnrt serve --engines sets how many engines share the box behind one router, which keeps each session on one engine so it can reuse its cached prefix. GLM-5.3-Flash runs two engines of 32 logical cores. Qwen3.8-27B's heads (24 query, 4 key-value, 16 Gated DeltaNet key heads) don't split over more than 8 ranks, so it runs 8 ranks wide: eight engines on one box. GLM-5.3's FP8 weights, about 745 GB, fit only as one engine across all 64 ranks, and DeepSeek-V4.1-Flash's build uses the same layout.

Until 0.4.0, trnrt serve started engine i at logical core i × 32, its own default degree, whatever the build's. With an 8-rank build the second engine landed on cores 32 to 39 and the third was refused. Engines now start at i times the build's degree.

Qwen3.8-27B: served on one box

What it asks of the engine

Qwen3.8-27B is a dense hybrid in BF16. 48 of its 64 layers use Gated DeltaNet, a linear attention that keeps a fixed-size recurrent state per sequence (16 key and 48 value heads of 128). The other 16 use softmax attention with a sigmoid output gate: 24 query heads and 4 key-value heads of 256, with rotary embeddings on 64 of each head's dimensions. The MLP is a dense SwiGLU, and the context is 262,144 tokens.

TrnRT already handled a recurrent state: GLM-5.3-Flash's linear-attention layers keep one, and the engine checkpoints it so a prefix-cache hit can resume from it. The 256-wide attention heads needed their own kernels, and a 27-billion-parameter dense model streams all of its weights on every step.

What we built for it

The qwen38 build runs eight engines of 8 logical cores, each with the full 262,144-token context and a bf16 KV cache. It turns on four device paths, each checked on the device alone and together with the others before it went into the build:

  • a Gated DeltaNet decode kernel, which takes over the recurrence from two rows a step up;
  • head_dim-256 attention for prefill and decode, through two kernels from AWS's NKI Library, attention_segmented_cte and attention_tkg;
  • a vocabulary head that computes its logits in fp32, from the matmul's fp32 accumulator;
  • a sampler that works on each rank's shard of the vocabulary, so the full vocabulary is never gathered.
Paired horizontal bars, device time per decode step at a 4,096-token window, before the kernels and with them. Whole step: 1 row 20.45 to 20.09 ms, 8 rows 52.95 to 25.45 ms; Gated DeltaNet (48 layers): 1 row 4.51 to 5.20 ms, 8 rows 8.78 to 7.30 ms; Attention (16 layers): 1 row 4.27 to 3.36 ms, 8 rows 29.84 to 4.50 ms; MLPs (64): 1 row 8.20 to 7.96 ms, 8 rows 9.11 to 8.74 ms; Norm, head, sampler: 1 row 1.46 to 1.52 ms, 8 rows 1.91 to 1.63 ms. The 8-row bucket is not served by the qwen38 build yet.

At 8 rows the kernels halved the decode step, almost all of it in attention. At 1 row the step barely moved: one-row steps keep Gated DeltaNet's torch recurrence.

With 8 requests decoding in one step and a 4,096-token window, the step went from 52.95 ms to 25.45 ms, and attention alone from 29.84 ms to 4.50 ms. The served build runs at most 2 rows a step today (below), so these step times measure the kernels on a bucket still to come.

Checked against fp32

The device runs bf16. The reference is the same engine on the host CPU in fp32. Two statistics, with their bars fixed before each run: token agreement, the share of output tokens from greedy runs of the same prompts that equal the reference's (bar 0.95); and the mean absolute difference between the device's and the reference's logprobs of the reference's tokens, up to each prompt's first difference (bar 0.05).

All 64 layers, one engine, 16 prompts of 128 to 2,048 tokens, 32 new tokens each, 8 in flight:

Device buildAgreementMean |Δ logprob|, decode / prefillResult
bf16 vocabulary head (release 0.3.0's form)0.926 (474 of 512)0.0080 / 0.0045agreement below the bar: every divergence an exact tie of the device's bf16 logits
fp32 vocabulary head0.998 (511 of 512)0.0050 / 0.0036pass
fp32 head and the four kernels (the qwen38 build's code, 8 rows a step)0.979 (501 of 512)0.0045 / 0.0034pass

The first row is why the build has an fp32 head. A bf16 head rounded near-tied logits into exact ties, and every one of the 38 divergences from the reference was one of those ties. Computing the logits in fp32 took agreement from 0.926 to 0.998. Per prompt length, 8 requests in flight were no further from the reference than 1 in flight (the mean absolute difference per band within 1.05×), and over the 48 Gated DeltaNet layers the kernels kept the recurrent state as close to fp32 as the plain torch forms do: the median layer at 0.999× their error, no layer above 1.1×.

Long contexts

No CPU reference fits at long contexts, so there the device is checked against itself: the logprob a decode step gave each token against the logprob a prefill of the same text gives it. The bars, fixed before the run: a mean of 0.03, a p99 of 0.3, and no divergence where both runs' top-1 margins exceed 0.5 nat.

Dot plot on a log scale of the absolute logprob difference between a decode step and a prefill of the same text, per page rung, with the bars fixed before the run, which apply to all positions pooled (mean 0.03, p99 0.3). 128-page rung (holds up to 32,768 tokens, 192 positions): mean 0.0056, p99 0.0294, max 0.0372, 0 divergences; 512-page rung (holds up to 131,072, 192 positions): mean 0.0050, p99 0.0503, max 0.1689, 0 divergences; 1,024-page rung (holds up to 262,144, 128 positions): mean 0.0032, p99 0.0249, max 0.0354, 0 divergences; all (prompts of 512 to 200,000 tokens, 512 positions): mean 0.0048, p99 0.0372, max 0.1689, 0 divergences.

Decode against prefill on prompts of 512 to 200,000 tokens: every rung well inside the bars, and no divergence.

On real text, TrnRT's own source files, with 64 new tokens per prompt on the decode buckets the build serves, the mean difference was 0.0048 and the p99 0.0372 over 512 positions. The comparison tool files a position under a page rung by its context plus one, and it counts each prompt's first output token, which both runs take from the prefill; the bars are defined with both (docs/KNOWN_ISSUES.md).

Served on AgentX, with accuracy on the same serve

AgentX is SemiAnalysis's benchmark of agent traffic. It replays a public set of coding-agent session traces, with synthetic prompt text: long, growing prompts with heavy prefix reuse. We ran agentx-harness 1.0.12 on a separate client machine (a c7i.48xlarge, the harness pinned to 48 logical CPUs) against one qwen38 serve, scored with InferenceX's definitions for the whole box of 16 chips. The points ran in the order 32, 16 and 8 users, with every engine's prompt cache flushed before each, and the harness ran with --max-context-length 262144, the model's own context.

Three panels against concurrent users, 8, 16 and 32, for Qwen3.8-27B on one trn2.48xlarge, qwen38 build: 8 engines of 8 logical cores, at most 2 requests decoding per engine. Requests a minute: 12.5, 20.1, 25.3. P90 tokens/s per user: 24.8, 25.4, 24.2. Time to first token, median: 1.7, 1.3, 9.9 s; p90: 18.2, 20.7, 76.6 s. Self-run with agentx-harness 1.0.12, not an official InferenceX result.

Requests served rise with users while P90 tokens/s per user stays between 24.2 and 25.4. At 32 users only 16 requests decode at once, and the first-token p90 of 76.6 s includes the wait for a seat.

UsersReq/minTok/s per chipP90 tok/s per userFirst token p50 / p90Prompt cachedTokens/$ (M), AWSTokens/$ (M), SemiAnalysis
3225.32,29724.29.9 s / 76.6 s93.4%3.7014.26
1620.11,96925.41.3 s / 20.7 s94.0%3.1712.22
812.51,25824.81.7 s / 18.2 s94.8%2.037.81

Measured 30 November to 1 December 2026; self-run, not an official InferenceX result, and not compared with a GPU. The 32- and 16-user points profiled 60 minutes (1,532 and 1,209 requests), the 8-user point 30 minutes (379 requests), to end within the run's time window. Tokens count input, cached input included, and output. P90 tok/s per user: 1 / the p90 inter-token latency, InferenceX's interactivity. Prompt cached: the share of the profiled requests' input tokens the server reported as cached. Tokens per dollar at AWS's Capacity Block list price for trn2.48xlarge, $2.235 per chip-hour (read 24 November 2026), and at SemiAnalysis's rate for trn2, $0.58 per chip-hour. Every point passed the harness's own validity check, with no errors and no request skipped for its length.

On the same serve, GSM8K by InferenceX's eval (all 1,319 problems, 5-shot, strict match, thinking at the template's default, up to 16,384 output tokens, 16 in flight) scored 97.42% (± 0.44). For reference, InferenceX reports 97.04% for Qwen3.8-27B-FP8, the FP8 checkpoint, on H100. The needle test hides codes in a 90,327-token document at depths 0.1, 0.5 and 0.9 and asks for them back: 3 of 3 right cold, and again after 48 other documents of the same length had pushed it out of the prefix cache, so the revisit recomputed it.

The limit today: 16 requests at a time

With Neuron SDK 2.32, three of Qwen3.8-27B's whole-model decode graphs cannot all execute in one engine: the 2-row graphs of the 128- and 1,024-page rungs (32,768 and 262,144 tokens) and the 8-row graph of the 128-page rung. Whichever of the three executes last stalls on its first execution, every rank waiting on its collectives, and the engine exits. Any two of them run clean, in any order, and turning off the attention kernel's early exit doesn't change it.

So the qwen38 build serves decode buckets of 1 and 2 rows, with at most 2 requests running per engine: 16 in flight on a box of 8 engines, the rest waiting. That wait is most of the 76.6-second first-token p90 at 32 users. Once 4-row decode runs beside the other graphs, each engine can run 4 requests, and the kernels above already work at 8 rows. The full account is in docs/KNOWN_ISSUES.md.

GLM-5.3: all 753 billion parameters on one box

What it asks of the engine

Each of GLM-5.3's 78 layers runs multi-head latent attention with RoPE over a sparse selection of the cached tokens. 21 layers choose that selection with DeepSeek Sparse Attention's lightning indexer; with IndexShare, the other 57 reuse the selection of the nearest earlier indexer layer. The MLP is 3 dense layers, then 75 MoE layers of 256 experts, 8 per token, plus a shared expert. Weights are FP8 with 128 × 128 block scales, about 745 GB in all.

Every layer attends over its KV cache, so GLM-5.3 has no recurrent state, and the engine assumed every model had some. The scheduler now serves such a model: a prefix-cache hit resumes the longest cached page-aligned prefix before the prompt's last token, with no state checkpoints, and the host cache tier, which restores prefixes from those checkpoints, is off.

What we built for it

Left: one trn2.48xlarge as 16 Trainium2 chips of 4 logical cores, the glm53 build's 64 ranks. Each rank holds 4 whole FP8 experts of GLM-5.3's 256 per MoE layer; 8 are marked as an example of one token's 8 routed experts, which sit on at most 8 ranks. Right: HBM of the fullest NeuronCore with the whole model loaded, 20.65 of 24 GiB: tensors 18.11, DMA rings 0.89, shared scratchpad 0.75, code 0.61, constants 0.14, collectives 0.10, runtime 0.05.

The glm53 build spreads each MoE layer's 256 experts over the box's 64 ranks, 4 whole experts per rank, and the whole model fits with 3.35 GiB to spare on the fullest core.

  • An expert-parallel MoE. Each rank holds whole FP8 experts, 4 per MoE layer, and the routed experts run through a new NKI kernel. The engine's torch expert path is a host loop that can't be traced into a device graph, so on Trainium2 the experts run through the kernel.
  • An exact selection kernel for the indexer. Our first device form of the indexer's top-k, a counting bisection, took over 25 minutes to compile in a 4-layer decode graph. On a NeuronCore the indexer now selects through an exact NKI selection kernel.
  • Weights read once. The replicated latent and indexer projections are dequantized once at load, not in every graph.
  • Fixes the device runs found. The router asked for an unsorted top-k, which XLA lowers to a full sort that the Neuron compiler refuses on trn2; its top-ks are now sorted. A 4,096-row prefill chunk's per-head index scores, 2 GiB in fp32, made its graphs too large for a NeuronCore's HBM, so it prefills in chunks of at most 1,024 rows, and every graph compiles at -O1.

The glm53 build runs one engine of 64 logical cores with the experts expert-parallel and an FP8 KV cache. Its context is 4,096 tokens because that is what the selection kernel holds today: a row of at most 4,096 scores per partition. Longer contexts need a two-stage selection for long rows.

What ran on Trainium2

The whole model runs 16 requests at once, with every logprob finite and coherent text out. A decode step of the whole model at its 4,096-token window, each call's own device time, takes 84.8 ms at 1 row (p10 84.0, p90 85.3, over 32 calls) and 366.2 ms at 16 rows (p10 351.2, p90 400.8, over 58 calls). No earlier release of GLM-5.3 ran on a device, so there is no baseline to compare with.

No CPU reference of the whole model fits a host (about 3 TB in fp32), so the correctness check runs its first 4 layers (3 dense, 1 MoE) on 4 prompts of 128 to 2,048 tokens, 32 new tokens each:

Device againstMean |Δ logprob|, decode / prefillAgreement
the CPU in fp32 with fp32 KV (the check)0.026 / 0.0290.758
the CPU in fp32 with FP8 KV0.018 / 0.0180.703
control, no device: the CPU with FP8 KV against fp32 KV0.023 / 0.0350.594

The logprobs pass. Agreement doesn't, and the control shows why that number says little at this depth: four layers of GLM-5.3 give a near-uniform next-token distribution, with top-1 margins of 0.005 to 0.05 nat where runs part, and the CPU alone, changing only its KV cache's precision, agrees on 0.594 of tokens. GSM8K is next: at 4,096 tokens a thinking-mode answer is cut short, and a full run at today's step time would take about 12 hours.

DeepSeek-V4.1-Flash: the first 4 layers

What it asks of the engine

DeepSeek-V4.1-Flash's 40 layers keep four parallel residual streams, as GLM-5.3-Flash's do. Attention reads a 128-token window of raw keys plus compressed keys, chosen by an indexer. The MoE has 384 routed experts, 6 per token, and a shared expert. A few layers add Engram: n-gram embedding tables looked up from the recent tokens. Weights are FP8 with 32 × 32 block scales, and the routed experts are MXFP4.

What we built for it

  • Engine state. The sliding window and the open compression groups are state the model carries between steps. They live in the engine's existing state pool, so prefix checkpoints and seat moves copy them with everything else. Engram's n-gram ids are hashed on the host, in exact 64-bit arithmetic, and passed with every call.
  • MXFP4 experts. The checkpoint reader refits MXFP4 experts to FP8 exactly, for rows that span up to 13 binades with scales in the released range; a row that doesn't fit exactly is refused at load. On FP8 dequantization, the MXFP4 experts and the model-parallel cut, it equals DeepSeek's own converter bit for bit, and it classifies all 96,085 tensors in the released checkpoint.
  • The released numerics. By default the decoder applies the released model's FP8 and FP4 activation roundings where DeepSeek's code applies them. The device build runs without them for now: they cast at e4m3fn's limit of 448, and Trainium2's e4m3 tops out at 240.

The dsv41 build runs one engine of 64 logical cores with a 4,096-token context and the experts on the XLA path.

What ran on Trainium2, and what the whole model needs

The first 4 layers ran on 4 prompts of 128 to 2,048 tokens, 32 new tokens each, against the CPU in fp32:

RunMean |Δ logprob|, decode / prefillp99 |Δ logprob|Agreement
the device (bf16)0.031 / 0.0040.440.766
control, no device: the CPU in bf160.067 (decode)0.510.594

The logprobs pass and agreement is below its bar. The control points to bf16 arithmetic: against the same fp32 reference, the CPU in bf16 does worse than the device (p99 0.51 against 0.44, agreement 0.594 against 0.766). We didn't compare the device with the CPU in bf16 position by position, so this is an indication only. At 4 layers the fullest NeuronCore uses 6.55 GiB of HBM.

The whole model needs an FP8 layout for its experts on the device: held as bf16, they don't fit a rank. It also needs prefill and decode cut into runs of layers, and an fp32 vocabulary head. After these runs, review found two edge cases in the indexer's selection, NaN scores and an interval just above the smallest normal float, and 0.4.0 fixes both. That changes the dsv41 build's graphs, so the 4-layer check runs again on the next device run.

How we checked them

Three experiments, each the device (bf16) against the same engine on the CPU in fp32, with bars fixed before the run: token agreement at least 0.95 and mean absolute logprob difference in decode at most 0.05. Qwen3.8-27B, all 64 layers on Trainium2, one engine at 8 rows a step: agreement 0.979, mean 0.0045, both pass. GLM-5.3, first 4 layers on Trainium2: agreement 0.758, mean 0.026, the logprobs pass and agreement misses; its control, the CPU alone with FP8 KV against fp32 KV: agreement 0.594, mean 0.023. DeepSeek-V4.1-Flash, first 4 layers on Trainium2 without the released roundings: agreement 0.766, mean 0.031, the logprobs pass and agreement misses; its control, the CPU alone in bf16 against fp32: agreement 0.594, mean 0.067, both bars missed.

Each family on Trainium2 against the same engine on the CPU in fp32. Qwen3.8-27B passes both bars across all 64 layers. On their first 4 layers GLM-5.3 and DeepSeek-V4.1-Flash pass the logprob bar, and a control without the device does no better on agreement.

  • Upstream references first. Before any device run, each family matched code its authors or their library released, on CPU in fp32, on reduced random configurations that keep each architecture's hard parts in play: transformers 5.17.0 for Qwen3.8-27B (each mixer within 2e-5 of the reference's largest value, the whole model's logits within 5e-5, greedy generation through the engine equal) and for GLM-5.3 (each layer within 1e-4 with the sparse selections equal, logits at tensor-parallel degrees 1, 2 and 4, greedy generation equal), and DeepSeek's released inference code for DeepSeek-V4.1-Flash, run on CPU through pure-torch stand-ins for its six GPU kernels.
  • A bug in the reference. On the way we found that DeepSeek's released reference reads a stale index key in a decode step that leaves a compression group open. The test harness corrects it at run time, and a test pins both behaviours.
  • Bars fixed in advance, with controls. On the device, every check's bars were set before the run. Where one missed, we either found and fixed the cause, as with Qwen3.8-27B's bf16 head, or ran a control without the device to see what rounding alone does, as with GLM-5.3 and DeepSeek-V4.1-Flash.
  • Long contexts and task accuracy. Where no CPU reference fits, the device is checked against itself, and the served build is scored on GSM8K and the needle test.

docs/MODELS.md has each test with its dimensions, tolerance and tensor-parallel degree.

What the device runs found

Every family passed its CPU checks at 0.3.0, and none of them started on a NeuronCore. The device runs found these, each fixed in 0.4.0:

  • No build could start the new families. Two of GLM-5.3-Flash's builds applied its device-only sparse-attention routes to every model, and the third turned on MTP, which the families' decoder refuses. Each family now has a build of its own, and asking for the wrong one names the build the model needs.
  • Engines on the wrong cores, as above.
  • Ties from a bf16 head. Qwen3.8-27B's agreement with fp32 was 0.926 until the vocabulary head computed its logits in fp32.
  • A sort the compiler refuses. GLM-5.3's router asked for an unsorted top-k, which XLA lowers to a full sort that neuronx-cc refuses on trn2.
  • A 25-minute compile. GLM-5.3's counting-bisection selection, in a 4-layer decode graph. It now runs as one NKI kernel.
  • Graphs too big for HBM. GLM-5.3's 4,096-row prefill chunks held 2 GiB of index scores per graph, and the engine's graphs didn't fit a NeuronCore.
  • A transpose the device refuses. A Neuron device tensor refused .contiguous() of DeepSeek-V4.1-Flash's transposed Engram weights, so they are transposed on the host at load.

Where each model stands

TrnRT labels each model by what has been shown for it on Trainium2, and the README carries the same labels:

ModelLevelWhat has been shown
GLM-5.3-FlashSupportedServed at a named release, with published AgentX results
Qwen3.8-27BPreviewServed on one box, checked against fp32, with AgentX, GSM8K and the needle on the same serve
GLM-5.3ExperimentalThe whole model runs at 4,096 tokens; on its first 4 layers the logprobs pass and agreement misses
DeepSeek-V4.1-FlashExperimentalIts first 4 layers ran, before 0.4.0's selection fix; the whole model waits on FP8 experts

Supported means served end to end at a named release, with measured throughput and latency on a named workload. Qwen3.8-27B has all of that except the release: its measurements ran on the code just before 0.4.0, so it moves up once they are repeated on the release. Preview means real weights pass a correctness check fixed in advance on a trn2.48xlarge. Experimental means the code matches an upstream reference on CPU and may run on Trainium2, but has not passed every check fixed in advance there.

Limitations

  1. Self-run, one run per point. Every TrnRT AgentX point is ours, one run each, and none is an official InferenceX result.
  2. Not yet on 0.4.0's own commit. The three families ran on the code just before 0.4.0's last review fixes. The fixes change DeepSeek-V4.1-Flash's selection and edit two files Qwen3.8-27B compiles, sampler.py and gqa.py, without moving a line.
  3. 16 Qwen3.8-27B requests decode at once on a box, until 4-row decode runs beside the other graphs.
  4. GLM-5.3 stops at 4,096 tokens and has no task accuracy score yet. DeepSeek-V4.1-Flash ran 4 of its 40 layers.

What's next

  • GLM-5.3-Flash: we've made a lot of performance optimizations since the November post, and a detailed post with the measurements is coming soon.
  • Qwen3.8-27B: 4-row decode beside the other graphs, for 4 requests running per engine. Then its MTP head, FP8 checkpoints and the vision tower.
  • GLM-5.3: contexts past 4,096 tokens, which need a two-stage index selection for long rows, the indexer's scores fused with the selection for prefill, and a context-parallel latent cache. Then GSM8K.
  • DeepSeek-V4.1-Flash: the whole model, starting with an FP8 layout for its experts, then GSM8K.
  • A device check of 0.4.0's own commit, DeepSeek-V4.1-Flash's changed selection first.

We will publish the runs behind each change of level with their method. Model requests go through the repo's model request template.

Reproduce it

You need Docker, any x86_64 host to compile on (no NeuronCore needed; it takes hours), and a trn2.48xlarge to serve on. pip install trnrt==0.4.0 (Python 3.13) installs the trnrt command; serving runs from the image built from the v0.4.0 tag. docs/DEPLOY.md explains each step and docs/CONFIGURATION.md lists every build.

1. Build the image (on the compile host, and again on the serving host)

bash
1git clone --branch v0.4.0 https://github.com/RunanywhereAI/trnrt.git && cd trnrt
2docker build -f docker/Dockerfile \
3 --build-arg TRNRT_VERSION=$(python3 -c 'import trnrt; print(trnrt.__version__)') \
4 --build-arg TRNRT_REVISION=$(git rev-parse HEAD) -t trnrt .

2. Build Qwen3.8-27B's compile cache (any x86_64 host)

bash
1OUT=/data/trnrt-qwen38 REV=1d4bf0f2ff6012fd82039f2fa52739d0dd7c60c0
2mkdir -p $OUT/nki $OUT/work
3trnrt() { docker run --rm -e HF_TOKEN -v $OUT:$OUT \
4 -v $OUT/nki:/var/tmp/nki-intermediate-cache trnrt "$@"; }
5trnrt compile shapes Qwen/Qwen3.8-27B --revision $REV --out $OUT
6trnrt compile capture --out $OUT -- --model $OUT/shapes --preset qwen38
7trnrt compile compile --out $OUT --work-root $OUT/work
8trnrt compile strip --out $OUT

Qwen3.8-27B is dense, so there is no compile decisions step, which reads MoE packing decisions.

3. Serve (on the trn2.48xlarge, with $OUT/cache and $OUT/nki copied over and hf from pip install -U huggingface_hub)

bash
1hf download Qwen/Qwen3.8-27B --revision 1d4bf0f2ff6012fd82039f2fa52739d0dd7c60c0 \
2 --local-dir /models/Qwen3.8-27B
3docker run --rm --privileged --network host --ipc=host \
4 -v /data/trnrt-qwen38/cache:/cache \
5 -v /data/trnrt-qwen38/nki:/var/tmp/nki-intermediate-cache \
6 -v /models/Qwen3.8-27B:/model \
7 -e NEURON_LIBTORCH_CACHE_ROOT=/cache \
8 trnrt serve --model /model --port 8000 --preset qwen38 --engines 8

That is eight engines of 8 logical cores behind the router on port 8000, serving the model as qwen. Capture and serve must use the same checkpoint revision.

4. AgentX and accuracy. On a separate client machine, with its own clone and Qwen3.8-27B's tokenizer files from the same revision in /models/Qwen3.8-27B, run each point in the order 32, 16 and 8 users, flushing every engine's prompt cache first and scoring for all 16 chips. The 32-user point:

bash
1SERVER_URL=http://SERVER_IP:8000 # the trn2.48xlarge's address
2pip install agentx-harness==1.0.12 -c benchmarks/agentx/constraints.txt
3curl -fsS -X POST "$SERVER_URL/flush_cache?timeout=60"
4taskset -c 48-71,144-167 agentx profile --url "$SERVER_URL" --endpoint /v1/chat/completions \
5 --model qwen --tokenizer /models/Qwen3.8-27B --tokenizer-trust-remote-code \
6 --max-context-length 262144 --concurrency 32 \
7 --public-dataset semianalysis_cc_traces_weka_062126 --output-artifact-dir runs/qwen38-c32/artifacts
8python3 -I benchmarks/agentx/score.py runs/qwen38-c32/artifacts --chips 16 --label qwen38-c32

Repeat with --concurrency 16 and 8, each into its own directory. Pass --chips 16: the scorer's default is 8, one GLM-5.3-Flash engine, and would double the per-chip numbers. The harness profiles 60 minutes a point, where our 8-user point ran 30. Accuracy on the same serve, from the serving host:

bash
1benchmarks/accuracy/install_lm_eval.sh
2benchmarks/accuracy/gsm8k.sh http://127.0.0.1:8000 runs/gsm8k-qwen38 16
3python3 -I benchmarks/accuracy/needle.py --server http://127.0.0.1:8000 --verdict runs/needle-qwen38.txt

We checked every command and flag above against v0.4.0's code and help output; we haven't yet re-run them end to end from the tag. GLM-5.3 (--preset glm53) and DeepSeek-V4.1-Flash (--preset dsv41) have builds too, one engine of 64 each (--engines 1): GLM-5.3 at 4,096 tokens, and DeepSeek-V4.1-Flash not yet as a whole model.

The CPU reference checks run from the same clone without a NeuronCore:

bash
1make dev # Python 3.13
2.venv/bin/pytest -q tests/test_qwen3_5_model.py tests/test_glm_moe_dsa_model.py \
3 tests/test_deepseek_v41_model.py tests/test_deepseek_v41_released.py

Acknowledgements

The models are the work of the Qwen, Z.ai and DeepSeek teams, who released their weights, configurations and reference code. AWS's Neuron SDK and NKI are what TrnRT's kernels are built on, and Qwen3.8-27B's attention runs two kernels from the NKI Library. SemiAnalysis built the AgentX harness and its public traces, and InferenceX's GSM8K eval and published results are how we measured and what we compared with. transformers made two of the three CPU references possible, and vLLM's parsers shaped our tool-call parsing. The Kiln authors' engine and kernels brought GLM-5.3-Flash up on Trainium2.


RunAnywhere builds inference engines for the hardware people can get: MetalRT for Apple silicon, QHexRT for Qualcomm Hexagon NPUs, and TrnRT for AWS Trainium. TrnRT is open source under Apache-2.0 at github.com/RunanywhereAI/trnrt. If you want frontier open models on your own Trainium capacity, talk to us.

  • trnRT
  • Trainium
  • Qwen3.8-27B
  • GLM-5.3
  • DeepSeek-V4.1-Flash
  • GLM-5.3-Flash
  • Open Source