SciSharp/LLamaSharp

A C#/.NET library to run LLM (🦙LLaMA/LLaVA) on your local device efficiently.

What it solves

Running large language models on your own device is often tricky: they are big, slow, and hard to integrate. LLamaSharp gives .NET developers an easy way to load and run LLaMA and other models locally, without needing to write low-level code or rely on cloud APIs.

How it works

LLamaSharp is built on top of llama.cpp, a well-known C++ engine for running LLMs. It packages that engine as native "backend" libraries for CPU, CUDA, Metal, and Vulkan, so you can get good performance on both processors and graphics cards. You install a NuGet package for the backend you need, download a model file in GGUF format, and then use simple C# APIs to set up a chat session or generate text. The library also supports RAG (Retrieval-Augmented Generation) to connect models to your own data.

Who it's for

This is for .NET developers (using C# or other .NET languages) who want to embed AI chat or text generation into their applications—on Windows, Linux, or Mac. It's especially useful if you need local, private inference or want to avoid per-request API costs.

Highlights

  • Cross-platform: works on Windows, Linux, and Mac.
  • Efficient: runs on CPU and GPU (CUDA, Metal, Vulkan) with native backends.
  • Easy setup: install a NuGet package and download a GGUF model—no C++ compilation needed.
  • High-level APIs: chat sessions, streaming responses, and simple model loading.
  • RAG support: connect models to your own documents for grounded answers.
  • Multimodal: can handle models like LLaVA for image + text tasks.
  • Integrations: examples and integrations with BotSharp, LangChain, and more.

Related

  • Project
  • Project
  • Project
  • Project
  • Project