trnrt 0.2.0__tar.gz → 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (310) hide show
  1. {trnrt-0.2.0/trnrt.egg-info → trnrt-0.3.0}/PKG-INFO +52 -36
  2. {trnrt-0.2.0 → trnrt-0.3.0}/README.md +51 -35
  3. {trnrt-0.2.0 → trnrt-0.3.0}/pyproject.toml +5 -1
  4. trnrt-0.3.0/tests/test_benchmark_mode.py +143 -0
  5. trnrt-0.3.0/tests/test_benchmarks.py +839 -0
  6. trnrt-0.3.0/tests/test_benchmarks_needle.py +537 -0
  7. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_builds.py +15 -0
  8. trnrt-0.3.0/tests/test_deepseek_v41.py +351 -0
  9. trnrt-0.3.0/tests/test_deepseek_v41_chat.py +272 -0
  10. trnrt-0.3.0/tests/test_deepseek_v41_engine.py +698 -0
  11. trnrt-0.3.0/tests/test_deepseek_v41_engram.py +333 -0
  12. trnrt-0.3.0/tests/test_deepseek_v41_model.py +577 -0
  13. trnrt-0.3.0/tests/test_deepseek_v41_reference.py +256 -0
  14. trnrt-0.3.0/tests/test_deepseek_v41_released.py +264 -0
  15. trnrt-0.3.0/tests/test_dsv41_ckpt.py +293 -0
  16. trnrt-0.3.0/tests/test_dsv41_ckpt_synth.py +671 -0
  17. trnrt-0.3.0/tests/test_dsv41_mxfp4.py +253 -0
  18. trnrt-0.3.0/tests/test_engine_kv_only.py +142 -0
  19. trnrt-0.3.0/tests/test_glm53_full_template.py +132 -0
  20. trnrt-0.3.0/tests/test_glm_moe_dsa_config.py +235 -0
  21. trnrt-0.3.0/tests/test_glm_moe_dsa_engine.py +77 -0
  22. trnrt-0.3.0/tests/test_glm_moe_dsa_ep.py +166 -0
  23. trnrt-0.3.0/tests/test_glm_moe_dsa_layers.py +247 -0
  24. trnrt-0.3.0/tests/test_glm_moe_dsa_model.py +391 -0
  25. trnrt-0.3.0/tests/test_glm_moe_dsa_topk.py +97 -0
  26. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_host_arena.py +16 -0
  27. trnrt-0.3.0/tests/test_model_families.py +84 -0
  28. trnrt-0.3.0/tests/test_moe_ep.py +788 -0
  29. trnrt-0.3.0/tests/test_parsers_deepseek.py +265 -0
  30. trnrt-0.3.0/tests/test_parsers_qwen3.py +230 -0
  31. trnrt-0.3.0/tests/test_parsers_qwen38.py +166 -0
  32. trnrt-0.3.0/tests/test_qwen3_5_checkpoint.py +188 -0
  33. trnrt-0.3.0/tests/test_qwen3_5_engine.py +119 -0
  34. trnrt-0.3.0/tests/test_qwen3_5_kernel_route.py +65 -0
  35. trnrt-0.3.0/tests/test_qwen3_5_layers.py +273 -0
  36. trnrt-0.3.0/tests/test_qwen3_5_model.py +233 -0
  37. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_release_plan.py +1 -1
  38. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_router.py +20 -1
  39. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_router_native.py +87 -3
  40. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_serve_anthropic.py +25 -0
  41. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_serve_api.py +27 -2
  42. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_serve_cli.py +32 -1
  43. trnrt-0.3.0/tests/test_serve_families.py +313 -0
  44. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_serve_native.py +106 -0
  45. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_serve_responses.py +12 -0
  46. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_serve_sampling.py +159 -2
  47. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_tp_stop_bound.py +273 -3
  48. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/__init__.py +1 -1
  49. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/__main__.py +45 -6
  50. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/engine/engine.py +53 -18
  51. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/engine/host_arena.py +6 -1
  52. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/engine/scheduler.py +24 -11
  53. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/engine/tp.py +59 -1
  54. trnrt-0.3.0/trnrt/kernels/moe_ep.py +1278 -0
  55. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/metrics.py +9 -6
  56. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/models/config.py +8 -1
  57. trnrt-0.3.0/trnrt/models/deepseek_v41.py +417 -0
  58. trnrt-0.3.0/trnrt/models/dsv41_attn.py +526 -0
  59. trnrt-0.3.0/trnrt/models/dsv41_ckpt.py +1074 -0
  60. trnrt-0.3.0/trnrt/models/dsv41_engine.py +728 -0
  61. trnrt-0.3.0/trnrt/models/dsv41_engram.py +536 -0
  62. trnrt-0.3.0/trnrt/models/dsv41_model.py +684 -0
  63. trnrt-0.3.0/trnrt/models/dsv41_mxfp4.py +152 -0
  64. trnrt-0.3.0/trnrt/models/dsv41_quant.py +80 -0
  65. trnrt-0.3.0/trnrt/models/families.py +61 -0
  66. trnrt-0.3.0/trnrt/models/gdn.py +363 -0
  67. trnrt-0.3.0/trnrt/models/glm_moe_dsa.py +519 -0
  68. trnrt-0.3.0/trnrt/models/gqa.py +142 -0
  69. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/models/loader.py +10 -1
  70. trnrt-0.3.0/trnrt/models/mla_rope.py +255 -0
  71. trnrt-0.3.0/trnrt/models/plain.py +443 -0
  72. trnrt-0.3.0/trnrt/models/qwen3_5.py +203 -0
  73. trnrt-0.3.0/trnrt/models/topk.py +114 -0
  74. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/serve/anthropic.py +11 -1
  75. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/serve/api.py +261 -78
  76. trnrt-0.3.0/trnrt/serve/benchmark_mode.py +77 -0
  77. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/serve/native.py +50 -18
  78. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/serve/parsers.py +349 -46
  79. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/serve/responses.py +7 -4
  80. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/serve/router.py +54 -8
  81. {trnrt-0.2.0 → trnrt-0.3.0/trnrt.egg-info}/PKG-INFO +52 -36
  82. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt.egg-info/SOURCES.txt +50 -0
  83. {trnrt-0.2.0 → trnrt-0.3.0}/LICENSE +0 -0
  84. {trnrt-0.2.0 → trnrt-0.3.0}/NOTICE +0 -0
  85. {trnrt-0.2.0 → trnrt-0.3.0}/setup.cfg +0 -0
  86. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_api.py +0 -0
  87. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_api_cached_tokens.py +0 -0
  88. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_api_engine_health.py +0 -0
  89. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_api_native.py +0 -0
  90. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_api_prompt_thread.py +0 -0
  91. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_api_request_checks.py +0 -0
  92. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_cache_overlap_pages.py +0 -0
  93. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_check_docs.py +0 -0
  94. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_check_image.py +0 -0
  95. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_check_mixed.py +0 -0
  96. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_ckpt_dominated.py +0 -0
  97. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_ckpt_mid.py +0 -0
  98. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_ckpt_mid_export.py +0 -0
  99. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_ckpt_offload_running.py +0 -0
  100. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_ckpt_prompt_finish.py +0 -0
  101. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_compile_farm.py +0 -0
  102. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_decode_composition.py +0 -0
  103. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_decode_route_modules.py +0 -0
  104. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_detok_incremental.py +0 -0
  105. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_detok_selfcheck.py +0 -0
  106. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_dma_hw.py +0 -0
  107. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_dsa_cp.py +0 -0
  108. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_dsa_cp_glue.py +0 -0
  109. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_dsa_cp_index_rows.py +0 -0
  110. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_dsa_fail_attn_trip.py +0 -0
  111. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_dsa_fail_trip.py +0 -0
  112. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_dsa_fused_layer.py +0 -0
  113. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_dsa_index.py +0 -0
  114. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_dsa_long.py +0 -0
  115. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_dsa_long_select_t_trips.py +0 -0
  116. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_dsa_merge_rbits.py +0 -0
  117. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_dsa_odec_drop.py +0 -0
  118. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_dsa_routes.py +0 -0
  119. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_dsa_row_classes.py +0 -0
  120. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_dsa_sel2g_generated.py +0 -0
  121. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_dsa_shell.py +0 -0
  122. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_dsa_slots.py +0 -0
  123. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_dsa_slots_n_p.py +0 -0
  124. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_dsa_snd.py +0 -0
  125. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_dsa_tieskip.py +0 -0
  126. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_dsa_topk.py +0 -0
  127. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_e2e.py +0 -0
  128. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_engine_priority.py +0 -0
  129. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_ffn_half.py +0 -0
  130. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_ffn_half_ids1.py +0 -0
  131. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_gated_norm.py +0 -0
  132. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_glm53_chat.py +0 -0
  133. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_glm53_template.py +0 -0
  134. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_glm5_next.py +0 -0
  135. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_grammar_engine.py +0 -0
  136. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_graph_equiv.py +0 -0
  137. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_graph_equiv_command.py +0 -0
  138. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_graph_equiv_meta.py +0 -0
  139. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_guided_host.py +0 -0
  140. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_host_cache.py +0 -0
  141. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_host_cache_batch.py +0 -0
  142. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_host_cache_checkpoints.py +0 -0
  143. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_host_cache_save_once.py +0 -0
  144. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_host_sampling_engine.py +0 -0
  145. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_host_sampling_units.py +0 -0
  146. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_host_sampling_warmup.py +0 -0
  147. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_host_sim_seam.py +0 -0
  148. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_iopool.py +0 -0
  149. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_kda.py +0 -0
  150. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_kda_decode.py +0 -0
  151. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_kda_routes.py +0 -0
  152. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_kda_shell.py +0 -0
  153. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_kda_shell_verify.py +0 -0
  154. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_kda_zero_row.py +0 -0
  155. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_labeler.py +0 -0
  156. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_lnc_split.py +0 -0
  157. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_local_k.py +0 -0
  158. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_log.py +0 -0
  159. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_max_running.py +0 -0
  160. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_mhc.py +0 -0
  161. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_mhc_seam.py +0 -0
  162. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_mk_b5c.py +0 -0
  163. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_mk_kda_layer.py +0 -0
  164. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_model_path.py +0 -0
  165. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_moe_dedupe.py +0 -0
  166. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_moe_prefill.py +0 -0
  167. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_moe_prefill_mdr.py +0 -0
  168. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_moe_prefill_tsb.py +0 -0
  169. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_neff_strip.py +0 -0
  170. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_no_abbrev.py +0 -0
  171. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_no_trace.py +0 -0
  172. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_numa_pin.py +0 -0
  173. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_parsers.py +0 -0
  174. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_parsers_glm.py +0 -0
  175. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_preset_env.py +0 -0
  176. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_prompt_cache.py +0 -0
  177. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_radix_cache.py +0 -0
  178. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_radix_eviction.py +0 -0
  179. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_rank_threads.py +0 -0
  180. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_router_affinity.py +0 -0
  181. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_row_isolation.py +0 -0
  182. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_rowclass_runner.py +0 -0
  183. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_sampler.py +0 -0
  184. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_sched_cli.py +0 -0
  185. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_sched_pchain.py +0 -0
  186. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_scheduler.py +0 -0
  187. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_scheduler_policy.py +0 -0
  188. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_scheduler_spec.py +0 -0
  189. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_serve_e2e.py +0 -0
  190. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_serve_sched.py +0 -0
  191. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_serve_stats.py +0 -0
  192. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_serve_structured.py +0 -0
  193. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_shape_dir_hub.py +0 -0
  194. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_shell.py +0 -0
  195. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_sp_gather_direct.py +0 -0
  196. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_spec_async.py +0 -0
  197. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_spec_config.py +0 -0
  198. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_spec_engine_fake.py +0 -0
  199. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_spec_metrics.py +0 -0
  200. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_spec_model.py +0 -0
  201. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_spec_runner_stub.py +0 -0
  202. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_spec_synth.py +0 -0
  203. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_start_checks.py +0 -0
  204. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_state_pool.py +0 -0
  205. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_state_pool_spec.py +0 -0
  206. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_third_party_notices.py +0 -0
  207. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_tp_init.py +0 -0
  208. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_tp_shm.py +0 -0
  209. {trnrt-0.2.0 → trnrt-0.3.0}/tests/test_zero_blobs.py +0 -0
  210. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/compile/__init__.py +0 -0
  211. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/compile/cache.py +0 -0
  212. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/compile/capture.py +0 -0
  213. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/compile/farm.py +0 -0
  214. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/compile/strip.py +0 -0
  215. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/config.py +0 -0
  216. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/engine/__init__.py +0 -0
  217. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/engine/grammar.py +0 -0
  218. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/engine/guided.py +0 -0
  219. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/engine/host_cache.py +0 -0
  220. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/engine/host_inputs.py +0 -0
  221. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/engine/iopool.py +0 -0
  222. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/engine/kv_pool.py +0 -0
  223. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/engine/model_runner.py +0 -0
  224. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/engine/radix_cache.py +0 -0
  225. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/engine/request.py +0 -0
  226. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/engine/sampler.py +0 -0
  227. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/engine/spec_async.py +0 -0
  228. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/engine/spec_synth.py +0 -0
  229. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/engine/start_checks.py +0 -0
  230. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/engine/start_lock.py +0 -0
  231. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/engine/state_pool.py +0 -0
  232. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/engine/watchdog.py +0 -0
  233. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/__init__.py +0 -0
  234. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/cc_tail.py +0 -0
  235. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/cc_world.py +0 -0
  236. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/delta_rule.py +0 -0
  237. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/dense_half.py +0 -0
  238. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/dsa_cp_glue.py +0 -0
  239. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/dsa_decode.py +0 -0
  240. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/dsa_index.py +0 -0
  241. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/dsa_long_pipe.py +0 -0
  242. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/dsa_long_pipe_s.py +0 -0
  243. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/dsa_long_select.py +0 -0
  244. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/dsa_long_select_t.py +0 -0
  245. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/dsa_sa.py +0 -0
  246. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/dsa_sat.py +0 -0
  247. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/dsa_satwf.py +0 -0
  248. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/dsa_satwfc.py +0 -0
  249. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/dsa_satwfcg.py +0 -0
  250. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/dsa_satwfcga.py +0 -0
  251. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/dsa_satwfg.py +0 -0
  252. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/dsa_sel2g.py +0 -0
  253. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/dsa_sel2gc.py +0 -0
  254. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/dsa_sel_s2.py +0 -0
  255. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/dsa_shell.py +0 -0
  256. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/dsa_slots.py +0 -0
  257. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/dsa_slots_c.py +0 -0
  258. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/dsa_slots_n.py +0 -0
  259. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/dsa_slots_n_p.py +0 -0
  260. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/dsa_slots_n_s.py +0 -0
  261. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/dsa_slots_n_s2.py +0 -0
  262. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/dsa_topk.py +0 -0
  263. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/dsa_topk_t.py +0 -0
  264. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/ffn_half.py +0 -0
  265. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/ffn_half_pb.py +0 -0
  266. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/ffn_half_shared.py +0 -0
  267. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/gated_norm.py +0 -0
  268. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/kda_decode.py +0 -0
  269. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/kda_half.py +0 -0
  270. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/kda_oob.py +0 -0
  271. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/kda_shell.py +0 -0
  272. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/mhc_fnj.py +0 -0
  273. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/mhc_front.py +0 -0
  274. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/mhc_mix.py +0 -0
  275. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/mhc_pre.py +0 -0
  276. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/mhc_pre_split.py +0 -0
  277. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/mhc_seam.py +0 -0
  278. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/mhc_split.py +0 -0
  279. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/mix_wide.py +0 -0
  280. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/mk_kda_layer.py +0 -0
  281. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/moe_dedupe.py +0 -0
  282. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/moe_half.py +0 -0
  283. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/moe_prefill.py +0 -0
  284. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/moe_prefill_mdr.py +0 -0
  285. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/moe_prefill_tsb.py +0 -0
  286. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/rowiso.py +0 -0
  287. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/shell.py +0 -0
  288. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/short_conv.py +0 -0
  289. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/kernels/sp_gather.py +0 -0
  290. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/log.py +0 -0
  291. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/models/__init__.py +0 -0
  292. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/models/decoder.py +0 -0
  293. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/models/dsa_long.py +0 -0
  294. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/models/dsa_select.py +0 -0
  295. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/models/glm5_next.py +0 -0
  296. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/models/hybrid.py +0 -0
  297. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/models/linear_attn.py +0 -0
  298. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/models/mla.py +0 -0
  299. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/models/quant.py +0 -0
  300. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/platform.py +0 -0
  301. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/serve/__init__.py +0 -0
  302. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/serve/dashboard.py +0 -0
  303. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/serve/prodlog.py +0 -0
  304. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/serve/prompt_cache.py +0 -0
  305. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/serve/stats.py +0 -0
  306. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt/serve/structured.py +0 -0
  307. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt.egg-info/dependency_links.txt +0 -0
  308. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt.egg-info/entry_points.txt +0 -0
  309. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt.egg-info/requires.txt +0 -0
  310. {trnrt-0.2.0 → trnrt-0.3.0}/trnrt.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: trnrt
3
- Version: 0.2.0
3
+ Version: 0.3.0
4
4
  Summary: LLM inference on AWS Trainium2, with NKI megakernels: an OpenAI-compatible server, 1M-token context and prefix caching
5
5
  Author-email: RunAnywhere <security@runanywhere.ai>
6
6
  License-Expression: Apache-2.0
@@ -73,7 +73,8 @@ Dynamic: license-file
73
73
 
74
74
  **TrnRT** is an open inference engine for large language models on AWS Trainium. It serves an OpenAI-compatible API
75
75
  from one `trn2.48xlarge`, runs decode as NKI megakernels (about one kernel per layer half), and keeps a prefix cache
76
- across device and host memory. **GLM-5.3-Flash is the first supported model; more open models are on the way.**
76
+ across device and host memory. **GLM-5.3-Flash is the first supported model. Qwen3.8-27B, GLM-5.3 and DeepSeek-V4.1-Flash are experimental:
77
+ CPU-verified, not yet run on Trainium2.**
77
78
 
78
79
  How we built it, with the AgentX results: [Serving GLM-5.3-Flash on one Trainium2 box with NKI layer megakernels](https://runanywhere.ai/blog/glm-5-3-flash-trainium2-nki-megakernels).
79
80
 
@@ -91,47 +92,52 @@ How we built it, with the AgentX results: [Serving GLM-5.3-Flash on one Trainium
91
92
  <picture>
92
93
  <source media="(prefers-color-scheme: dark)" srcset="docs/assets/standing-dark.svg">
93
94
  <source media="(prefers-color-scheme: light)" srcset="docs/assets/standing-light.svg">
94
- <img alt="1.6 to 1.75 times H200's tokens per dollar at 1 to 8 users, 1.34 times at 12 users and 1.07 times at 16, and 3.5 to 5.2 times H100's at 12 to 32 users: InferenceX AgentX, one TrnRT engine of 8 Trainium2 chips against one 8-GPU node, at AWS Capacity Block prices." src="docs/assets/standing-dark.svg" width="100%">
95
+ <img alt="1.6 to 1.9 times H200's tokens per dollar at 1, 4 and 8 users (MTP at InferenceX's golden acceptance length) and 1.09 times at 16, and 3.9 to 5.2 times H100's at 16, 24 and 32 users: InferenceX AgentX, one TrnRT engine of 8 Trainium2 chips against one 8-GPU node, at AWS Capacity Block prices." src="docs/assets/standing-dark.svg" width="100%">
95
96
  </picture>
96
97
  </p>
97
98
 
98
- On [InferenceX](https://github.com/SemiAnalysisAI/InferenceX) AgentX, which replays real coding-agent sessions, one TrnRT
99
- engine (8 Trainium2 chips, half a `trn2.48xlarge`) delivers more tokens per dollar than one 8-GPU H200 node up to 16
100
- concurrent users, and 3.5-5.2× an H100 node's from 12 to 32 users. All three run GLM-5.3-Flash's FP8 weights and are
101
- priced at AWS's Capacity Block list prices.
99
+ On [InferenceX](https://github.com/SemiAnalysisAI/InferenceX) AgentX, which replays real coding-agent sessions, one
100
+ TrnRT engine (8 Trainium2 chips, half a `trn2.48xlarge`) delivers more tokens per dollar than one 8-GPU H200 node at 1,
101
+ 4, 8 and 16 concurrent users, and 3.9-5.2× an H100 node's at 16, 24 and 32 users. At 1, 4 and 8 users it runs the
102
+ `latency-golden` build: MTP speculation at InferenceX's golden acceptance length (2.519), the benchmark mode, whose
103
+ output text is not the model's. Both columns of those rows, tokens per dollar and tok/s per user, are at that synthetic
104
+ acceptance (as H200's are at theirs), so they compare speed, never output quality. All three run GLM-5.3-Flash's FP8
105
+ weights and are priced at AWS's Capacity Block list prices.
102
106
 
103
107
  <p align="center">
104
108
  <picture>
105
109
  <source media="(prefers-color-scheme: dark)" srcset="docs/assets/results-agentx-users-dark.png">
106
110
  <source media="(prefers-color-scheme: light)" srcset="docs/assets/results-agentx-users-light.png">
107
- <img alt="AgentX total tokens per dollar by concurrent users: trn2 above H200 up to 16 users and above H100 at every concurrency, at AWS Capacity Block prices." src="docs/assets/results-agentx-users-dark.png" width="760">
111
+ <img alt="AgentX total tokens per dollar by concurrent users: trn2 above H200 at 1, 4, 8 and 16 users and above H100 at every measured concurrency, at AWS Capacity Block prices." src="docs/assets/results-agentx-users-dark.png" width="760">
108
112
  </picture>
109
113
  </p>
110
114
 
111
- | Users | Tokens per $: trn2 ÷ H200 | Tokens per $: trn2 ÷ H100 | P90 interactivity, tok/s per user: trn2 / H200 |
112
- |---|---|---|---|
113
- | 1 | **1.64×** | **1.52×** | 62.2 / 272 |
114
- | 4 | **1.75×** | **1.74×** | 41.8 / 235 |
115
- | 8 | **1.61×** | **2.01×** | 25.8 / 168 |
116
- | 12 | **1.34×** | **3.53×** | 17.1 / 138 |
117
- | 16 | **1.07×** | **3.82×** | 14.2 / 87.8 |
118
- | 24 | 0.86× | **5.16×** | 11.4 / 78.7 |
119
- | 32 | 0.81× | **4.95×** | 10.7 / 50.1 |
120
-
121
- **Where we're behind.** Each trn2 user is slower: P90 interactivity (end to end, the wait for the first token
122
- included) is 10.7-62.2 tok/s per user against H200's 50.1-272. At 24 and 32
123
- users H200 delivers more tokens per dollar (0.81-0.86×), and on the 8K/1K fixed-length recipe, which has no prefix reuse,
124
- trn2 delivers 0.56-0.76× H200's. Where a decode step's time goes is in
115
+ | Users | trn2 build | Tokens per $: trn2 ÷ H200 | Tokens per $: trn2 ÷ H100 | P90 interactivity, tok/s per user: trn2 / H200 |
116
+ |---|---|---|---|---|
117
+ | 1 | `latency-golden` | **1.73×** | **1.60×** | 66.3 / 272 |
118
+ | 4 | `latency-golden` | **1.89×** | **1.88×** | 51.3 / 235 |
119
+ | 8 | `latency-golden` | **1.63×** | **2.02×** | 27.6 / 168 |
120
+ | 16 | `balanced` | **1.09×** | **3.89×** | 14.2 / 87.8 |
121
+ | 24 | `throughput` | 0.87× | **5.17×** | 11.5 / 78.7 |
122
+ | 32 | `throughput` | 0.81× | **4.95×** | 10.7 / 50.1 |
123
+
124
+ **Where we're behind.** Each trn2 user is slower: P90 interactivity (1 / the P90 inter-token latency, as InferenceX
125
+ plots it; the wait for the first token is not in it) is 10.7-66.3 tok/s per user against H200's 50.1-272 (at 1-8
126
+ users both at synthetic golden acceptance). At 24 and 32 users H200 delivers more tokens per dollar (0.81-0.87×), and on
127
+ the 8K/1K fixed-length recipe, whose prompts share no prefix (its client's warmup sends the first timed prompt, so one
128
+ timed request per run can find it cached), trn2 delivers 0.89-1.00× H200's at 1-8 users and 0.52-0.82× at 16-64. Where a decode step's time goes is in
125
129
  [docs/RESULTS.md](docs/RESULTS.md#where-a-decode-steps-time-goes).
126
130
 
127
131
  <sub>InferenceX AgentX harness 1.0.12, canonical workload, one hour per point; ratios compare the same concurrency. The
128
- 1-8 user points use MTP at InferenceX's golden acceptance length (2.519; trn2's measured acceptance is 2.20). Prices,
129
- AWS Capacity Blocks list, read 24 Nov 2026: trn2.48xlarge $2.235 per Trainium2 chip-hour ($35.76 per instance-hour),
130
- p5.48xlarge $5.970 per H100-hour, p5e.48xlarge $6.866 per H200-hour. trn2 ran TrnRT's internal builds on Neuron SDK
131
- 2.32 (GSM8K 97.4-97.7% on the MTP builds, strict exact match, 5-shot, all 1,319 problems; a needle test passed on the
132
- host-tier restore); this release's builds are graph-equivalent to them, and a device run of release 0.2.0 itself is
133
- pending. GPU numbers are InferenceX's public runs; we report no accuracy score for them and did not check them. Every
134
- table, source run and the method:
132
+ 1-8 user points use MTP at InferenceX's golden acceptance length (2.519; trn2's measured acceptance is 2.20): the
133
+ `latency-golden` build, whose output text is not the model's. Prices, AWS Capacity Blocks list, read 24 Nov 2026:
134
+ trn2.48xlarge $2.235 per Trainium2 chip-hour ($35.76 per instance-hour), p5.48xlarge $5.970 per H100-hour, p5e.48xlarge
135
+ $6.866 per H200-hour. Every trn2 point is a run of 0.2.0's code with the serve fixes, on 25 Nov 2026 (the 2.20
136
+ acceptance dates from 0.2.0), with
137
+ [benchmarks/](benchmarks/README.md) (the image from `docker/Dockerfile`, Neuron SDK 2.32, and a compile cache built from
138
+ source). GSM8K is 97.4-97.6% on the builds served with real acceptance (strict exact match, 5-shot, all 1,319 problems),
139
+ and each passed a needle test (on its answers; a host-tier restore is not observable on this server). GPU numbers are
140
+ InferenceX's public runs; we report no accuracy score for them and did not check them. Every table, source run and the method:
135
141
  [docs/RESULTS.md](docs/RESULTS.md#against-h100-and-h200-inferencex-agentx-and-8k1k).</sub>
136
142
 
137
143
  ## Highlights
@@ -220,10 +226,15 @@ The full guide covers what each step needs, start-up checks, the three builds an
220
226
  |---|---|
221
227
  | **AWS Trainium2**, `trn2.48xlarge` (16 chips, 2 engines × TP 32, LNC 2) | ✅ Supported |
222
228
  | **[GLM-5.3-Flash](https://huggingface.co/zai-org/GLM-5.3-Flash)** (320B MoE, 18B active, FP8, 1M-token context) | ✅ Supported |
229
+ | **[Qwen3.8-27B](https://huggingface.co/Qwen/Qwen3.8-27B)** (dense, Gated DeltaNet and gated attention, BF16) | 🧪 Experimental: CPU-verified, not yet run on Trainium2 |
230
+ | **[GLM-5.3](https://huggingface.co/zai-org/GLM-5.3)** (MoE, latent attention with a sparse indexer, FP8) | 🧪 Experimental: CPU-verified, not yet run on Trainium2 |
231
+ | **[DeepSeek-V4.1-Flash](https://huggingface.co/deepseek-ai/DeepSeek-V4.1-Flash)** (MoE with MXFP4 experts, compressed sparse attention, Engram) | 🧪 Experimental: CPU-verified, not yet run on Trainium2 |
223
232
  | More open models | 🔜 Coming soon. [Request a model](https://github.com/RunanywhereAI/trnrt/issues/new?template=30-model-request.yml) |
224
233
 
225
- GLM-5.3-Flash is where TrnRT starts. The engine, router, caches and compile pipeline are built to carry more model
226
- families, and [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md#adding-a-model-family) describes what a new one needs.
234
+ GLM-5.3-Flash is where TrnRT starts. An experimental model's code is in the tree and matches an upstream reference on
235
+ CPU on reduced configurations, but it has not run on Trainium2 here and no device number is claimed for it: [docs/MODELS.md](docs/MODELS.md)
236
+ says what each one has and what it still needs. [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md#adding-a-model-family)
237
+ describes what a new model family needs.
227
238
 
228
239
  ## Benchmarks
229
240
 
@@ -241,14 +252,18 @@ at $35.76/h, the batch 12 cost is $0.167 per million tokens. Full tables, cold-p
241
252
  methodology are in [docs/RESULTS.md](docs/RESULTS.md).
242
253
 
243
254
  These numbers were measured with an earlier build of TrnRT, at release 0.1.0's batch presets, which this release's
244
- builds replace. This repository passes these checks against that build
255
+ builds replace. At release 0.1.0, this repository passed these checks against that build
245
256
  ([docs/KNOWN_ISSUES.md](docs/KNOWN_ISSUES.md#verification-status)):
246
257
 
247
- - Graph equivalence: EQUAL on all 32 ranks, for all 157 graphs that build compiles in the default batch-12
258
+ - Graph equivalence: EQUAL on all 32 ranks, for all 157 graphs that build compiles in its default batch-12
248
259
  configuration.
249
260
  - Outputs: byte-identical to that build's on 384 of 384 requests.
250
- - Serving: the two-engine serve in the [Quickstart](#quickstart) passed end to end on the device at release 0.1.0. On
251
- this release it has run end to end on CPU only so far; the device run is pending.
261
+ - Serving: the two-engine serve in the [Quickstart](#quickstart) passed end to end on the device.
262
+
263
+ On 0.2.0's code with the serve fixes (24-25 Nov 2026), the builds read EQUAL against their reference builds, with
264
+ bitwise-equal outputs on the device, and the comparison with H100 and H200 above is a run of that code. 0.3.0 then
265
+ added the experimental model families, with a dispatch in two traced files: none of these checks, nor the two-engine
266
+ serve, has run on the device for 0.3.0 yet ([KNOWN_ISSUES.md](docs/KNOWN_ISSUES.md#verification-status)).
252
267
 
253
268
  ## How it works
254
269
 
@@ -271,11 +286,12 @@ trnrt/
271
286
  ├── __main__.py CLI: serve, engine, compile
272
287
  ├── serve/ OpenAI API, session-affine router, output parsers
273
288
  ├── engine/ scheduler, prefix caches, tensor parallelism
274
- ├── models/ GLM-5.3-Flash: KDA, DSA, mHC, MoE, FP8 loading
289
+ ├── models/ GLM-5.3-Flash: KDA, DSA, mHC, MoE, FP8 loading; the experimental families
275
290
  ├── kernels/ NKI decode megakernels and prefill kernels
276
291
  └── compile/ offline compile: shapes, capture, neuronx-cc, strip
277
292
  docker/ the serving and compile image
278
293
  tools/ graph-equivalence gate, device checks, doc checks
294
+ benchmarks/ the recipe for every published point: builds, clients, scorers, accuracy
279
295
  tests/ CPU test suite (no NeuronCore needed)
280
296
  docs/ guides, results, kernel notes
281
297
  ```
@@ -26,7 +26,8 @@
26
26
 
27
27
  **TrnRT** is an open inference engine for large language models on AWS Trainium. It serves an OpenAI-compatible API
28
28
  from one `trn2.48xlarge`, runs decode as NKI megakernels (about one kernel per layer half), and keeps a prefix cache
29
- across device and host memory. **GLM-5.3-Flash is the first supported model; more open models are on the way.**
29
+ across device and host memory. **GLM-5.3-Flash is the first supported model. Qwen3.8-27B, GLM-5.3 and DeepSeek-V4.1-Flash are experimental:
30
+ CPU-verified, not yet run on Trainium2.**
30
31
 
31
32
  How we built it, with the AgentX results: [Serving GLM-5.3-Flash on one Trainium2 box with NKI layer megakernels](https://runanywhere.ai/blog/glm-5-3-flash-trainium2-nki-megakernels).
32
33
 
@@ -44,47 +45,52 @@ How we built it, with the AgentX results: [Serving GLM-5.3-Flash on one Trainium
44
45
  <picture>
45
46
  <source media="(prefers-color-scheme: dark)" srcset="docs/assets/standing-dark.svg">
46
47
  <source media="(prefers-color-scheme: light)" srcset="docs/assets/standing-light.svg">
47
- <img alt="1.6 to 1.75 times H200's tokens per dollar at 1 to 8 users, 1.34 times at 12 users and 1.07 times at 16, and 3.5 to 5.2 times H100's at 12 to 32 users: InferenceX AgentX, one TrnRT engine of 8 Trainium2 chips against one 8-GPU node, at AWS Capacity Block prices." src="docs/assets/standing-dark.svg" width="100%">
48
+ <img alt="1.6 to 1.9 times H200's tokens per dollar at 1, 4 and 8 users (MTP at InferenceX's golden acceptance length) and 1.09 times at 16, and 3.9 to 5.2 times H100's at 16, 24 and 32 users: InferenceX AgentX, one TrnRT engine of 8 Trainium2 chips against one 8-GPU node, at AWS Capacity Block prices." src="docs/assets/standing-dark.svg" width="100%">
48
49
  </picture>
49
50
  </p>
50
51
 
51
- On [InferenceX](https://github.com/SemiAnalysisAI/InferenceX) AgentX, which replays real coding-agent sessions, one TrnRT
52
- engine (8 Trainium2 chips, half a `trn2.48xlarge`) delivers more tokens per dollar than one 8-GPU H200 node up to 16
53
- concurrent users, and 3.5-5.2× an H100 node's from 12 to 32 users. All three run GLM-5.3-Flash's FP8 weights and are
54
- priced at AWS's Capacity Block list prices.
52
+ On [InferenceX](https://github.com/SemiAnalysisAI/InferenceX) AgentX, which replays real coding-agent sessions, one
53
+ TrnRT engine (8 Trainium2 chips, half a `trn2.48xlarge`) delivers more tokens per dollar than one 8-GPU H200 node at 1,
54
+ 4, 8 and 16 concurrent users, and 3.9-5.2× an H100 node's at 16, 24 and 32 users. At 1, 4 and 8 users it runs the
55
+ `latency-golden` build: MTP speculation at InferenceX's golden acceptance length (2.519), the benchmark mode, whose
56
+ output text is not the model's. Both columns of those rows, tokens per dollar and tok/s per user, are at that synthetic
57
+ acceptance (as H200's are at theirs), so they compare speed, never output quality. All three run GLM-5.3-Flash's FP8
58
+ weights and are priced at AWS's Capacity Block list prices.
55
59
 
56
60
  <p align="center">
57
61
  <picture>
58
62
  <source media="(prefers-color-scheme: dark)" srcset="docs/assets/results-agentx-users-dark.png">
59
63
  <source media="(prefers-color-scheme: light)" srcset="docs/assets/results-agentx-users-light.png">
60
- <img alt="AgentX total tokens per dollar by concurrent users: trn2 above H200 up to 16 users and above H100 at every concurrency, at AWS Capacity Block prices." src="docs/assets/results-agentx-users-dark.png" width="760">
64
+ <img alt="AgentX total tokens per dollar by concurrent users: trn2 above H200 at 1, 4, 8 and 16 users and above H100 at every measured concurrency, at AWS Capacity Block prices." src="docs/assets/results-agentx-users-dark.png" width="760">
61
65
  </picture>
62
66
  </p>
63
67
 
64
- | Users | Tokens per $: trn2 ÷ H200 | Tokens per $: trn2 ÷ H100 | P90 interactivity, tok/s per user: trn2 / H200 |
65
- |---|---|---|---|
66
- | 1 | **1.64×** | **1.52×** | 62.2 / 272 |
67
- | 4 | **1.75×** | **1.74×** | 41.8 / 235 |
68
- | 8 | **1.61×** | **2.01×** | 25.8 / 168 |
69
- | 12 | **1.34×** | **3.53×** | 17.1 / 138 |
70
- | 16 | **1.07×** | **3.82×** | 14.2 / 87.8 |
71
- | 24 | 0.86× | **5.16×** | 11.4 / 78.7 |
72
- | 32 | 0.81× | **4.95×** | 10.7 / 50.1 |
73
-
74
- **Where we're behind.** Each trn2 user is slower: P90 interactivity (end to end, the wait for the first token
75
- included) is 10.7-62.2 tok/s per user against H200's 50.1-272. At 24 and 32
76
- users H200 delivers more tokens per dollar (0.81-0.86×), and on the 8K/1K fixed-length recipe, which has no prefix reuse,
77
- trn2 delivers 0.56-0.76× H200's. Where a decode step's time goes is in
68
+ | Users | trn2 build | Tokens per $: trn2 ÷ H200 | Tokens per $: trn2 ÷ H100 | P90 interactivity, tok/s per user: trn2 / H200 |
69
+ |---|---|---|---|---|
70
+ | 1 | `latency-golden` | **1.73×** | **1.60×** | 66.3 / 272 |
71
+ | 4 | `latency-golden` | **1.89×** | **1.88×** | 51.3 / 235 |
72
+ | 8 | `latency-golden` | **1.63×** | **2.02×** | 27.6 / 168 |
73
+ | 16 | `balanced` | **1.09×** | **3.89×** | 14.2 / 87.8 |
74
+ | 24 | `throughput` | 0.87× | **5.17×** | 11.5 / 78.7 |
75
+ | 32 | `throughput` | 0.81× | **4.95×** | 10.7 / 50.1 |
76
+
77
+ **Where we're behind.** Each trn2 user is slower: P90 interactivity (1 / the P90 inter-token latency, as InferenceX
78
+ plots it; the wait for the first token is not in it) is 10.7-66.3 tok/s per user against H200's 50.1-272 (at 1-8
79
+ users both at synthetic golden acceptance). At 24 and 32 users H200 delivers more tokens per dollar (0.81-0.87×), and on
80
+ the 8K/1K fixed-length recipe, whose prompts share no prefix (its client's warmup sends the first timed prompt, so one
81
+ timed request per run can find it cached), trn2 delivers 0.89-1.00× H200's at 1-8 users and 0.52-0.82× at 16-64. Where a decode step's time goes is in
78
82
  [docs/RESULTS.md](docs/RESULTS.md#where-a-decode-steps-time-goes).
79
83
 
80
84
  <sub>InferenceX AgentX harness 1.0.12, canonical workload, one hour per point; ratios compare the same concurrency. The
81
- 1-8 user points use MTP at InferenceX's golden acceptance length (2.519; trn2's measured acceptance is 2.20). Prices,
82
- AWS Capacity Blocks list, read 24 Nov 2026: trn2.48xlarge $2.235 per Trainium2 chip-hour ($35.76 per instance-hour),
83
- p5.48xlarge $5.970 per H100-hour, p5e.48xlarge $6.866 per H200-hour. trn2 ran TrnRT's internal builds on Neuron SDK
84
- 2.32 (GSM8K 97.4-97.7% on the MTP builds, strict exact match, 5-shot, all 1,319 problems; a needle test passed on the
85
- host-tier restore); this release's builds are graph-equivalent to them, and a device run of release 0.2.0 itself is
86
- pending. GPU numbers are InferenceX's public runs; we report no accuracy score for them and did not check them. Every
87
- table, source run and the method:
85
+ 1-8 user points use MTP at InferenceX's golden acceptance length (2.519; trn2's measured acceptance is 2.20): the
86
+ `latency-golden` build, whose output text is not the model's. Prices, AWS Capacity Blocks list, read 24 Nov 2026:
87
+ trn2.48xlarge $2.235 per Trainium2 chip-hour ($35.76 per instance-hour), p5.48xlarge $5.970 per H100-hour, p5e.48xlarge
88
+ $6.866 per H200-hour. Every trn2 point is a run of 0.2.0's code with the serve fixes, on 25 Nov 2026 (the 2.20
89
+ acceptance dates from 0.2.0), with
90
+ [benchmarks/](benchmarks/README.md) (the image from `docker/Dockerfile`, Neuron SDK 2.32, and a compile cache built from
91
+ source). GSM8K is 97.4-97.6% on the builds served with real acceptance (strict exact match, 5-shot, all 1,319 problems),
92
+ and each passed a needle test (on its answers; a host-tier restore is not observable on this server). GPU numbers are
93
+ InferenceX's public runs; we report no accuracy score for them and did not check them. Every table, source run and the method:
88
94
  [docs/RESULTS.md](docs/RESULTS.md#against-h100-and-h200-inferencex-agentx-and-8k1k).</sub>
89
95
 
90
96
  ## Highlights
@@ -173,10 +179,15 @@ The full guide covers what each step needs, start-up checks, the three builds an
173
179
  |---|---|
174
180
  | **AWS Trainium2**, `trn2.48xlarge` (16 chips, 2 engines × TP 32, LNC 2) | ✅ Supported |
175
181
  | **[GLM-5.3-Flash](https://huggingface.co/zai-org/GLM-5.3-Flash)** (320B MoE, 18B active, FP8, 1M-token context) | ✅ Supported |
182
+ | **[Qwen3.8-27B](https://huggingface.co/Qwen/Qwen3.8-27B)** (dense, Gated DeltaNet and gated attention, BF16) | 🧪 Experimental: CPU-verified, not yet run on Trainium2 |
183
+ | **[GLM-5.3](https://huggingface.co/zai-org/GLM-5.3)** (MoE, latent attention with a sparse indexer, FP8) | 🧪 Experimental: CPU-verified, not yet run on Trainium2 |
184
+ | **[DeepSeek-V4.1-Flash](https://huggingface.co/deepseek-ai/DeepSeek-V4.1-Flash)** (MoE with MXFP4 experts, compressed sparse attention, Engram) | 🧪 Experimental: CPU-verified, not yet run on Trainium2 |
176
185
  | More open models | 🔜 Coming soon. [Request a model](https://github.com/RunanywhereAI/trnrt/issues/new?template=30-model-request.yml) |
177
186
 
178
- GLM-5.3-Flash is where TrnRT starts. The engine, router, caches and compile pipeline are built to carry more model
179
- families, and [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md#adding-a-model-family) describes what a new one needs.
187
+ GLM-5.3-Flash is where TrnRT starts. An experimental model's code is in the tree and matches an upstream reference on
188
+ CPU on reduced configurations, but it has not run on Trainium2 here and no device number is claimed for it: [docs/MODELS.md](docs/MODELS.md)
189
+ says what each one has and what it still needs. [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md#adding-a-model-family)
190
+ describes what a new model family needs.
180
191
 
181
192
  ## Benchmarks
182
193
 
@@ -194,14 +205,18 @@ at $35.76/h, the batch 12 cost is $0.167 per million tokens. Full tables, cold-p
194
205
  methodology are in [docs/RESULTS.md](docs/RESULTS.md).
195
206
 
196
207
  These numbers were measured with an earlier build of TrnRT, at release 0.1.0's batch presets, which this release's
197
- builds replace. This repository passes these checks against that build
208
+ builds replace. At release 0.1.0, this repository passed these checks against that build
198
209
  ([docs/KNOWN_ISSUES.md](docs/KNOWN_ISSUES.md#verification-status)):
199
210
 
200
- - Graph equivalence: EQUAL on all 32 ranks, for all 157 graphs that build compiles in the default batch-12
211
+ - Graph equivalence: EQUAL on all 32 ranks, for all 157 graphs that build compiles in its default batch-12
201
212
  configuration.
202
213
  - Outputs: byte-identical to that build's on 384 of 384 requests.
203
- - Serving: the two-engine serve in the [Quickstart](#quickstart) passed end to end on the device at release 0.1.0. On
204
- this release it has run end to end on CPU only so far; the device run is pending.
214
+ - Serving: the two-engine serve in the [Quickstart](#quickstart) passed end to end on the device.
215
+
216
+ On 0.2.0's code with the serve fixes (24-25 Nov 2026), the builds read EQUAL against their reference builds, with
217
+ bitwise-equal outputs on the device, and the comparison with H100 and H200 above is a run of that code. 0.3.0 then
218
+ added the experimental model families, with a dispatch in two traced files: none of these checks, nor the two-engine
219
+ serve, has run on the device for 0.3.0 yet ([KNOWN_ISSUES.md](docs/KNOWN_ISSUES.md#verification-status)).
205
220
 
206
221
  ## How it works
207
222
 
@@ -224,11 +239,12 @@ trnrt/
224
239
  ├── __main__.py CLI: serve, engine, compile
225
240
  ├── serve/ OpenAI API, session-affine router, output parsers
226
241
  ├── engine/ scheduler, prefix caches, tensor parallelism
227
- ├── models/ GLM-5.3-Flash: KDA, DSA, mHC, MoE, FP8 loading
242
+ ├── models/ GLM-5.3-Flash: KDA, DSA, mHC, MoE, FP8 loading; the experimental families
228
243
  ├── kernels/ NKI decode megakernels and prefill kernels
229
244
  └── compile/ offline compile: shapes, capture, neuronx-cc, strip
230
245
  docker/ the serving and compile image
231
246
  tools/ graph-equivalence gate, device checks, doc checks
247
+ benchmarks/ the recipe for every published point: builds, clients, scorers, accuracy
232
248
  tests/ CPU test suite (no NeuronCore needed)
233
249
  docs/ guides, results, kernel notes
234
250
  ```
@@ -65,7 +65,10 @@ xfail_strict = true
65
65
  [tool.ruff]
66
66
  target-version = "py313"
67
67
  line-length = 120
68
- extend-exclude = ["build", "dist"]
68
+ # tests/reference holds DeepSeek's released encoder and inference code, and benchmarks/accuracy/lm_eval_patch
69
+ # InferenceX's lm-eval hooks, each kept byte for byte (THIRD_PARTY_NOTICES.md): never reformatted or linted.
70
+ extend-exclude = ["build", "dist", "tests/reference/deepseek_v41_encoding.py", "tests/reference/deepseek_v41/model.py",
71
+ "tests/reference/deepseek_v41/engram.py", "benchmarks/accuracy/lm_eval_patch"]
69
72
 
70
73
  [tool.ruff.format]
71
74
  # Traced code is never reformatted: a moved line can change a kernel's compiled binary, and with it every compile-cache
@@ -131,6 +134,7 @@ ignore = [
131
134
  "tests/**" = ["S101", "S106", "S311", "ARG", "T20"]
132
135
  # Command-line programs print their output.
133
136
  "tools/**" = ["T20"]
137
+ "benchmarks/**" = ["T20"]
134
138
  "docker/**" = ["T20"]
135
139
  "trnrt/__main__.py" = ["T20"]
136
140
  "trnrt/compile/farm.py" = ["T20"]
@@ -0,0 +1,143 @@
1
+ """The benchmark mode (synthetic acceptance) announces itself (trnrt/serve/benchmark_mode.py): the engine's and the router's
2
+ responses carry the x-trnrt-synthetic-acceptance header, /health carries a `benchmark_mode` block, and both warn in the
3
+ log. Without the mode nothing changes: no header, the same /health body."""
4
+
5
+ from __future__ import annotations
6
+
7
+ import logging
8
+
9
+ import pytest
10
+
11
+ pytest.importorskip("fastapi")
12
+ pytest.importorskip("httpx") # fastapi.testclient
13
+
14
+ from trnrt.serve import benchmark_mode
15
+ from trnrt.serve.router import Router
16
+
17
+ AL = 2.518506
18
+ H = benchmark_mode.HEADER
19
+
20
+
21
+ def _engine_client(synth_al):
22
+ from fastapi.testclient import TestClient
23
+
24
+ from tests.test_serve_api import PLAIN, ScriptedEngine
25
+ from trnrt.serve import api
26
+
27
+ eng = ScriptedEngine(PLAIN)
28
+ if synth_al is not None:
29
+ eng.cfg.spec_synth_al = synth_al
30
+ return TestClient(api.build_app(eng, "glm")), eng
31
+
32
+
33
+ def _stop(eng):
34
+ from trnrt.serve import api
35
+
36
+ for lp in [lp for lp in api._LOOPS if lp.engine is eng]:
37
+ lp.stop()
38
+
39
+
40
+ def test_the_engine_announces_the_mode_on_every_response_and_in_health(caplog):
41
+ caplog.set_level(logging.WARNING)
42
+ client, eng = _engine_client(AL)
43
+ try:
44
+ with client:
45
+ assert "BENCHMARK MODE" in caplog.text and "2.51851" in caplog.text
46
+ h = client.get("/health")
47
+ assert h.status_code == 200 and h.headers[H] == "2.51851"
48
+ block = h.json()["benchmark_mode"]
49
+ assert block["synthetic_acceptance_length"] == AL and block["drafts_verified"] is False
50
+ assert client.get("/v1/models").headers[H] == "2.51851"
51
+ r = client.post("/v1/completions", json={"prompt": "Hello", "max_tokens": 3})
52
+ assert r.status_code == 200 and r.headers[H] == "2.51851"
53
+ with client.stream(
54
+ "POST", "/v1/completions", json={"prompt": "Hello", "max_tokens": 3, "stream": True}
55
+ ) as s:
56
+ assert s.status_code == 200 and s.headers[H] == "2.51851"
57
+ lines = [ln for ln in s.iter_lines() if ln.startswith("data: ")]
58
+ assert lines[-1] == "data: [DONE]" # the stream itself is untouched
59
+ finally:
60
+ _stop(eng)
61
+
62
+
63
+ def test_a_failed_engine_still_announces_the_mode_in_its_503():
64
+ from trnrt.serve import api
65
+
66
+ client, eng = _engine_client(AL)
67
+ try:
68
+ with client:
69
+ loop = next(lp for lp in api._LOOPS if lp.engine is eng)
70
+ loop.health_error = lambda: "rank 3 died" # as EngineLoop._fail leaves it
71
+ h = client.get("/health")
72
+ assert h.status_code == 503 and h.json()["status"] == "failed" and h.json()["error"] == "rank 3 died"
73
+ assert h.json()["benchmark_mode"]["synthetic_acceptance_length"] == AL and h.headers[H] == "2.51851"
74
+ finally:
75
+ _stop(eng)
76
+
77
+
78
+ def test_without_the_mode_the_engine_adds_nothing():
79
+ client, eng = _engine_client(None)
80
+ try:
81
+ with client:
82
+ h = client.get("/health")
83
+ assert h.json() == {"status": "ok"} and H not in h.headers
84
+ r = client.post("/v1/completions", json={"prompt": "Hello", "max_tokens": 3})
85
+ assert r.status_code == 200 and H not in r.headers
86
+ finally:
87
+ _stop(eng)
88
+
89
+
90
+ def _stats(al):
91
+ return {"gauges": {"kv_pages_used": 10, "kv_pages_total": 100, "spec": {"synth_al": al}}}
92
+
93
+
94
+ def test_the_router_takes_the_mode_from_its_workers_stats(caplog):
95
+ from fastapi.testclient import TestClient
96
+
97
+ from trnrt.serve.router import build_router_app
98
+
99
+ caplog.set_level(logging.WARNING)
100
+ router = Router(["http://127.0.0.1:9", "http://127.0.0.1:10"])
101
+ with TestClient(build_router_app(router, poll_s=0)) as c:
102
+ h = c.get("/health")
103
+ assert H not in h.headers and "benchmark_mode" not in h.json() # before any poll saw the mode
104
+
105
+ router.note_stats(0, _stats(None))
106
+ router.note_stats(1, {"gauges": {"kv_pages_used": 1, "kv_pages_total": 4}}) # no spec block at all
107
+ assert router.benchmark_lengths() == [] and router.kv_used == [0.1, 0.25]
108
+ assert H not in c.get("/health").headers
109
+
110
+ router.note_stats(1, _stats(AL))
111
+ router.note_stats(1, _stats(AL)) # warned once per change, not per poll
112
+ assert caplog.text.count("BENCHMARK MODE") == 1
113
+ assert "trnrt.router: worker http://127.0.0.1:10: " in caplog.text # the router's own log prefix
114
+ h = c.get("/health")
115
+ assert h.headers[H] == "2.51851" and h.json()["benchmark_mode"]["synthetic_acceptance_length"] == AL
116
+ assert c.get("/v1/models").headers[H] == "2.51851" # a 503 (no worker answers) says it too
117
+
118
+ router.note_stats(0, _stats(3.0)) # two lengths at once: both named
119
+ assert c.get("/health").headers[H] == "2.51851,3"
120
+
121
+ router.note_stats(0, _stats(None))
122
+ router.note_stats(1, _stats(None)) # restarted without the mode
123
+ assert H not in c.get("/health").headers
124
+
125
+
126
+ def test_the_header_middleware_replaces_a_header_of_the_same_name():
127
+ from fastapi import FastAPI, Response
128
+ from fastapi.testclient import TestClient
129
+
130
+ app = FastAPI()
131
+
132
+ @app.get("/x")
133
+ async def x():
134
+ return Response("ok", headers={H: "stale"})
135
+
136
+ app.add_middleware(benchmark_mode.HeaderMiddleware, value=lambda: "2.5")
137
+ r = TestClient(app).get("/x")
138
+ assert r.headers.get_list(H) == ["2.5"]
139
+
140
+
141
+ def test_the_banner_says_what_the_text_is_not():
142
+ b = benchmark_mode.banner(AL)
143
+ assert "unverified" in b and "not the model's" in b and "never to judge output quality" in b