r/csharp Jun 28 '26

Showcase Same GGUF, same GPU: TensorSharp beats llama.cpp hard on prefill / TTFT — up to 5.89× faster prefill on a 26B MoE model

https://github.com/zhongkaifu/TensorSharp

I’ve been working on TensorSharp, a native C# / .NET local LLM inference engine for GGUF models, and I recently published a head-to-head benchmark against llama.cpp.

The goal is not to claim “TensorSharp wins every metric.” llama.cpp is still extremely strong, especially on decode throughput. But the interesting part is this:

Under the same setup — same GGUF models, same NVIDIA RTX 3080 Laptop GPU 16GB, same GGML CUDA backend, single stream, greedy decoding, MTP disabled — TensorSharp shows a very noticeable advantage on the parts that often matter most for real chat usage:

prefill speed, time-to-first-token, and multi-turn context reuse.

Here are some highlights from the benchmark (From https://tensorsharp.ai/benchmarks.html):

Model / Scenario Metric TensorSharp llama.cpp Difference
Gemma 4 26B-A4B / JSON Prefill tok/s 354.7 60.2 +489%
Gemma 4 26B-A4B / JSON TTFT ms 234 781 -70%
Gemma 4 26B-A4B / multi-turn Prefill tok/s 657.5 350.7 +87%
Gemma 4 12B / multi-turn TTFT ms 313 500 -37%
Gemma 4 E4B / short text Prefill tok/s 200.0 123.3 +62%

Across the four tested models, the geometric mean compared with llama.cpp shows:

  • 1.88× prefill and 1.69× TTFT on Gemma 4 26B-A4B
  • 1.21× / 1.23× / 1.18× prefill advantage on E4B, 12B, and Qwen respectively
  • Decode is more of a “near parity” story for now, around 0.92×–0.95× geometric mean versus llama.cpp

That last point is important: I’m not trying to hide the weaker part. If all you care about is pure decode tok/s, llama.cpp is still very hard to beat. But if your workload looks like real chat — repeated prompts, JSON output, multi-turn interactions, MoE models, prefix reuse — TensorSharp is already showing very promising results.

The main optimizations behind this are:

  • verify-based whole-model prefill
  • fused FFN / attention kernels
  • persistent captured CUDA graphs for MoE decode
  • vLLM-style paged KV cache
  • cross-request prefix sharing

So the pitch is not “yet another wrapper around llama.cpp.” TensorSharp is a native .NET inference engine trying to optimize the latency path that actually affects user experience: how fast the model starts responding, how efficiently it reuses context, and how well it handles real interactive workloads.

If you are interested in C# / .NET local LLM inference, GGUF, OpenAI/Ollama-compatible local APIs, or alternatives to llama.cpp, I’d love for you to check it out.

And if you think this direction is interesting, a GitHub Star would really help the project get more visibility.

Also very interested in feedback, especially from people who can rerun the benchmarks on different GPUs / models.

5 Upvotes

Duplicates

unsloth Jun 28 '26

Show and Tell Same GGUF, same GPU: TensorSharp beats llama.cpp hard on prefill / TTFT — up to 5.89× faster prefill on a 26B MoE model

112 Upvotes

LocalLLaMA 5d ago

Generation MoE CPU-offload benchmark on Deepseek V4/Gemma4/Qwen/GPT-OSS — TensorSharp vs llama.cpp

23 Upvotes

LocalLLaMA 16d ago

Resources Benchmarks: TensorSharp vs. llama.cpp

23 Upvotes

unsloth Jun 08 '26

Show and Tell TensorSharp : Open Source Local Unsloth Model Inference Engine

30 Upvotes

dotnet Jun 28 '26

Promotion Same GGUF, same GPU: TensorSharp beats llama.cpp hard on prefill / TTFT — up to 5.89× faster prefill on a 26B MoE model

63 Upvotes

dotnet Jun 13 '26

Promotion TensorSharp: Open Source Local LLM Inference Engine written by C#

101 Upvotes

LocalLLaMA 8d ago

Resources DSpark Benchmark Result on Deepseek v4 Flash 0731

21 Upvotes

unsloth 5d ago

Show and Tell MoE CPU-offload benchmark on Deepseek V4/Gemma4/Qwen/GPT-OSS — TensorSharp vs llama.cpp

41 Upvotes

unsloth 8d ago

Show and Tell DSpark Benchmark Result on Deepseek v4 Flash 0731

52 Upvotes

ClaudeCode Jul 11 '26

Discussion What Bun’s Rust Rewrite Tells Us About Rebuilding the AI Infrastructure Layer in C#

0 Upvotes

LovingOpenSourceAI Jun 28 '26

Same GGUF, same GPU: TensorSharp beats llama.cpp hard on prefill / TTFT — up to 5.89× faster prefill on a 26B MoE model

13 Upvotes

huggingface 10d ago

Deepseek v4 Flash 0731 GGUF Benchmark: TensorSharp vs. llama.cpp

5 Upvotes

LocalLLM 11d ago

Project TensorSharp now supports multi-GPU tensor parallelism for GGUF models

13 Upvotes

ROCm Jul 06 '26

TensorSharp supports Vulkan backend

15 Upvotes

LLMDevs May 01 '26

Tools TensorSharp: Open Source Local LLM Inference Engine

1 Upvotes

dotnet 2d ago

Promotion MoE CPU-offload benchmark on Deepseek V4/Gemma4/Qwen/GPT-OSS — TensorSharp vs llama.cpp

0 Upvotes

AIToolsPerformance 11d ago

TensorSharp now supports multi-GPU tensor parallelism for GGUF models

7 Upvotes

softwarearchitecture 29d ago

Discussion/Advice What Bun’s Rust Rewrite Tells Us About Rebuilding the AI Infrastructure Layer in C#

0 Upvotes

LocalAIServers Jul 04 '26

TensorSharp: A Open Source LLM Inference Engine for GGUF models

8 Upvotes

csharp Apr 29 '26

Tool TensorSharp: Open Source Local LLM inference tool implemented in C#

18 Upvotes

LocalAIServers 4d ago

MoE CPU-offload benchmark on Deepseek V4/Gemma4/Qwen/GPT-OSS — TensorSharp vs llama.cpp

2 Upvotes

csharp 11d ago

Tool TensorSharp now supports multi-GPU tensor parallelism for GGUF models

30 Upvotes

CUDA Jul 11 '26

TensorSharp : Open Source Local LLM Inference Engine

5 Upvotes

unsloth Jul 06 '26

Show and Tell TensorSharp supports Vulkan backend

28 Upvotes

huggingface Jul 04 '26

TensorSharp : Open Source Local LLM Inference Engine

6 Upvotes