2026-11-26 15:49 UTC

RunAnywhere open-sources TrnRT for GLM-5.3-Flash on Trainium2

state: significantheat: lowuncertainty: mediumrelevance: hightrainium-inference inference-optimizationRunAnywhereAman SwarSanchit Monga

What is this?

RunAnywhere, an inference-engine company, published TrnRT, an Apache-2.0 open-source engine for serving Z.ai’s 320B-parameter GLM-5.3-Flash on one AWS trn2.48xlarge. The November 4, 2026 first-party write-up by Aman Swar and Sanchit Monga describes custom AWS Neuron Kernel Interface (NKI) layer kernels and a cache-aware serving setup; it credits the earlier Kiln project for bringing the model up on Trainium and says much of TrnRT’s prompt processing still uses Kiln work. RunAnywhere reports a batch-8 decode-step improvement from 32.2 ms to 24.2 ms and self-run AgentX results, including up to 28.9 requests per minute at 32 agents. These are company-reported, single-run-per-point results, not official InferenceX results; the team reports no same-trace GPU comparison or task-level accuracy evaluation. Its sparse-attention prefill retains an approximation affecting about 1.2% of selections. A November 18 Show HN post separately announced the open-source release, while the detailed benchmarks and caveats are in the company’s November 4 post.

Why it matters

This is a concrete example of software engineering making a less widely used accelerator useful for serving a very large, long-context model. If the reported results reproduce, TrnRT could broaden where developers can deploy agent workloads and put pressure on inference costs by making AWS Trainium a more practical alternative. But the evidence establishes neither GPU cost superiority nor production-quality accuracy and latency: the published AgentX runs are self-run, use a specific coding-agent workload, and lack a matched GPU baseline.

Current assessment

RunAnywhere has released TrnRT under Apache-2.0 for serving GLM-5.3-Flash on one AWS trn2.48xlarge; its November 18 Show HN announcement complements the company’s November 4 engineering post. RunAnywhere reports that custom NKI kernels reduced a batch-8 decode step from 32.2 ms to 24.2 ms and presents self-run AgentX results, including up to 28.9 requests per minute at 32 agents. These are company-reported measurements from a specific harness and workload, not independent validation or a matched GPU comparison; throughput does not establish per-user responsiveness or cost superiority. The authors also report no task-level accuracy evaluation and retain an approximate sparse-attention selection affecting about 1.2% of selections. The release makes Trainium a more concrete deployment option for this large, long-context model and may broaden access to alternative inference infrastructure. Further model support is a future plan, not current availability. No new implementation result or independent reproduction has appeared in this update; the release was already established in the case, so the engagement bump is not a material change.

Measured heat

now 0 pts/hpeak 8 pts/hcomments 0/hpeers p10momentum: steady3 platformsage 554h
points/hour across evidence · reading as of 2026-11-27 02:23:58.509736+11:00 · deterministic, not a model opinion

How the heat travelled

11-03 13:00⭐ origin echo-reconstructedThe article is itself the original primary source for its implementation and benchmark results; it identifies the authors as Aman Swar and S
Aman Swar and Sanchit Monga (RunAnywhere) on blog (echo) · attributed from reddit.post.1xo0yuq, hn.story.50372064
—
11-04 21:47first on r/MachineLearning · published · +32.8h[P] NKI layer megakernels for GLM-5.3-Flash on AWS Trainium2: where a decode step's time went, and what we changed [P]
WildCard727
—
11-04 21:52first on hacker news · published · +32.9hServing GLM-5.3-Flash on one Trainium2 box with NKI layer megakernels
sanchitmonga22
—
11-04 21:47amplified on r/MachineLearningreddit.post.1xo0yuq
WildCard727
peak 1 · 0 comments · 1% of case engagement
11-04 21:52amplified on hacker newshn.story.50372064
sanchitmonga22
peak 3 · 0 comments · 4% of case engagement
11-17 16:01amplified on hacker news 👑hn.story.50533270
sanchitmonga22
peak 54 · 8 comments · 95% of case engagement
11-04 22:20our radar first saw it · +33.3hdiscovery anchor: reddit.post.1xo0yuq—
pace: p35 vs 1845 stories at the 336h mark (now 554h old) — ahead of adobe-max-ai-agents-creative-tools-mcp (1.5x), behind 42loop-agent-operated-product-experiment (0.8x)

Evidence (4) — ⭐ canonical anchor

sourceobjectauthorscorecomments
🟠 reddit[P] NKI layer megakernels for GLM-5.3-Flash on AWS Trainium2: where a decode step's time went, and what we changed [P]
MachineLearning
WildCard72710
🟧 hnServing GLM-5.3-Flash on one Trainium2 box with NKI layer megakernels
Retrieved article excerpt

Open article · Retrieved 2026-11-04T22:24:33.089283+00:00

[Back to Blog](https://runanywhere.ai/blog)

trnRT · November 4, 2026 · 34 min read

# Serving GLM-5.3-Flash on one Trainium2 box with NKI layer megakernels

One AWS trn2.48xlarge serves GLM-5.3-Flash at up to 28.9 agent requests a minute on SemiAnalysis's AgentX benchmark, 3.57 million tokens a minute, and takes a million-token prompt to its first token in about three minutes. NKI layer megakernels cut its decode step from 32.2 ms to 24.2 ms.

By Aman Swar and Sanchit Monga

Serving GLM-5.3-Flash on one Trainium2 box with NKI layer megakernels

*GLM-5.3-Flash is a 320-billion-parameter, million-token MoE. We serve it on one AWS trn2.48xlarge and measure it on SemiAnalysis's AgentX benchmark, which replays the shape of real coding-agent sessions: long, mostly cached prompts, subagents, and users waiting on every answer. We found no earlier published AgentX results on Trainium. To get here we rewrote the model's decode as one NKI kernel per layer half, or per whole layer for the sparse-attention layers, and built a prefix cache that keeps each agent's context in device and host memory. Here is what that bought, what it costs on AWS, where the time still goes, and what didn't work.*

Three panels against concurrent agents (4, 8, 16, 32) at batch size 8 per serving instance. Throughput: 913, 1,754, 2,580 and 3,147 total tokens/s per chip. Time to first token, median: 1.07, 0.96, 1.26 and 28.9 s; p90: 3.55, 3.02, 6.27 and 77.9 s. Inter-token latency, median: 15.9, 20.6, 27.7 and 34.0 ms; p90: 22.8, 30.0, 40.4 and 49.9 ms.

*The whole post in one chart: what one box serves on AgentX as agents are added. Up to 16 agents the median request starts in about a second; at 32, requests queue for a decode slot. We haven't run GPUs on the same traces yet, so there is no P5 line here (see [Limitations](https://runanywhere.ai/blog/glm-5-3-flash-trainium2-nki-megakernels#limitations)).*

> **Key results** (one AWS trn2.48xlarge, 16 Trainium2 chips, two serving instances; AgentX runs on 2 November 2026)
>
> - **Agent traffic.** On SemiAnalysis's AgentX benchmark (self-run, one hour per point), one box serves up to 28.9 agent requests a minute (32 agents, batch size 12): 3,720 tokens/s per Trainium2 chip, 3.57 million tokens a minute, for $0.021 per request at AWS's capacity-block price. At 16 agents it serves 19.1 requests a minute; the median request with a cached prompt starts in 1.24 s and decodes at 35.9 tokens/s.
> - **Million-token prompts.** One instance, on half the box, takes a 1,039,912-token prompt to its first token in 190.8 s: 8.7× sooner than the 1,651.7 s Kiln v0.2.0 published for the same half-box setup. A follow-up question on a cached million-token context gets its first token in 1.84 s (median of three).
> - **Decode step.** Fusing each layer half into one NKI kernel made a decode step with eight requests per instance 25% faster: from 32.2 ms (our 17 October build, which already ran first versions of the KDA and MoE kernels) to 24.2 ms (1 November), on the same 32-way tensor-parallel layout. We show where the remaining time goes.
> - **Accuracy.** Every kernel ships behind a byte-for-byte or high-precision-reference gate. One approximation remains in sparse-attention prompt processing, on 1.2% of selections; we measure its effect [below](https://runanywhere.ai/blog/glm-5-3-flash-trainium2-nki-megakernels#accuracy-note).

> **How to read these numbers**
>
> - The AgentX results are self-run with agentx-harness 1.0.7, one run per point. They are not official InferenceX results.
> - About 95% of the tokens in the throughput figures are prompt input read from the prefix cache, as is typical of coding agents. We report output and uncached input separately, and cost per request.
> - The numbers were measured with our internal build. The public repository compiles the same 157 graphs on all 32 ranks and returns byte-identical outputs on 384 test requests.
> - We haven't run a GPU baseline on the same traces (see [Limitations](https://runanywhere.ai/blog/glm-5-3-flash-trainium2-nki-megakernels#limitations)), or a task-level accuracy eval on the benchmarked build.

The engine code that accompanies this post is at [github.com/RunanywhereAI/trnrt](https://github.com/RunanywhereAI/trnrt) (Apache-2.0).

## Why Trainium2

A 320-billion-parameter model with a million-token context needs memory first: FP8 weights for 288 experts in every MoE layer, the linear-attention layers' recurrent state for every session, and the sparse-attention layers' cache for every agent's context. On AWS's own price list, a trn2.48xlarge rents for less than half as much per terabyte of accelerator memory as an eight-GPU H200 or B200 box.

| Instance | Per TB-hour | Per hour | Memory | Chips |
| --- | --- | --- | --- | --- |
| trn2.48xlarge | **$23.84** | $35.76 | 1.5 TB | 16 Trainium2 |
| p5e.48xlarge | $48.69 | $54.92 | 1.128 TB | 8 H200 |
| p5en.48xlarge | $55.99 | $63.16 | 1.128 TB | 8 H200 |
| p6-b200.48xlarge | $79.38 | $113.67 | 1.432 TB | 8 B200 |

*EC2 Capacity Blocks for ML in US East (Ohio): prices from AWS's [Capacity Block pricing](https://aws.amazon.com/ec2/capacityblocks/pricing/), accelerator memory from its instance pages ([Trn2](https://aws.amazon.com/ec2/instance-types/trn2/), [P5](https://aws.amazon.com/ec2/instance-types/p5/), [P6](https://aws.amazon.com/ec2/instance-types/p6/)), read 3 November 2026. These are rental prices, not serving costs.*

A cheaper box per gigabyte is only the start: what it costs per request depends on the engine. On AgentX at 16 agents, one trn2.48xlarge costs $0.031 per agent request at the capacity-block price. We haven't run GLM-5.3-Flash on these GPUs on the same traces, so we make no claim about Trainium2 against GPUs per request; that comparison is on our list. What we can say is how much room is left: a decode step today takes four times its memory floor (24.2 ms against 6.1 ms), so the same box can serve more agents an hour as the engine improves. The rest of this post is where that time goes and what we did about it.

## The model and the hardware

GLM-5.3-Flash has 45 layers, 320 billion parameters, and activates about 18 billion of them per token. Three things make it hard to serve:

- **Two kinds of attention.** 34 layers use Kimi Delta Attention (KDA), a linear attention that keeps a fixed-size recurrent state per sequence instead of a KV cache that grows with context. The other 11, every fourth layer, use DeepSeek Sparse Attention (DSA). An indexer scores every cached token and keeps the top 2,048 (512 blocks of four), and latent attention runs over just those.
- **Four residual streams.** Manifold-constrained hyper-connections (mHC) replace the single residual stream with four. Every layer reads a learned mix of them and writes back to all four. The mixing matrix is renormalized on every token by 20 Sinkhorn iterations.
- **A large, sparse FFN.** Every layer after the first three ends in a mixture of experts with 288 routed experts, eight per token, plus a shared expert. The weights are FP8, as released.

Diagram. Top: the 45 layers in order, colored by type: three dense-FFN KDA layers, then a DSA sparse-attention layer every fourth layer from layer 3 (layers 3, 7, ..., 43, 11 in all), with KDA layers with MoE in between and at the end. Bottom: what one KDA layer and one DSA layer do, each wrapped by mHC: four residual streams, remixed through a matrix kept near doubly stochastic by a 20-iteration Sinkhorn step.

*One decode step: 34 KDA layers and 11 DSA layers, every one wrapped in mHC.*

A trn2.48xlarge has 16 Trainium2 chips, each with 96 GiB of HBM at 2.9 TB/s and eight physical NeuronCores. Each NeuronCore combines four compute engines with a large software-managed scratchpad, SBUF. The engines are a matrix engine, a vector engine, a scalar engine and a general-purpose GpSimd engine. Trainium2's default logical-core setting, LNC = 2, pairs the physical cores two by two, so the box has 64 logical cores. A kernel sees each pair as two programs that run side by side. We run two serving instances per box, each tensor-parallel across 32 logical cores on 8 chips; within an instance, the sparse-attention layers also split the long context across groups of eight ranks (context parallelism). The instances sit behind a router that keeps each agent session on one instance so its prefix stays cached.

Diagram. Agent sessions reach a session-affine router, which sends each session to one of two serving instances. Each instance runs the whole model tensor-parallel over 32 logical NeuronCores on 8 Trainium2 chips (LNC = 2: two physical cores per logical core). Each instance decodes up to 12 requests at once, in compiled batch sizes 1, 2, 4, 6, 8 and 12, prefills in chunks of up to 4,096 tokens, and keeps a prefix cache.

*Two serving instances per box, each holding a full copy of the model.*

The kernels are written in NKI, the Neuron Kernel Interface: AWS's Python-embedded kernel language for Trainium. An NKI kernel works at tile level. It decides which engine runs each instruction and moves data between HBM and SBUF explicitly. On a GPU, the closest analogue is writing in Triton or CUDA rather than relying on a compiler's fusion.

## Where we started

When we started in early October, no AWS-supported or major open-source engine served GLM-5.3-Flash on Trainium. As of 3 November:

- AWS's vLLM plugin for Neuron registers no GLM model in its latest release ([v0.29.0.1.2.0](https://github.com/vllm-project/vllm-neuron/releases/tag/v0.29.0.1.2.0), 19 October), though it ships one GLM-5.3 prefill norm kernel. An open pull request, [vllm-neuron#66](https://github.com/vllm-project/vllm-neuron/pull/66), ports the larger GLM-5.3 (78 layers, 256 experts) to trn2.
- NxD Inference, AWS's earlier inference library, has been [in maintenance mode](https://awsdocs-neuron.readthedocs-hosted.com/en/latest/about-neuron/announcements/neuron2.x/announce-maintenance-nxdi-nxd-core-inference.html) since Neuron 2.30, [left AWS's Deep Learning AMIs and containers](https://awsdocs-neuron.readthedocs-hosted.com/en/latest/release-notes/components/dlamis.html) in 2.32, and its support on Trn2 and Trn3 [ends in Neuron 2.34](https://awsdocs-neuron.readthedocs-hosted.com/en/latest/about-neuron/announcements/neuron2.x/announce-eos-nxdi-nxd-core-inference.html).
- SGLang [announced a Trainium plugin](https://www.lmsys.org/blog/2026-10-22-sglang-trainium-beta) on 22 October, in a limited beta that lists GLM-5.2/5.3 among its models. It hasn't published performance numbers yet.

The one engine that did serve GLM-5.3-Flash on Trainium2 was [Kiln](https://github.com/foxl-ai/kiln), an independent open-source inference engine for Trainium, first released on 5 October 2026. On our box it reproduced its own published benchmark: 229.2 output tokens per second against v0.2.0's published 229.5, on 8K-token prompts with 256-token answers at 128 concurrent requests.

Kiln is also our baseline, and we measured it on our own box rather than rely on its published numbers. On 9 October we ran Kiln v0.2.0 (commit 607ac2e, one README commit after the tag) on the same trn2.48xlarge, in the best configuration we found for it: its published Trainium2 configuration with decode batch sizes of 1, 2 and 4, as two instances behind its router. That configuration is built for Kiln's benchmark shape, 8K-token prompts; for million-token prompts v0.2.0 has a separate, opt-in long-context engine, which we didn't run, so that row quotes Kiln's published figure. Agent traffic is different. Prompts are long and mostly cached, and each user waits on decode. That set our two goals: million-token contexts under agent load, and fast decode at around eight concurrent users per instance. Against Kiln v0.2.0 on our box:

|  | Kiln v0.2.0 | Ours (2 Nov) | Ours against Kiln v0.2.0 |
| --- | --- | --- | --- |
| First token, uncached 8K-token prompt | 7.33 s (measured on our box, 9 Oct; median at 2 concurrent requests, 8,192-token p
sanchitmonga2230
🟧 echo.blog ⭐The article is itself the original primary source for its implementation and benchmark results; it identifies the authors as Aman Swar and SAman Swar and Sanchit Monga (RunAnywhere)——
🟧 hnShow HN: TrnRT – An open-source LLM inference engine for AWS Trainiumsanchitmonga22548

Interpretation history

Decision trace