AI-powered text generation for .NET.
Generate structured content, summaries, corrections, and style transformations with on-device LLMs. Grammar-constrained outputs, Dynamic Sampling technology, multimodal support, and reasoning capabilities. 100% local processing, zero cloud dependency.
Elevate .NET apps with AI-powered text generation.
LM-Kit.NET brings cutting-edge AI-driven text generation directly to your .NET applications. Generate coherent, contextually relevant text across various domains, from structured content creation and summarization to grammar correction and text enhancement. By leveraging compact Large Language Models (LLMs) that run entirely on-device, LM-Kit ensures fast, secure, and private processing without the need for cloud services.
Powered by Dynamic Sampling technology, LM-Kit achieves up to 75% error reduction and 2x faster inference speeds. With support for grammar-constrained outputs, multimodal inputs, and reasoning capabilities, you can build sophisticated text generation pipelines that meet enterprise requirements.
New in 2026: Agent templates for text generation tasks including
WriterAgentTemplate, EditorAgentTemplate, and
SummarizerAgentTemplate. Build agentic text generation workflows with
planning strategies and tool integration.
Sampling
Dynamic Sampling
Proprietary technology ensuring accurate, constrained outputs with optimal performance.
Multimodal
Multimodal support
Generate text from images, documents, and attachments with VLM integration.
Reasoning
Reasoning capabilities
Chain-of-thought prompting and intermediate reasoning steps with ReasoningLevel control.
Local
100% local
On-device inference with no cloud dependency. Your data never leaves your infrastructure.
Grammar-constrained text generation.
Generate outputs that strictly conform to predefined formats using custom grammars, JSON schemas, and BNF definitions. Powered by Dynamic Sampling technology for up to 75% error reduction.
JSON
JSON schema enforcement
Create Grammar objects from JSON schemas to ensure generated content aligns with structure and data types. Build JSON outputs directly from .NET types including complex structures like dates and arrays.
BNF
BNF grammar definitions
Define custom grammars using Backus-Naur Form (BNF) for domain-specific output formats. Enforce exact syntax requirements for code generation, queries, and structured documents.
Schema
TextExtractionElement
Define extraction schemas with typed elements including String, Float, Date, Boolean, and Arrays. Supports formatting hints, case modes, and required field validation.
Built-in
Predefined grammar types
Use built-in grammars for common formats: Json, JsonArray, Arithmetic, List, and Boolean. Rapid prototyping with zero grammar definition required.
Constrain
Whitelisted values
Constrain outputs to specific allowed values using the WhitelistedValues property. Perfect for classification tasks and controlled vocabulary generation.
Discovery
Schema discovery
Automatically discover extraction schemas from unstructured content using SchemaDiscovery. Let the AI identify relevant fields and data types.
Grammar factory methods
- Create a
Grammarobject from a JSON schema string to enforce structured JSON output generation. - Build grammar from
TextExtractionElementcollection for typed data extraction with validation. - Generate grammar from a list of allowed string values for constrained classification outputs.
- Create JSON grammar from field definitions for rapid schema development without full JSON schema.
using LMKit.Model; using LMKit.TextGeneration; using LMKit.TextGeneration.Sampling; using LMKit.Extraction; // Load the model var model = LM.LoadFromModelID("qwen3.5:4b"); // Define extraction elements for structured output var elements = new List<TextExtractionElement> { new TextExtractionElement("ProductName", ElementType.String, "Name of the product"), new TextExtractionElement("Price", ElementType.Float, "Price in USD"), new TextExtractionElement("ReleaseDate", ElementType.Date, "Product release date"), new TextExtractionElement("Features", ElementType.StringArray, "List of key features") }; // Create grammar from extraction elements var grammar = Grammar.CreateJsonGrammarFromExtractionElements(elements); // Create conversation with grammar constraint var chat = new SingleTurnConversation(model) { Grammar = grammar }; // Generate structured output var result = chat.Submit("Extract product info: The SuperWidget Pro costs $299.99 and launches March 15, 2026."); Console.WriteLine(result.Completion);
Intelligent text condensation.
Condense lengthy texts into concise, informative summaries. Extract key insights from any content size with adaptive overflow strategies and multilingual support.
Adaptive summarization engine
The LM-Kit Summarizer is a sophisticated NLP engine that employs innovative techniques to condense content of any size or language into coherent summaries. Multiple overflow strategies ensure reliable handling of massive inputs, from short articles to lengthy legal documents.
Overflow resolution strategies
Truncate: Process the first portion that fits within context limitsRecursiveSummarize: Iteratively summarize chunks then combineReject: Return error for content exceeding limits- Automatic title generation with
GenerateTitleproperty - Configurable summary length via
MaxContentWords - Target language detection and generation
- Multimodal support: summarize from images
- Confidence score for quality assessment
using LMKit.Model; using LMKit.TextGeneration; var model = LM.LoadFromModelID("mistral-small3.2"); var summarizer = new Summarizer(model) { GenerateTitle = true, GenerateContent = true, MaxContentWords = 150, OverflowStrategy = OverflowResolutionStrategy.RecursiveSummarize, TargetLanguage = Language.English }; var result = summarizer.Summarize( File.ReadAllText("annual-report.txt")); Console.WriteLine($"Title: {result.Title}"); Console.WriteLine($"Summary: {result.Content}");
Summary modes
Mode
Briefing
Executive-style condensed overview
Mode
Key points
Extract main takeaways
Mode
Abstract
Academic-style summary
Mode
Custom
Your defined intent
AI-powered text quality enhancement.
Identify and correct grammatical errors, typos, and inconsistencies. Real-time feedback for professional, polished content across multiple languages.
Grammar
Grammar correction
Fix subject-verb agreement, tense inconsistencies, and sentence structure issues automatically.
Spell
Spell checking
Detect and correct spelling mistakes with context-aware suggestions.
i18n
Multilingual support
Correct text in multiple languages with language-specific rules and conventions.
Realtime
Real-time processing
Instant corrections as users type with async support for responsive applications.
using LMKit.Model; using LMKit.TextEnhancement; var model = LM.LoadFromModelID("qwen3.5:4b"); var corrector = new TextCorrection(model); string input = "My cat don't never flyed to the moon " + "because he too much tired from baking pizza."; string corrected = corrector.Correct(input); Console.WriteLine("Original: " + input); Console.WriteLine("Corrected: " + corrected); // Output: "My cat has never flown to the moon // because he was too tired from baking pizza." // Async support for real-time applications var asyncResult = await corrector.CorrectAsync(input);
Style transformation & tone adaptation.
Transform text into various communication styles while preserving meaning and structure. Tailor content for different audiences with predefined and custom styles.
Style
Concise
Clear, direct communication
Style
Professional
Business-appropriate tone
Style
Friendly
Warm, approachable style
Style
Custom
Define your own style
Brand
Brand consistency
Ensure all communications align with your brand voice and style guidelines across different platforms.
Language
Language adaptation
Translate and rewrite text while maintaining context and nuance for global audiences.
Audience
Audience targeting
Tailor content to resonate with specific audience segments, improving engagement.
Async
Async processing
Asynchronous support for efficient, real-time rewriting in dynamic applications.
using LMKit.Model; using LMKit.TextEnhancement; var model = LM.LoadFromModelID("qwen3.5:4b"); var rewriter = new TextRewriter(model); string casual = "Hey! So basically the project's done and it works great!"; // Transform to professional style string professional = rewriter.Rewrite(casual, WritingStyle.Professional); Console.WriteLine("Professional: " + professional); // "The project has been completed successfully and is functioning as expected." // Transform to concise style string concise = rewriter.Rewrite(casual, WritingStyle.Concise); Console.WriteLine("Concise: " + concise); // "Project complete. Fully operational."
Get started with examples.
Explore working code samples demonstrating text generation capabilities.
Web content extractor
Extract and summarize web page information to structured JSON using grammar constraints.
Text summarizer
Condense lengthy text into concise summaries with optional title generation.
Text corrector
Fix grammar and spelling errors with AI-powered correction.
Text rewriter
Transform text into different communication styles.
Keyword extraction
Extract key terms and topics from text content.
Multi-turn chat
Build conversational AI with context-aware responses.
Key classes & methods.
Core components for building text generation pipelines.
SingleTurnConversation
One-shot text generation with grammar constraints, system prompts, and sampling configuration.
MultiTurnConversation
Context-aware chat with memory, tools, skills, and reasoning support.
Summarizer
Intelligent text condensation with overflow strategies and multilingual support.
Grammar
Grammar-constrained output with BNF, JSON schema, and extraction element support.
TextCorrection
Grammar and spelling correction with real-time feedback and async support.
TextRewriter
Style transformation with predefined and custom writing styles.
KeywordExtraction
Extract key terms and topics with configurable count and target language.
TextExtraction
Extract structured data from unstructured content with schema definition.
Compose prompts like programs.
Every prompt LM-Kit produces, including the system prompts driving conversations, agents, and skills, can flow through a full templating engine. Three syntaxes, filters, conditionals, loops, custom helpers. Compiled once, reused everywhere.
Build it. Read it. Try it.
Working console demos on GitHub, step-by-step how-to guides on the docs site, and the API reference for the classes used on this page.
Single-turn chat
Console demo: one-shot prompt with a local LLM.
Open on GitHub → DemoMulti-turn chat
Console demo: history-aware chat with streaming.
Open on GitHub → DemoText summarizer
Console demo: long-form summaries with overflow policies.
Open on GitHub → How-to guideLoad a model and generate
Foundational how-to: from NuGet to first inference.
Read the guide →Seven pillars, one foundation.
The seven pillars of LM-Kit.NET, plus the local runtime they share. Highlighted card is where you are now.
01 · AI Agents
Orchestration patterns
ReAct planning, supervisors, parallel and pipeline orchestrators, persistent memory, MCP clients, custom tools.
AI Agents02 · Document Intelligence
Parse PDFs, images, EML
PDF text and table extraction, on-device OCR reaching SOTA benchmark scores, structured field extraction with grammar-constrained generation.
Document Intelligence03 · Vision & Multimodal
VLMs, image classification, chat with image
Image understanding, classification, labeling, multimodal chat, image embeddings, VLM-OCR, background removal. Same conversation surface as LLMs.
Vision & Multimodal04 · RAG & Knowledge
Vector search and retrieval
Built-in vector store, Qdrant connector, embeddings, hybrid retrieval, document chunking, source citations.
RAG & Knowledge05 · Text Analysis
Classification, NER, PII, sentiment
Built-in classifiers and an extractor that emits typed C# objects via grammar-constrained sampling. Sentiment, keywords, language detection.
Text Analysis06 · Speech & Audio
Audio transcription, STT
A growing local speech-to-text stack: hallucination suppression, Voice Activity Detection, real-time translation, streaming output, 100+ languages.
Speech & Audio07 · Text Generation
Conversations, rewriting, summaries
Single-turn, multi-turn, and stateless conversation primitives. Translate, correct, rewrite, summarise. Prompt templates, streaming, grammar-constrained outputs.
You are hereThe foundation
Every capability above runs on this runtime.
Foundation
Local Inference
The runtime all seven pillars sit on. The LM-Kit.NET NuGet ships the complete inference system: open-weight LLMs, vision-language models, embeddings, on-device speech-to-text, OCR and classifiers, accelerated on CPU, AVX2, CUDA 12/13, Vulkan or Metal. One package, zero cloud calls, predictable latency, full data and technology sovereignty.
Ready to build AI-powered text generation?
Full control over content creation, summarization, and enhancement. 100% local, 100% your infrastructure.