Embedder
One class, one constructor, one method (with overloads).
Turn any text passage, image, or document into a dense vector
that captures meaning. Embedder is the unified API
used by every search, RAG, classification, and clustering
workflow in LM-Kit.NET. Runs entirely on-device with any
embedding model in the catalog.
EmbedderOne class, one constructor, one method (with overloads).
VectorOperationsCosine, dot, Euclidean similarity plus normalisation utilities.
float[] & float[][]Plain arrays. Drop directly into any vector store or do raw vector math.
01 · Unified
Load nomic-embed-text for text, nomic-embed-vision for images, bge-m3 for multilingual. Same Embedder constructor. Same GetEmbeddings call.
02 · Batched
Overloads accept a single string, an IEnumerable<string>, pre-tokenised arrays, or ImageBuffer sequences for images. Throughput scales linearly with batch size on GPU.
03 · Async-first
GetEmbeddingsAsync + cancellationEvery overload has an async sibling. Pass a CancellationToken, get back a Task. Wire straight into server pipelines without blocking the request thread.
04 · Cross-modal
Nomic Embed Vision aligns its image vector space with nomic-embed-text. A text query retrieves matching images, an image query retrieves matching text passages. One vector store, two modalities.
05 · Multilingual
bge-m3bge-m3 embeds across 100+ languages in one model. Index in mixed-language corpora, query in any language, retrieve cross-lingually without per-language pipelines.
06 · Plug-in stores
In-memory, FileSystemVectorStore, Qdrant via connector, or a custom IVectorStore implementation. float[] in, similarity hits out. No vendor lock-in.
Single, batch, and cross-modal. Pick a tab for the pattern you need.
The simplest pattern. One model, one call, one vector. The
EmbeddingSize property tells you the dimension
ahead of time so you can size your vector store correctly.
using LMKit.Model; using LMKit.Embeddings; var model = LM.LoadFromModelID("embeddinggemma-300m"); var embedder = new Embedder(model); float[] vec = embedder.GetEmbeddings("Machine learning is fascinating."); Console.WriteLine($"dimensions: {vec.Length} (matches embedder.EmbeddingSize = {embedder.EmbeddingSize})");
Batch inputs in one call for throughput. Combine with
VectorOperations.CosineSimilarity for duplicate
detection, semantic deduplication, or clustering.
var texts = new[] { "The cat sat on the mat.", "A feline rested on the rug.", "Stock market closed higher.", }; // One call, three vectors. GPU batches them efficiently. float[][] vecs = embedder.GetEmbeddings(texts); // 0 and 1 are semantically close; 2 is far away. float simCatRug = VectorOperations.CosineSimilarity(vecs[0], vecs[1]); float simCatStock = VectorOperations.CosineSimilarity(vecs[0], vecs[2]); Console.WriteLine($"cat ~ rug: {simCatRug:F3}"); Console.WriteLine($"cat ~ stock: {simCatStock:F3}");
Vision and text embedders share a vector space when paired
(e.g. nomic-embed-vision + nomic-embed-text).
Embed once, query both modalities, retrieve cross-modally
without two separate pipelines.
using LMKit.Graphics; // One aligned pair of embedders. var textEmb = new Embedder(LM.LoadFromModelID("nomic-embed-text")); var imageEmb = new Embedder(LM.LoadFromModelID("nomic-embed-vision")); // Index images. var store = new FileSystemVectorStore("./image-index"); foreach (var path in Directory.EnumerateFiles("./photos", "*.jpg")) { float[] vec = imageEmb.GetEmbeddings(ImageBuffer.LoadAsRGB(path)); await store.UpsertAsync(path, vec, new() { ["file"] = path }); } // Query with TEXT. Retrieves IMAGE results. float[] query = textEmb.GetEmbeddings("sunset over the ocean"); var hits = await store.SearchAsync(query, topK: 5);
Text
embeddinggemma-300mCompact 300M-parameter multilingual embedder. Runs comfortably on CPU. Default choice for laptop-grade workloads and air-gapped servers.
Text
nomic-embed-textStrong text embedder; pair with nomic-embed-vision for cross-modal workflows. Same vector dimensionality, shared semantic space.
Multilingual
bge-m3100+ languages in one model. Dense AND sparse output (so it can drive lexical-style retrieval too). The default choice for international corpora.
Text
qwen3-embedding:0.6b / 4b / 8bQwen3 embedding family across three sizes. Choose based on accuracy / memory trade-off; same API.
Vision
nomic-embed-visionImage vectors aligned with nomic-embed-text. Same vector space, two modalities, one index. Powers vision-grounded retrieval and multimodal search.
Bring your own
If a model is in GGUF format, LM.LoadFromFile handles it. The Embedder wrapper works the same way.
Generating vectors is half the work. The rest of the stack handles storage, retrieval, expansion, reranking, and grounded generation.
Storage
Built-in FileSystemVectorStore, Qdrant connector, or a custom IVectorStore. Same vectors, three deployment shapes.
Recall
HyDE, MultiQuery, contextualisation. When the user's wording is far from the corpus, these techniques pull it back.
Query expansionPrecision
A second-pass model reorders the top-k from any retriever. Often the difference between mediocre and excellent results.
RerankerGeneration
Wrap the full pipeline into DocumentRag and answer with citations.
Lexical companion
Layout-aware exact / regex / fuzzy search with bounding boxes. Pair lexical and semantic for hybrid workflows.
Document SearchOutside RAG
Same Embedder powers classification, clustering, semantic deduplication, and anomaly detection. The Text Analysis page covers those patterns.
Text Analysis use casesWorking 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.
Console demo: ingest, embed, retrieve, ground answers with citations.
Open on GitHub → DemoConsole demo: cross-modal embeddings + retrieval with reranking.
Open on GitHub → How-to guideIndex, embed, query by meaning, rerank.
Read the guide → API referenceAPI reference for the unified text + image embedder.
Open the reference →The seven pillars of LM-Kit.NET, plus the local runtime they share. Highlighted card is where you are now.
01 · AI Agents
ReAct planning, supervisors, parallel and pipeline orchestrators, persistent memory, MCP clients, custom tools.
AI Agents02 · Document Intelligence
PDF text and table extraction, on-device OCR reaching SOTA benchmark scores, structured field extraction with grammar-constrained generation.
Document Intelligence03 · Vision & Multimodal
Image understanding, classification, labeling, multimodal chat, image embeddings, VLM-OCR, background removal. Same conversation surface as LLMs.
Vision & Multimodal04 · RAG & Knowledge
Built-in vector store, Qdrant connector, embeddings, hybrid retrieval, document chunking, source citations.
RAG & Knowledge05 · Text Analysis
Built-in classifiers and an extractor that emits typed C# objects via grammar-constrained sampling. Sentiment, keywords, language detection.
Text Analysis06 · Speech & Audio
A growing local speech-to-text stack: hallucination suppression, Voice Activity Detection, real-time translation, streaming output, 100+ languages.
Speech & Audio07 · Text Generation
Single-turn, multi-turn, and stateless conversation primitives. Translate, correct, rewrite, summarise. Prompt templates, streaming, grammar-constrained outputs.
Text GenerationThe foundation
Every capability above runs on this runtime.
Foundation
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.