Skip to content
RunAnywhere

trnRT is our open-source inference engine for AWS Trainium.

It serves GLM-5.3-Flash, a 320-billion-parameter model with a million-token context, from a single trn2.48xlarge. We wrote its decode kernels and its prefix cache. The code is open and the method is published.

Release
v0.2.0
Released
November 25, 2026
License
Apache-2.0
GitHub stars
1.7K

What one box serves

trnRT: measured values, with the conditions each was measured under
MeasuredValueConditionsSource
Agent requests a minute from one box28.9req/min32 agents at batch size 12 on the AgentX benchmark.Method
Tokens a minute at that point3.57Mtokens/minInput and output together. About 95% is prompt input read from the prefix cache.Method
To the first token of a 1,039,912-token prompt190.8sOne instance on half the box, one request alone, nothing cached.Method
To the first token of a follow-up question on that cached context1.84sMedian of three follow-up questions.Method

One AWS trn2.48xlarge (16 Trainium2 chips) running two serving instances of GLM-5.3-Flash with FP8 weights. AgentX runs on 2 November 2026 with agentx-harness 1.0.7, run by us, a single one-hour run per point. These are not official InferenceX results. They were measured with our internal build of 2 November 2026; the public repository compiles the same graphs.

One kernel for each half of a layer

A decode step spent only a quarter of its time moving bytes. The rest went to small instructions, call boundaries and waits. So decode became one NKI kernel per layer half, or per whole layer for the sparse-attention layers.

Before: a chain of small kernels
HBMhigh-bandwidth memorymixprojectconvdeltanorma call per kernel, glue between callsevery hand-off goes through HBM
After: a layer megakernel
HBMhigh-bandwidth memoryinputs, weightsoutputsmixprojectconvdeltanormone NKI kernel per layer halfthe working set stays in on-chip memory
  • 17 October build32.2 ms
  • 1 November build24.2 ms
  • Memory floor6.1 ms

One decode step with eight requests per instance, on the same layout. The October build already ran first versions of two of the kernels. The floor is the time it takes to read what the step needs from memory, so a step still takes four times its floor.

Keep the working set on the chip

Activations, recurrent state and the weights in flight fit in on-chip scratch memory, so apart from weights streaming in, only a layer's inputs and outputs cross HBM.

Use both cores of a logical core

A logical NeuronCore is a pair of physical cores, and a kernel runs as two programs. Splitting the weight streams between them nearly doubles how fast weights arrive.

Move the cross-chip sums inside

When a sum across chips would block a kernel, it moves into the kernel, where independent work can overlap the wait.

Each session stays with its cache

The box runs two engines, each a full copy of the model across 32 logical NeuronCores on 8 chips. A router keeps every agent session on one engine, so its prefix stays cached there.

agent sessionsengine A8 chipsprefix cacheengine B8 chipsprefix cache32 logical NeuronCores per enginesession-affine router

What agent traffic looks like

The median AgentX prompt is 83K to 106K tokens, and only about 1.6K to 1.9K of them are new. About 95% of all tokens are cached input and under 1% are output.

What the router does

A session ID pins a conversation to one engine. Without one, the router picks the engine that already holds the longest prefix of the prompt.

What each engine does

It decodes up to 12 requests at once and prefills new prompt text in chunks of up to 4,096 tokens, with every graph compiled ahead of time.

A million tokens, read once

Reading a full context takes minutes. The prefix cache keeps what was read in device memory, with a host-memory tier for evicted pages, so the next question starts in seconds.

190.8s

First read of a 1,039,912-token prompt. Nothing is cached, so every page is processed.

1.84s

A follow-up on the same context. The pages are in the prefix cache, so only the new tokens are processed.

The first read is one request alone on half the box, at about 5,450 prompt tokens a second. The follow-up is the median of three.

What these numbers do not say

  • One box, a single one-hour run per point, run by us. These are not official InferenceX results.
  • The numbers come from our internal build of 2 November 2026. The public repository compiles the same graphs.
  • The AgentX harness we ran, 1.0.7, was not the latest release.
  • The post makes no performance claim against GPUs: we had not run GLM-5.3-Flash on GPUs on the same traces. The repository README carries a later tokens-per-dollar comparison against public GPU runs, with its own caveats.
  • At 32 agents, requests queue for a decode slot. The median wait is 7 s at batch size 12.
  • No point we ran reaches 30 tokens a second per user by AgentX's P90 end-to-end measure.
  • There is no task-level accuracy evaluation on the benchmarked build. Every kernel ships behind a byte-for-byte or high-precision reference check instead.
  • One approximation remains in sparse-attention prompt processing, on 1.2% of selections. The post measures its effect.
  • Much of the prompt processing still runs on kernels we did not write. The post credits them.
  • trnRT supports one chip family, Trainium2, and one model, GLM-5.3-Flash, today.