zhongkaifu/TensorSharp
A native .NET LLM inference engine and agent runtime for GGUF models. TensorSharp provides a console application, a web-based chatbot interface, iPhone App, and Ollama/OpenAI-compatible HTTP APIs for programmatic access. It supports Windows/MacOS/iOS/Linux with full GPU capability
TensorSharp is a local inference engine for running AI models on your own computer. It's built for .NET 10 and works on Windows, macOS, and Linux. You can use it through a command-line tool, a browser chat interface, or by embedding it in your own .NET apps. It also powers a separate app called TensorAgent for phones and desktops.
What it does:
- Runs text, reasoning, multimodal (image/audio/video input), embeddings, image generation/editing, and video generation models.
- Supports multiple backends: pure C# CPU kernels, or native CUDA (NVIDIA), Metal (Apple), and Vulkan (AMD/Intel/NVIDIA) for acceleration.
- Offers several interfaces: CLI, browser chat, and APIs compatible with Ollama and OpenAI.
- Includes advanced features like continuous batching, a paged KV cache, speculative decoding, and multi-GPU support.
- Has optional telemetry (OpenTelemetry) for monitoring, off by default.
- Includes Agent Skills and code tools for file, shell, and document workflows.
- Allows personal knowledge collections with file uploads and semantic search.
- Lets you steer an active response while the model is still generating.
Quick start:
- Download prebuilt binaries from the Releases page, or build from source with .NET 10 SDK, CMake, and GPU toolchains.
- Example: run a Gemma 4 E4B model via CLI with
--backend ggml_cudaon NVIDIA,ggml_metalon Apple Silicon,ggml_vulkanfor Vulkan, orggml_cpufor CPU-only. - Host a server with browser chat at localhost:5000 and Ollama/OpenAI-compatible APIs.
Supported models:
- Text/reasoning/multimodal: DeepSeek, GLM, Gemma, Qwen, Mistral, Hunyuan, Muse, MiniMax, and more.
- Image/video generation: Qwen-Image, LTX 2.5, MiniMax-H3, Wan.
- Embeddings: EmbeddingGemma 2, BERT/XLM-R variants.
- Support varies by model; check the docs for details.
Benchmarks:
- Recent comparisons show TensorSharp outperforming llama.cpp on specific workloads (e.g., 3.23× faster prefill on DeepSeek with exact mode, 5.50× with approximate mode). Results are workload-specific and not universal.
Documentation:
- Extensive docs cover installation, usage, model support, benchmarks, and more. Links are provided in the README.
In short, TensorSharp is a flexible, local AI inference engine that runs many model types on your own hardware, with multiple interfaces and acceleration options.
Related
- Project
- Project
- Project
- Project
- Project