Skip to content

Sharplight v0.2.0

Choose a tag to compare

@github-actions github-actions released this 17 Nov 12:33

Sharplight 0.2

The first stable release of Sharplight, a .NET 11 / C# 14 inference engine with a Vulkan GPU backend and a CPU backend, and of
Sharplight Studio, its desktop app. 0.2 follows the 0.1.x alpha series (last: v0.1.22-alpha) and changes the scope from
"language and ONNX models" to every model kind on one engine: text, speech recognition, speech synthesis, audio, vision, image
generation and video generation, all loaded through the same importers, compiled through the same graph IR and called through one
task-client pattern.

Packages: NuGet 0.2.N (N = the git height of release/v0.2; the GitHub release v0.2.N carries the Studio installers). Most
applications need only the entry package:

dotnet add package Sharplight
var services = new ServiceCollection()
    .AddSharplight()
    .AddTextGenerator((o, sp) => { /* o.ModelPath, o.Devices */ });

See the README ("Getting started") and docs/api-overview.md.

Highlights

  • One engine for every model kind. A task layer in Sharplight.Core with one client per kind (ITextGenerator,
    ISpeechRecognizer, ISpeechSynthesizer, IImageGenerator, IVideoGenerator, IImageClassifier, IImageEmbedder,
    IObjectDetector, IDepthEstimator, IImageSegmenter, ISemanticSegmenter, ITextRecognizer, IImageUpscaler, IAudioCodec,
    IVoiceActivityDetector, IAudioEmbedder, IMusicGenerator, IAudioSeparator), registered with Microsoft.Extensions.DependencyInjection
    and safe to call from a UI thread (documented threading contract: no compute before the first await, background stream producers,
    cancellation between steps).
  • The .slm package stores every kind: a model description (kind and components such as encoder, decoder, tokenizer, denoiser,
    VAE, scheduler, vocoder), graphs, weights, attachments, and precompiled artifacts per execution provider (two-stage code generation:
    portable code plus device-specific code, VK_KHR_pipeline_binary with a pipeline-cache fallback).
  • Verified-model catalog: 203 entries (179 installable) with pinned revisions, files, checksums and companion files, each
    verified against its reference implementation (transformers, diffusers, llama.cpp, whisper.cpp, onnxruntime, the authors' code). The
    tables of docs/compatible-models.md are generated from it, and Studio installs its entries with one click.
  • Native Metal provider (preview) for Apple silicon on the same Slang kernel library (compiled to MSL), with simdgroup_matrix
    GEMMs; on macOS the provider order is Metal, Vulkan (MoltenVK), CPU.
  • Server foundations: Sharplight.Hosting (multi-model host management from options or JSON, fit planning, capacity status for
    health checks and cluster coordinators), multi-tenant serving seams (tenant resolver, isolation scope, prefix-cache partitions,
    admission, usage and metrics, per-model defaults) and sharplight serve on top of it.
  • Sharplight Studio grew from a chat app into a workbench for every model kind (see below), with stable and unstable update
    channels (Velopack) for Linux, Windows and macOS.

Model kinds and families

All entries below are verified against a reference; numbers and conditions are in docs/compatible-models.md
and docs/model-support.md.

  • Text generation. 168 of the 172 llama.cpp architectures end to end (GGUF and Hugging Face safetensors), a Hub top-20 sweep plus
    9 large models (safetensors against transformers, GGUF against llama.cpp), OPT, slow BPE tokenizers, Metaspace handling. New since
    0.1.22: Gemma 4 MoE, DeepSeek-V4 native, bring-up rounds 9-11 (lfm3, spark2_5, llava_onevision2, clover_moe, mimo_v2,
    nemotron_h_omni, PaliGemma text, DFlash drafters, Inkling, Kimi K3, DeepSeek-OCR family, GroveMoE, ...). MTP draft heads
    (qwen4exp NextN from HF, GGUF or an mtp-*.gguf sidecar, MiMo-7B MTP, Qwen3-Next and GLM-4 MoE NextN) for speculative decoding.
  • Quantized Hugging Face checkpoints: NVFP4, MXFP4, FP8, GPTQ (incl. Marlin), AWQ (incl. gemv_fast), bitsandbytes NF4/FP4/LLM.int8,
    MLX (2/3/4/5-bit, mxfp4/nvfp4/mxfp8), AutoRound, HQQ, EETQ, Quark int4/int8/MXFP6, optimum-quanto, torchao int8/float8, GGUF I2_S
    kept quantized; AQLM, FP-Quant, HIGGS, VPTQ, EXL2 dequantized at import. A restricted pickle loader (Sharplight.Import.PyTorch) reads
    .bin checkpoints without running pickled code.
  • Speech to text: Whisper (HF, whisper.cpp ggml and GGUF; beam search, long-form, VAD pre-segmentation), Distil-Whisper, Moonshine,
    Parakeet CTC/TDT/RNN-T (incl. GGUF), Canary, wav2vec2 CTC, and audio language models Qwen3-ASR 1.7B and Voxtral Mini 3B
    (token-exact against transformers).
  • Text to speech: OuteTTS 0.2, Kokoro-82M, Orpheus 3B + SNAC, Chatterbox (built-in voice and voice cloning), F5-TTS v1 + Vocos,
    XTTS v2 (58 speakers and voice cloning), CosyVoice 3 0.5B (zero-shot and instructions). Streaming synthesis (CosyVoice chunked
    flow, XTTS, Chatterbox) with playback while generating, saved voices (VoiceLibrary) and text normalization for 8 languages.
  • Audio: EnCodec, DAC and Mimi codecs, Silero VAD, CLAP audio/text embeddings, MusicGen small, Demucs htdemucs source separation.
  • Vision: ViT, timm and Hugging Face ResNets, ConvNeXt V1 (HF and timm), CLIP / SigLIP / SigLIP 2 (zero-shot), DINOv2, DETR, RT-DETR v1/v2, YOLOS, Ultralytics YOLOv8/v10/11
    (detection and instance segmentation, ONNX exports), Table Transformer, Depth Anything V1/V2, SAM 2.1 (points and boxes),
    SegFormer, BiRefNet and RMBG-2.0 background removal, TrOCR, Florence-2 (OCR, captions, detection), Real-ESRGAN and SwinIR upscaling.
  • Image generation: Stable Diffusion 1.5 / 2.x / SDXL / SDXL-Turbo / SDXL-Lightning / SD-Turbo (diffusers, single file, .ckpt,
    stable-diffusion.cpp GGUF), SD3 / SD3.5 Medium, FLUX.1 schnell and dev (incl. city96 GGUF), FLUX.2 Klein 4B, Chroma1-HD,
    Z-Image-Turbo, Qwen-Image, Qwen-Image 2.1 and 2.1 Turbo, Krea 2 Turbo; popular SD1.5/SDXL/Illustrious fine-tunes as single files;
    FLUX.2 Dev 32B (GGUF with the Mistral 3.2 text encoder); reference-image editing (FLUX.2, FLUX.1 Kontext) with a Studio edit mode;
    LoRA merging at load (kohya and PEFT for SD1.5, SDXL, FLUX and Krea 2); txt2img, img2img and inpainting; /v1/images/generations.
  • Video generation: Wan 2.1 T2V 1.3B, Wan 2.2 TI2V 5B, Wan 2.2 T2V/I2V A14B (two experts), Wan 2.1 I2V and FLF2V 14B (incl. GGUF),
    LTX-Video 0.9.0, 0.9.5 and 13B 0.9.8 distilled (single files and GGUF), HunyuanVideo (diffusers and GGUF, tiled causal 3-D VAE decode).
  • ONNX: operator rounds 7-8 (verified against onnxruntime 1.32: GQA, RotaryEmbedding, SimplifiedLayerNorm, NMS, RoiAlign, Loop,
    Range, STFT, StringSplit, MurmurHash3, ...), opt-in fast (TF32-class) matrix precision.

Media I/O

  • Native audio library (Sharplight.Audio): Sharplight's own C library over miniaudio, libopus, libogg, opusfile and libvorbis,
    cross-compiled with zig for linux-x64, linux-arm64, win-x64, win-arm64 and osx-arm64. Decoders for WAV, FLAC, MP3, Ogg Vorbis and
    Ogg Opus, encoders for WAV and Ogg Opus, playback and capture devices. The core's managed WAV I/O stays the fallback.
  • Video (Sharplight.Video): Sharplight's own LGPL FFmpeg 9.0.2 build for the same five runtimes (OpenH264, SVT-AV1, dav1d, libvpx,
    libopus, statically linked into the FFmpeg shared libraries) through FFmpeg.AutoGen: MP4, WebM, MOV, Matroska, GIF and APNG
    encoding (H.264, AV1, VP9, VP8, ProRes, FFV1 and the machine's hardware encoders: NVENC, VideoToolbox, Media Foundation) and decoding.
    Managed APNG and GIF encoders in the core are the fallback.

Serving and APIs

  • OpenAI- and Anthropic-compatible server (Sharplight.AspNetCore) with continuous batching; speech recognition
    (/v1/audio/transcriptions) and image generation (/v1/images/generations) endpoints.
  • Microsoft.Extensions.AI adapters for chat, embeddings, speech to text, text to speech and image generation.
  • Prefill in passes of up to 2048 rows (auto-sized from the available memory) and whole-pass prefill in the server: time to first
    token at 16 streams is now at vLLM's level.
  • Sharplight.Hosting: one ModelHost for chat, embedding, reranker and task models on shared devices, configured from options or
    JSON (ModelHostingJson), with placement, fit planning and HostStatus; ServingChatClient.
  • Sharplight.DesignTokens: the CSS and icons of the Sharplight look for web UIs (Studio's theme is generated from the same tokens).
  • Prerelease packages of develop on a GitHub Packages feed.
  • sharplight command line (assembly Sharplight.Cli): chat, generate, bench, serve (one or several models over HTTP), --gpus,
    storage and store commands; samples for
    transcription, speech, vision, image and video generation.
  • Storage modes for every written file: system (default), portable (next to the AppImage / executable) or a custom folder, switchable
    with sharplight storage use ... or in Studio, with migration.
  • SHARPLIGHT_VK_DEVICES pins the Vulkan devices a process uses.

Sharplight Studio

  • Pages per model kind: Chat, Transcribe, Speak (built-in voices and cloning from a recording), Audio (codecs, VAD, CLAP, MusicGen,
    Demucs), Vision (classification, zero-shot, detection, depth, segmentation with SAM points/box, semantic segmentation with legend and
    cut-out export, OCR, upscaling with a compare slider, background removal), Image (txt2img, img2img, inpainting, live preview, LoRA
    slots, PNG metadata, persistent gallery), Video (text-, image- and last-frame-to-video, video gallery, export panel with FFmpeg
    formats and hardware encoders; a native video player with seek, frame step, loop and audio track), Image edit mode (FLUX.2,
    FLUX.1 Kontext), streaming speech playback and saved voices, Tasks.
  • Shared inference building blocks: parameter panel with presets, run queue, history, output gallery, zoom viewer with compare divider.
  • Discover: filters per model type, format, quantization, fit, license and gated state, per-type highlights, multi-component repositories,
    one-click downloads of diffusers pipelines and whisper.cpp repositories, and the Verified models list from the catalog.
  • Settings split into tabs (General, Storage, Models, Engine, Updates, Data and about), storage modes, update UI (Velopack channels
    <rid>-stable / <rid>-unstable), macOS app menu.
  • Update channel selector (Settings > Updates): switch an installed Studio between Stable and Preview (unstable); the
    choice is saved and the chosen feed is checked at once. A channel without a release shows "No stable release yet"; moving from a
    newer preview to an older stable release asks first (Downgrade or Stay on the current version). 0.2 is the first release on
    the stable channels.
  • No inference or heavy work on the UI thread (responsiveness tests guard it).

Performance

Measured on one NVIDIA RTX PRO 4500 Blackwell (32 GB, 896 GB/s, 200 W), Vulkan provider; full tables in
docs/benchmarks.md sections 34-39 (and 41 for Apple silicon).

  • Against llama.cpp (same GGUF files, single stream, section 34): decode at 0.90-0.99x of llama.cpp CUDA and 0.96-1.17x of llama.cpp
    Vulkan on all models; prefill at 512 tokens from 0.79x (Llama-3.2-1B) to 1.12x (Nemotron-3-Nano-30B-A3B) of CUDA and 0.93-1.47x of
    Vulkan.
  • Against vLLM 0.33 (identical Hugging Face weights, sections 38-39): decode level (0.95-1.08x; Qwen3-8B bf16 53 vs 52 tok/s,
    FP8 89 vs 87); prefill at 2048 tokens 0.73-1.01x (Qwen3-0.6B 1.01x, Llama-3.2-1B 0.92x, Qwen3-8B bf16 0.81x, FP8 0.73x) and at
    8192 tokens 0.73-0.90x; at 512 tokens 1.8x on Qwen3-0.6B. Serving with 2000-token prompts at 16 streams: TTFT p50 Llama-3.2-1B
    158 vs 204 ms, Qwen3-8B 795 vs 726 ms; prefill throughput at 16 streams 0.68-0.78x of vLLM's.
  • Against onnxruntime 1.32 CUDA (section 37): in fast mode faster than ORT TF32 on every listed model (0.38-0.88x of its latency,
    phi-3.5 at 1.04x), and in strict f32-accurate mode faster than ORT strict on all of them.
  • Image and video generation: Qwen-Image 2.1 faster than diffusers at 1024 px; HunyuanVideo 2.9x faster per step than diffusers;
    LTX-Video 0.9.5 decoders 4x faster than the first implementation.
  • macOS: MoltenVK prefill regression fixed (88 to 610 tok/s), NEON CPU kernels. The Metal provider prefills 2-2.6x faster than
    MoltenVK on GitHub's virtual M1 runner (Qwen3-0.6B Q8_0 pp512 855 vs 428 tok/s; section 41). These numbers are indicative only:
    shared virtualized hardware, one run each, and llama.cpp's Metal backend is far below its usual results on that VM.

Breaking changes since 0.1

  • Dependency injection instead of static registries (public API pass). GgufImporter.Register(), ModelAdapterRegistry,
    ProviderRegistry, MultimodalRegistry and the other static registries are gone; compose with services.AddSharplight() or the per-package
    IServiceCollection extensions (AddGgufImporter(), AddBuiltinArchitectures(), AddCpuProvider(), AddVulkanProvider(o => ...),
    ...). Loads take the container's ModelLoader (LlmModel.Load(loader, path, options), TaskModel.Load(loader, options)).
    Options classes have settable properties and bind from configuration. The migration table is in
    docs/api-overview.md.
  • Packages renamed or folded (no forwarding packages):
    • Sharplight.Llm, Sharplight.Tokenizers, Sharplight.Templating, Sharplight.Architectures and Sharplight.Package are part of
      Sharplight.Core (namespaces unchanged; the conversion API of Sharplight.Package.Import moved to Sharplight.Package).
    • Sharplight.Gguf, Sharplight.HuggingFace, Sharplight.Onnx are now Sharplight.Import.Gguf, Sharplight.Import.HuggingFace,
      Sharplight.Import.Onnx (namespaces moved with them).
    • Sharplight.Defaults (develop prereleases only) is now Sharplight, the entry package.
  • ASP.NET Core: AddSharplight(host, ...), UseSharplight(), MapSharplight() are now AddSharplightServer(host, ...),
    UseSharplightServer(), MapSharplightServer().
  • Extensions.AI: AddSharplightChatClient(path, load, ...) is now AddSharplightChatClient(o => { o.ModelPath = ...; o.Devices = [...]; }, ...).
  • Server sample removed: samples/Sharplight.Server (sharplight-server) is replaced by sharplight serve of the command line,
    built on Sharplight.Hosting.
  • Hub: new ModelPuller(hub, downloader, store, converter); ModelConverter is a service; PackagePrecompiler.Precompile takes
    the providers.
  • LlmLoadOptions.Auxiliary is a dictionary keyed by AuxiliaryRoles (Auxiliary = { [AuxiliaryRoles.Mmproj] = path }).
  • LlmLoadOptions.MaxBatchTokens, the CLI / server --batch and EngineOptions.PrefillChunk default to 0 (automatic: up to 2048 rows,
    whole passes in the server) instead of 512.
  • SM-sized GEMM K splits and the faster causal prefill attention kernel are on by default (opt-outs SHARPLIGHT_GEMM_WAVE=fixed,
    SHARPLIGHT_ATTN_FE_CAUSAL=0).
  • The .slm format gained model descriptions and attachments (new section kinds, same container version); packages written by
    0.1.x still load (without a description the kind is resolved from the graphs). Graphs optimized by an older pipeline are optimized again
    once at load; re-converting stores the result and skips that step.
  • Storage: files move under the storage layout (system / portable / custom); sharplight store migrate takes over the models of
    earlier versions.

Known issues

  • Unsigned packages. Code signing is not set up yet: Windows SmartScreen and macOS Gatekeeper warn on first start of Studio.
  • Metal is a preview: verified on GitHub's virtual M1 runner only; it does not use the integer-dot matvec yet (Q8_0 decode is
    6-17 % slower than MoltenVK there). MoltenVK stays available. The NVIDIA performance numbers above are from Linux.
  • Prefill gap against vLLM on large GEMM-bound models: 0.73-0.81x at 2048-8192 tokens on the 8B models (FP8 0.73x), and
    0.68-0.78x prefill throughput at 16 streams (benchmarks section 39). Decode is level.
  • ONNX: ImageDecoder is not implemented; Bernoulli and training-mode Dropout are not reproducible against the reference
    RNG; 64-bit BitCast is not exact (64-bit values travel as 32-bit). These are listed in the conformance skip list.
  • Studio: image conversations run on a separate single-sequence session (not batched with the text engine, and not counted in
    the residency budget); the embedded API server does not serve speech models yet; microphone and playback were tested through the
    null backend only; conversion during a download reports its log, not a percentage (docs/studio.md, "Limitations").
  • Models that do not work yet (new TTS architectures such as Qwen3-TTS and VibeVoice, ControlNet, FLUX.2 Dev, HiDream,
    streaming ASR models, CTranslate2 files, ...) are listed with the reason in
    docs/compatible-models.md
    section 9; unsupported models are rejected with a clear message.
  • Licenses of model weights are the user's responsibility; see below.

Licenses

Sharplight is MIT licensed. Some shipped components and supported models carry their own terms:

  • FFmpeg (Sharplight.Video, Studio): Sharplight's own build is LGPL-2.1-or-later (no GPL or non-free components), shipped as
    shared libraries so it can be replaced; license texts of FFmpeg and every statically linked library (OpenH264, SVT-AV1, dav1d,
    libvpx, libopus, zlib, the MinGW-w64 runtime and LLVM runtime parts on Windows, nv-codec-headers) are in native/ffmpeg/licenses
    and ship with the package.
  • OpenH264 / H.264: the H.264 encoder is Cisco's OpenH264 compiled from source (BSD-2-Clause). Cisco's royalty coverage for H.264
    patents applies only to the binaries Cisco distributes, not to a build from source; whoever distributes a product that encodes H.264
    is responsible for any patent licensing in their jurisdiction. AV1 (SVT-AV1, with the AOM patent license) and VP8/VP9 (libvpx, with
    Google's patent grant) are royalty-free alternatives, and the machine's hardware encoders are used where available.
  • Native audio: miniaudio (public domain / MIT-0), libopus, libogg, opusfile, libvorbis (BSD-3-Clause); notices in third_party.
  • MoltenVK (Sharplight.Vulkan.MoltenVK, macOS): Apache-2.0, notices in the package.
  • Model weights are not part of Sharplight and keep their own licenses, shown in Studio and in the catalog. Notably:
    RMBG-2.0 (briaai) is CC BY-NC 4.0 (non-commercial) and gated; BiRefNet is MIT; Ultralytics YOLO weights are AGPL-3.0
    (an enterprise license is available from Ultralytics), so check before shipping them in a product; FLUX.1-dev and other models
    have non-commercial or custom licenses; gated repositories need the user's own Hugging Face token and acceptance of the terms.