turing-engine 2.0.0__tar.gz → 2.1.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 (369) hide show
  1. {turing_engine-2.0.0 → turing_engine-2.1.0}/MANIFEST.in +1 -0
  2. {turing_engine-2.0.0 → turing_engine-2.1.0}/NOTICE +8 -0
  3. turing_engine-2.1.0/PKG-INFO +355 -0
  4. turing_engine-2.1.0/README.md +310 -0
  5. {turing_engine-2.0.0 → turing_engine-2.1.0}/csrc/marlin/kernel_configs.h +10 -5
  6. {turing_engine-2.0.0 → turing_engine-2.1.0}/csrc/marlin/marlin.cu +21 -16
  7. turing_engine-2.1.0/csrc/marlin_moe/kernel.h +50 -0
  8. turing_engine-2.1.0/csrc/marlin_moe/kernel_bf16_g128.cu +10 -0
  9. turing_engine-2.1.0/csrc/marlin_moe/kernel_bf16_g64.cu +10 -0
  10. turing_engine-2.1.0/csrc/marlin_moe/kernel_fp16_g128.cu +10 -0
  11. turing_engine-2.1.0/csrc/marlin_moe/kernel_fp16_g64.cu +10 -0
  12. turing_engine-2.1.0/csrc/marlin_moe/marlin_template.h +1995 -0
  13. turing_engine-2.1.0/csrc/marlin_moe/ops.cu +578 -0
  14. turing_engine-2.1.0/csrc/pybind_bindings.cpp +751 -0
  15. turing_engine-2.1.0/csrc/turing_w4_expert_cpu.hpp +324 -0
  16. {turing_engine-2.0.0 → turing_engine-2.1.0}/pyproject.toml +2 -2
  17. {turing_engine-2.0.0 → turing_engine-2.1.0}/setup.py +17 -11
  18. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_attention_and_rope.py +0 -23
  19. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_colibri_enhancements.py +1 -1
  20. turing_engine-2.1.0/tests/test_csrc_and_simd.py +76 -0
  21. turing_engine-2.1.0/tests/test_doc_tables.py +21 -0
  22. turing_engine-2.1.0/tests/test_eagle3.py +517 -0
  23. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_ecosystem_integrations.py +9 -1
  24. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_elastic_memory.py +2 -2
  25. turing_engine-2.1.0/tests/test_engine_generation.py +753 -0
  26. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_entropy_kernel.py +1 -1
  27. turing_engine-2.1.0/tests/test_flashinfer_prefill.py +123 -0
  28. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_fused_fast_kernels.py +7 -8
  29. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_fused_kernels_parity.py +1 -1
  30. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_fused_ops.py +36 -1
  31. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_generation_api.py +26 -0
  32. turing_engine-2.1.0/tests/test_go_template.py +39 -0
  33. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_hf_parity.py +18 -0
  34. turing_engine-2.1.0/tests/test_hpc_integrations.py +46 -0
  35. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_kernel_fusions_and_simd_v8.py +2 -54
  36. turing_engine-2.1.0/tests/test_kernel_fusions_native.py +58 -0
  37. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_kv_cache.py +104 -8
  38. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_kv_transfer.py +14 -1
  39. turing_engine-2.1.0/tests/test_lazy_imports.py +26 -0
  40. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_marlin.py +28 -5
  41. turing_engine-2.1.0/tests/test_marlin_moe.py +248 -0
  42. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_measured_differentiators.py +1 -1
  43. turing_engine-2.1.0/tests/test_moe_expert_offload.py +271 -0
  44. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_moe_offload.py +1 -1
  45. turing_engine-2.1.0/tests/test_moe_w4.py +183 -0
  46. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_native_kernel_fusions.py +4 -83
  47. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_prefill_decode_scheduling.py +70 -0
  48. turing_engine-2.1.0/tests/test_probe.py +63 -0
  49. turing_engine-2.1.0/tests/test_segment_pool_and_batching.py +49 -0
  50. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_serving_and_api.py +91 -0
  51. turing_engine-2.1.0/tests/test_simd_reasoning_scanner.py +23 -0
  52. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_static_pool_and_streaming.py +1 -1
  53. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_storage_ingest_ladder.py +0 -8
  54. turing_engine-2.1.0/tests/test_subspace_and_router.py +17 -0
  55. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_triton_kv_decode.py +141 -4
  56. turing_engine-2.1.0/tests/test_triton_kv_prefill.py +624 -0
  57. turing_engine-2.1.0/tests/test_triton_moe.py +171 -0
  58. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/__init__.py +2 -4
  59. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/cli.py +120 -46
  60. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/config.py +5 -5
  61. turing_engine-2.1.0/turing/core/__init__.py +30 -0
  62. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/core/heterogeneous_moe.py +3 -0
  63. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/core/kv_cache.py +135 -30
  64. turing_engine-2.1.0/turing/core/probe.py +175 -0
  65. {turing_engine-2.0.0/turing/core → turing_engine-2.1.0/turing/experimental}/__init__.py +7 -14
  66. {turing_engine-2.0.0/turing/core → turing_engine-2.1.0/turing/experimental}/cross_model_kv.py +4 -4
  67. turing_engine-2.1.0/turing/experimental/demo/__init__.py +17 -0
  68. {turing_engine-2.0.0/turing → turing_engine-2.1.0/turing/experimental}/demo/agent_system.py +2 -2
  69. {turing_engine-2.0.0/turing → turing_engine-2.1.0/turing/experimental}/demo/engine_wrapper.py +2 -2
  70. {turing_engine-2.0.0/turing → turing_engine-2.1.0/turing/experimental}/demo/epistemic_gate.py +1 -1
  71. {turing_engine-2.0.0/turing → turing_engine-2.1.0/turing/experimental}/demo/interactive_demo.py +1 -1
  72. {turing_engine-2.0.0/turing/core → turing_engine-2.1.0/turing/experimental}/elastic_memory.py +2 -2
  73. {turing_engine-2.0.0/turing/core → turing_engine-2.1.0/turing/experimental}/expert_prefetch.py +2 -2
  74. {turing_engine-2.0.0/turing/core → turing_engine-2.1.0/turing/experimental}/hierarchical_compression.py +1 -1
  75. {turing_engine-2.0.0/turing/core → turing_engine-2.1.0/turing/experimental}/hybrid_attention.py +4 -4
  76. {turing_engine-2.0.0/turing/core → turing_engine-2.1.0/turing/experimental}/hybrid_memory.py +1 -1
  77. turing_engine-2.1.0/turing/experimental/kernels/__init__.py +1 -0
  78. {turing_engine-2.0.0/turing → turing_engine-2.1.0/turing/experimental}/kernels/triton_chunk_compression.py +1 -1
  79. {turing_engine-2.0.0/turing/core → turing_engine-2.1.0/turing/experimental}/kslot_pooling.py +2 -2
  80. {turing_engine-2.0.0/turing/core → turing_engine-2.1.0/turing/experimental}/lineage.py +1 -1
  81. turing_engine-2.1.0/turing/kernels/flashinfer_prefill.py +147 -0
  82. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/kernels/marlin.py +18 -6
  83. turing_engine-2.1.0/turing/kernels/marlin_moe.py +120 -0
  84. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/kernels/triton_fused_ops.py +68 -32
  85. turing_engine-2.1.0/turing/kernels/triton_kv_decode.py +398 -0
  86. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/kernels/triton_kv_prefill.py +5 -2
  87. turing_engine-2.1.0/turing/kernels/triton_moe.py +636 -0
  88. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/kernels/triton_w4a16.py +18 -14
  89. turing_engine-2.1.0/turing/models/causal_lm.py +2109 -0
  90. turing_engine-2.1.0/turing/models/eagle3.py +386 -0
  91. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/models/hf_loader.py +19 -2
  92. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/models/quant.py +154 -46
  93. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/models/tensor_parallel.py +3 -0
  94. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/serving/embeddings.py +9 -0
  95. turing_engine-2.1.0/turing/serving/engine.py +1613 -0
  96. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/serving/extract.py +3 -10
  97. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/serving/kv_transfer.py +3 -0
  98. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/serving/ollama_api.py +28 -13
  99. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/serving/pull.py +6 -2
  100. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/serving/reasoning.py +12 -5
  101. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/serving/server.py +31 -20
  102. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/serving/traffic.py +3 -3
  103. turing_engine-2.1.0/turing_engine.egg-info/PKG-INFO +355 -0
  104. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing_engine.egg-info/SOURCES.txt +51 -127
  105. turing_engine-2.0.0/PKG-INFO +0 -288
  106. turing_engine-2.0.0/README.md +0 -243
  107. turing_engine-2.0.0/csrc/pybind_bindings.cpp +0 -1716
  108. turing_engine-2.0.0/csrc/turing_adam_kernel.hpp +0 -49
  109. turing_engine-2.0.0/csrc/turing_apc_hash.hpp +0 -51
  110. turing_engine-2.0.0/csrc/turing_asynch_scheduler.hpp +0 -138
  111. turing_engine-2.0.0/csrc/turing_birkhoff.hpp +0 -69
  112. turing_engine-2.0.0/csrc/turing_chunked_decay.hpp +0 -102
  113. turing_engine-2.0.0/csrc/turing_conv2d_shared.hpp +0 -62
  114. turing_engine-2.0.0/csrc/turing_convolution_shared.hpp +0 -64
  115. turing_engine-2.0.0/csrc/turing_cpu_moe_kernel.hpp +0 -57
  116. turing_engine-2.0.0/csrc/turing_dag_tree_mask.hpp +0 -39
  117. turing_engine-2.0.0/csrc/turing_kda_simd.hpp +0 -125
  118. turing_engine-2.0.0/csrc/turing_laplacian_2d.hpp +0 -44
  119. turing_engine-2.0.0/csrc/turing_latent_decode.hpp +0 -113
  120. turing_engine-2.0.0/csrc/turing_lru_cache.hpp +0 -358
  121. turing_engine-2.0.0/csrc/turing_matrix_pow.hpp +0 -80
  122. turing_engine-2.0.0/csrc/turing_matryoshka_quadtree.hpp +0 -138
  123. turing_engine-2.0.0/csrc/turing_mhc_simd.hpp +0 -128
  124. turing_engine-2.0.0/csrc/turing_mmap.hpp +0 -197
  125. turing_engine-2.0.0/csrc/turing_nbody_attention.hpp +0 -83
  126. turing_engine-2.0.0/csrc/turing_paged_attention.hpp +0 -118
  127. turing_engine-2.0.0/csrc/turing_persistent_reducer.hpp +0 -74
  128. turing_engine-2.0.0/csrc/turing_pso.hpp +0 -53
  129. turing_engine-2.0.0/csrc/turing_pso_objectives.hpp +0 -84
  130. turing_engine-2.0.0/csrc/turing_pso_tuner.hpp +0 -89
  131. turing_engine-2.0.0/csrc/turing_radix_trie.hpp +0 -142
  132. turing_engine-2.0.0/csrc/turing_reasoning_scanner.hpp +0 -100
  133. turing_engine-2.0.0/csrc/turing_residual_outlier.hpp +0 -78
  134. turing_engine-2.0.0/csrc/turing_segment_pool.hpp +0 -90
  135. turing_engine-2.0.0/csrc/turing_serializer.hpp +0 -90
  136. turing_engine-2.0.0/csrc/turing_sinkhorn_ot.hpp +0 -131
  137. turing_engine-2.0.0/csrc/turing_threadpool.hpp +0 -123
  138. turing_engine-2.0.0/csrc/turing_unified_memory.hpp +0 -61
  139. turing_engine-2.0.0/csrc/turing_varlen_pack.hpp +0 -52
  140. turing_engine-2.0.0/csrc/turing_welford_anneal.hpp +0 -56
  141. turing_engine-2.0.0/tests/test_advanced_hpc.py +0 -110
  142. turing_engine-2.0.0/tests/test_cca_and_enhanced_speculation.py +0 -74
  143. turing_engine-2.0.0/tests/test_cross_model_kv_transfer.py +0 -141
  144. turing_engine-2.0.0/tests/test_csrc_and_simd.py +0 -232
  145. turing_engine-2.0.0/tests/test_demo.py +0 -138
  146. turing_engine-2.0.0/tests/test_doc_tables.py +0 -10
  147. turing_engine-2.0.0/tests/test_engine_generation.py +0 -198
  148. turing_engine-2.0.0/tests/test_flashinfer_prefill.py +0 -71
  149. turing_engine-2.0.0/tests/test_fused_batched_sampler.py +0 -59
  150. turing_engine-2.0.0/tests/test_fused_kernels_and_simd.py +0 -126
  151. turing_engine-2.0.0/tests/test_fused_moe_block_gemm.py +0 -80
  152. turing_engine-2.0.0/tests/test_hierarchical_compression_csa_hca.py +0 -81
  153. turing_engine-2.0.0/tests/test_hierarchical_paging.py +0 -51
  154. turing_engine-2.0.0/tests/test_hpc_integrations.py +0 -182
  155. turing_engine-2.0.0/tests/test_hybrid_attention.py +0 -78
  156. turing_engine-2.0.0/tests/test_hybrid_linear_decay.py +0 -160
  157. turing_engine-2.0.0/tests/test_hybrid_mesh.py +0 -28
  158. turing_engine-2.0.0/tests/test_kernel_fusions_native.py +0 -112
  159. turing_engine-2.0.0/tests/test_latent_decode.py +0 -71
  160. turing_engine-2.0.0/tests/test_lazy_imports.py +0 -24
  161. turing_engine-2.0.0/tests/test_lineage_and_pooling.py +0 -150
  162. turing_engine-2.0.0/tests/test_linear_recurrence_kernel.py +0 -67
  163. turing_engine-2.0.0/tests/test_matryoshka_draft.py +0 -87
  164. turing_engine-2.0.0/tests/test_mhc_doubly_stochastic.py +0 -92
  165. turing_engine-2.0.0/tests/test_native_lfru_cache.py +0 -73
  166. turing_engine-2.0.0/tests/test_paged_decode_gemv.py +0 -59
  167. turing_engine-2.0.0/tests/test_radix_trie_cpp.py +0 -38
  168. turing_engine-2.0.0/tests/test_segment_pool_and_batching.py +0 -132
  169. turing_engine-2.0.0/tests/test_simd_reasoning_scanner.py +0 -53
  170. turing_engine-2.0.0/tests/test_sinkhorn_eviction_scores.py +0 -64
  171. turing_engine-2.0.0/tests/test_speculation_and_tree.py +0 -106
  172. turing_engine-2.0.0/tests/test_speculative_eagle_dspark.py +0 -75
  173. turing_engine-2.0.0/tests/test_split_k_and_prefix_bypass.py +0 -171
  174. turing_engine-2.0.0/tests/test_subspace_and_router.py +0 -50
  175. turing_engine-2.0.0/tests/test_triton_kv_prefill.py +0 -91
  176. turing_engine-2.0.0/tests/test_xkv_latent_transfer.py +0 -94
  177. turing_engine-2.0.0/turing/core/asynch_scheduler.py +0 -35
  178. turing_engine-2.0.0/turing/core/attention_cache.py +0 -135
  179. turing_engine-2.0.0/turing/core/cca.py +0 -139
  180. turing_engine-2.0.0/turing/core/cca_fast.py +0 -83
  181. turing_engine-2.0.0/turing/core/hybrid_mesh.py +0 -76
  182. turing_engine-2.0.0/turing/core/matrix_pow.py +0 -76
  183. turing_engine-2.0.0/turing/core/mhc.py +0 -169
  184. turing_engine-2.0.0/turing/core/optimal_transport.py +0 -101
  185. turing_engine-2.0.0/turing/core/persistent_gemv.py +0 -38
  186. turing_engine-2.0.0/turing/core/router.py +0 -207
  187. turing_engine-2.0.0/turing/core/router_annealer.py +0 -66
  188. turing_engine-2.0.0/turing/core/speculation.py +0 -570
  189. turing_engine-2.0.0/turing/core/swarm_objectives.py +0 -42
  190. turing_engine-2.0.0/turing/core/swarm_opt.py +0 -137
  191. turing_engine-2.0.0/turing/core/unified_memory.py +0 -60
  192. turing_engine-2.0.0/turing/demo/__init__.py +0 -17
  193. turing_engine-2.0.0/turing/kernels/birkhoff_cuda.py +0 -82
  194. turing_engine-2.0.0/turing/kernels/cooperative_conv2d_cuda.py +0 -27
  195. turing_engine-2.0.0/turing/kernels/cooperative_conv_cuda.py +0 -99
  196. turing_engine-2.0.0/turing/kernels/flashinfer_prefill.py +0 -66
  197. turing_engine-2.0.0/turing/kernels/fused_adam_cuda.py +0 -78
  198. turing_engine-2.0.0/turing/kernels/fused_rope_cuda.py +0 -45
  199. turing_engine-2.0.0/turing/kernels/gds_loader.py +0 -52
  200. turing_engine-2.0.0/turing/kernels/laplacian_2d_cuda.py +0 -39
  201. turing_engine-2.0.0/turing/kernels/rocm_heuristics.py +0 -66
  202. turing_engine-2.0.0/turing/kernels/sinkhorn_ot_cuda.py +0 -60
  203. turing_engine-2.0.0/turing/kernels/softened_attention.py +0 -54
  204. turing_engine-2.0.0/turing/kernels/triton_cca.py +0 -35
  205. turing_engine-2.0.0/turing/kernels/triton_chunked_decay.py +0 -207
  206. turing_engine-2.0.0/turing/kernels/triton_fused_kslot_gate.py +0 -80
  207. turing_engine-2.0.0/turing/kernels/triton_fused_router.py +0 -93
  208. turing_engine-2.0.0/turing/kernels/triton_kv_decode.py +0 -246
  209. turing_engine-2.0.0/turing/kernels/triton_latent_decode.py +0 -198
  210. turing_engine-2.0.0/turing/kernels/triton_matryoshka_gemv.py +0 -102
  211. turing_engine-2.0.0/turing/kernels/triton_mhc_fuse.py +0 -134
  212. turing_engine-2.0.0/turing/kernels/triton_paged_decode_gemv.py +0 -415
  213. turing_engine-2.0.0/turing/kernels/triton_residual_outlier.py +0 -87
  214. turing_engine-2.0.0/turing/kernels/triton_segment_pool.py +0 -202
  215. turing_engine-2.0.0/turing/kernels/triton_spec_entropy.py +0 -161
  216. turing_engine-2.0.0/turing/kernels/triton_spec_verify.py +0 -128
  217. turing_engine-2.0.0/turing/kernels/triton_subspace_compress.py +0 -106
  218. turing_engine-2.0.0/turing/kernels/vulkan_runtime.py +0 -77
  219. turing_engine-2.0.0/turing/models/causal_lm.py +0 -1050
  220. turing_engine-2.0.0/turing/serving/engine.py +0 -726
  221. turing_engine-2.0.0/turing_engine.egg-info/PKG-INFO +0 -288
  222. {turing_engine-2.0.0 → turing_engine-2.1.0}/LICENSE +0 -0
  223. {turing_engine-2.0.0 → turing_engine-2.1.0}/csrc/marlin/LICENSE +0 -0
  224. {turing_engine-2.0.0 → turing_engine-2.1.0}/csrc/marlin/awq_marlin_repack.cu +0 -0
  225. {turing_engine-2.0.0 → turing_engine-2.1.0}/csrc/marlin/core/scalar_type.hpp +0 -0
  226. {turing_engine-2.0.0 → turing_engine-2.1.0}/csrc/marlin/dequant.h +0 -0
  227. {turing_engine-2.0.0 → turing_engine-2.1.0}/csrc/marlin/kernel.h +0 -0
  228. {turing_engine-2.0.0 → turing_engine-2.1.0}/csrc/marlin/kernel_bf16_g128.cu +0 -0
  229. {turing_engine-2.0.0 → turing_engine-2.1.0}/csrc/marlin/kernel_bf16_g64.cu +0 -0
  230. {turing_engine-2.0.0 → turing_engine-2.1.0}/csrc/marlin/kernel_fp16_g128.cu +0 -0
  231. {turing_engine-2.0.0 → turing_engine-2.1.0}/csrc/marlin/kernel_fp16_g64.cu +0 -0
  232. {turing_engine-2.0.0 → turing_engine-2.1.0}/csrc/marlin/marlin.cuh +0 -0
  233. {turing_engine-2.0.0 → turing_engine-2.1.0}/csrc/marlin/marlin_dtypes.cuh +0 -0
  234. {turing_engine-2.0.0 → turing_engine-2.1.0}/csrc/marlin/marlin_mma.h +0 -0
  235. {turing_engine-2.0.0 → turing_engine-2.1.0}/csrc/marlin/marlin_template.h +0 -0
  236. {turing_engine-2.0.0 → turing_engine-2.1.0}/csrc/turing_cufile.hpp +0 -0
  237. {turing_engine-2.0.0 → turing_engine-2.1.0}/csrc/turing_dilated_conv1d.hpp +0 -0
  238. {turing_engine-2.0.0 → turing_engine-2.1.0}/csrc/turing_elastic_budget.hpp +0 -0
  239. {turing_engine-2.0.0 → turing_engine-2.1.0}/csrc/turing_fast_hash.hpp +0 -0
  240. {turing_engine-2.0.0 → turing_engine-2.1.0}/csrc/turing_fast_hash_tensor.hpp +0 -0
  241. {turing_engine-2.0.0 → turing_engine-2.1.0}/csrc/turing_gated_zero_identity.hpp +0 -0
  242. {turing_engine-2.0.0 → turing_engine-2.1.0}/csrc/turing_gguf_cpp.hpp +0 -0
  243. {turing_engine-2.0.0 → turing_engine-2.1.0}/csrc/turing_gguf_simd.hpp +0 -0
  244. {turing_engine-2.0.0 → turing_engine-2.1.0}/csrc/turing_halo_exchange.hpp +0 -0
  245. {turing_engine-2.0.0 → turing_engine-2.1.0}/csrc/turing_hierarchical.hpp +0 -0
  246. {turing_engine-2.0.0 → turing_engine-2.1.0}/csrc/turing_http_server.hpp +0 -0
  247. {turing_engine-2.0.0 → turing_engine-2.1.0}/csrc/turing_json_fast_scan.hpp +0 -0
  248. {turing_engine-2.0.0 → turing_engine-2.1.0}/csrc/turing_linear_recurrence.hpp +0 -0
  249. {turing_engine-2.0.0 → turing_engine-2.1.0}/csrc/turing_lora_gemv.hpp +0 -0
  250. {turing_engine-2.0.0 → turing_engine-2.1.0}/csrc/turing_main.cpp +0 -0
  251. {turing_engine-2.0.0 → turing_engine-2.1.0}/csrc/turing_model_cpp.hpp +0 -0
  252. {turing_engine-2.0.0 → turing_engine-2.1.0}/csrc/turing_nbody_recirculator.hpp +0 -0
  253. {turing_engine-2.0.0 → turing_engine-2.1.0}/csrc/turing_paged_memory.hpp +0 -0
  254. {turing_engine-2.0.0 → turing_engine-2.1.0}/csrc/turing_parallel_reader.hpp +0 -0
  255. {turing_engine-2.0.0 → turing_engine-2.1.0}/csrc/turing_prefix_match.hpp +0 -0
  256. {turing_engine-2.0.0 → turing_engine-2.1.0}/csrc/turing_prefix_router.hpp +0 -0
  257. {turing_engine-2.0.0 → turing_engine-2.1.0}/csrc/turing_ridge_solver.hpp +0 -0
  258. {turing_engine-2.0.0 → turing_engine-2.1.0}/csrc/turing_rope.hpp +0 -0
  259. {turing_engine-2.0.0 → turing_engine-2.1.0}/csrc/turing_routing_history.hpp +0 -0
  260. {turing_engine-2.0.0 → turing_engine-2.1.0}/csrc/turing_safetensors_fast_header.hpp +0 -0
  261. {turing_engine-2.0.0 → turing_engine-2.1.0}/csrc/turing_sampler.hpp +0 -0
  262. {turing_engine-2.0.0 → turing_engine-2.1.0}/csrc/turing_shannon_entropy.hpp +0 -0
  263. {turing_engine-2.0.0 → turing_engine-2.1.0}/csrc/turing_simd.hpp +0 -0
  264. {turing_engine-2.0.0 → turing_engine-2.1.0}/csrc/turing_spec_verifier.hpp +0 -0
  265. {turing_engine-2.0.0 → turing_engine-2.1.0}/csrc/turing_tokenizer_cpp.hpp +0 -0
  266. {turing_engine-2.0.0 → turing_engine-2.1.0}/csrc/turing_traffic_manager.hpp +0 -0
  267. {turing_engine-2.0.0 → turing_engine-2.1.0}/setup.cfg +0 -0
  268. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_accuracy_eval.py +0 -0
  269. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_activation_sparsity.py +0 -0
  270. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_chat_and_aliases.py +0 -0
  271. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_completions_render.py +0 -0
  272. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_cpp_engine_parity.py +0 -0
  273. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_cpp_http_server.py +0 -0
  274. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_cpp_standalone.py +0 -0
  275. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_distributed_inference.py +0 -0
  276. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_dsl_executor_load.py +0 -0
  277. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_dsl_primitives.py +0 -0
  278. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_expert_cache_eviction.py +0 -0
  279. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_fast_hash.py +0 -0
  280. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_gguf_loader.py +0 -0
  281. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_gguf_parity.py +0 -0
  282. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_gguf_simd_parity.py +0 -0
  283. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_heterogeneous_moe_and_anthropic.py +0 -0
  284. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_kv_events.py +0 -0
  285. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_langchain_integration.py +0 -0
  286. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_llamaindex_integration.py +0 -0
  287. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_llmd_metrics.py +0 -0
  288. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_lora_adapters.py +0 -0
  289. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_model_resolver.py +0 -0
  290. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_models_and_tp.py +0 -0
  291. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_niah.py +0 -0
  292. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_no_private_identifiers.py +0 -0
  293. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_ollama_api.py +0 -0
  294. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_parallel_reader_and_gds.py +0 -0
  295. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_resolver_local_names.py +0 -0
  296. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_serverless_integrations.py +0 -0
  297. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_serving_headers.py +0 -0
  298. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_side_endpoints.py +0 -0
  299. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_simd_json_scanner.py +0 -0
  300. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_simd_kernels_parity.py +0 -0
  301. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_spec_gate_and_parity.py +0 -0
  302. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_structured_output.py +0 -0
  303. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_tool_calling.py +0 -0
  304. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_traffic_management.py +0 -0
  305. {turing_engine-2.0.0 → turing_engine-2.1.0}/tests/test_w4a16.py +0 -0
  306. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/core/expert_cache.py +0 -0
  307. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/core/rope.py +0 -0
  308. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/core/subspace.py +0 -0
  309. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/dsl/__init__.py +0 -0
  310. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/dsl/context.py +0 -0
  311. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/dsl/executor.py +0 -0
  312. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/dsl/primitives.py +0 -0
  313. {turing_engine-2.0.0/turing → turing_engine-2.1.0/turing/experimental}/demo/world_model.py +0 -0
  314. {turing_engine-2.0.0/turing → turing_engine-2.1.0/turing/experimental}/kernels/triton_chunk_filter.py +0 -0
  315. {turing_engine-2.0.0/turing → turing_engine-2.1.0/turing/experimental}/kernels/triton_dilated_conv.py +0 -0
  316. {turing_engine-2.0.0/turing → turing_engine-2.1.0/turing/experimental}/kernels/triton_fused_lora.py +0 -0
  317. {turing_engine-2.0.0/turing → turing_engine-2.1.0/turing/experimental}/kernels/triton_fused_moe_block_gemm.py +0 -0
  318. {turing_engine-2.0.0/turing → turing_engine-2.1.0/turing/experimental}/kernels/triton_fused_qkv_rope.py +0 -0
  319. {turing_engine-2.0.0/turing → turing_engine-2.1.0/turing/experimental}/kernels/triton_fused_sample.py +0 -0
  320. {turing_engine-2.0.0/turing → turing_engine-2.1.0/turing/experimental}/kernels/triton_gated_zero_identity.py +0 -0
  321. {turing_engine-2.0.0/turing → turing_engine-2.1.0/turing/experimental}/kernels/triton_hybrid_anchor_fuse.py +0 -0
  322. {turing_engine-2.0.0/turing → turing_engine-2.1.0/turing/experimental}/kernels/triton_kslot_pool.py +0 -0
  323. {turing_engine-2.0.0/turing → turing_engine-2.1.0/turing/experimental}/kernels/triton_linear_recurrence.py +0 -0
  324. {turing_engine-2.0.0/turing → turing_engine-2.1.0/turing/experimental}/kernels/triton_linear_recurrence_step.py +0 -0
  325. {turing_engine-2.0.0/turing → turing_engine-2.1.0/turing/experimental}/kernels/triton_matryoshka_spec.py +0 -0
  326. {turing_engine-2.0.0/turing → turing_engine-2.1.0/turing/experimental}/kernels/triton_quadtree_mrp.py +0 -0
  327. {turing_engine-2.0.0/turing → turing_engine-2.1.0/turing/experimental}/kernels/triton_vram_hash.py +0 -0
  328. {turing_engine-2.0.0/turing/core → turing_engine-2.1.0/turing/experimental}/paging.py +0 -0
  329. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/integrations/__init__.py +0 -0
  330. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/integrations/langchain.py +0 -0
  331. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/kernels/__init__.py +0 -0
  332. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/kernels/dispatch.py +0 -0
  333. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/kernels/shannon_entropy_cuda.py +0 -0
  334. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/kernels/triton_flash_tree.py +0 -0
  335. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/kernels/triton_recirculation.py +0 -0
  336. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/kernels/triton_select_gather.py +0 -0
  337. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/kernels/triton_sparse_gemv.py +0 -0
  338. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/kernels/triton_swiglu.py +0 -0
  339. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/models/__init__.py +0 -0
  340. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/models/activation_sparsity.py +0 -0
  341. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/models/adapters.py +0 -0
  342. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/models/architecture_registry.py +0 -0
  343. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/models/converter.py +0 -0
  344. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/models/gguf_loader.py +0 -0
  345. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/models/gguf_tokenizer.py +0 -0
  346. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/models/ingest.py +0 -0
  347. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/models/mesh_2d.py +0 -0
  348. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/models/registry.py +0 -0
  349. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/models/resolver.py +0 -0
  350. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/models/safetensors_mmap.py +0 -0
  351. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/models/sizing_profiles.py +0 -0
  352. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/models/streaming_loader.py +0 -0
  353. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/models/vllm_adapter.py +0 -0
  354. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/serving/__init__.py +0 -0
  355. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/serving/accuracy_eval.py +0 -0
  356. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/serving/anthropic_api.py +0 -0
  357. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/serving/disagg_sidecar.py +0 -0
  358. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/serving/distributed.py +0 -0
  359. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/serving/generation.py +0 -0
  360. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/serving/kv_events.py +0 -0
  361. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/serving/niah.py +0 -0
  362. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/serving/prefix_cache.py +0 -0
  363. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/serving/spec_gate.py +0 -0
  364. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/serving/structured.py +0 -0
  365. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing/serving/tools.py +0 -0
  366. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing_engine.egg-info/dependency_links.txt +0 -0
  367. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing_engine.egg-info/entry_points.txt +0 -0
  368. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing_engine.egg-info/requires.txt +0 -0
  369. {turing_engine-2.0.0 → turing_engine-2.1.0}/turing_engine.egg-info/top_level.txt +0 -0
@@ -6,4 +6,5 @@ include pyproject.toml
6
6
  include setup.py
7
7
  recursive-include turing *.py
8
8
  recursive-include csrc/marlin *
9
+ recursive-include csrc/marlin_moe *
9
10
  include NOTICE
@@ -12,3 +12,11 @@ csrc/marlin/ : Marlin mixed-precision (W4A16) GEMM kernel
12
12
  Licensed under the Apache License, Version 2.0 (csrc/marlin/LICENSE). Each file's header says whether Turing Engine
13
13
  modified it and how. turing/kernels/marlin.py ports layout logic from vLLM's
14
14
  vllm/model_executor/layers/quantization/utils/marlin_utils.py (Apache-2.0).
15
+
16
+ csrc/marlin_moe/ : Marlin mixed-precision (W4A16) GEMM kernel for mixture-of-experts layers
17
+ Vendored from vLLM v0.31.0 (https://github.com/vllm-project/vllm): csrc/libtorch_stable/moe/marlin_moe_wna16/.
18
+ Copyright contributors to the vLLM project. Marlin: Copyright (C) 2024 Elias Frantar (IST-DASLab,
19
+ https://github.com/IST-DASLab/marlin), modified by Neural Magic and the vLLM project.
20
+ Licensed under the Apache License, Version 2.0 (csrc/marlin/LICENSE). Each file's header says whether Turing Engine
21
+ modified it and how. turing/kernels/marlin_moe.py follows the call sequence of vLLM's
22
+ vllm/model_executor/layers/fused_moe/experts/marlin_moe.py (Apache-2.0).
@@ -0,0 +1,355 @@
1
+ Metadata-Version: 2.4
2
+ Name: turing-engine
3
+ Version: 2.1.0
4
+ Summary: LLM inference server for KV-cache and quantization research: int8/fp8/int4 KV caches that keep the layers low-bit storage would break in full precision, 4-bit GPTQ, EAGLE-3 speculative decoding, HuggingFace parity tests on 16 model types, and OpenAI, Anthropic and Ollama APIs on one port
5
+ Author: Ishan Gupta
6
+ Author-email: Ishan Gupta <support@intutic.ai>
7
+ Requires-Python: >=3.10
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ License-File: NOTICE
11
+ Requires-Dist: torch>=2.0.0
12
+ Requires-Dist: numpy>=1.22.0
13
+ Requires-Dist: fastapi>=0.100.0
14
+ Requires-Dist: uvicorn>=0.22.0
15
+ Requires-Dist: pydantic>=2.0.0
16
+ Requires-Dist: pybind11>=2.10.0
17
+ Requires-Dist: requests>=2.28.0
18
+ Requires-Dist: httpx>=0.24.0
19
+ Requires-Dist: transformers>=4.38.0
20
+ Requires-Dist: jinja2>=3.1.0
21
+ Requires-Dist: huggingface-hub>=0.20.0
22
+ Provides-Extra: dev
23
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
24
+ Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
25
+ Requires-Dist: wheel; extra == "dev"
26
+ Requires-Dist: build; extra == "dev"
27
+ Requires-Dist: pyzmq>=24.0.0; extra == "dev"
28
+ Requires-Dist: msgpack>=1.0; extra == "dev"
29
+ Requires-Dist: prometheus-client>=0.17; extra == "dev"
30
+ Requires-Dist: httpx2>=2.0; python_version >= "3.10" and extra == "dev"
31
+ Requires-Dist: langchain-core>=0.3; extra == "dev"
32
+ Requires-Dist: gguf>=0.19.0; extra == "dev"
33
+ Requires-Dist: datasets>=2.18; extra == "dev"
34
+ Requires-Dist: llguidance>=1.9.0; extra == "dev"
35
+ Requires-Dist: jsonschema>=4.0; extra == "dev"
36
+ Provides-Extra: structured
37
+ Requires-Dist: llguidance>=1.9.0; extra == "structured"
38
+ Requires-Dist: jsonschema>=4.0; extra == "structured"
39
+ Provides-Extra: llmd
40
+ Requires-Dist: pyzmq>=24.0.0; extra == "llmd"
41
+ Requires-Dist: msgpack>=1.0; extra == "llmd"
42
+ Dynamic: author
43
+ Dynamic: license-file
44
+ Dynamic: requires-python
45
+
46
+ # ⚡ Turing Engine
47
+
48
+ **An LLM inference server whose int8/fp8/int4 KV cache finds the layers low-bit storage would break and keeps them in
49
+ full precision**, with HuggingFace parity tests on 16 model types, 4-bit GPTQ weights, EAGLE-3 speculative decoding,
50
+ and OpenAI, Anthropic and Ollama APIs on one port. It runs on NVIDIA GPUs, Apple Silicon and CPUs. With Qwen2.5-1.5B
51
+ on an NVIDIA L4, its int4 KV cache holds 2.4× as many tokens as a 16-bit cache in the same GPU memory, at +0.02
52
+ nats, and 4-bit decoding (the LM head in 4 bits too) is 1.09–1.34× faster than vLLM at batch sizes 1 to 64.
53
+
54
+ [![Docs: Live](https://img.shields.io/badge/Documentation-intutic.github.io%2Fturing-blue.svg)](https://intutic.github.io/turing/)
55
+ [![PyPI: turing-engine](https://img.shields.io/pypi/v/turing-engine.svg)](https://pypi.org/project/turing-engine/)
56
+ [![Python 3.10–3.12](https://img.shields.io/badge/Python-3.10–3.12-blue.svg)](https://pypi.org/project/turing-engine/)
57
+ [![Release: v2.1.0](https://img.shields.io/badge/Release-v2.1.0-blue.svg)](CHANGELOG.md)
58
+ [![License: BSL 1.1](https://img.shields.io/badge/License-BSL%201.1-green.svg)](LICENSE)
59
+ [![Tests: 1507](https://img.shields.io/badge/Tests-1507-brightgreen.svg)](https://github.com/intutic/turing/actions)
60
+
61
+ [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/intutic/turing/blob/master/demo/turing_quickstart_colab.ipynb)
62
+
63
+ It loads HuggingFace checkpoints, llama.cpp GGUF files and its own 4-bit `.tgate4` directories, and matches
64
+ HuggingFace's logits when the KV cache is kept in the model's dtype. It is built for trying KV-cache and quantization
65
+ changes against real models, not for production serving ([how it compares](#how-it-compares)).
66
+
67
+ [What's new](#whats-new-in-210) · [Get started](#get-started) · [What it is good for](#what-it-is-good-for) ·
68
+ [How it compares](#how-it-compares) · [More ways to run it](#more-ways-to-run-it) · [Models](#models) ·
69
+ [Features](#features) · [Documentation](#documentation)
70
+
71
+ ---
72
+
73
+ ## What's new in 2.1.0
74
+
75
+ * **EAGLE-3 draft heads** (`--draft-head`): Qwen3-8B with a published head runs at 101.0–102.4% of vLLM with the same
76
+ head in 13 of 15 cells on an L4.
77
+ * **fp8 KV cache** (`--kv-cache-dtype fp8`), calibrated like int8 and int4: at 16K-token prompts 99.0–101.3% of
78
+ vLLM's fp8, and it keeps Qwen2.5-1.5B-Instruct at 56.6% on GSM8K where vLLM's fp8 drops it to 2.4%.
79
+ * **4-bit MoE**: `turing convert` packs the experts too and Marlin kernels run them (Qwen1.5-MoE at 101–127% of
80
+ vLLM); `--moe-expert-slots` computes some experts on the CPU, which fits Mixtral-8x7B on a 24 GB GPU.
81
+ * **Shorter steps**: overlapped decode, CUDA graphs for prefill, and a warm-up before the server listens.
82
+ * **A CUDA image that starts on a GPU.** `v2.0.0-cuda` lacks the C compiler Triton needs; `v2.1.0-cuda` has it.
83
+
84
+ Everything else, with the measurements behind it, is in the [changelog](CHANGELOG.md).
85
+
86
+ ---
87
+
88
+ ## Get started
89
+
90
+ ### 1. Install
91
+ ```bash
92
+ pip install turing-engine # Python 3.10–3.12
93
+ pip install "turing-engine[structured]" # optional: JSON-schema and tool_choice enforcement (llguidance)
94
+ ```
95
+ Wheels with the C++ extension are built for Linux x86_64 and aarch64 and macOS arm64; elsewhere (Windows, Intel
96
+ Macs) pip builds it from the source package, which needs a C++20 compiler. From a clone: `pip install -e .`.
97
+
98
+ Or run the server in Docker ([docs/docker.md](docs/docker.md)):
99
+ ```bash
100
+ docker run --rm -p 127.0.0.1:8000:8000 ghcr.io/intutic/turing:v2.1.0 --model smollm2
101
+ docker run --rm --gpus all -p 127.0.0.1:8000:8000 ghcr.io/intutic/turing:v2.1.0-cuda --model Qwen/Qwen2.5-7B-Instruct --device cuda
102
+ ```
103
+
104
+ ### 2. Chat in the terminal
105
+ ```bash
106
+ turing chat --model smollm2 # alias for HuggingFaceTB/SmolLM2-135M
107
+ turing chat --model Qwen/Qwen2.5-0.5B-Instruct
108
+ turing chat --model ./models/qwen2.5-0.5b-instruct-q8_0.gguf # llama.cpp GGUF, no conversion
109
+ ```
110
+
111
+ ### 3. Serve OpenAI, Anthropic and Ollama APIs on one port
112
+ ```bash
113
+ turing serve --model Qwen/Qwen2.5-7B-Instruct --port 8000
114
+ ```
115
+ OpenAI (`/v1/chat/completions`, `/v1/completions`, `/v1/embeddings`), Anthropic (`/v1/messages`) and Ollama
116
+ (`/api/chat`, `/api/generate`, `/api/pull`, …) clients can point at `http://localhost:8000`. The server listens on
117
+ `0.0.0.0` by default and needs no key unless started with `--api-key` (or `TURING_API_KEY`).
118
+
119
+ ---
120
+
121
+ ## What it is good for
122
+
123
+ * **Low-bit KV caches that do not silently break the model.** When a pool stores KV in int8, fp8 or int4, Turing
124
+ measures at startup which layers that format damages (each layer's K and V are round-tripped alone and the change in
125
+ the next-token distribution is measured on random tokens, in a few seconds) and keeps those layers in the model's
126
+ dtype; outlier key channels are scaled down for int4. On Qwen2.5-1.5B-Instruct vLLM's default fp8, per-token fp8 and
127
+ per-token int4 caches collapse (GSM8K 0.6–2.4%); Turing's int8, fp8 and int4 keep it working with no setting:
128
+
129
+ <!-- table:vs_kv_short -->
130
+ | KV cache | Layers kept in bf16 | GSM8K | Pass-key 2K–32K | ΔNLL vs bf16 | s/request (16K, B=128) |
131
+ | :--- | :---: | :---: | :---: | :---: | :---: |
132
+ | Turing bf16 (reference) | — | 57.2% | 100.0% | — | 1.90 |
133
+ | Turing int8 | automatic | 58.6% | 100.0% | -0.000 ± 0.002 | 1.72 |
134
+ | Turing fp8 | automatic | 56.6% | 100.0% | +0.009 ± 0.005 | 1.68 |
135
+ | Turing int4 | automatic | 52.8% | 100.0% | +0.020 ± 0.005 | 2.06 |
136
+ | vLLM bf16 (reference) | — | 57.4% | 100.0% | — | 2.65 |
137
+ | vLLM fp8 | — | 2.4% | 5.0% | +2.286 ± 0.394 | 1.72 |
138
+ | vLLM fp8 | layer 0 (manual) | 56.8% | 100.0% | +0.013 ± 0.003 | 1.79 |
139
+ <!-- /table -->
140
+
141
+ vLLM fp8 with layer 0 skipped *by hand* matches Turing's quality at 0.80–1.07× Turing's time per request (int4
142
+ to fp8), which is the point: the calibration finds that layer automatically. vLLM's per-token int8 and int4
143
+ caches are in the [full table](docs/comparison.md). It is also packaged on its own for vLLM users, under
144
+ Apache-2.0: [`packages/kv-layer-guard`](packages/kv-layer-guard). Validated on six instruct models (Qwen2.5 1.5B
145
+ and 7B, Llama 3.2, Gemma 2, Phi-3.5, Mistral), including one limit it does not catch
146
+ ([benchmarks §2](docs/benchmarks.md#2-kv-cache-quality-and-the-layers-it-keeps)).
147
+ * **Correctness you can check.** The exact model reproduces HuggingFace's logits on 16 model families in the tests, 13 of them
148
+ also on real checkpoints ([models & hardware](docs/models_and_hardware.md)); 13 real GGUF files agree with llama.cpp.
149
+ * **A codebase small enough to change.** Paged KV pool, Triton decode kernels, GPTQ, TEAL sparsity, prefix caching,
150
+ speculative decoding and the OpenAI, Anthropic and Ollama APIs are a few Python modules and kernels, with a
151
+ standalone C++ engine beside them. The eval scripts (`scripts/eval_kv_quality.py`, `turing eval-accuracy`,
152
+ `turing eval-niah`, the Turing-vs-vLLM and llama.cpp benchmarks) run any idea against real models.
153
+
154
+ **Limitations:** tensor and pipeline parallelism are tested as CPU processes only, not on multiple GPUs; the largest
155
+ dense model run end to end is Qwen3-8B, and the largest MoE model Mixtral-8x7B in 4 bits with some experts on the CPU.
156
+
157
+ ---
158
+
159
+ ## How it compares
160
+
161
+ Is it faster than vLLM or llama.cpp? On one NVIDIA L4 with models of 0.4B to 8B parameters it is ahead of vLLM in
162
+ fp16 by a few percent and at 4 bits with its default settings by more, and behind in the settings listed below. Same
163
+ model and prompts (Qwen2.5-1.5B-Instruct, 512-token prompts, 256 new tokens):
164
+
165
+ <!-- table:vs_4bit -->
166
+ | Setting | Batch 1, tok/s | Batch 8, tok/s | Batch 64, tok/s | GSM8K (n=500) |
167
+ | :--- | :---: | :---: | :---: | :---: |
168
+ | llama.cpp Q4_K_M | 183 | 764 | 2,171 | 52.4% ± 2.2% |
169
+ | vLLM GPTQ-Int4 (Qwen's checkpoint) | 171 | 1,096 | 3,082 | 50.2% ± 2.2% |
170
+ | vLLM AWQ (Qwen's checkpoint) | 169 | 1,081 | 3,046 | — |
171
+ | Turing GPTQ, fp16 LM head (`--no-quantize-lm-head`) | 174 | 1,117 | 3,092 | 50.4% ± 2.2% |
172
+ | Turing GPTQ (4-bit LM head, the default) | 229 | 1,385 | 3,350 | 51.8% ± 2.2% |
173
+ | Turing GPTQ, fp16 LM head, TEAL 25% | 107 | 953 | 2,600 | 46.2% ± 2.2% |
174
+ | Turing GPTQ, fp16 LM head, TEAL 40% | 112 | 960 | 2,614 | 42.0% ± 2.2% |
175
+ | vLLM fp16 (reference) | 75 | 538 | 2,236 | — |
176
+ | Turing fp16 (reference) | 77 | 547 | 2,265 | — |
177
+ <!-- /table -->
178
+
179
+ * **fp16:** Turing is at 101–103% of vLLM's throughput at batch 1–64 (the median of three runs of each engine,
180
+ taken in turn; repeated runs of one setting differ by up to 3%), and at 101–114% on SmolLM2 at 1,024-token
181
+ prompts.
182
+ * **First token:** a prompt arriving alone gets its first token sooner than on vLLM (18 against 28–29 ms on
183
+ SmolLM2-360M, 27 against 32 ms on Qwen2.5-1.5B, 68 against 71–73 ms on SmolLM2-1.7B). In a burst of 32 or 64
184
+ SmolLM2 prompts the mean first token is 10–16% sooner than vLLM's when both engines take 8,192 tokens per step
185
+ and from 5% sooner to 2% later when both take 2,048.
186
+ * **4 bits** (the LM head in 4 bits too, the default): Turing is 1.34 / 1.26 / 1.09× vLLM and 1.25 / 1.81 / 1.54×
187
+ llama.cpp at batch 1 / 8 / 64 (the three engines in turn on one L4, within one boot). This quantizes one more
188
+ matrix than vLLM's GPTQ checkpoint does; GSM8K 51.8% against vLLM's 50.2% (each ± 2.2%), and the 4-bit head adds
189
+ 0.007–0.009 nats of next-token NLL on three models (`results_quality_head_cuda.json`).
190
+ * **4 bits with the LM head in fp16** (`--no-quantize-lm-head`): Turing is at 100–102% of vLLM. llama.cpp is 1.05×
191
+ faster at batch 1; Turing is faster than llama.cpp at batch 8 and 64 (1.46× and 1.42×).
192
+ * **16K-token prompts, fp16 KV at equal memory:** Turing is 1.06–1.40× faster per request than vLLM, more at larger
193
+ batches. With one byte per value, at the same step budget, Turing's fp8 cache is at 99.0–101.3% of vLLM's fp8
194
+ and its int8 at 97.0–99.0%; vLLM's fp8 keeps no layer in fp16 and wrecks this model's output (above), and with
195
+ layer 0 kept in fp16 as Turing keeps it Turing's fp8 is at 103.5–106.2% and its int8 at 100.7–103.8%.
196
+ * **Speculative decoding:** with prompt lookup (8 drafts) Turing is at 100–121% of vLLM's n-gram speculator on code,
197
+ rewrite and chat prompts; with a published EAGLE-3 head on Qwen3-8B it is at 101.0–102.4% of vLLM with the same
198
+ head in 13 of 15 cells. The other two are within the spread of vLLM's own runs: code with chains of 7 at 4
199
+ requests at 99.3–99.8%, and chat at 4 requests at 98.3% of vLLM's fastest of four processes and 100.2% of their
200
+ mean (vLLM's outputs, and with them its speed, change from one process to the next).
201
+ * **MoE models:** OLMoE in bf16 is level with vLLM at batch 1 and 8 and 3% behind at batch 32; Qwen1.5-MoE in 4
202
+ bits is at 101–127% of vLLM on Qwen's GPTQ checkpoint (99.1–101.5% with its LM head in fp16, as in that
203
+ checkpoint; 100.0–102.6% converted with `--symmetric`, the grid of that checkpoint).
204
+ Mixtral-8x7B does not fit a 24 GB GPU in 4 bits: with two of each layer's eight experts computed on the CPU
205
+ (`--moe-expert-slots 6`) it runs at 13.7 / 16.5 tok/s at batch 1 / 2, against 13.2 / 14.0 for llama.cpp with 26
206
+ of its layers on the GPU.
207
+ * **Cold start:** from process start to first token Turing takes 25.4 s from a cold page cache and 10.0 s warm,
208
+ against vLLM's 51.7 s and 34.2 s (vLLM ran in an earlier run, alongside a Turing build that took 27.4 s and
209
+ 12.1 s: 1.9–2.8× sooner); llama.cpp with its 4-bit GGUF takes 7.1 s and 1.3 s.
210
+
211
+ Details and every other setting are in the [comparison](docs/comparison.md); the results files and the commands
212
+ that produced them are in [`benchmarks/`](benchmarks/). These are one GPU and five models: for production serving
213
+ (multi-GPU, larger models, a longer track record) use vLLM, SGLang or TensorRT-LLM; on a laptop, llama.cpp or
214
+ Ollama.
215
+
216
+ ---
217
+
218
+ ## More ways to run it
219
+
220
+ ### Quantize to 4-bit once, serve the result
221
+ ```bash
222
+ turing convert --model Qwen/Qwen2.5-7B-Instruct --output ./qwen7b-gptq --method gptq
223
+ turing serve --model ./qwen7b-gptq
224
+ ```
225
+
226
+ ### Turing DSL
227
+ ```python
228
+ import turing
229
+
230
+ @turing.chain(model="smollm2", device="auto")
231
+ def three_answers(question: str):
232
+ turing.gen(f"Question: {question}\nThink step by step.", max_tokens=64)
233
+ branches = turing.fork(3, temperature=0.8) # the context so far is prefilled once and shared
234
+ for i, b in enumerate(branches):
235
+ b.gen(f"\nAnswer {i + 1}:", max_tokens=64)
236
+ return turing.join(branches, strategy="best") # highest mean log-probability
237
+ ```
238
+
239
+ ### Standalone C++ engine (`turing-cli`)
240
+ ```bash
241
+ cmake -B build && cmake --build build
242
+ ./build/turing-cli generate --model ./models/llama-3.2-1b-instruct-f16.gguf --prompt "Hello"
243
+ ./build/turing-cli serve --model ./models/llama-3.2-1b-instruct-f16.gguf --port 8000 # binds 127.0.0.1
244
+ ```
245
+ It runs Llama-layout GGUF models (RMSNorm, SwiGLU, RoPE, grouped-query attention) on the CPU with AVX2 or NEON, with
246
+ an optional int8 KV cache (`--kv-cache-dtype int8`).
247
+
248
+ ### Tensor and pipeline parallelism
249
+ ```bash
250
+ ./scripts/launch_distributed.sh Qwen/Qwen2.5-7B-Instruct 2 2 # MODEL TP PP, via torchrun; rank 0 serves HTTP
251
+ ```
252
+ Sharded weights and KV pages over `torch.distributed`. The tests run TP 2/4, PP 2 and TP 2 × PP 2 as CPU (gloo)
253
+ processes and compare logits with a single process; multi-GPU (NCCL) runs are not tested yet.
254
+
255
+ ---
256
+
257
+ ## Models
258
+
259
+ `tests/test_hf_parity.py` checks prefill, chunked prefill, decode and batched decode against HuggingFace
260
+ (atol 1e-3) for 25 configurations of these model types: **llama**, **mistral** (sliding window), **qwen2**,
261
+ **qwen3**, **gemma**, **gemma2** (soft-capping), **gemma3_text** (local/global RoPE), **phi** (Phi-2), **phi3** (incl.
262
+ LongRoPE), **gpt2**, **opt** (incl. post-LN and projected embeddings), **gpt_neox**, **mixtral**, **qwen2_moe**,
263
+ **qwen3_moe** and **olmoe**. RoPE scaling types: default, linear, dynamic, YaRN, LongRoPE, Llama 3 and proportional.
264
+ Any other architecture is refused before download (`hf_loader.FAMILIES`, `ArchitectureRegistry`); weights never fall
265
+ back to random values. Every family except OPT also loads from GGUF (Mistral and Mixtral through llama.cpp's
266
+ `llama` architecture). Details: [models & hardware](docs/models_and_hardware.md).
267
+
268
+ ## Hardware
269
+
270
+ Tested on NVIDIA GPUs (CUDA, Triton kernels, CUDA graphs; benchmarked on an L4), Apple Silicon (MPS) and x86_64 and
271
+ arm64 CPUs. `--device` also accepts `rocm` (PyTorch's HIP build), and auto-detection picks `xpu` or `vulkan` when
272
+ PyTorch reports them; those backends are untested.
273
+
274
+ ---
275
+
276
+ ## Features
277
+
278
+ | Area | What the code does |
279
+ | :--- | :--- |
280
+ | KV cache | One paged pool per model (16-token pages), `native`/`int8`/`int4` storage with the layers that format damages kept in the model dtype (chosen at startup), copy-on-write forks; Quest page selection (`--kv-page-budget`), also inside CUDA graphs |
281
+ | Prefix caching | Automatic: full pages indexed by chained token hashes, reused copy-on-write, evicted LRU (`--no-prefix-caching`) |
282
+ | Speculative decoding | Prompt lookup or an EAGLE-3 draft head (`--draft-head`), `--draft-tokens` (default 8); a request drafts only while it pays; output distribution equals plain decoding for greedy and sampling |
283
+ | Weights | fp32/fp16/bf16; 4-bit GPTQ or RTN (`turing convert`, `--quantization`); TEAL-style activation sparsity in batch-1 decode on CUDA (`--activation-sparsity`, off by default) |
284
+ | LoRA | Several PEFT adapters at once (`--lora NAME=PATH`), chosen per request by `model: "base:NAME"` or `X-Turing-Adapter` |
285
+ | API | Chat templates, tools (OpenAI and Anthropic; Hermes, Mistral and Llama 3 call formats), reasoning (`reasoning_content`, Anthropic thinking blocks, effort budgets), JSON schema by token-level constrained decoding, stop strings, usage with cached tokens |
286
+ | Traffic | Admission control sized to the KV pool and three QoS lanes, on by default (429/503 with `Retry-After`) |
287
+ | Other endpoints | Embeddings, rerank, `/v1/extract`, render endpoints, Prometheus `/metrics`, llm-d KV events |
288
+ | Distributed | Tensor and pipeline parallelism (torchrun); prefill/decode disaggregation over TCP (`--prefill-worker`, `--prefill-server`) |
289
+ | Evals | `turing eval-accuracy` (GSM8K exact match) and `turing eval-niah` (pass-key retrieval), through the engine on real weights |
290
+
291
+ The `turing.experimental` package holds research components outside the serving path: cross-model KV transfer, `clean_base`
292
+ lineage, k-slot pooling, an MoE expert-offload runner and hybrid linear/softmax attention (needs a model trained with
293
+ it). What each does, and how it performed on real models, is in
294
+ [experimental components](docs/experimental.md).
295
+
296
+ ---
297
+
298
+ ## CLI
299
+
300
+ ```bash
301
+ turing serve --model <id|.gguf|.tgate4 dir> [--port 8000] # HTTP server
302
+ turing chat --model <id> # terminal chat
303
+ turing generate --model gpt2 --prompt "Artificial intelligence is"
304
+ turing convert --model <hf id> --output <dir> [--method gptq|rtn]
305
+ turing eval-accuracy --model <id> --samples 100 # GSM8K, k-shot greedy
306
+ turing eval-niah --model <id> --context-len 1024 4096 # pass-key retrieval
307
+ turing info # devices and runtime
308
+ ```
309
+
310
+ ## Client SDKs
311
+
312
+ ```python
313
+ from openai import OpenAI
314
+ client = OpenAI(base_url="http://localhost:8000/v1", api_key="unused")
315
+ r = client.chat.completions.create(model="Qwen/Qwen2.5-7B-Instruct",
316
+ messages=[{"role": "user", "content": "Write a binary search in Python."}])
317
+ print(r.choices[0].message.content)
318
+
319
+ import anthropic
320
+ client = anthropic.Anthropic(base_url="http://localhost:8000", api_key="unused")
321
+ m = client.messages.create(model="Qwen/Qwen2.5-7B-Instruct", max_tokens=128,
322
+ messages=[{"role": "user", "content": "Hello"}])
323
+ print(m.content[0].text)
324
+
325
+ import ollama
326
+ client = ollama.Client(host="http://localhost:8000")
327
+ print(client.chat(model="Qwen/Qwen2.5-7B-Instruct", messages=[{"role": "user", "content": "Hello"}])["message"]["content"])
328
+ ```
329
+
330
+ LangChain and LlamaIndex have their own packages (Apache-2.0, no dependency on the engine):
331
+ ```bash
332
+ pip install langchain-turing # from langchain_turing import ChatTuring (tools, streaming with usage)
333
+ pip install llama-index-llms-turing # from llama_index.llms.turing import Turing
334
+ ```
335
+ LiteLLM, KServe, Helm and llm-d: [integrations](docs/integrations.md).
336
+
337
+ ---
338
+
339
+ ## Documentation
340
+
341
+ * **Getting started:** [Quickstart](https://intutic.github.io/turing/quickstart/) · [Docker](https://intutic.github.io/turing/docker/)
342
+ * **User guide:** [Serving & API](https://intutic.github.io/turing/serving/) · [Models & hardware](https://intutic.github.io/turing/models_and_hardware/) · [Integrations](https://intutic.github.io/turing/integrations/) · [Kubernetes & llm-d](https://intutic.github.io/turing/llmd-integration/)
343
+ * **Performance:** [Comparison](https://intutic.github.io/turing/comparison/) · [Benchmarks](https://intutic.github.io/turing/benchmarks/)
344
+ * **Internals:** [Architecture](https://intutic.github.io/turing/architecture/) · [Experimental components](https://intutic.github.io/turing/experimental/)
345
+ * **Project:** [Changelog](CHANGELOG.md) · [Contributing](CONTRIBUTING.md) · [Security policy](SECURITY.md) · [Licensing](https://intutic.github.io/turing/licensing/)
346
+
347
+ ---
348
+
349
+ ## License
350
+
351
+ Turing Engine is licensed under the **Business Source License 1.1 (BSL 1.1)**.
352
+ * **Free for non-production use**: development, local testing, academic research, personal single-GPU workstations and benchmarking ([`LICENSE`](LICENSE), Additional Use Grant). Production use (multi-GPU clusters, commercial hosting, revenue-generating API traffic) needs a separate commercial license.
353
+ * `packages/` is under the **Apache License 2.0** now: `kv-layer-guard` (the KV layer calibration, usable with vLLM),
354
+ `langchain-turing` and `llama-index-llms-turing`.
355
+ * Converts automatically to **Apache 2.0** on **August 24, 2030** or the fourth anniversary of the first public release (as [`LICENSE`](LICENSE) §3 states).