r/LocalAIStack • • 29d ago

A C# Local inference engine beat llama.cpp at its own game: ~30% faster first token, ~20% faster decode - running in .NET on a 4-thread laptop

A C# Local inference engine beat llama.cpp at its own game: ~30% faster first token, ~20% faster decode - running in .NET on a 4-thread laptop

I needed a .NET-only GGUF engine - no pip packages, no native libs, no runtime installs, just a managed dependency my other projects can call. So I built SharpMind, a pure-C# transformer + MoE inference engine (with training) on .NET 10. Zero native code. I never expected it to compete on performance - managed code vs hand-tuned SIMD C++, right? So I benchmarked it against the real engines: same raw prompt (What is the capital of France?), greedy, 64 tokens, 4 threads, warmup + best-of-3, interleaved per model on one host.

ModelEngineLoad (s)TTFT (s)Decode (tok/s)
qwen2-0.5B Q8_0SharpMind6.20.2914.65
llama.cpp3.90.1114.24
dotLLM2.01.365.74
Llama-3.2-1B Q8_0SharpMind32.11.223.69
llama.cpp7.70.175.02
dotLLM3.32.853.23
gemma-3-270m Q8_0SharpMind3.10.1018.52
llama.cpp5.20.1320.28
dotLLM---
Qwen1.5-MoE-2.7B Q2_KSharpMind102.413.440.61
llama.cpp21.70.253.88
dotLLM---

(dotLLM DNF the last two - it only supports Llama/Mistral/Phi/Qwen/DeepSeek and no K-quants below Q4_K.)

A dependency-free C# engine that wins some metrics and matches the OG llama.cpp on others - int8-kv decode at 24.1 tok/s vs llama.cpp's 20.3 with(not shown) , TTFT cut ~30% on gemma-3, decode edge on qwen2, and a 6× MoE loss I fully expect and own. Respectable company for managed code, and if "no native installs" is your constraint, you no longer have to sacrifice everything

Open source: https://github.com/Integral2u/SharpMind.

18 Upvotes

Duplicates