C# Deep Learning Frameworks: In-Depth Research Report
This report surveys the current state of the C#/.NET deep learning ecosystem, covering frameworks, task-specific performance, deployment scenarios, and cross-language comparisons.
Key points
- Full-function training frameworks: TensorFlow.NET (3.3k+ stars, SciSharp) mirrors Python TensorFlow's static-graph API with CUDA/cuDNN support; TorchSharp (1.5k+ stars, .NET Foundation) offers PyTorch-style dynamic graphs but has a smaller ecosystem, mainly used for image recognition.
- Inference frameworks: ML.NET (9.1k+ stars, Microsoft) provides Fluent-API, .NET-native ML with AutoML and new YOLOv8 object detection APIs; ONNX Runtime (16k+ stars) is the de facto cross-platform inference standard with Execution Providers for CPU, CUDA/TensorRT, DirectML, OpenVINO, and Core ML/NNAPI.
- DeploySharp (2025-2026 emerging project) enables zero-configuration deployment of YOLOv5-v12 (detection, segmentation, pose, OBB), PP-OCR v4/v5, and anomaly-detection models, with switchable OpenVINO/ONNX Runtime backends (TensorRT planned for 2026).
- YOLOv8n on RTX 3060: 23ms per-frame latency with DeploySharp; PP-OCR end-to-end 23ms with TensorRT backend.
- Intel NUC 11 edge case: YOLOv8n drops from 120ms (native ONNX Runtime) to 35ms with OpenVINO optimization.
- C# (.NET 8) vs Python 3.11 on the same ONNX Runtime backend (ResNet-50): 7% lower latency, 65% less memory at 100 concurrent requests, 57% faster cold start, 14% higher peak throughput — attributed to Native AOT,
Span<T>, and no GIL contention. - Jetson Nano industrial case: C# + INT8-quantized YOLOv8s achieves <50ms end-to-end weld-defect detection, 4× faster than cloud inference.
- ONNX Runtime is the preferred path for BERT-family inference, using dynamic axes for variable-length sequences; graph optimization cuts latency 30-50%.
- LLamaSharp (llama.cpp-based) runs GGUF-quantized local LLMs (Mistral, Mixtral, Qwen) on consumer hardware across Windows/Linux/macOS with CPU, CUDA, Metal, and OpenCL backends.
- Semantic Kernel provides enterprise-grade LLM orchestration with planners, vector store abstractions, and Azure OpenAI integration.
- Whisper.net supports 99-language speech-to-text with timestamps and speaker diarization on consumer CPUs.
- Cloud: ONNX Runtime containers under 100MB (Alpine); Kubernetes HPA scaling, Azure ML integration with ML.NET, Triton Inference Server with C# gRPC clients for high-throughput serving.
- Mobile: ONNX Runtime Mobile (few-MB builds, NNAPI/Core ML) with .NET MAUI; INT8 quantization reduces model size to 25% of FP32 with <2% accuracy loss.
- Edge/embedded: OpenVINO on Intel NUC/NPU (<50ms anomaly detection, 98.5% accuracy in a bearing-fault case), ONNX Runtime ARM64 builds for Raspberry Pi, deterministic latency techniques (
GC.TryStartNoGCRegion, Native AOT,mlockall, real-time scheduling). - Hybrid edge-cloud: model partitioning, dynamic task offloading based on bandwidth, and delta model updates saving 90%+ update bandwidth.
Performance findings
NLP and LLM integration
Deployment scenarios
Community maturity
ML.NET and ONNX Runtime enjoy Microsoft backing with commercial Azure support and strict semantic versioning; TensorFlow.NET (SciSharp) is well-regarded but updates quarterly; TorchSharp is considered less mature with limited application coverage; DeploySharp iterates rapidly with active community channels but has limited API stability guarantees at 0.x.
Conclusion
C# is a production-viable alternative to Python for inference-centric and high-concurrency AI services, particularly on Windows, Intel edge hardware, and enterprise .NET stacks. For training, TensorFlow.NET and TorchSharp cover most needs but trail Python ecosystems; most teams export models via ONNX for C# deployment.