[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-108951":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":23,"defaultBranch":24,"hasWiki":25,"hasPages":23,"topics":26,"createdAt":10,"pushedAt":38,"updatedAt":39,"readmeContent":40,"aiSummary":41,"trendingCount":16,"starSnapshotCount":16,"syncStatus":42,"lastSyncTime":43,"discoverSource":44},108951,"RustingStrata","RustingStudio\u002FRustingStrata","RustingStudio","Pure-Rust LLM inference engine for GGUF (Qwen, DeepSeek, GLM, Hy4, Flint). Runs models bigger than your VRAM on CUDA and Vulkan, with MTP drafts and an OpenAI\u002FAnthropic server. 12 GB RTX 3060 vs llama.cpp: Qwen3.6-35B-A3B UD-Q5_K_M 80.5 vs 64.4 tok\u002Fs, Flint UD-Q5_K_XL 64.6 vs 48.6. With MTP: 108 tok\u002Fs (UD-Q3_K_M), up to 160 (UD-Q2_K_XL).","",null,"Rust",388,43,3,8,0,30,111,266,129,94.9,"Other",false,"main",true,[27,28,29,30,31,32,33,34,35,36,37],"cuda","gguf","inference","llama-cpp","llm","local-llm","mixture-of-experts","moe","openai-api","qwen","rust","2026-11-23 19:49:05","2026-11-23 20:34:25","# RustingStrata\n\nA pure-Rust inference engine for the Qwen3.5\u002F3.6 hybrid model family (`qwen35moe`, `qwen35`) in GGUF; Qwen3-Next\n(`qwen3next`), Qwen3.8-Flash-Next (`qwen4exp`) and Qwen3 (`qwen3`, `qwen3moe`) also run. CUDA kernels are compiled at run time with NVRTC through\ncudarc (cached as a cubin), and the same kernels also run on Vulkan (`--backend vulkan`, GLSL compiled to SPIR-V and\ncommitted): no C++ build step, no ggml. Experts that do not fit in VRAM run on the CPU at the same time as the GPU\nwork, and the expert placement adapts to the routing it sees.\n\nStatus: v1.2.0. Milestones M0-M6 are done (M6: server, chat, calibration, bench); the v1 gate run is in\n`docs\u002Fm6-results.md`.\n\n## Numbers\n\nReference machine: RTX 3060 12 GB, Ryzen 5 7600X, 32 GB RAM. Model: `Qwen3.6-35B-A3B-UD-Q2_K_XL.gguf` (11.7 GiB,\ndoes not fit in VRAM). llama.cpp is the 2026-10-28 build 11876, tuned for the same file (`-ncmoe 12 -ub 2048\n-b 2048`, flash attention; with its default ubatch its 4K prefill is ~1550).\n\n| | CUDA | Vulkan | llama.cpp |\n|---|---|---|---|\n| Prefill, 4K prompt | **2216 tok\u002Fs** (2169-2252) | 2154 (2140-2162) | ~2236 (2183-2310) |\n| Decode after 4K prompt | **113.4 tok\u002Fs** (110.9-114.8) | 113.6 | 66.5 |\n| Decode, short prompt (like tg128) | **118.2 tok\u002Fs** (117.0-118.8) | 117.3 | 68.4 |\n| Decode with MTP drafts (`--mtp 1`, greedy), short \u002F after 4K | **up to 160 \u002F 152 tok\u002Fs** | 158 \u002F 154 | (its MTP is slower) |\n| 32K: prefill \u002F decode | **1800 \u002F 91.9 tok\u002Fs** | 1582 \u002F 90.7 | |\n| Greedy top-1 agreement with llama.cpp (20 prompts x 32 tokens), either llama.cpp mode | 98-99% | 98-99% | 98.3% (its batch vs token-by-token modes) |\n\nMeasured with `strata bench --gpu --mtp 0 --pp 512,4096,32768 --tg 128 --reps 3 --ctx 32896`, mean of 3 rounds\n(range in brackets); llama.cpp from `llama-server` timings, 4047-token prompt + 128 tokens, 3 runs.\nMTP gains depend on the text.\nAgreement counts a token when it matches llama.cpp run token by token or with the context as one batch;\nllama.cpp's own two modes agree on only 98.3%. The remaining misses are near-ties where\nfloat rounding order picks a different token. The expert placement adapts between runs and the CPU and\nGPU expert kernels round differently, so greedy output can change at such near-ties from one run to the next. MTP\non and off give identical greedy tokens.\n\nWith less VRAM, simulated on the 3060 with `--vram-margin` (not measured on real 8 GB or 6 GB cards): ~8 GB\nkeeps 116 \u002F 110 tok\u002Fs decode (short \u002F after 4K) and 2128 tok\u002Fs 4K prefill, ~6 GB 105 \u002F 97 and 2056.\n\nOther models, greedy \"The capital of France is\" with `--gpu` (CUDA \u002F Vulkan, second run):\n\n| Model | Types | Decode |\n|---|---|---|\n| Qwen3.5-2B (fine-tune) Q4_K_M | Q4_K, Q6_K, ... | 208 \u002F 208 tok\u002Fs |\n| Qwen3-4B-Instruct-2507 Q4_K_M (dense) | Q4_K, Q6_K | 104 \u002F 110 tok\u002Fs |\n| Qwen3.5-9B Q5_K_S | Q5_K, Q6_K, Q8_0 | 51 \u002F 53 tok\u002Fs |\n| Qwen3-30B-A3B-Instruct-2507 UD-Q2_K_XL | Q2_K to Q6_K | 114 \u002F 123 tok\u002Fs |\n| Qwen3.8-27B UD-IQ3_XXS (dense, 10.8 GB on GPU) | IQ1_S to IQ4_XS, Q2_K to Q8_0 | 20.6 \u002F 20.5 tok\u002Fs |\n| Qwen3.6-35B-A3B UD-IQ4_XS (57% of experts fit in VRAM) | IQ3_S, IQ4_XS, Q6_K, Q8_0 | 94 \u002F 96 tok\u002Fs |\n| Qwen3-Next-80B-A3B-Instruct UD-IQ1_S (most experts on the CPU) | IQ1_S to IQ4_NL, Q4_K to Q8_0, BF16 | 92 \u002F 90 tok\u002Fs |\n| Qwen3.8-Flash-Next GSQ-RCO IQ2_XS (64 GB in two files, pass the `-00001-of-00002` one; 18% of experts fit in VRAM, and with 32 GB RAM the rest are partly read from disk) | Q2_0, IQ1_M to IQ4_XS, Q6_K, Q8_0, F16, BF16 | 22 \u002F 20 tok\u002Fs |\n\nSupported GGUF types: F32, F16, BF16, Q8_0, Q4_0, Q4_1, Q5_0, Q5_1, Q2_0, Q2_K-Q6_K, IQ1_S, IQ1_M, IQ2_XXS, IQ2_XS, IQ2_S,\nIQ3_XXS, IQ3_S, IQ4_XS, IQ4_NL.\n\n## Build\n\nNeeds Rust (2024 edition) and either an NVIDIA driver with the CUDA 13 NVRTC library (loaded at run time) or a\nVulkan 1.3 driver with shaderFloat64, int8\u002F16\u002F64 and subgroup size 32 or a fixed size 64 (tested on RTX 3060 and\nRadeon VII; Intel Arc lacks shaderFloat64). The CUDA kernels need Ampere or newer (compute capability 8.0, for\n`cp.async` and int8 tensor cores); on Pascal, Turing or Volta use `--backend vulkan`. `--gpu` picks CUDA when it\nloads, else Vulkan; `--backend` chooses. The first CUDA run compiles the kernels (~15 s) and caches them. AMD GPUs:\nsee [docs\u002FAMD.md](docs\u002FAMD.md) for known issues and what to send in a report.\n\n```sh\ncargo build --release\n```\n\nWindows: install the Visual Studio C++ Build Tools first (one dependency compiles C code).\n\n## Use\n\nWithout a terminal: run `strata` (double-click `strata.exe` on Windows; release binaries are on the GitHub releases\npage). It starts the server on http:\u002F\u002F127.0.0.1:8080 and opens a chat page in the browser. The page keeps chats in\nthe browser, downloads models from Hugging Face (Models and settings; `HF_TOKEN` for gated repos), switches between\nthe models in the models folder (`%LOCALAPPDATA%\\rusting_strata\\models` on Windows,\n`~\u002F.local\u002Fshare\u002Frusting_strata\u002Fmodels` elsewhere, or `serve --models-dir`), and shows the context use, speed, totals and CPU, memory and graphics memory use\nof the server. Other apps that take an OpenAI-compatible address (Open WebUI, Jan, SillyTavern, code editors) can\nuse `http:\u002F\u002F127.0.0.1:8080\u002Fv1` too.\n\nFrom a terminal:\n\n```sh\nM=path\u002Fto\u002FQwen3.6-35B-A3B-UD-Q2_K_XL.gguf\n\n# Measure the best prefill chunk, short-prompt threshold and MTP drafts on this machine once.\n# Later runs read ~\u002F.cache\u002Frusting_strata\u002Fstrata-\u003Cmodel>.json unless flags override it.\ntarget\u002Frelease\u002Fstrata calibrate --model $M\n\ntarget\u002Frelease\u002Fstrata generate --model $M --gpu --prompt \"Write a haiku about rivers.\" -n 128\ntarget\u002Frelease\u002Fstrata chat --model $M --gpu                 # --think for thinking mode, --temp 0.7 to sample\ntarget\u002Frelease\u002Fstrata bench --model $M --gpu --pp 512,4096 --tg 128\nSTRATA_API_KEY=secret target\u002Frelease\u002Fstrata serve --model $M --gpu --addr 127.0.0.1:8080\n```\n\n`serve` speaks the OpenAI chat completions API (`POST \u002Fv1\u002Fchat\u002Fcompletions`, streamed or not, `GET \u002Fv1\u002Fmodels`).\nIt runs one request at a time; `--parallel N` (GPU) decodes up to N together (4 requests: 164 tok\u002Fs in total on the\n3060, 41 each; see [docs\u002FHOSTING.md](docs\u002FHOSTING.md)). `temperature`, `top_k`, `top_p` and `seed` are honored, and decoding is greedy when\nthey are left out. `max_tokens` (or `max_completion_tokens`) and `stop` (up to 16 strings) work as in the OpenAI\nAPI; `n` must be 1. Thinking is off unless a request sets `chat_template_kwargs.enable_thinking` (Anthropic:\n`thinking: {\"type\": \"enabled\"}`). When a request repeats the previous request's messages and adds new ones, only the new part is\nprefilled (`usage.prompt_tokens_details.cached_tokens`). `tools` and `tool_choice` work as in the OpenAI API (calls\ncome back as `tool_calls` with `finish_reason: \"tool_calls\"`). The prompt follows the model's own chat template,\nrendered like llama.cpp's `--jinja`. `tool_choice: \"required\"` does not force a call.\n`POST \u002Fv1\u002Fmessages` speaks the Anthropic Messages API (text, `tool_use` and `tool_result` blocks, streamed or not,\nthe key in `x-api-key`, and `POST \u002Fv1\u002Fmessages\u002Fcount_tokens`), so Claude Code can use the server:\n`ANTHROPIC_BASE_URL=http:\u002F\u002F127.0.0.1:8080 ANTHROPIC_API_KEY=secret ANTHROPIC_MODEL=local ANTHROPIC_SMALL_FAST_MODEL=local claude`.\nOpenCode and other agents use the OpenAI address. Qwen3.6's template leaves the think block out of replies before the\nlast user message, so each new user message changes the text of the earlier turns and the whole conversation is\nprefilled again. Strata keeps those blocks by default, so a long agent session prefills only what was added;\n`--preserve-thinking false` (or `chat_template_kwargs.preserve_thinking` in a request) follows the template.\nA request with another history (an agent's side request for a title or a summary) parks the conversation's state in\nhost memory (`--cache-ram`, 4096 MB by default), and the next request that continues it takes it back instead of\nprefilling it again.\nFor a server that other people use (customer keys in a file, a usage log for billing, `\u002Fhealth`, TLS through a\nreverse proxy, systemd), see [docs\u002FHOSTING.md](docs\u002FHOSTING.md). Each customer key reuses only its own cached\nconversations; all requests under one key count as one user.\n\nUseful flags: `--ctx` (KV cache size, default 4096), `--mtp [N]` (speculative decoding with the model's draft\nhead; greedy tokens stay the same, sampling keeps its distribution), `--chunk`, `--threads`, `--vram-margin`. On a\nGPU that drives no display, `--vram-margin 256` keeps more experts resident (+1-2% prefill); 128 runs out of\nmemory. `--kv q8` halves the KV cache (345 instead of 650 MB at 32K) at about 6% slower 32K decode and 14% slower\n32K prefill. Without `--gpu` everything runs on the CPU reference, which is slow and meant for checking.\nIf you reach `serve` through a LAN name while it is bound to `0.0.0.0`, allow that name with\n`--allowed-hosts ai-server.lan` (or `STRATA_ALLOWED_HOSTS=ai-server.lan`).\n\nSeveral GPUs: `--device 0,1` splits the layers over the cards in proportion to their free VRAM, so more experts stay\nresident. The cards run one after the other, so one request gets more memory, not twice the speed of one card. MTP\ndrafting is off on a split model. AMD cards clock down in the gaps while the other card works; `echo high >\n\u002Fsys\u002Fclass\u002Fdrm\u002FcardN\u002Fdevice\u002Fpower_dpm_force_performance_level` (as root, per card) took a two-card split from 44 to 57\ntok\u002Fs in one report.\n\nThe experts that do not fit in VRAM are read from the GGUF through the page cache. A file system that keeps file data\nout of the page cache (ZFS with `primarycache=metadata`) makes every run read them from disk again; load the model\nfrom a file system that caches data, or from a tmpfs copy.\n\n## Tests\n\n```sh\ncargo test --release                      # GPU tests need the model: STRATA_MODEL=path\u002Fto\u002Fmodel.gguf\npython -I tools\u002Fparity.py $M --extra \"--gpu\" --tag gpu   # agreement with llama.cpp (needs llama-server once)\n```\n\n## Layout\n\n`src\u002Fgguf.rs` (file reader), `src\u002Fquant\u002F` (dequantization), `src\u002Fmodel.rs` (CPU reference forward),\n`src\u002Fcuda\u002F` and `src\u002Fvulkan\u002F` (GPU kernels and shaders, behind `src\u002Fbackend.rs`), `src\u002Fgpu_model.rs` (GPU forward,\nMTP, verify), `src\u002Fgpu_model\u002Fprefill.rs` (chunked prefill), `src\u002Fexpert_cache.rs` (expert placement), `src\u002Fcpu_moe.rs`\nand `src\u002Fcpu_worker.rs` (CPU expert compute), `src\u002Fserve.rs` (HTTP), `src\u002Fchat.rs` (chat templates and tool calls),\n`src\u002Fmain.rs` (CLI).\n\n## License\n\nRustingStrata is released under the [RustingStrata License 1.0](LICENSE.md).\nYou may use, modify and distribute it, including for commercial services, as\nlong as you keep the license and credit Vasyl Trefilov as the original author.\nYou may not sell RustingStrata itself.\n","RustingStrata 是一个纯 Rust 编写的本地大语言模型推理引擎，专为 Qwen 系列 GGUF 格式模型（包括 Qwen3、Qwen3.5、Qwen3.6、Qwen3.8 及其 MoE 变体）优化。支持 CUDA 和 Vulkan 后端（兼容 NVIDIA 与 AMD 显卡），具备混合 CPU+GPU 专家调度、运行时编译 CUDA 内核（无 C++ 构建依赖）、MTP 多目标推测解码等核心能力，推理速度在 RTX 3060 上较 llama.cpp 提升约 1.7 倍。适用于资源受限的本地部署场景，如边缘设备、低 VRAM 显卡上的 MoE 模型实时推理、私有化 API 服务（兼容 OpenAI\u002FAnthropic 接口）。",2,"2026-11-24 04:35:25","CREATED_QUERY"]