# scisharp/llamasharp

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/scisharp-llamasharp).**

3,714 stars · 496 forks · C# · MIT

## Links

- GitHub: https://github.com/SciSharp/LLamaSharp
- Homepage: https://scisharp.github.io/LLamaSharp
- awesome-repositories: https://awesome-repositories.com/repository/scisharp-llamasharp.md

## Description

LLamaSharp is a .NET LLM inference library and local runtime that enables the execution of large language models on CPU and GPU hardware. It serves as a multimodal AI library capable of processing both text and image inputs to generate analytical textual responses without relying on external APIs.

The project distinguishes itself as a grammar-based text generator that enforces specific output formats, such as JSON, through constrained sampling pipelines. It also functions as a retrieval augmented generation framework integration, allowing the combination of local inference with external data indexing.

The library covers a broad range of capabilities including text embedding generation for vector search, chat session management for stateful conversations, and image analysis. It further provides tools for model weight quantization, document relevance reranking, and the offloading of model layers to graphics hardware.

## Tags

### Artificial Intelligence & ML

- [Local AI Inference](https://awesome-repositories.com/f/artificial-intelligence-ml/machine-learning/infrastructure/model-deployment-and-serving/local-and-on-device-inference/local-ai-inference.md) — Executes large language models directly on local CPU and GPU hardware for private, low-latency inference. ([source](https://scisharp.github.io/LLamaSharp/latest/xmldocs/))
- [Local LLM Execution](https://awesome-repositories.com/f/artificial-intelligence-ml/on-device-models/local-llm-execution.md) — Enables the execution of large language models on local hardware with optimized tokenization and memory management.
- [Retrieval-Augmented Generation](https://awesome-repositories.com/f/artificial-intelligence-ml/conversational-interfaces/retrieval-augmented-generation.md) — Grounds model responses by retrieving relevant documents from external data indexing for factual context. ([source](https://github.com/SciSharp/LLamaSharp))
- [Hardware Acceleration Backends](https://awesome-repositories.com/f/artificial-intelligence-ml/hardware-acceleration-backends.md) — Configures the runtime to use specific hardware acceleration backends like CUDA, Vulkan, or AVX. ([source](https://scisharp.github.io/LLamaSharp/latest/xmldocs/))
- [Inference Libraries](https://awesome-repositories.com/f/artificial-intelligence-ml/large-language-models/inference-libraries.md) — Provides a high-performance .NET library for loading and executing large language models on local CPU and GPU hardware.
- [Grammar-Constrained Generation](https://awesome-repositories.com/f/artificial-intelligence-ml/model-output-formatting/grammar-constrained-generation.md) — Enforces structural validity of model outputs using formal grammar rules to ensure responses follow formats like JSON. ([source](https://github.com/SciSharp/LLamaSharp/blob/master/mkdocs.yml))
- [GGUF Model Loaders](https://awesome-repositories.com/f/artificial-intelligence-ml/model-weight-converters/gguf-weight-quantization/gguf-model-loaders.md) — Loads and initializes quantized model weights from the GGUF binary format to minimize memory usage.
- [Structured Output Generators](https://awesome-repositories.com/f/artificial-intelligence-ml/natural-language-code-generators/structured-generation-engines/structured-output-generators.md) — Forces language models to produce strictly typed, machine-readable formats like JSON using grammar constraints.
- [Text Embedding Generators](https://awesome-repositories.com/f/artificial-intelligence-ml/text-embedding-generators.md) — Provides utilities for transforming text into vector representations to support semantic search and similarity analysis. ([source](https://github.com/SciSharp/LLamaSharp/blob/master/mkdocs.yml))
- [Grammar-Constrained Samplers](https://awesome-repositories.com/f/artificial-intelligence-ml/text-generation-strategies/token-prediction/grammar-constrained-samplers.md) — Restricts token generation based on formal language rules to enforce strict output schemas.
- [AI Agent Development](https://awesome-repositories.com/f/artificial-intelligence-ml/ai-agent-development.md) — Provides the necessary primitives to build interactive AI agents, including conversation state and streaming responses within .NET.
- [Multimodal Frameworks](https://awesome-repositories.com/f/artificial-intelligence-ml/ai-application-frameworks/multimodal-frameworks.md) — Provides a framework capable of processing both text and image inputs to generate analytical textual responses.
- [Vision Analysis](https://awesome-repositories.com/f/artificial-intelligence-ml/ai-image-generators/vision-analysis.md) — Generates descriptive or analytical textual responses by processing image files alongside text prompts. ([source](https://scisharp.github.io/LLamaSharp/latest/QuickStart/))
- [AI Integration Frameworks](https://awesome-repositories.com/f/artificial-intelligence-ml/ai-integration-frameworks.md) — Integrates the local inference engine with external software kits for orchestration and bot development. ([source](https://github.com/SciSharp/LLamaSharp))
- [Chat Session Management](https://awesome-repositories.com/f/artificial-intelligence-ml/chat-session-management.md) — Maintains conversational history and state across multi-turn dialogues to provide continuity. ([source](https://github.com/SciSharp/LLamaSharp/blob/master/README.md))
- [Conversation Context Tracking](https://awesome-repositories.com/f/artificial-intelligence-ml/conversation-context-tracking.md) — Stores and retrieves historical query-response pairs to maintain continuity within multi-turn dialogues.
- [Document Rerankers](https://awesome-repositories.com/f/artificial-intelligence-ml/document-rerankers.md) — Scores and re-orders document lists based on their relevance to a specific user query. ([source](https://scisharp.github.io/LLamaSharp/latest/xmldocs/))
- [RAG Framework Integrations](https://awesome-repositories.com/f/artificial-intelligence-ml/machine-learning/infrastructure/model-evaluation-analysis/machine-learning-evaluation/database-integrated-workflows/rag-framework-integrations.md) — Integrates local inference with external data indexing to implement retrieval-augmented generation workflows.
- [Incremental Inference Streaming](https://awesome-repositories.com/f/artificial-intelligence-ml/machine-learning/infrastructure/model-inference-serving/model-integration-pipelines/model-inference/inference-result-processors/incremental-inference-streaming.md) — Streams model outputs to clients incrementally as they are generated to reduce perceived latency. ([source](https://github.com/SciSharp/LLamaSharp/blob/master/README.md))
- [GPU Acceleration Configurations](https://awesome-repositories.com/f/artificial-intelligence-ml/machine-learning/infrastructure/model-optimization-and-inference/hardware-and-acceleration/hardware-acceleration/gpu-acceleration-configurations.md) — Allows precise configuration of the number of model layers offloaded to the GPU to optimize inference performance. ([source](https://scisharp.github.io/LLamaSharp/latest/QuickStart/))
- [Sampling Controls](https://awesome-repositories.com/f/artificial-intelligence-ml/probabilistic-modeling/sampling-controls.md) — Adjusts the randomness and creativity of generated text using custom sampling pipelines and parameters. ([source](https://scisharp.github.io/LLamaSharp/latest/xmldocs/))
- [Weight Quantization](https://awesome-repositories.com/f/artificial-intelligence-ml/quantized-inference-runtimes/weight-quantization.md) — Compresses large model weights into lower-precision formats to reduce memory usage and increase inference speed. ([source](https://github.com/SciSharp/LLamaSharp/blob/master/mkdocs.yml))

### Data & Databases

- [Model Layer Offloading](https://awesome-repositories.com/f/data-databases/memory-optimization-strategies/compositor-memory-limits/model-layer-offloading.md) — Distributes specific model computation layers to graphics hardware to accelerate processing speed.
- [Vector Search](https://awesome-repositories.com/f/data-databases/vector-search.md) — Implements the conversion of text into embeddings to facilitate similarity-based information retrieval and document reranking.

### Graphics & Multimedia

- [GPU Hardware Acceleration](https://awesome-repositories.com/f/graphics-multimedia/gpu-hardware-acceleration.md) — Distributes specific model computation layers to graphics hardware to accelerate processing speed. ([source](https://github.com/SciSharp/LLamaSharp/blob/master/README.md))

### Part of an Awesome List

- [Artificial Intelligence](https://awesome-repositories.com/f/awesome-lists/ai/artificial-intelligence.md) — C# bindings for running LLaMA and GPT models locally.
