Blog

Technical articles on AI inference, search, embeddings, and building developer tools.

· 4 min read

Sentence Embeddings in Rust on the CPU, without ONNX Runtime or libtorch

Run all-MiniLM-L6-v2 and other sentence-transformers models from Rust with one crate: no ONNX export, no libtorch, no Python. The same scores as sentence-transformers, a 25 MB binary, and 1,000 sentences embedded in about a second.

rust embeddings sentence-transformers minilm semantic-search inference kjarni
Read more
· 3 min read

Speech to Text in C#, Offline: Whisper in Your .NET Process

Transcribe audio files from C# with OpenAI's Whisper running locally: no API key, no Python, no whisper.cpp build. One NuGet package, timestamps per segment, and 3 minutes of speech transcribed in 25 seconds on a CPU.

C# dotnet speech-to-text whisper transcription offline kjarni
Read more
· 8 min read

Image Search in C#: Find Photos by Description with CLIP, Offline

Search a folder of photos by typing what is in them, from C#, with no cloud API, no Python and no ONNX export. CLIP runs in your process from one NuGet package. Tested on 1,000 COCO photos: 19 ms per photo to index, and the right photo in the top 5 for 85% of captions.

C# dotnet image-search clip embeddings computer-vision kjarni
Read more
· 4 min read

Semantic Grep in C#: Search Files by Meaning, Not Keywords

A grep that finds lines by what they mean, in 50 lines of C#. Ask "is this safe to call from several threads" and get the comments that answer it, where grep finds nothing. One NuGet package, offline, no Python.

C# dotnet semantic-search grep embeddings cli kjarni
Read more
· 5 min read

Local LLM in Qt: An Offline AI Chat App in QML and C++

Run a local LLM inside a Qt 6 / QML application: stream tokens to the UI, stop generation, and keep conversation history, with no server and no API key. Complete source, with real timings and memory use from Llama 3.2 1B.

qt qml cpp llm local-ai chat llama offline kjarni
Read more
· 7 min read

Local AI in Unity: Embeddings, Moderation and LLM NPCs, Offline in C#

Run transformer models inside a Unity game with no server and no API key: match free-text player commands by meaning, moderate chat with toxic-bert, and give an NPC a local LLM. Two DLLs, .NET Standard 2.1, Mono and IL2CPP.

unity csharp gamedev embeddings semantic-search llm moderation offline kjarni
Read more
· 8 min read

Download kjarni.dll: Kjarni on Windows for C#, Unity and C++

Which Kjarni file you need on Windows and where it comes from: Kjarni.dll and kjarni_ffi.dll for C# and Unity, kjarni_ffi.lib and kjarni.h for C++, and kjarni.exe for the command line. Nothing else to install from 0.2.4.

windows csharp dotnet unity cpp msvc embeddings inference kjarni
Read more
· 4 min read

Running a Local LLM from C++

Load Llama, Mistral, Qwen or Phi inside a C++ program and generate text in-process. One header and one shared library, blocking replies and token streaming, with the model running on your own machine.

cpp c++23 llm llama local-ai chat inference streaming nlp kjarni
Read more
· 5 min read

Local Semantic Search in Python

Index a directory, then search it by keyword, by meaning, or both, from Python. One pip install with no dependencies, running on your own machine, with a worked example of where hybrid search goes wrong and what fixes it.

python semantic-search embeddings bm25 hybrid-search reranking vector-search local-ai rag kjarni
Read more
· 10 min read

Local Semantic Search in C++ without libtorch or ONNX Runtime

Run embeddings, classification and reranking from C++ with no libtorch and no ONNX Runtime: one header and one shared library that links only against libc. Works with C++11, C++14, C++17 and C++23, and takes four commands from nothing to output.

cpp c++11 c++17 c++23 semantic-search embeddings machine-learning reranking inference nlp kjarni
Read more
· 6 min read

all-MiniLM-L6-v2 Max Sequence Length: 256 Tokens, Not 512

all-MiniLM-L6-v2 truncates at 256 tokens, about 900 characters, and drops the rest without a warning. Why the configs say 128, 256 and 512, what chunk size to use, and why raising max_seq_length to 512 makes retrieval worse.

embeddings sentence-transformers rag minilm chunking semantic-search nlp kjarni
Read more
· 5 min read

A local IChatClient for Microsoft.Extensions.AI

Implement IChatClient with the model inside your .NET process. No daemon, no localhost port. Streaming, multi-turn and Semantic Kernel.

C# dotnet microsoft-extensions-ai ichatclient semantic-kernel llm llama local-ai inference kjarni
Read more
· 6 min read

RAG in C# without a Vector Database

Build a retrieval-augmented generation pipeline in C#: index documents, search them, rerank the hits, and answer with a local LLM. One NuGet package, start to finish, with every stage running on your own machine.

C# dotnet rag retrieval-augmented-generation vector-database semantic-search reranking llm local-ai kjarni
Read more
· 7 min read

Reranking in C# with a Cross-Encoder

Improve search relevance in .NET with cross-encoder reranking. Rescore your existing search results from Elasticsearch, SQL LIKE, or vector search, locally in C# and in your own process.

C# dotnet reranking cross-encoder search semantic-search relevance rag local-ai kjarni
Read more
· 7 min read

Local LLM Chat in C# without Ollama or an API Key

Run Llama, Mistral, Qwen or Phi locally from C#. One NuGet package, loaded in-process and answering offline. Streaming, multi-turn conversations and sampling control in .NET.

C# dotnet llm llama mistral local-ai chatbot inference nlp kjarni
Read more
· 5 min read

Local Embeddings for Microsoft.Extensions.AI, no Ollama

Implement IEmbeddingGenerator locally in .NET. Plug Kjarni into Microsoft.Extensions.AI and Semantic Kernel with one NuGet package that has zero dependencies. Runs on CPU, in your process, offline.

C# dotnet microsoft-extensions-ai semantic-kernel embeddings iembeddinggenerator rag local-ai nlp kjarni
Read more
· 5 min read

ML from the Command Line without Writing Code

Run sentiment analysis, generate embeddings, detect toxicity, and search documents from your terminal. One binary, reads stdin, writes JSON, pipes into any script or CI pipeline.

cli machine-learning sentiment-analysis embeddings search nlp kjarni devops
Read more
· 7 min read

Document Search in C# without Elasticsearch

Build a full-text search engine in C# with keyword search, semantic search, hybrid ranking, and reranking. Index files and query them in 10 lines of code, with the index living on your own disk.

C# dotnet search-engine semantic-search bm25 reranking machine-learning nlp kjarni
Read more
· 5 min read

Why I Built a Native ML Inference Engine in Rust

Kjarni is a single native library that runs transformer models in your own process, from Rust, C#, Go, C++ or the command line. One install, on CPU, offline after the first run.

rust machine-learning inference embeddings transformers nlp kjarni
Read more