[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-110915":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":23,"defaultBranch":24,"hasWiki":23,"hasPages":23,"topics":25,"createdAt":10,"pushedAt":36,"updatedAt":37,"readmeContent":38,"aiSummary":39,"trendingCount":16,"starSnapshotCount":16,"syncStatus":17,"lastSyncTime":40,"discoverSource":41},110915,"trnrt","RunanywhereAI\u002Ftrnrt","RunanywhereAI","The open LLM inference engine for AWS Trainium: NKI megakernels, 1M-token context, OpenAI-compatible API. By RunAnywhere.","https:\u002F\u002Frunanywhere.ai\u002Fblog\u002Fglm-5-3-flash-trainium2-nki-megakernels",null,"Python",1661,28,5,9,0,2,74,800,22,86.39,"Apache License 2.0",false,"development",[26,27,28,29,30,31,32,33,34,35],"aws","glm","inference","llm","llm-serving","megakernels","neuron","nki","openai-api","trainium","2026-11-22 22:04:36","2026-11-23 18:38:49","\u003Cp align=\"center\">\n  \u003Cpicture>\n    \u003Csource media=\"(prefers-color-scheme: dark)\" srcset=\"docs\u002Fassets\u002Fbanner-dark.svg\">\n    \u003Csource media=\"(prefers-color-scheme: light)\" srcset=\"docs\u002Fassets\u002Fbanner-light.svg\">\n    \u003Cimg alt=\"TrnRT: the open LLM inference engine for AWS Trainium, by RunAnywhere\" src=\"docs\u002Fassets\u002Fbanner-dark.svg\" width=\"100%\">\n  \u003C\u002Fpicture>\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  \u003Ca href=\"https:\u002F\u002Fgithub.com\u002FRunanywhereAI\u002Ftrnrt\u002Factions\u002Fworkflows\u002Fci.yml\">\u003Cimg alt=\"CI\" src=\"https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Factions\u002Fworkflow\u002Fstatus\u002FRunanywhereAI\u002Ftrnrt\u002Fci.yml?branch=development&style=flat-square&labelColor=161515&label=CI\">\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fscorecard.dev\u002Fviewer\u002F?uri=github.com\u002FRunanywhereAI\u002Ftrnrt\">\u003Cimg alt=\"OpenSSF Scorecard\" src=\"https:\u002F\u002Fimg.shields.io\u002Fossf-scorecard\u002Fgithub.com\u002FRunanywhereAI\u002Ftrnrt?style=flat-square&labelColor=161515&label=OpenSSF%20Scorecard\">\u003C\u002Fa>\n  \u003Ca href=\"LICENSE\">\u003Cimg alt=\"License: Apache 2.0\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flicense-Apache%202.0-fd7014?style=flat-square&labelColor=161515\">\u003C\u002Fa>\n  \u003Cimg alt=\"Python 3.13\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fpython-3.13-fd7014?style=flat-square&labelColor=161515\">\n  \u003Cimg alt=\"AWS Trainium2\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FAWS-Trainium2-fd7014?style=flat-square&labelColor=161515\">\n  \u003Cimg alt=\"Neuron SDK 2.32\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FNeuron%20SDK-2.32-fd7014?style=flat-square&labelColor=161515\">\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  \u003Ca href=\"#quickstart\">\u003Cb>Quickstart\u003C\u002Fb>\u003C\u002Fa> ·\n  \u003Ca href=\"docs\u002FRESULTS.md\">\u003Cb>Benchmarks\u003C\u002Fb>\u003C\u002Fa> ·\n  \u003Ca href=\"docs\u002FREADME.md\">\u003Cb>Docs\u003C\u002Fb>\u003C\u002Fa> ·\n  \u003Ca href=\"docs\u002FMEGAKERNELS.md\">\u003Cb>Kernels\u003C\u002Fb>\u003C\u002Fa> ·\n  \u003Ca href=\"https:\u002F\u002Frunanywhere.ai\u002Fblog\u002Fglm-5-3-flash-trainium2-nki-megakernels\">\u003Cb>Blog post\u003C\u002Fb>\u003C\u002Fa> ·\n  \u003Ca href=\"https:\u002F\u002Frunanywhere.ai\">\u003Cb>runanywhere.ai\u003C\u002Fb>\u003C\u002Fa>\n\u003C\u002Fp>\n\n**TrnRT** is an open inference engine for large language models on AWS Trainium. It serves an OpenAI-compatible API\nfrom one `trn2.48xlarge`, runs decode as NKI megakernels (about one kernel per layer half), and keeps a prefix cache\nacross device and host memory. **GLM-5.3-Flash is the first supported model; more open models are on the way.**\n\nHow we built it, with the AgentX results: [Serving GLM-5.3-Flash on one Trainium2 box with NKI layer megakernels](https:\u002F\u002Frunanywhere.ai\u002Fblog\u002Fglm-5-3-flash-trainium2-nki-megakernels).\n\n\u003Cp align=\"center\">\n  \u003Cpicture>\n    \u003Csource media=\"(prefers-color-scheme: dark)\" srcset=\"docs\u002Fassets\u002Fcards-dark.svg\">\n    \u003Csource media=\"(prefers-color-scheme: light)\" srcset=\"docs\u002Fassets\u002Fcards-light.svg\">\n    \u003Cimg alt=\"3.57M tokens per minute on one trn2.48xlarge (AgentX, batch 12). 24 ms batch-8 decode step, down from 32.2 ms with NKI megakernels. $0.040 per million tokens at the spot price, $0.167 on a capacity block.\" src=\"docs\u002Fassets\u002Fcards-dark.svg\" width=\"100%\">\n  \u003C\u002Fpicture>\n\u003C\u002Fp>\n\n## Highlights\n\n| Feature | What it does |\n|---|---|\n| **NKI megakernels** | One fused kernel per layer half for decode: KDA attention, the fused DSA layer, mHC and the MoE FFN. |\n| **1M-token context** | Sparse attention (top 2,048) and linear attention, with fixed-size state. |\n| **Prefix cache** | A radix tree over FP8 KV pages, plus a host-memory tier for evicted pages and state checkpoints. |\n| **Two engines per box** | Each engine is tensor-parallel over 32 logical NeuronCores, behind a session-affine router. |\n| **OpenAI API** | Chat and completions, streaming, tool calls and reasoning output. |\n| **Offline compile** | Every graph is built on a CPU host; the serving box loads them and compiles nothing by default. |\n\n## Quickstart\n\nYou need Docker, a `trn2.48xlarge` to serve on, and any x86_64 host to compile on. New to Trainium? Start with\n[docs\u002FAWS.md](docs\u002FAWS.md).\n\n**1. Build the image** (Neuron SDK 2.32 (neuronx-cc 2.27), Python 3.13)\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002FRunanywhereAI\u002Ftrnrt.git && cd trnrt\ndocker build -f docker\u002FDockerfile \\\n  --build-arg TRNRT_VERSION=$(python3 -c 'import trnrt; print(trnrt.__version__)') \\\n  --build-arg TRNRT_REVISION=$(git rev-parse HEAD) -t trnrt .\n```\n\n**2. Build the compile cache** (any x86_64 host, no NeuronCore needed; takes hours)\n\n```bash\nOUT=\u002Fdata\u002Ftrnrt REV=eb9eb208eb0d988989d07a6a12d0fdeb5f52574a\nmkdir -p $OUT\u002Fnki $OUT\u002Fwork\ntrnrt() { docker run --rm -e HF_TOKEN -v $OUT:$OUT \\\n  -v $OUT\u002Fnki:\u002Fvar\u002Ftmp\u002Fnki-intermediate-cache trnrt \"$@\"; }\ntrnrt compile shapes zai-org\u002FGLM-5.3-Flash --revision $REV --out $OUT\ntrnrt compile decisions --model zai-org\u002FGLM-5.3-Flash --revision $REV --out $OUT\ntrnrt compile capture --out $OUT -- --model $OUT\u002Fshapes\ntrnrt compile compile --out $OUT --work-root $OUT\u002Fwork\ntrnrt compile strip --out $OUT\n```\n\n**3. Serve** (on the `trn2.48xlarge`, with `$OUT\u002Fcache` and `$OUT\u002Fnki` copied over)\n\n```bash\nhf download zai-org\u002FGLM-5.3-Flash --revision eb9eb208eb0d988989d07a6a12d0fdeb5f52574a \\\n  --local-dir \u002Fmodels\u002FGLM-5.3-Flash\ndocker run --rm --privileged --network host --ipc=host \\\n  -v \u002Fdata\u002Ftrnrt\u002Fcache:\u002Fcache \\\n  -v \u002Fdata\u002Ftrnrt\u002Fnki:\u002Fvar\u002Ftmp\u002Fnki-intermediate-cache \\\n  -v \u002Fmodels\u002FGLM-5.3-Flash:\u002Fmodel \\\n  -e NEURON_LIBTORCH_CACHE_ROOT=\u002Fcache \\\n  trnrt serve --model \u002Fmodel --port 8000\n```\n\n**4. Call it** with any OpenAI client\n\n```python\nfrom openai import OpenAI\n\nclient = OpenAI(base_url=\"http:\u002F\u002Flocalhost:8000\u002Fv1\", api_key=\"unused\")\nreply = client.chat.completions.create(\n    model=\"glm\",\n    messages=[{\"role\": \"user\", \"content\": \"Write a haiku about Trainium.\"}],\n    extra_body={\"session_id\": \"my-session\"},  # keeps a conversation on one engine's prefix cache\n)\nprint(reply.choices[0].message.content)\n```\n\nThe full guide covers what each step needs, start-up checks, the batch 4, 8 and 12 configurations and every flag:\n[deploy](docs\u002FDEPLOY.md) · [API](docs\u002FAPI.md) · [configuration](docs\u002FCONFIGURATION.md).\n\n## Supported hardware and models\n\n\u003Cp align=\"center\">\n  \u003Cpicture>\n    \u003Csource media=\"(prefers-color-scheme: dark)\" srcset=\"docs\u002Fassets\u002Fsupport-dark.svg\">\n    \u003Csource media=\"(prefers-color-scheme: light)\" srcset=\"docs\u002Fassets\u002Fsupport-light.svg\">\n    \u003Cimg alt=\"Hardware: AWS Trainium2 (trn2.48xlarge, 16 chips, 96 GiB HBM each, Neuron SDK 2.32), supported. Models: GLM-5.3-Flash (320B MoE, 18B active, FP8, 1M-token context), supported. More open models: coming soon.\" src=\"docs\u002Fassets\u002Fsupport-dark.svg\" width=\"100%\">\n  \u003C\u002Fpicture>\n\u003C\u002Fp>\n\n| Target | Status |\n|---|---|\n| **AWS Trainium2**, `trn2.48xlarge` (16 chips, 2 engines × TP 32, LNC 2) | ✅ Supported |\n| **[GLM-5.3-Flash](https:\u002F\u002Fhuggingface.co\u002Fzai-org\u002FGLM-5.3-Flash)** (320B MoE, 18B active, FP8, 1M-token context) | ✅ Supported |\n| More open models | 🔜 Coming soon. [Request a model](https:\u002F\u002Fgithub.com\u002FRunanywhereAI\u002Ftrnrt\u002Fissues\u002Fnew?template=30-model-request.yml) |\n\nGLM-5.3-Flash is where TrnRT starts. The engine, router, caches and compile pipeline are built to carry more model\nfamilies, and [docs\u002FARCHITECTURE.md](docs\u002FARCHITECTURE.md#adding-a-model-family) describes what a new one needs.\n\n## Benchmarks\n\n[SemiAnalysis AgentX](https:\u002F\u002Fgithub.com\u002FSemiAnalysisAI\u002Fagentx-harness) replays real coding-agent sessions. One\n`trn2.48xlarge` ran it at a 1M-token context with 32 concurrent agents, for one hour per point:\n\n| Decode batch | Requests \u002F min | Tokens \u002F min | Decode tok\u002Fs per user (p50) | First token, cached (p50) | $ \u002F M tokens (spot) |\n|---|---|---|---|---|---|\n| 4 | 19.3 | 2.36M | 46.6 | 76.73 s | $0.061 |\n| 8 | 25.2 | 3.02M | 29.4 | 28.82 s | $0.047 |\n| **12** (default) | **28.9** | **3.57M** | 22.3 | 6.53 s | **$0.040** |\n\nTokens count input (cached input included) and output. Spot price: $8.60\u002Fh, us-east-2, 3 Nov 2026. On a capacity block\nat $35.76\u002Fh, the batch 12 cost is $0.167 per million tokens. Full tables, cold-prompt latencies, long prompts and\nmethodology are in [docs\u002FRESULTS.md](docs\u002FRESULTS.md).\n\nThese numbers were measured with an earlier build of TrnRT. This repository passes these checks against that build\n([docs\u002FKNOWN_ISSUES.md](docs\u002FKNOWN_ISSUES.md#verification-status)):\n\n- Graph equivalence: EQUAL on all 32 ranks, for all 157 graphs that build compiles in the default batch-12\n  configuration.\n- Outputs: byte-identical to that build's on 384 of 384 requests.\n- Serving: the two-engine serve in the [Quickstart](#quickstart) passes end to end.\n\n## How it works\n\n\u003Cp align=\"center\">\n  \u003Cpicture>\n    \u003Csource media=\"(prefers-color-scheme: dark)\" srcset=\"docs\u002Fassets\u002Farchitecture-dark.svg\">\n    \u003Csource media=\"(prefers-color-scheme: light)\" srcset=\"docs\u002Fassets\u002Farchitecture-light.svg\">\n    \u003Cimg alt=\"Clients reach a session-affine router on port 8000, which sends each session to one of two engines. Each engine is tensor-parallel over 32 logical NeuronCores on 8 chips. Offline, five steps build the compile cache the engines load.\" src=\"docs\u002Fassets\u002Farchitecture-dark.svg\" width=\"100%\">\n  \u003C\u002Fpicture>\n\u003C\u002Fp>\n\nDecode is not limited by memory bandwidth here; small instructions, kernel boundaries and exposed collectives dominate it. So\neach decode megakernel follows three rules: keep the working set in SBUF, use both physical cores symmetrically, and move\nthe collectives into the kernel. [docs\u002FMEGAKERNELS.md](docs\u002FMEGAKERNELS.md) walks through every kernel.\n\n## Repository layout\n\n```text\ntrnrt\u002F\n├── __main__.py   CLI: serve, engine, compile\n├── serve\u002F        OpenAI API, session-affine router, output parsers\n├── engine\u002F       scheduler, prefix caches, tensor parallelism\n├── models\u002F       GLM-5.3-Flash: KDA, DSA, mHC, MoE, FP8 loading\n├── kernels\u002F      NKI decode megakernels and prefill kernels\n└── compile\u002F      offline compile: shapes, capture, neuronx-cc, strip\ndocker\u002F           the serving and compile image\ntools\u002F            graph-equivalence gate, device checks, doc checks\ntests\u002F            CPU test suite (no NeuronCore needed)\ndocs\u002F             guides, results, kernel notes\n```\n\nMore in [docs\u002FARCHITECTURE.md](docs\u002FARCHITECTURE.md).\n\n## Development\n\n```bash\nmake dev     # editable install with test and lint tools (Python 3.13)\nmake check   # lint, type-check, then the CPU test suite\n```\n\nSee [docs\u002FDEVELOPMENT.md](docs\u002FDEVELOPMENT.md) for the test tiers and CI, [CONTRIBUTING.md](CONTRIBUTING.md) to send a\nchange (pull requests target `development`), [SUPPORT.md](SUPPORT.md) to get help, and [SECURITY.md](SECURITY.md) to\nreport a vulnerability.\n\n## AWS resources\n\n| Resource | Link |\n|---|---|\n| Trainium2 and `trn2` instances | [aws.amazon.com\u002Fec2\u002Finstance-types\u002Ftrn2](https:\u002F\u002Faws.amazon.com\u002Fec2\u002Finstance-types\u002Ftrn2\u002F) |\n| AWS Neuron SDK documentation | [awsdocs-neuron.readthedocs-hosted.com](https:\u002F\u002Fawsdocs-neuron.readthedocs-hosted.com\u002F) |\n| NKI (Neuron Kernel Interface) | [NKI documentation](https:\u002F\u002Fawsdocs-neuron.readthedocs-hosted.com\u002Fen\u002Flatest\u002Fgeneral\u002Fnki\u002Findex.html) |\n| Neuron deep learning containers | [github.com\u002Faws-neuron\u002Fdeep-learning-containers](https:\u002F\u002Fgithub.com\u002Faws-neuron\u002Fdeep-learning-containers) |\n| EC2 Capacity Blocks for ML | [aws.amazon.com\u002Fec2\u002Fcapacityblocks](https:\u002F\u002Faws.amazon.com\u002Fec2\u002Fcapacityblocks\u002F) |\n\n## Acknowledgments\n\nThanks to the AWS Neuron team for NKI and its documentation, to Z.ai for releasing GLM-5.3-Flash, and to SemiAnalysis\nfor AgentX and its public traces. TrnRT includes code derived from other Apache-2.0 projects: see [NOTICE](NOTICE)\nand [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).\n\n## License\n\n[Apache License 2.0](LICENSE).\n\n\u003Cp align=\"center\">\n  \u003Cbr>\n  \u003Ca href=\"https:\u002F\u002Frunanywhere.ai\">\n    \u003Cpicture>\n      \u003Csource media=\"(prefers-color-scheme: dark)\" srcset=\"docs\u002Fassets\u002Frunanywhere-lockup-dark.svg\">\n      \u003Csource media=\"(prefers-color-scheme: light)\" srcset=\"docs\u002Fassets\u002Frunanywhere-lockup-light.svg\">\n      \u003Cimg alt=\"RunAnywhere\" src=\"docs\u002Fassets\u002Frunanywhere-lockup-dark.svg\" height=\"32\">\n    \u003C\u002Fpicture>\n  \u003C\u002Fa>\n  \u003Cbr>\n  \u003Csub>Built by \u003Ca href=\"https:\u002F\u002Frunanywhere.ai\">RunAnywhere\u003C\u002Fa>.\u003C\u002Fsub>\n\u003C\u002Fp>\n\n\u003Csub>AWS, Amazon Web Services, Trainium, Inferentia and Neuron are trademarks of Amazon.com, Inc. or its affiliates. The\nAWS logo appears here as published in AWS's Architecture Icons. TrnRT is an independent open-source project, not\naffiliated with or endorsed by Amazon Web Services.\u003C\u002Fsub>\n","TrnRT 是一个面向 AWS Trainium 加速器的开源大语言模型（LLM）推理引擎，专为高性能、低成本部署设计。它基于 Neuron SDK 和 NKI（Neuron Kernel Interface）实现层级融合的 megakernels，支持百万级上下文长度，提供与 OpenAI API 兼容的服务接口，并利用跨设备与主机内存的 prefix cache 提升长序列推理效率。当前已验证支持 GLM-5.3-Flash 模型，在单台 trn2.48xlarge 实例上实现 3.57M tokens\u002F分钟吞吐与低延迟 decode 步骤。适用于在 AWS 云环境中部署开源 LLM 的生产级推理服务，尤其适合对成本敏感、需长上下文与高吞吐的 AI 应用场景。","2026-11-24 04:39:56","CREATED_QUERY"]