mate-llm 0.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.
- mate_llm-0.1.0/LICENSE +137 -0
- mate_llm-0.1.0/PKG-INFO +180 -0
- mate_llm-0.1.0/README.md +159 -0
- mate_llm-0.1.0/mate/__init__.py +279 -0
- mate_llm-0.1.0/mate/_bridge.py +1494 -0
- mate_llm-0.1.0/mate/_gguf_tables.py +380 -0
- mate_llm-0.1.0/mate/_hadamard.py +131 -0
- mate_llm-0.1.0/mate/_hf_utils.py +241 -0
- mate_llm-0.1.0/mate/_import_common.py +273 -0
- mate_llm-0.1.0/mate/_int8.py +37 -0
- mate_llm-0.1.0/mate/_policy.py +260 -0
- mate_llm-0.1.0/mate/_protocols.py +142 -0
- mate_llm-0.1.0/mate/_sampling.py +252 -0
- mate_llm-0.1.0/mate/_trellis_dispatch.py +849 -0
- mate_llm-0.1.0/mate/anthropic_api.py +840 -0
- mate_llm-0.1.0/mate/auto_fit.py +1936 -0
- mate_llm-0.1.0/mate/chat_drafters.py +2374 -0
- mate_llm-0.1.0/mate/cli.py +716 -0
- mate_llm-0.1.0/mate/cptc.py +620 -0
- mate_llm-0.1.0/mate/cpu_runner.py +3671 -0
- mate_llm-0.1.0/mate/csrc/mate_cuda_kernels.cu +4531 -0
- mate_llm-0.1.0/mate/csrc/mate_doorbell_moe.cu +737 -0
- mate_llm-0.1.0/mate/csrc/mate_doorbell_moe.cuh +84 -0
- mate_llm-0.1.0/mate/csrc/mate_e8_v3.cu +1348 -0
- mate_llm-0.1.0/mate/csrc/mate_e8_v3.cuh +34 -0
- mate_llm-0.1.0/mate/csrc/mate_gdn.cu +9004 -0
- mate_llm-0.1.0/mate/csrc/mate_gdn.cuh +288 -0
- mate_llm-0.1.0/mate/csrc/mate_gemv_v2.cuh +3608 -0
- mate_llm-0.1.0/mate/csrc/mate_gemv_v3.cu +4 -0
- mate_llm-0.1.0/mate/csrc/mate_gemv_v3.cuh +14499 -0
- mate_llm-0.1.0/mate/csrc/mate_hyper_res.cu +3500 -0
- mate_llm-0.1.0/mate/csrc/mate_hyper_res.cuh +152 -0
- mate_llm-0.1.0/mate/csrc/mate_inkling_engine.cu +12322 -0
- mate_llm-0.1.0/mate/csrc/mate_inkling_engine.cuh +263 -0
- mate_llm-0.1.0/mate/csrc/mate_kv_v2.cuh +3494 -0
- mate_llm-0.1.0/mate/csrc/mate_moe_gemv.cu +3617 -0
- mate_llm-0.1.0/mate/csrc/mate_moe_gemv.cuh +97 -0
- mate_llm-0.1.0/mate/csrc/mate_nvfp4_moe.cu +9323 -0
- mate_llm-0.1.0/mate/csrc/mate_nvfp4_moe.cuh +51 -0
- mate_llm-0.1.0/mate/csrc/mate_offload_async.cu +1863 -0
- mate_llm-0.1.0/mate/csrc/mate_offload_async.cuh +137 -0
- mate_llm-0.1.0/mate/csrc/mate_r4kv.cu +11066 -0
- mate_llm-0.1.0/mate/csrc/mate_r4kv.cuh +274 -0
- mate_llm-0.1.0/mate/csrc/mate_screened_head.cu +2261 -0
- mate_llm-0.1.0/mate/csrc/mate_screened_head.cuh +79 -0
- mate_llm-0.1.0/mate/csrc/mate_sparse_r4kv.cu +4017 -0
- mate_llm-0.1.0/mate/csrc/mate_sparse_r4kv.cuh +169 -0
- mate_llm-0.1.0/mate/csrc/mate_spec_gpu.cu +2151 -0
- mate_llm-0.1.0/mate/csrc/mate_spec_gpu.cuh +127 -0
- mate_llm-0.1.0/mate/csrc/mate_t2tc.cu +52 -0
- mate_llm-0.1.0/mate/csrc/runtime/CMakeLists.txt +76 -0
- mate_llm-0.1.0/mate/csrc/runtime/arena.hpp +1047 -0
- mate_llm-0.1.0/mate/csrc/runtime/cuda_runtime_kernels.cu +300 -0
- mate_llm-0.1.0/mate/csrc/runtime/http_server.hpp +1091 -0
- mate_llm-0.1.0/mate/csrc/runtime/jinja.hpp +2285 -0
- mate_llm-0.1.0/mate/csrc/runtime/mate_serve.cpp +254 -0
- mate_llm-0.1.0/mate/csrc/runtime/safetensors_mmap.hpp +927 -0
- mate_llm-0.1.0/mate/csrc/runtime/scheduler.hpp +1358 -0
- mate_llm-0.1.0/mate/csrc/runtime/tokenizer.hpp +1486 -0
- mate_llm-0.1.0/mate/csrc/runtime/wave1_runners.hpp +2372 -0
- mate_llm-0.1.0/mate/cuda_ext/__init__.py +430 -0
- mate_llm-0.1.0/mate/cuda_ext/_build.py +535 -0
- mate_llm-0.1.0/mate/cuda_ext/_ops_doorbell.py +428 -0
- mate_llm-0.1.0/mate/cuda_ext/_ops_gdn.py +3037 -0
- mate_llm-0.1.0/mate/cuda_ext/_ops_gemv.py +2548 -0
- mate_llm-0.1.0/mate/cuda_ext/_ops_hyper.py +1065 -0
- mate_llm-0.1.0/mate/cuda_ext/_ops_inkling.py +1713 -0
- mate_llm-0.1.0/mate/cuda_ext/_ops_kv.py +2666 -0
- mate_llm-0.1.0/mate/cuda_ext/_ops_moe.py +1830 -0
- mate_llm-0.1.0/mate/cuda_ext/_ops_offload.py +1175 -0
- mate_llm-0.1.0/mate/cuda_ext/_ops_sparse_kv.py +1160 -0
- mate_llm-0.1.0/mate/cuda_ext/_ops_spec.py +949 -0
- mate_llm-0.1.0/mate/double_hadamard.py +1408 -0
- mate_llm-0.1.0/mate/e8_kv.py +1468 -0
- mate_llm-0.1.0/mate/engram.py +2676 -0
- mate_llm-0.1.0/mate/exl3_codec.py +231 -0
- mate_llm-0.1.0/mate/exl3_import.py +626 -0
- mate_llm-0.1.0/mate/fast_decode.py +4512 -0
- mate_llm-0.1.0/mate/fused.py +236 -0
- mate_llm-0.1.0/mate/fused_proj.py +935 -0
- mate_llm-0.1.0/mate/gguf_import.py +1559 -0
- mate_llm-0.1.0/mate/hf.py +2268 -0
- mate_llm-0.1.0/mate/hf_cache.py +551 -0
- mate_llm-0.1.0/mate/hybrid_decode.py +9616 -0
- mate_llm-0.1.0/mate/inkling2_exact.py +4269 -0
- mate_llm-0.1.0/mate/inkling_mtp.py +3967 -0
- mate_llm-0.1.0/mate/kv_cache.py +345 -0
- mate_llm-0.1.0/mate/kvarn_kv.py +928 -0
- mate_llm-0.1.0/mate/linear.py +1108 -0
- mate_llm-0.1.0/mate/loftq.py +190 -0
- mate_llm-0.1.0/mate/mlx_import.py +1364 -0
- mate_llm-0.1.0/mate/model_resolver.py +830 -0
- mate_llm-0.1.0/mate/moe.py +2321 -0
- mate_llm-0.1.0/mate/nf12.py +538 -0
- mate_llm-0.1.0/mate/offload_engine.py +4015 -0
- mate_llm-0.1.0/mate/quantize.py +4200 -0
- mate_llm-0.1.0/mate/scale_tune.py +1938 -0
- mate_llm-0.1.0/mate/sensitivity.py +2154 -0
- mate_llm-0.1.0/mate/server.py +6510 -0
- mate_llm-0.1.0/mate/sparse_kv.py +4185 -0
- mate_llm-0.1.0/mate/speculative.py +12264 -0
- mate_llm-0.1.0/mate/static_kv.py +4050 -0
- mate_llm-0.1.0/mate/stream_parser.py +654 -0
- mate_llm-0.1.0/mate/stream_quant.py +3994 -0
- mate_llm-0.1.0/mate_llm.egg-info/PKG-INFO +180 -0
- mate_llm-0.1.0/mate_llm.egg-info/SOURCES.txt +212 -0
- mate_llm-0.1.0/mate_llm.egg-info/dependency_links.txt +1 -0
- mate_llm-0.1.0/mate_llm.egg-info/entry_points.txt +2 -0
- mate_llm-0.1.0/mate_llm.egg-info/requires.txt +10 -0
- mate_llm-0.1.0/mate_llm.egg-info/top_level.txt +1 -0
- mate_llm-0.1.0/pyproject.toml +45 -0
- mate_llm-0.1.0/setup.cfg +4 -0
- mate_llm-0.1.0/tests/test_anthropic_and_stream_fsm.py +1083 -0
- mate_llm-0.1.0/tests/test_async_hrq_and_cpu_spec.py +999 -0
- mate_llm-0.1.0/tests/test_carrier_r4kv_and_paged.py +905 -0
- mate_llm-0.1.0/tests/test_chat_spec_drafters.py +1296 -0
- mate_llm-0.1.0/tests/test_cli_auto_fit.py +594 -0
- mate_llm-0.1.0/tests/test_cptc.py +132 -0
- mate_llm-0.1.0/tests/test_cptc_and_hadamard.py +259 -0
- mate_llm-0.1.0/tests/test_cpu_ih4_vnni.py +707 -0
- mate_llm-0.1.0/tests/test_cpu_moe_and_inkling_decode.py +1462 -0
- mate_llm-0.1.0/tests/test_cpu_mojo_step_fusion.py +597 -0
- mate_llm-0.1.0/tests/test_cuda_ext.py +1897 -0
- mate_llm-0.1.0/tests/test_dflash2_and_mtp.py +672 -0
- mate_llm-0.1.0/tests/test_doorbell_3tier_offload.py +632 -0
- mate_llm-0.1.0/tests/test_double_hadamard.py +166 -0
- mate_llm-0.1.0/tests/test_e8_kv.py +392 -0
- mate_llm-0.1.0/tests/test_e8_mojo_ops.py +1056 -0
- mate_llm-0.1.0/tests/test_exl3_and_mlx_import.py +750 -0
- mate_llm-0.1.0/tests/test_exl3_codec.py +140 -0
- mate_llm-0.1.0/tests/test_fast_decode.py +1273 -0
- mate_llm-0.1.0/tests/test_forespark_b64_serving.py +1073 -0
- mate_llm-0.1.0/tests/test_frontier_quality_and_merge.py +556 -0
- mate_llm-0.1.0/tests/test_frontier_runners_e2e.py +1067 -0
- mate_llm-0.1.0/tests/test_frontier_showdown_protocol.py +450 -0
- mate_llm-0.1.0/tests/test_fused_ops.py +97 -0
- mate_llm-0.1.0/tests/test_gdn_treewy_and_h2fp8.py +639 -0
- mate_llm-0.1.0/tests/test_gemm_and_qlora.py +132 -0
- mate_llm-0.1.0/tests/test_gemv_m1_ops.py +1145 -0
- mate_llm-0.1.0/tests/test_gguf_and_cli.py +1476 -0
- mate_llm-0.1.0/tests/test_grouped_moe_and_serving.py +635 -0
- mate_llm-0.1.0/tests/test_grouped_t2tc_moe.py +840 -0
- mate_llm-0.1.0/tests/test_hf_load_quantized.py +205 -0
- mate_llm-0.1.0/tests/test_hrq_avx512_and_pool.py +424 -0
- mate_llm-0.1.0/tests/test_hrq_cpu.py +392 -0
- mate_llm-0.1.0/tests/test_hybrid_decode.py +1362 -0
- mate_llm-0.1.0/tests/test_hyper_res_ops.py +617 -0
- mate_llm-0.1.0/tests/test_inkling2_exact_parity.py +403 -0
- mate_llm-0.1.0/tests/test_inkling_batched_fast.py +456 -0
- mate_llm-0.1.0/tests/test_inkling_cuda_engine.py +3001 -0
- mate_llm-0.1.0/tests/test_inkling_fixes.py +804 -0
- mate_llm-0.1.0/tests/test_inkling_mtp.py +981 -0
- mate_llm-0.1.0/tests/test_inkling_mtp_fast.py +907 -0
- mate_llm-0.1.0/tests/test_isoquant_kv.py +141 -0
- mate_llm-0.1.0/tests/test_kvarn_kv.py +401 -0
- mate_llm-0.1.0/tests/test_lossless_spec_trifecta.py +810 -0
- mate_llm-0.1.0/tests/test_lossless_spec_wave2.py +410 -0
- mate_llm-0.1.0/tests/test_lossless_spec_wave3_batched_bole.py +1131 -0
- mate_llm-0.1.0/tests/test_lossless_spec_wave3_moe_offload.py +930 -0
- mate_llm-0.1.0/tests/test_lossless_spec_wave3_verifier.py +976 -0
- mate_llm-0.1.0/tests/test_max_ops_dispatch.py +240 -0
- mate_llm-0.1.0/tests/test_moe_and_loftq.py +533 -0
- mate_llm-0.1.0/tests/test_moe_and_safetensors.py +114 -0
- mate_llm-0.1.0/tests/test_nf12_and_fusion.py +468 -0
- mate_llm-0.1.0/tests/test_ngq2_engram.py +470 -0
- mate_llm-0.1.0/tests/test_nvfp4_moe_kernel.py +1298 -0
- mate_llm-0.1.0/tests/test_offload_async_cpp.py +424 -0
- mate_llm-0.1.0/tests/test_r4kv_tree_and_inkling_attn.py +771 -0
- mate_llm-0.1.0/tests/test_replayssm_dice_gaad.py +705 -0
- mate_llm-0.1.0/tests/test_run_5090_burst_cli.py +565 -0
- mate_llm-0.1.0/tests/test_scale_tune.py +565 -0
- mate_llm-0.1.0/tests/test_screened_head_and_fp4_t2tc.py +426 -0
- mate_llm-0.1.0/tests/test_sensitivity.py +281 -0
- mate_llm-0.1.0/tests/test_server.py +261 -0
- mate_llm-0.1.0/tests/test_server_and_hf_cache.py +339 -0
- mate_llm-0.1.0/tests/test_sm120_gemm_prefill.py +492 -0
- mate_llm-0.1.0/tests/test_sparse_qsa_mla_kv.py +778 -0
- mate_llm-0.1.0/tests/test_spec_gpu_ops.py +384 -0
- mate_llm-0.1.0/tests/test_speculative.py +833 -0
- mate_llm-0.1.0/tests/test_stream_quant_and_profiles.py +1111 -0
- mate_llm-0.1.0/tests/test_universal_and_wiring.py +260 -0
- mate_llm-0.1.0/tests/test_v2_cpp_core.py +674 -0
- mate_llm-0.1.0/tests/test_v2_cpp_server.py +486 -0
- mate_llm-0.1.0/tests/test_v2_cpp_wave1_integration.py +619 -0
- mate_llm-0.1.0/tests/test_v2_frontier_moe_and_cptc.py +336 -0
- mate_llm-0.1.0/tests/test_v2_gdn_and_adaptive_spec.py +436 -0
- mate_llm-0.1.0/tests/test_v2_gemv_streamk.py +377 -0
- mate_llm-0.1.0/tests/test_v2_hf_and_rotations.py +372 -0
- mate_llm-0.1.0/tests/test_v2_model_resolver_cli.py +502 -0
- mate_llm-0.1.0/tests/test_v2_quality_ldlq.py +261 -0
- mate_llm-0.1.0/tests/test_v2_r4kv_blackwell.py +261 -0
- mate_llm-0.1.0/tests/test_v2_sensitivity_and_moe.py +487 -0
- mate_llm-0.1.0/tests/test_v2_sprint1_quant.py +267 -0
- mate_llm-0.1.0/tests/test_v2_sprint1_sensitivity_moe.py +442 -0
- mate_llm-0.1.0/tests/test_v2_sprint1_tuning_and_kv.py +363 -0
- mate_llm-0.1.0/tests/test_v2_sprint2_u04_gemma4_kv.py +633 -0
- mate_llm-0.1.0/tests/test_v2_sprint2_u06_inkling.py +555 -0
- mate_llm-0.1.0/tests/test_v2_sprint2_u10_fa4_blasst.py +383 -0
- mate_llm-0.1.0/tests/test_v2_sprint2_u12_dp4a_5b6b.py +568 -0
- mate_llm-0.1.0/tests/test_v2_sprint2_u15_sm120a_moe.py +560 -0
- mate_llm-0.1.0/tests/test_v2_sprint2_u17_polygraph.py +679 -0
- mate_llm-0.1.0/tests/test_v2_sprint3_u18_u25_moe_numa.py +511 -0
- mate_llm-0.1.0/tests/test_v2_sprint3_u19_engram.py +411 -0
- mate_llm-0.1.0/tests/test_v2_sprint3_u20_u21_mla_gdn.py +821 -0
- mate_llm-0.1.0/tests/test_v2_sprint3_u23_cpu_simd.py +396 -0
- mate_llm-0.1.0/tests/test_v2_sprint4_loopquant.py +810 -0
- mate_llm-0.1.0/tests/test_v2_sprint4_max_ops.py +1259 -0
- mate_llm-0.1.0/tests/test_v2_sprint4_runtime.py +855 -0
- mate_llm-0.1.0/tests/test_v2_sprint5_m1_quant.py +455 -0
- mate_llm-0.1.0/tests/test_v2_sprint5_m2_mixed_dry.py +621 -0
- mate_llm-0.1.0/tests/test_v2_sprint5_m3_gemv_t2tc.py +339 -0
- mate_llm-0.1.0/tests/test_v2_sprint5_m4_spec_loopcd.py +801 -0
- mate_llm-0.1.0/tests/test_v2_sprint5_m5_systems.py +647 -0
- mate_llm-0.1.0/tests/test_xor_nariq_upgrades.py +550 -0
mate_llm-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based upon (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind) by name to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by the Licensor or its
|
|
58
|
+
representatives for the purpose of discussing and improving the Work,
|
|
59
|
+
but excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the Licensor or its representatives as
|
|
61
|
+
"Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
exercising permissions granted by this License.
|
|
65
|
+
|
|
66
|
+
"Derivative Works" are governed by the terms below.
|
|
67
|
+
|
|
68
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
69
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
70
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
71
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
72
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
73
|
+
Work and such Derivative Works in Source or Object form.
|
|
74
|
+
|
|
75
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
76
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
77
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
78
|
+
(except as stated in this section) patent license to make, have made,
|
|
79
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
80
|
+
where such license applies only to those patent claims licensable
|
|
81
|
+
by such Contributor that are necessarily infringed by their
|
|
82
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
83
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
84
|
+
institute patent litigation against any entity (including a
|
|
85
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
86
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
87
|
+
or contributory patent infringement, then any patent licenses
|
|
88
|
+
granted to You under this License shall terminate as of the date
|
|
89
|
+
such litigation is filed.
|
|
90
|
+
|
|
91
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
92
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
93
|
+
modifications, and in Source or Object form, provided that You
|
|
94
|
+
meet the following conditions:
|
|
95
|
+
|
|
96
|
+
(a) You must give any other recipients of the Work or
|
|
97
|
+
Derivative Works a copy of this License.
|
|
98
|
+
|
|
99
|
+
(b) You must cause any modified files to carry prominent notices
|
|
100
|
+
stating that You modified the files.
|
|
101
|
+
|
|
102
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
103
|
+
that You distribute, all copyright notices, patent notices,
|
|
104
|
+
and trademark notices from the Source form of the Work,
|
|
105
|
+
excluding those notices that do not apply to any part of
|
|
106
|
+
the Work.
|
|
107
|
+
|
|
108
|
+
(d) If the Work includes a NOTICE file containing text such as the
|
|
109
|
+
"NOTICE" file included in the Work, then any Derivative Works
|
|
110
|
+
that You distribute must include a NOTICE file containing
|
|
111
|
+
a readable copy of the Work.
|
|
112
|
+
|
|
113
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
114
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
115
|
+
by You to Licensor shall be licensed under the terms of the License,
|
|
116
|
+
without any additional terms or conditions.
|
|
117
|
+
|
|
118
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
119
|
+
names, trademarks, or service names of the Work.
|
|
120
|
+
|
|
121
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
122
|
+
agreed to in writing, Licensor provides the Work on an "AS IS"
|
|
123
|
+
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
|
124
|
+
or implied, including, without limitation, any warranties or
|
|
125
|
+
conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS
|
|
126
|
+
FOR A PARTICULAR PURPOSE.
|
|
127
|
+
|
|
128
|
+
8. Limitation of Liability. In no event shall any Contributor be liable
|
|
129
|
+
to You for damages, including any direct, indirect, special,
|
|
130
|
+
incidental, or consequential damages arising out of this License.
|
|
131
|
+
|
|
132
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
133
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
134
|
+
and charge a fee for, acceptance of support, warranty, or indemnity
|
|
135
|
+
liability.
|
|
136
|
+
|
|
137
|
+
END OF TERMS AND CONDITIONS
|
mate_llm-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mate-llm
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: MATE (Memory-Aligned Trellis Engine): CPTC-TQIR trellis quantization, Trellis-QLoRA training, and compressed KV/MoE kernels in Mojo and CUDA
|
|
5
|
+
License: Apache-2.0
|
|
6
|
+
Project-URL: Homepage, https://github.com/Honkware/mate-llm
|
|
7
|
+
Project-URL: Repository, https://github.com/Honkware/mate-llm
|
|
8
|
+
Project-URL: Issues, https://github.com/Honkware/mate-llm/issues
|
|
9
|
+
Requires-Python: >=3.11
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Requires-Dist: numpy>=1.26
|
|
13
|
+
Requires-Dist: torch>=2.3
|
|
14
|
+
Requires-Dist: safetensors>=0.4
|
|
15
|
+
Provides-Extra: hf
|
|
16
|
+
Requires-Dist: transformers>=4.45; extra == "hf"
|
|
17
|
+
Requires-Dist: huggingface_hub>=0.25; extra == "hf"
|
|
18
|
+
Provides-Extra: dev
|
|
19
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
20
|
+
Dynamic: license-file
|
|
21
|
+
|
|
22
|
+
# MATE: Memory-Aligned Trellis Engine
|
|
23
|
+
|
|
24
|
+
2-to-4 bit trellis quantization, compressed-KV CUDA/Mojo inference, bare-metal C++20 serving, 3-tier MoE offload, and zero-materialization Trellis-QLoRA fine-tuning for local GPUs and CPUs.
|
|
25
|
+
|
|
26
|
+
[Quickstart](#quickstart) | [Benchmarks](#benchmarks) | [Support Matrix](#support-matrix) | [Documentation](#documentation)
|
|
27
|
+
|
|
28
|
+
## Highlights
|
|
29
|
+
|
|
30
|
+
- **2-4 bit CPTC-TQIR weights:** Hessian-aware sequential GPTAQ LDLQ with GPU curvature-weighted Viterbi, per-head V-O Hadamard folding (`R2`), KL tile-scale distillation, 6-bit trellis / probability-banded `lm_head` export, and universal GGUF v2/v3, EXL3, MLX, and Hugging Face import.
|
|
31
|
+
- **Native Blackwell/Ada CUDA + Mojo 1.2 CPU kernels:** Zero-SMEM pure-ALU `trellis_gemv_v3` (`dp4a` + `svh` epilogue + Stream-K), zero-spill `r4kv_decode_attn` with 128-split Blackwell merge, fused `conv1d+GDN` with L2 state persistence, and zero-`libmax.so` Mojo AVX-512 VNNI / AVX2 CPU SIMD decode.
|
|
32
|
+
- **4.5x-6.4x compressed KV caches:** Default rotated 4-bit/2-bit `R4KV` (up to 1M-token context in 24.3 GB VRAM), 8D `E8` lattice (`2.0-4.0` bpw), dual-scaled `KVarN`, and 3-bit `IsoQuant`.
|
|
33
|
+
- **Dual Python + bare-metal C++20 serving:** Continuous batching (`B=64`), OpenAI `/v1/chat/completions` and Anthropic `/v1/messages` APIs, confidence-gated speculative decoding (`UnifiedSpeculatorRouter`, Suffix/SAM, Native MTP, `DFlash 2`), and standalone zero-Python C++20 `mate-serve` (`mate/csrc/runtime/`).
|
|
34
|
+
- **Frontier MoE & Trellis-QLoRA:** 3-tier GPU doorbell MoE offload (VRAM hot pool + pinned RAM victim cache + 4 KiB-aligned NVMe), exact `Qwen3.8-Flash-Next` / `Hy4-Flash` / `Inkling-2-Mini` hybrid runners, and frozen-base Trellis-QLoRA + LoftQ fine-tuning.
|
|
35
|
+
|
|
36
|
+
## Quickstart
|
|
37
|
+
|
|
38
|
+
### Install
|
|
39
|
+
|
|
40
|
+
Requires Python 3.11+ and PyTorch 2.3+. On NVIDIA GPUs with `nvcc` and `ninja`, `mate` JIT-compiles its CUDA extension (`mate/csrc/`) natively with no Mojo dependency. Mojo 1.2+ is optional on CUDA machines and is only needed for CPU SIMD (`mate/libmate.so`).
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
pip install "mate-llm[hf]"
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
For local development from source:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
pip install -e ".[hf]"
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
To build the optional standalone bare-metal C++20 server (`mate-serve` + `libmate_runtime.so`):
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
cmake -S mate/csrc/runtime -B build/runtime -DCMAKE_BUILD_TYPE=Release
|
|
56
|
+
cmake --build build/runtime -j
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Run, Serve, or Quantize
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
# Run a pre-quantized MATE checkpoint directly from Hugging Face
|
|
63
|
+
mate run Honkware/Qwen3-8B-MATE-4b --ctx 32768 --serve
|
|
64
|
+
|
|
65
|
+
# Check hardware memory fit offline (no weight download)
|
|
66
|
+
mate fit Qwen/Qwen3-8B --ctx 32768
|
|
67
|
+
|
|
68
|
+
# Interactive chat or OpenAI/Anthropic HTTP server
|
|
69
|
+
mate chat Qwen/Qwen3-8B --bits 4
|
|
70
|
+
mate serve Qwen/Qwen3-8B --bits 4 --max-seq-len 32768 --host 127.0.0.1 --port 8000
|
|
71
|
+
|
|
72
|
+
# Quantize a Hugging Face model or GGUF checkpoint to .mate.safetensors
|
|
73
|
+
mate quantize Qwen/Qwen3-8B -o qwen3-8b-4b.mate.safetensors --bits 4 --depth 10
|
|
74
|
+
mate inspect qwen3-8b-4b.mate.safetensors
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Query the server with any OpenAI or Anthropic client (`OPENAI_BASE_URL=http://127.0.0.1:8000/v1`, `ANTHROPIC_BASE_URL=http://127.0.0.1:8000`):
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
curl http://127.0.0.1:8000/v1/chat/completions \
|
|
81
|
+
-H "Content-Type: application/json" \
|
|
82
|
+
-d '{"model":"Qwen/Qwen3-8B","messages":[{"role":"user","content":"Write a C++20 lock-free ring buffer."}]}'
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Python API
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
import torch
|
|
89
|
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
|
90
|
+
from mate.double_hadamard import fold_vo_head_hadamard
|
|
91
|
+
from mate.fast_decode import FastDecodeRunner
|
|
92
|
+
from mate.hf import quantize_model
|
|
93
|
+
from mate._policy import RoleQuantPolicy
|
|
94
|
+
|
|
95
|
+
model_id = "Qwen/Qwen3-8B"
|
|
96
|
+
tok = AutoTokenizer.from_pretrained(model_id)
|
|
97
|
+
model = AutoModelForCausalLM.from_pretrained(model_id, dtype=torch.bfloat16, device_map="cuda").eval()
|
|
98
|
+
|
|
99
|
+
fold_vo_head_hadamard(model)
|
|
100
|
+
quantize_model(model, policy=RoleQuantPolicy(dense_bits=4, trellis_depth=10), mode="mse")
|
|
101
|
+
|
|
102
|
+
runner = FastDecodeRunner(model, max_seq_len=32768, kv_mode="r4kv")
|
|
103
|
+
prompt = tok.encode("Explain tail-biting trellis quantization in two sentences.", return_tensors="pt").cuda()
|
|
104
|
+
out = runner.generate(prompt, max_new_tokens=128)
|
|
105
|
+
print(tok.decode(out[0], skip_special_tokens=True))
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Pre-Quantized Checkpoints
|
|
109
|
+
|
|
110
|
+
Ready-to-run `.mate.safetensors` checkpoints are published on Hugging Face under [huggingface.co/Honkware](https://huggingface.co/Honkware):
|
|
111
|
+
|
|
112
|
+
| Model Family | Variants | Architecture |
|
|
113
|
+
|---|---|---|
|
|
114
|
+
| `Qwen/Qwen3-8B` | [`4b`](https://huggingface.co/Honkware/Qwen3-8B-MATE-4b), [`3b`](https://huggingface.co/Honkware/Qwen3-8B-MATE-3b), [`2b`](https://huggingface.co/Honkware/Qwen3-8B-MATE-2b) | Dense GQA |
|
|
115
|
+
| `meta-llama/Llama-3.1-8B-Instruct` | [`4b`](https://huggingface.co/Honkware/Meta-Llama-3.1-8B-Instruct-MATE-4b), [`3b`](https://huggingface.co/Honkware/Meta-Llama-3.1-8B-Instruct-MATE-3b), [`2b`](https://huggingface.co/Honkware/Meta-Llama-3.1-8B-Instruct-MATE-2b) | Dense GQA |
|
|
116
|
+
| `Qwen/Qwen3-14B` | [`4b`](https://huggingface.co/Honkware/Qwen3-14B-MATE-4b), [`3b`](https://huggingface.co/Honkware/Qwen3-14B-MATE-3b), [`2b`](https://huggingface.co/Honkware/Qwen3-14B-MATE-2b) | Dense GQA |
|
|
117
|
+
| `google/gemma-4-12B-it` | [`4b`](https://huggingface.co/Honkware/gemma-4-12B-it-MATE-4b), [`3b`](https://huggingface.co/Honkware/gemma-4-12B-it-MATE-3b), [`2b`](https://huggingface.co/Honkware/gemma-4-12B-it-MATE-2b) | Sliding + Global Hybrid |
|
|
118
|
+
| `Qwen3.8-27B` | [`4b`](https://huggingface.co/Honkware/Qwen3.8-27B-MATE-4b), [`3b`](https://huggingface.co/Honkware/Qwen3.8-27B-MATE-3b), [`2b`](https://huggingface.co/Honkware/Qwen3.8-27B-MATE-2b) | 64L GDN + Full Attention |
|
|
119
|
+
| `Inkling-2-Mini` | [`13GB`](https://huggingface.co/Honkware/Inkling-2-Mini-MATE-13GB), [`8.3GB`](https://huggingface.co/Honkware/Inkling-2-Mini-MATE-8.3GB) | Looped MoE |
|
|
120
|
+
| `Qwen3.8-Flash-Next` | [`3b`](https://huggingface.co/Honkware/Qwen3.8-Flash-Next-MATE-3b), [`mixed-45GB`](https://huggingface.co/Honkware/Qwen3.8-Flash-Next-MATE-mixed-45GB) | 512-Expert MoE + Sparse-QSA |
|
|
121
|
+
| `Hy4-Flash` | [`3b`](https://huggingface.co/Honkware/Hy4-Flash-MATE-3b) | LatentMoE + MLA + Engram |
|
|
122
|
+
|
|
123
|
+
## Benchmarks
|
|
124
|
+
|
|
125
|
+
All numbers below are measured live on single GPUs (`sm_120a` Blackwell PRO 6000, `R4KV` 4-bit KV cache, CUDA Graphs). Full tables covering `2b`/`3b`/`4b`, NVIDIA L4 (`sm_89`), RTX 5090, batched decode (`803 tok/s` at `B=48` on `Qwen3-8B-4b`; `6,728 tok/s` at `B=64` on `Inkling-2-Mini`), 1M-token context, and Mojo CPU SIMD kernels are in [docs/benchmarks.md](docs/benchmarks.md).
|
|
126
|
+
|
|
127
|
+
### 4-Bit & 3-Bit Dense / Hybrid Quality & Single-Stream Decode (PRO 6000, 96 GB)
|
|
128
|
+
|
|
129
|
+
Evaluated on `wikitext-2-raw-v1:test` at `seq_len=2048` (100 windows) against BF16 reference:
|
|
130
|
+
|
|
131
|
+
| Model | Variant | Size | WT-2 PPL (`delta`) | KLD | Top-1 | `d=128` (`tok/s`) | `d=32,768` (`tok/s`) | Peak VRAM (`32K`) |
|
|
132
|
+
|---|---|---:|---:|---:|---:|---:|---:|---:|
|
|
133
|
+
| `Qwen3-8B` | `CPTC-4b` | 5.67 GiB | **9.581** (+0.11%) | **0.0315** | **93.23%** | **196.2** | **123.6** | 7.36 GB |
|
|
134
|
+
| `Qwen3-8B` | `CPTC-3b` | 4.86 GiB | **10.009** (+4.58%) | **0.1119** | **87.29%** | **244.9** | **142.2** | 6.67 GB |
|
|
135
|
+
| `Llama-3.1-8B-Instruct` | `CPTC-4b` | 5.33 GiB | **7.378** (+2.23%) | **0.0277** | **93.13%** | **208.4** | **134.2** | 7.25 GB |
|
|
136
|
+
| `Qwen3-14B` | `CPTC-4b` | 9.26 GiB | **8.505** (+0.65%) | **0.0231** | **94.08%** | **124.2** | **95.1** | 11.82 GB |
|
|
137
|
+
| `gemma-4-12B-it` | `CPTC-4b` | 7.15 GiB | **13.283** (-0.09%) | **0.0682** | **90.97%** | **113.8** | **78.9** | 9.90 GB |
|
|
138
|
+
| `Qwen3.8-27B` | `CPTC-4b` | 16.50 GiB | **6.714** (-0.72%) | **0.0245** | **94.25%** | **64.8** | **60.3** | 17.49 GB |
|
|
139
|
+
| `Qwen3.8-27B` | `CPTC-3b` | 13.67 GiB | **6.922** (+2.36%) | **0.0662** | **90.03%** | **80.6** | **73.9** | 14.72 GB |
|
|
140
|
+
|
|
141
|
+
### Frontier & Batched Highlights (PRO 6000, 96 GB)
|
|
142
|
+
|
|
143
|
+
| Model | Config | Context `d` | Throughput (`tok/s`) | Peak VRAM |
|
|
144
|
+
|---|---|---:|---:|---:|
|
|
145
|
+
| `Inkling-2-Mini` | `FP8Dense` (`B=64`, `k=7`, Native DSpark) | 640 | **6,728.60** (105.13/user) | 43.14 GB |
|
|
146
|
+
| `Inkling-2-Mini` | `BF16Dense` lossless (`B=64`, `k=7`, Native DSpark) | 640 | **6,514.88** (101.79/user) | 43.16 GB |
|
|
147
|
+
| `Inkling-2-Mini` | `FP8Dense` (`M=1`, `r4k_r2v` KV, CPU embed offload) | **1,048,576** | **54.00** | **23.04 GB** |
|
|
148
|
+
| `Qwen3-8B` | `CPTC-4b` (`B=48`, ragged `R4KV`) | 128 | **803.08** (16.73/user) | **8.73 GB** |
|
|
149
|
+
|
|
150
|
+
## Support Matrix
|
|
151
|
+
|
|
152
|
+
### Hardware Backends
|
|
153
|
+
|
|
154
|
+
| Target | Compute Path | Requirements | Notes |
|
|
155
|
+
|---|---|---|---|
|
|
156
|
+
| NVIDIA Blackwell (`sm_120a`) | Native CUDA (`trellis_gemv_v3`, `r4kv`, `gdn`, `t2tc`, `nvfp4_moe`) | CUDA 12.8+, `nvcc`, `ninja` | Full DP4A, PDL, Stream-K, 128-split R4KV, L2 GDN persistence |
|
|
157
|
+
| NVIDIA Hopper / Ada (`sm_90` / `sm_89`) | Native CUDA (`trellis_gemv_v3`, `r4kv`, `gdn`, `e8_v3`) | CUDA 12.1+, `nvcc`, `ninja` | Full CUDA-Graph decode and compressed KV |
|
|
158
|
+
| NVIDIA Ampere (`sm_80` / `sm_86`) | Native CUDA (`trellis_gemv_v3`, `r4kv`, `e8_v3`) | CUDA 12.1+, `nvcc`, `ninja` | DP4A GEMV and compressed KV |
|
|
159
|
+
| x86-64 AVX-512 VNNI / AVX2 | Mojo 1.2 `mate/libmate.so` (`IH4-VNNI-BiasHoist`) | Mojo 1.2+ | Zero `libmax.so` runtime dependency |
|
|
160
|
+
| Fallback (non-CUDA / CPU) | PyTorch reference | Python 3.11+, PyTorch 2.3+ | Functional fallback for testing and export |
|
|
161
|
+
|
|
162
|
+
> [!NOTE]
|
|
163
|
+
> ROCm, Metal, and Vulkan backends are not supported yet. On CUDA machines, Mojo 1.2 is optional and only loaded lazily when invoking CPU SIMD kernels.
|
|
164
|
+
|
|
165
|
+
### Capabilities
|
|
166
|
+
|
|
167
|
+
- **Model families:** Llama / Mistral / Qwen2 / Qwen3 (`FastDecodeRunner`), Qwen3.5 / Qwen3.8 Gated DeltaNet + Full Attention, Gemma 4 heterogeneous sliding/global attention, `Inkling-2-Mini` looped MoE, `Qwen3.8-Flash-Next` (512-expert MoE + Sparse-QSA + Layer-1 Engram), and `Hy4-Flash` (iHC + MLA + Engram + DFly2 drafter hooks).
|
|
168
|
+
- **Input formats:** Hugging Face (`BF16/FP16/FP8/NVFP4/MXFP4/AWQ/GPTQ/NF4`), GGUF v2/v3 (all 36 GGML types), EXL3, and MLX.
|
|
169
|
+
- **KV backends (`--kv-backend`):** `r4kv` (4b/2b rotated, default on CUDA), `e8` (8D lattice `2.0-4.0` bpw), `kvarn` (`k4v2/k4v4/k2v2`), `isoquant` (3b scalar / HF cache), `fp16`.
|
|
170
|
+
- **Speculative modes (`--speculative`):** `auto`, `router` (`UnifiedSpeculatorRouter`), `suffix` / `sam`, `mtp`, `dflash2` / `dspark` / `dspine`, `--draft-model`, `none`.
|
|
171
|
+
|
|
172
|
+
## Documentation
|
|
173
|
+
|
|
174
|
+
- [docs/benchmarks.md](docs/benchmarks.md): Full single-GPU-per-table Blackwell PRO 6000, RTX 5090, and Mojo CPU benchmark reports.
|
|
175
|
+
- [docs/architecture.md](docs/architecture.md): Repository layout, CPTC-TQIR weight format, CUDA/Mojo kernels, and bare-metal C++20 `mate-serve` runtime.
|
|
176
|
+
- [docs/serving.md](docs/serving.md): CLI reference (`mate fit`, `mate run`, `mate serve`, `mate quantize`), OpenAI and Anthropic HTTP endpoints, and speculative decoding controls.
|
|
177
|
+
|
|
178
|
+
## License
|
|
179
|
+
|
|
180
|
+
Apache-2.0. See [LICENSE](LICENSE).
|
mate_llm-0.1.0/README.md
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
# MATE: Memory-Aligned Trellis Engine
|
|
2
|
+
|
|
3
|
+
2-to-4 bit trellis quantization, compressed-KV CUDA/Mojo inference, bare-metal C++20 serving, 3-tier MoE offload, and zero-materialization Trellis-QLoRA fine-tuning for local GPUs and CPUs.
|
|
4
|
+
|
|
5
|
+
[Quickstart](#quickstart) | [Benchmarks](#benchmarks) | [Support Matrix](#support-matrix) | [Documentation](#documentation)
|
|
6
|
+
|
|
7
|
+
## Highlights
|
|
8
|
+
|
|
9
|
+
- **2-4 bit CPTC-TQIR weights:** Hessian-aware sequential GPTAQ LDLQ with GPU curvature-weighted Viterbi, per-head V-O Hadamard folding (`R2`), KL tile-scale distillation, 6-bit trellis / probability-banded `lm_head` export, and universal GGUF v2/v3, EXL3, MLX, and Hugging Face import.
|
|
10
|
+
- **Native Blackwell/Ada CUDA + Mojo 1.2 CPU kernels:** Zero-SMEM pure-ALU `trellis_gemv_v3` (`dp4a` + `svh` epilogue + Stream-K), zero-spill `r4kv_decode_attn` with 128-split Blackwell merge, fused `conv1d+GDN` with L2 state persistence, and zero-`libmax.so` Mojo AVX-512 VNNI / AVX2 CPU SIMD decode.
|
|
11
|
+
- **4.5x-6.4x compressed KV caches:** Default rotated 4-bit/2-bit `R4KV` (up to 1M-token context in 24.3 GB VRAM), 8D `E8` lattice (`2.0-4.0` bpw), dual-scaled `KVarN`, and 3-bit `IsoQuant`.
|
|
12
|
+
- **Dual Python + bare-metal C++20 serving:** Continuous batching (`B=64`), OpenAI `/v1/chat/completions` and Anthropic `/v1/messages` APIs, confidence-gated speculative decoding (`UnifiedSpeculatorRouter`, Suffix/SAM, Native MTP, `DFlash 2`), and standalone zero-Python C++20 `mate-serve` (`mate/csrc/runtime/`).
|
|
13
|
+
- **Frontier MoE & Trellis-QLoRA:** 3-tier GPU doorbell MoE offload (VRAM hot pool + pinned RAM victim cache + 4 KiB-aligned NVMe), exact `Qwen3.8-Flash-Next` / `Hy4-Flash` / `Inkling-2-Mini` hybrid runners, and frozen-base Trellis-QLoRA + LoftQ fine-tuning.
|
|
14
|
+
|
|
15
|
+
## Quickstart
|
|
16
|
+
|
|
17
|
+
### Install
|
|
18
|
+
|
|
19
|
+
Requires Python 3.11+ and PyTorch 2.3+. On NVIDIA GPUs with `nvcc` and `ninja`, `mate` JIT-compiles its CUDA extension (`mate/csrc/`) natively with no Mojo dependency. Mojo 1.2+ is optional on CUDA machines and is only needed for CPU SIMD (`mate/libmate.so`).
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pip install "mate-llm[hf]"
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
For local development from source:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pip install -e ".[hf]"
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
To build the optional standalone bare-metal C++20 server (`mate-serve` + `libmate_runtime.so`):
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
cmake -S mate/csrc/runtime -B build/runtime -DCMAKE_BUILD_TYPE=Release
|
|
35
|
+
cmake --build build/runtime -j
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Run, Serve, or Quantize
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
# Run a pre-quantized MATE checkpoint directly from Hugging Face
|
|
42
|
+
mate run Honkware/Qwen3-8B-MATE-4b --ctx 32768 --serve
|
|
43
|
+
|
|
44
|
+
# Check hardware memory fit offline (no weight download)
|
|
45
|
+
mate fit Qwen/Qwen3-8B --ctx 32768
|
|
46
|
+
|
|
47
|
+
# Interactive chat or OpenAI/Anthropic HTTP server
|
|
48
|
+
mate chat Qwen/Qwen3-8B --bits 4
|
|
49
|
+
mate serve Qwen/Qwen3-8B --bits 4 --max-seq-len 32768 --host 127.0.0.1 --port 8000
|
|
50
|
+
|
|
51
|
+
# Quantize a Hugging Face model or GGUF checkpoint to .mate.safetensors
|
|
52
|
+
mate quantize Qwen/Qwen3-8B -o qwen3-8b-4b.mate.safetensors --bits 4 --depth 10
|
|
53
|
+
mate inspect qwen3-8b-4b.mate.safetensors
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Query the server with any OpenAI or Anthropic client (`OPENAI_BASE_URL=http://127.0.0.1:8000/v1`, `ANTHROPIC_BASE_URL=http://127.0.0.1:8000`):
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
curl http://127.0.0.1:8000/v1/chat/completions \
|
|
60
|
+
-H "Content-Type: application/json" \
|
|
61
|
+
-d '{"model":"Qwen/Qwen3-8B","messages":[{"role":"user","content":"Write a C++20 lock-free ring buffer."}]}'
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Python API
|
|
65
|
+
|
|
66
|
+
```python
|
|
67
|
+
import torch
|
|
68
|
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
|
69
|
+
from mate.double_hadamard import fold_vo_head_hadamard
|
|
70
|
+
from mate.fast_decode import FastDecodeRunner
|
|
71
|
+
from mate.hf import quantize_model
|
|
72
|
+
from mate._policy import RoleQuantPolicy
|
|
73
|
+
|
|
74
|
+
model_id = "Qwen/Qwen3-8B"
|
|
75
|
+
tok = AutoTokenizer.from_pretrained(model_id)
|
|
76
|
+
model = AutoModelForCausalLM.from_pretrained(model_id, dtype=torch.bfloat16, device_map="cuda").eval()
|
|
77
|
+
|
|
78
|
+
fold_vo_head_hadamard(model)
|
|
79
|
+
quantize_model(model, policy=RoleQuantPolicy(dense_bits=4, trellis_depth=10), mode="mse")
|
|
80
|
+
|
|
81
|
+
runner = FastDecodeRunner(model, max_seq_len=32768, kv_mode="r4kv")
|
|
82
|
+
prompt = tok.encode("Explain tail-biting trellis quantization in two sentences.", return_tensors="pt").cuda()
|
|
83
|
+
out = runner.generate(prompt, max_new_tokens=128)
|
|
84
|
+
print(tok.decode(out[0], skip_special_tokens=True))
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Pre-Quantized Checkpoints
|
|
88
|
+
|
|
89
|
+
Ready-to-run `.mate.safetensors` checkpoints are published on Hugging Face under [huggingface.co/Honkware](https://huggingface.co/Honkware):
|
|
90
|
+
|
|
91
|
+
| Model Family | Variants | Architecture |
|
|
92
|
+
|---|---|---|
|
|
93
|
+
| `Qwen/Qwen3-8B` | [`4b`](https://huggingface.co/Honkware/Qwen3-8B-MATE-4b), [`3b`](https://huggingface.co/Honkware/Qwen3-8B-MATE-3b), [`2b`](https://huggingface.co/Honkware/Qwen3-8B-MATE-2b) | Dense GQA |
|
|
94
|
+
| `meta-llama/Llama-3.1-8B-Instruct` | [`4b`](https://huggingface.co/Honkware/Meta-Llama-3.1-8B-Instruct-MATE-4b), [`3b`](https://huggingface.co/Honkware/Meta-Llama-3.1-8B-Instruct-MATE-3b), [`2b`](https://huggingface.co/Honkware/Meta-Llama-3.1-8B-Instruct-MATE-2b) | Dense GQA |
|
|
95
|
+
| `Qwen/Qwen3-14B` | [`4b`](https://huggingface.co/Honkware/Qwen3-14B-MATE-4b), [`3b`](https://huggingface.co/Honkware/Qwen3-14B-MATE-3b), [`2b`](https://huggingface.co/Honkware/Qwen3-14B-MATE-2b) | Dense GQA |
|
|
96
|
+
| `google/gemma-4-12B-it` | [`4b`](https://huggingface.co/Honkware/gemma-4-12B-it-MATE-4b), [`3b`](https://huggingface.co/Honkware/gemma-4-12B-it-MATE-3b), [`2b`](https://huggingface.co/Honkware/gemma-4-12B-it-MATE-2b) | Sliding + Global Hybrid |
|
|
97
|
+
| `Qwen3.8-27B` | [`4b`](https://huggingface.co/Honkware/Qwen3.8-27B-MATE-4b), [`3b`](https://huggingface.co/Honkware/Qwen3.8-27B-MATE-3b), [`2b`](https://huggingface.co/Honkware/Qwen3.8-27B-MATE-2b) | 64L GDN + Full Attention |
|
|
98
|
+
| `Inkling-2-Mini` | [`13GB`](https://huggingface.co/Honkware/Inkling-2-Mini-MATE-13GB), [`8.3GB`](https://huggingface.co/Honkware/Inkling-2-Mini-MATE-8.3GB) | Looped MoE |
|
|
99
|
+
| `Qwen3.8-Flash-Next` | [`3b`](https://huggingface.co/Honkware/Qwen3.8-Flash-Next-MATE-3b), [`mixed-45GB`](https://huggingface.co/Honkware/Qwen3.8-Flash-Next-MATE-mixed-45GB) | 512-Expert MoE + Sparse-QSA |
|
|
100
|
+
| `Hy4-Flash` | [`3b`](https://huggingface.co/Honkware/Hy4-Flash-MATE-3b) | LatentMoE + MLA + Engram |
|
|
101
|
+
|
|
102
|
+
## Benchmarks
|
|
103
|
+
|
|
104
|
+
All numbers below are measured live on single GPUs (`sm_120a` Blackwell PRO 6000, `R4KV` 4-bit KV cache, CUDA Graphs). Full tables covering `2b`/`3b`/`4b`, NVIDIA L4 (`sm_89`), RTX 5090, batched decode (`803 tok/s` at `B=48` on `Qwen3-8B-4b`; `6,728 tok/s` at `B=64` on `Inkling-2-Mini`), 1M-token context, and Mojo CPU SIMD kernels are in [docs/benchmarks.md](docs/benchmarks.md).
|
|
105
|
+
|
|
106
|
+
### 4-Bit & 3-Bit Dense / Hybrid Quality & Single-Stream Decode (PRO 6000, 96 GB)
|
|
107
|
+
|
|
108
|
+
Evaluated on `wikitext-2-raw-v1:test` at `seq_len=2048` (100 windows) against BF16 reference:
|
|
109
|
+
|
|
110
|
+
| Model | Variant | Size | WT-2 PPL (`delta`) | KLD | Top-1 | `d=128` (`tok/s`) | `d=32,768` (`tok/s`) | Peak VRAM (`32K`) |
|
|
111
|
+
|---|---|---:|---:|---:|---:|---:|---:|---:|
|
|
112
|
+
| `Qwen3-8B` | `CPTC-4b` | 5.67 GiB | **9.581** (+0.11%) | **0.0315** | **93.23%** | **196.2** | **123.6** | 7.36 GB |
|
|
113
|
+
| `Qwen3-8B` | `CPTC-3b` | 4.86 GiB | **10.009** (+4.58%) | **0.1119** | **87.29%** | **244.9** | **142.2** | 6.67 GB |
|
|
114
|
+
| `Llama-3.1-8B-Instruct` | `CPTC-4b` | 5.33 GiB | **7.378** (+2.23%) | **0.0277** | **93.13%** | **208.4** | **134.2** | 7.25 GB |
|
|
115
|
+
| `Qwen3-14B` | `CPTC-4b` | 9.26 GiB | **8.505** (+0.65%) | **0.0231** | **94.08%** | **124.2** | **95.1** | 11.82 GB |
|
|
116
|
+
| `gemma-4-12B-it` | `CPTC-4b` | 7.15 GiB | **13.283** (-0.09%) | **0.0682** | **90.97%** | **113.8** | **78.9** | 9.90 GB |
|
|
117
|
+
| `Qwen3.8-27B` | `CPTC-4b` | 16.50 GiB | **6.714** (-0.72%) | **0.0245** | **94.25%** | **64.8** | **60.3** | 17.49 GB |
|
|
118
|
+
| `Qwen3.8-27B` | `CPTC-3b` | 13.67 GiB | **6.922** (+2.36%) | **0.0662** | **90.03%** | **80.6** | **73.9** | 14.72 GB |
|
|
119
|
+
|
|
120
|
+
### Frontier & Batched Highlights (PRO 6000, 96 GB)
|
|
121
|
+
|
|
122
|
+
| Model | Config | Context `d` | Throughput (`tok/s`) | Peak VRAM |
|
|
123
|
+
|---|---|---:|---:|---:|
|
|
124
|
+
| `Inkling-2-Mini` | `FP8Dense` (`B=64`, `k=7`, Native DSpark) | 640 | **6,728.60** (105.13/user) | 43.14 GB |
|
|
125
|
+
| `Inkling-2-Mini` | `BF16Dense` lossless (`B=64`, `k=7`, Native DSpark) | 640 | **6,514.88** (101.79/user) | 43.16 GB |
|
|
126
|
+
| `Inkling-2-Mini` | `FP8Dense` (`M=1`, `r4k_r2v` KV, CPU embed offload) | **1,048,576** | **54.00** | **23.04 GB** |
|
|
127
|
+
| `Qwen3-8B` | `CPTC-4b` (`B=48`, ragged `R4KV`) | 128 | **803.08** (16.73/user) | **8.73 GB** |
|
|
128
|
+
|
|
129
|
+
## Support Matrix
|
|
130
|
+
|
|
131
|
+
### Hardware Backends
|
|
132
|
+
|
|
133
|
+
| Target | Compute Path | Requirements | Notes |
|
|
134
|
+
|---|---|---|---|
|
|
135
|
+
| NVIDIA Blackwell (`sm_120a`) | Native CUDA (`trellis_gemv_v3`, `r4kv`, `gdn`, `t2tc`, `nvfp4_moe`) | CUDA 12.8+, `nvcc`, `ninja` | Full DP4A, PDL, Stream-K, 128-split R4KV, L2 GDN persistence |
|
|
136
|
+
| NVIDIA Hopper / Ada (`sm_90` / `sm_89`) | Native CUDA (`trellis_gemv_v3`, `r4kv`, `gdn`, `e8_v3`) | CUDA 12.1+, `nvcc`, `ninja` | Full CUDA-Graph decode and compressed KV |
|
|
137
|
+
| NVIDIA Ampere (`sm_80` / `sm_86`) | Native CUDA (`trellis_gemv_v3`, `r4kv`, `e8_v3`) | CUDA 12.1+, `nvcc`, `ninja` | DP4A GEMV and compressed KV |
|
|
138
|
+
| x86-64 AVX-512 VNNI / AVX2 | Mojo 1.2 `mate/libmate.so` (`IH4-VNNI-BiasHoist`) | Mojo 1.2+ | Zero `libmax.so` runtime dependency |
|
|
139
|
+
| Fallback (non-CUDA / CPU) | PyTorch reference | Python 3.11+, PyTorch 2.3+ | Functional fallback for testing and export |
|
|
140
|
+
|
|
141
|
+
> [!NOTE]
|
|
142
|
+
> ROCm, Metal, and Vulkan backends are not supported yet. On CUDA machines, Mojo 1.2 is optional and only loaded lazily when invoking CPU SIMD kernels.
|
|
143
|
+
|
|
144
|
+
### Capabilities
|
|
145
|
+
|
|
146
|
+
- **Model families:** Llama / Mistral / Qwen2 / Qwen3 (`FastDecodeRunner`), Qwen3.5 / Qwen3.8 Gated DeltaNet + Full Attention, Gemma 4 heterogeneous sliding/global attention, `Inkling-2-Mini` looped MoE, `Qwen3.8-Flash-Next` (512-expert MoE + Sparse-QSA + Layer-1 Engram), and `Hy4-Flash` (iHC + MLA + Engram + DFly2 drafter hooks).
|
|
147
|
+
- **Input formats:** Hugging Face (`BF16/FP16/FP8/NVFP4/MXFP4/AWQ/GPTQ/NF4`), GGUF v2/v3 (all 36 GGML types), EXL3, and MLX.
|
|
148
|
+
- **KV backends (`--kv-backend`):** `r4kv` (4b/2b rotated, default on CUDA), `e8` (8D lattice `2.0-4.0` bpw), `kvarn` (`k4v2/k4v4/k2v2`), `isoquant` (3b scalar / HF cache), `fp16`.
|
|
149
|
+
- **Speculative modes (`--speculative`):** `auto`, `router` (`UnifiedSpeculatorRouter`), `suffix` / `sam`, `mtp`, `dflash2` / `dspark` / `dspine`, `--draft-model`, `none`.
|
|
150
|
+
|
|
151
|
+
## Documentation
|
|
152
|
+
|
|
153
|
+
- [docs/benchmarks.md](docs/benchmarks.md): Full single-GPU-per-table Blackwell PRO 6000, RTX 5090, and Mojo CPU benchmark reports.
|
|
154
|
+
- [docs/architecture.md](docs/architecture.md): Repository layout, CPTC-TQIR weight format, CUDA/Mojo kernels, and bare-metal C++20 `mate-serve` runtime.
|
|
155
|
+
- [docs/serving.md](docs/serving.md): CLI reference (`mate fit`, `mate run`, `mate serve`, `mate quantize`), OpenAI and Anthropic HTTP endpoints, and speculative decoding controls.
|
|
156
|
+
|
|
157
|
+
## License
|
|
158
|
+
|
|
159
|
+
Apache-2.0. See [LICENSE](LICENSE).
|