Text Generation
Transformers
Safetensors
GGUF
English
lfm2
kailu
kvchub
small-language-model
hybrid
short-convolution
conversational
Instructions to use KvcHub/KaiLu-3-Mini with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use KvcHub/KaiLu-3-Mini with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="KvcHub/KaiLu-3-Mini") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("KvcHub/KaiLu-3-Mini") model = AutoModelForCausalLM.from_pretrained("KvcHub/KaiLu-3-Mini", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use KvcHub/KaiLu-3-Mini with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf KvcHub/KaiLu-3-Mini # Run inference directly in the terminal: llama cli -hf KvcHub/KaiLu-3-Mini
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf KvcHub/KaiLu-3-Mini # Run inference directly in the terminal: llama cli -hf KvcHub/KaiLu-3-Mini
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf KvcHub/KaiLu-3-Mini # Run inference directly in the terminal: ./build/bin/llama cli -hf KvcHub/KaiLu-3-Mini
Use Docker
docker model run hf.co/KvcHub/KaiLu-3-Mini
- Llama new
- LM Studio
- Jan
- vLLM
How to use KvcHub/KaiLu-3-Mini with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "KvcHub/KaiLu-3-Mini" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "KvcHub/KaiLu-3-Mini", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/KvcHub/KaiLu-3-Mini
- SGLang
How to use KvcHub/KaiLu-3-Mini with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "KvcHub/KaiLu-3-Mini" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "KvcHub/KaiLu-3-Mini", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "KvcHub/KaiLu-3-Mini" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "KvcHub/KaiLu-3-Mini", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use KvcHub/KaiLu-3-Mini with Ollama:
ollama run hf.co/KvcHub/KaiLu-3-Mini
- Unsloth Desktop
- Docker Model Runner
How to use KvcHub/KaiLu-3-Mini with Docker Model Runner:
docker model run hf.co/KvcHub/KaiLu-3-Mini
- Lemonade
How to use KvcHub/KaiLu-3-Mini with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull KvcHub/KaiLu-3-Mini
Run and chat with the model
lemonade run user.KaiLu-3-Mini-{{QUANT_TAG}}List all available models
lemonade list
- Atomic Chat
|
Download README.md from KvcHub/KaiLu-3-Mini: direct link, hf CLI and curl.
- Browser
- Download file 11.2 kB
-
https://huggingface.co/KvcHub/KaiLu-3-Mini/resolve/main/README.md
- Command line
-
hf download hf://KvcHub/KaiLu-3-Mini/README.md
-
curl -L -H "Authorization: Bearer $HF_TOKEN" -o README.md https://huggingface.co/KvcHub/KaiLu-3-Mini/resolve/main/README.md
11.2 kB
| license: other | |
| license_name: kailu-3-license | |
| license_link: https://huggingface.co/KvcHub/KaiLu-3-Mini/blob/main/LICENSE | |
| language: | |
| - en | |
| library_name: transformers | |
| pipeline_tag: text-generation | |
| inference: false | |
| tags: | |
| - kailu | |
| - kvchub | |
| - small-language-model | |
| - hybrid | |
| - short-convolution | |
| - lfm2 | |
| - conversational | |
| datasets: | |
| - HuggingFaceFW/fineweb-edu | |
| - HuggingFaceTB/smollm-corpus | |
| - DKYoon/SlimPajama-6B | |
| - HuggingFaceTB/finemath | |
| - wikimedia/wikipedia | |
| - OpenCoder-LLM/opc-annealing-corpus | |
| - HuggingFaceTB/smol-smoltalk | |
| - HuggingFaceH4/ultrafeedback_binarized | |
| - nvidia/HelpSteer2 | |
| - Anthropic/hh-rlhf | |
| extra_gated_heading: "KaiLu 3 Mini License (Version 1.0, November 2026)" | |
| extra_gated_prompt: "Copyright (c) 2026 KvcHub. All rights reserved except as granted in the [KaiLu 3 Mini License](https://huggingface.co). Free for personal, non-commercial use only (hobby projects, learning, teaching, and non-commercial research). Business or commercial use—including paid products/services, ad-supported apps, paid APIs, internal company work, or paid client work—is prohibited without prior written permission from KvcHub (hello@kvchub.com). Provided as is without warranty." | |
| extra_gated_fields: | |
| I have read and agree to the KaiLu 3 Mini License: checkbox | |
| I confirm my use is strictly personal and non-commercial: checkbox | |
| Full Name: text | |
| extra_gated_button_content: "Agree and Request Access" | |
| # KaiLu 3 Mini | |
| **A small language model with a big brain. Built from scratch by [KvcHub](https://kvchub.com).** | |
| KaiLu 3 Mini is a 329M-parameter chat model built from scratch by [KvcHub](https://kvchub.com). It has a hybrid brain: 16 fast gated short-convolution layers read nearby words, and 8 attention layers connect the whole text. It read 6.6B tokens of textbooks, web pages, math, Wikipedia and code, then learned to chat and to prefer the answers people like. | |
| ## Model details | |
| | | | | |
| |---|---| | |
| | Parameters | 329,353,216 | | |
| | Layers | 24: 16 gated short-convolution (kernel 3), 8 attention (layers 3, 6, 9, 12, 15, 18, 21, 23) | | |
| | Width | hidden 1,024, SwiGLU feed-forward 2,816 | | |
| | Attention | 16 query heads, 4 key-value heads (grouped-query), QK-norm, RoPE θ = 1,000,000 | | |
| | Context | 1,024 tokens | | |
| | Vocabulary | 32,768 tokens (byte-level BPE) | | |
| | Embeddings | input and output shared | | |
| | Weights | bfloat16, safetensors | | |
| | Format | `Lfm2ForCausalLM` in 🤗 Transformers (4.54+). KaiLu 3 shares LFM2's layer layout only: it was trained from scratch and contains no LFM2 weights. | | |
| ## How it was made | |
| 1. **Pretraining:** 6.6B tokens, mixed as: educational web (FineWeb-Edu) 50%, synthetic textbooks (Cosmopedia v2) 18%, general web and books (SlimPajama-6B, without Books3) 12%, math (FineMath 4+) 8%, Wikipedia 6%, code (OpenCoder annealing) 6%. | |
| 2. **Supervised fine-tuning:** about 460K conversations from smol-smoltalk, one pass, learning only from the assistant replies. | |
| 3. **Preference tuning (DPO, β = 0.1):** answer pairs from UltraFeedback (binarized), HelpSteer2 preferences and Anthropic HH-RLHF (up to 60K pairs). | |
| ## Chat format | |
| KaiLu 3 learned from conversations written like this: | |
| ``` | |
| <|system|> | |
| You are KaiLu, a helpful assistant. | |
| <|user|> | |
| Hi! | |
| <|assistant|> | |
| Hello! How can I help?<|endoftext|> | |
| ``` | |
| Each reply ends with `<|endoftext|>`. | |
| ## Limitations | |
| KaiLu 3 is a small model. It can state wrong facts confidently, lose track in long conversations and write buggy code. | |
| It works best in English and within 1,024 tokens. It has had no safety testing beyond its preference tuning, so check | |
| its answers before relying on them. | |
| ## License | |
| **Free for personal use. Business use needs permission.** KaiLu 3 is released under the [KaiLu 3 Mini License](https://huggingface.co/KvcHub/KaiLu-3-Mini/blob/main/LICENSE/): | |
| you can use, study and modify it for free for personal and non-commercial purposes. For any business or commercial use, | |
| contact KvcHub at [hello@kvchub.com](mailto:hello@kvchub.com) first. The datasets it learned from keep their own licenses. | |
| Built by [KvcHub](https://kvchub.com). | |
| <!-- KVCHUB-SECURITY-AND-BENCHMARKS --> | |
| ## Security & KvcHub Model Comparison | |
| See [`SECURITY.md`](./SECURITY.md) for the full threat model, deployment checklist, and vulnerability reporting policy. | |
| ### KvcHub Model Security Comparison | |
| | Model | Task | Params | Weight Format (Pickle-Free) | Runtime Isolation | Training Provenance | Data / Secret Hygiene | Supply-Chain & Checksums | License | | |
| |---|---|---:|---|---|---|---|---|---| | |
| | **[Kava-Privacy-30M](https://huggingface.co/KvcHub/Kava-Privacy-30M)** | PII Redaction (36 langs, 30 entities) | 30.46M | `safetensors` (Yes) | 100% local / offline (Transformers, CPU/MPS/CUDA) | 100% from scratch | Synthetic 36-lang + CC-BY-4.0/Apache-2.0 synthetic PII; no real user PII; zero-hallucination span tagging | HF LFS SHA-256 + `eval_results.json` | Apache-2.0 | | |
| | **[Kava-Privacy-2.01M-mlx](https://huggingface.co/KvcHub/Kava-Privacy-2.01M-mlx)** | PII Redaction (EN, 16 entities) | 2.01M | `safetensors` (Yes) | 100% local / offline (Apple MLX) | 100% from scratch | Fully synthetic training data; zero cloud calls | HF LFS SHA-256 (`kava_privacy.py` custom loader) | MIT | | |
| | **[Kava-Privacy-636k-mlx](https://huggingface.co/KvcHub/Kava-Privacy-636k-mlx)** | PII Redaction (EN, 9 entities) | 636K | `safetensors` (Yes) | 100% local / offline (Apple MLX) | 100% from scratch | Fully synthetic training data; zero cloud calls | HF LFS SHA-256 (`kava_privacy.py` custom loader) | MIT | | |
| | **[KaiLu-3-Pro](https://huggingface.co/KvcHub/KaiLu-3-Pro)** | Conversational LM | 1.03B | `safetensors` + `GGUF` (Yes) | 100% local / offline (llama.cpp, Ollama, Transformers) | 100% from scratch | Public open corpora + DPO (UltraFeedback, HelpSteer2, HH-RLHF); no formal red-team audit | Explicit `SHA256SUMS` + HF LFS SHA-256 | Apache-2.0 | | |
| | **[KaiLu-3-Mini](https://huggingface.co/KvcHub/KaiLu-3-Mini)** | Conversational LM | 329M | `safetensors` + `GGUF` (Yes) | 100% local / offline (Transformers, llama.cpp) | 100% from scratch | Public open corpora + DPO (UltraFeedback, HelpSteer2, HH-RLHF); no formal red-team audit | HF LFS SHA-256 | KaiLu-3 License (Non-commercial) | | |
| | **[KaiLu-Web](https://huggingface.co/KvcHub/KaiLu-Web)** | In-Browser Chat LM | 329M / 1.03B | Split `GGUF` (Yes) | Browser WebAssembly sandbox (`wllama`); zero server calls | Packaged from KaiLu-3 / 3-Pro | Same as KaiLu-3 / 3-Pro; browser COOP/COEP isolation | HF LFS SHA-256 | Per-file (Apache-2.0 / KaiLu-3) | | |
| | **[KaiLu-2-2B-GGUF](https://huggingface.co/KvcHub/KaiLu-2-2B-GGUF)** | Reasoning & Chat LM | 1.90B | `GGUF` F16–Q2_K (Yes) | 100% local / offline (llama.cpp) | 100% from scratch (distilled text mix) | Public open datasets + synthetic reasoning; no formal safety red-teaming | HF LFS SHA-256 + `stats.json` | Apache-2.0 | | |
| | **[KaiLu-1-933M](https://huggingface.co/KvcHub/KaiLu-1-933M)** | Mobile / Desktop Chat LM | 933M | `safetensors` + `GGUF` (Yes) | 100% local / offline (Apple MLX / mobile GGUF) | 100% from scratch | Offline on-device execution; legacy v1 release | HF LFS SHA-256 | Apache-2.0 | | |
| | **[Ki-Complete-7B](https://huggingface.co/KvcHub/Ki-Complete-7B)** | Code Autocomplete (FIM) | 7B (LoRA r=64) | `GGUF` + PEFT `safetensors` (Yes) | 100% local / offline (`llama-server` on `127.0.0.1`) | Fine-tuned on `Qwen2.5-Coder-7B` | Permissive-license code only; pre-training secret/key scan + extension blocks novel key-shaped strings | HF LFS SHA-256 | Apache-2.0 | | |
| | **[Ki-Complete-1.5B](https://huggingface.co/KvcHub/Ki-Complete-1.5B)** | Code Autocomplete (FIM) | 1.5B (LoRA r=64) | `GGUF` + PEFT `safetensors` (Yes) | 100% local / offline (`llama-server` on `127.0.0.1`) | Fine-tuned on `Qwen2.5-Coder-1.5B` | Permissive-license code only; pre-training secret/key scan + extension blocks novel key-shaped strings | HF LFS SHA-256 | Apache-2.0 | | |
| ### KvcHub Model Benchmark Comparison | |
| #### 1. PII Redaction Family (`Kava-Privacy`) | |
| | Model | Params | Languages | Entities | Architecture | Primary Benchmark Result | False-Positive / Hard-Neg Check | Speed (Apple Silicon) | | |
| |---|---:|---:|---:|---|---|---|---| | |
| | **[Kava-Privacy-30M](https://huggingface.co/KvcHub/Kava-Privacy-30M)** | 30.46M | **36** | **30** (61 BIO) | ModernBERT (from scratch) | Held-out test Exact Span **F1 0.9146** (P 0.8952 / R 0.9348) | Hard-Neg FPR: **0.0** | **33.3 docs/sec** (MPS) | | |
| | **[Kava-Privacy-2.01M-mlx](https://huggingface.co/KvcHub/Kava-Privacy-2.01M-mlx)** | 2.01M | 1 (EN) | 16 | MLX Encoder (from scratch) | Adversarial 100% (12/12) · Zero-shot OOD 87.5% | 0% on physics/subnet/legal/ticker suite | 2.2 ms / doc (MLX) | | |
| | **[Kava-Privacy-636k-mlx](https://huggingface.co/KvcHub/Kava-Privacy-636k-mlx)** | 636K | 1 (EN) | 9 | 4L MLX Encoder (from scratch) | Synthetic val token acc 99.6%–100.0% across 9 tags | Synthetic val O-tag acc 100.0% | Sub-ms (2.4 MB weights) | | |
| #### 2. Conversational & Reasoning LM Family (`KaiLu`) | |
| | Model | Params | Architecture | Context (Trained) | Footprint (Recommended) | Speed (Apple Silicon) | Reported Benchmarks | | |
| |---|---:|---|---|---|---|---| | |
| | **[KaiLu-3-Pro](https://huggingface.co/KvcHub/KaiLu-3-Pro)** | 1.03B | LFM2 Hybrid (36L) | 1,024 (51K cfg) | 1.09 GB (`Q8_0` GGUF) / 2.07 GB (bf16) | Local CPU/Metal/Ollama | Benchmarks intentionally omitted (MMLU/ARC/HumanEval/GSM8K included in SFT; evaluate on unseen data) | | |
| | **[KaiLu-3-Mini](https://huggingface.co/KvcHub/KaiLu-3-Mini)** | 329M | LFM2 Hybrid (24L) | 1,024 | `model.safetensors` + `kailu-3.gguf` | Local CPU/Metal | Pretrained on 6.6B tokens + 460K SFT + 60K DPO pairs (no formal eval table published) | | |
| | **[KaiLu-Web](https://huggingface.co/KvcHub/KaiLu-Web)** | 329M / 1.03B | LFM2 Hybrid (`wllama` WASM) | 1,024 | 351 MB (`3-Q8_0`) / 623 MB (`3-Pro-Q4_K_M`) | In-browser WASM | Browser-packaged builds of KaiLu-3-Mini & KaiLu-3-Pro | | |
| | **[KaiLu-2-2B-GGUF](https://huggingface.co/KvcHub/KaiLu-2-2B-GGUF)** | 1.90B | LFM2 Hybrid (104L) | 1,024 (4K GGUF) | 1.17 GB (`Q4_K_M`, 1.51 GB RAM) | **107 tok/s** GPU / 64 tok/s CPU (`Q4_K_M`) | Held-out PPL **11.003** (F16) / **11.077** (`Q4_K_M`); 8th-grade math **75.0%**; Random math **43.3%**; Unseen-vocab IQ **72.5%** | | |
| | **[KaiLu-1-933M](https://huggingface.co/KvcHub/KaiLu-1-933M)** | 933M | MLX Transformer | — | 546 MB mobile GGUF (1.15 GB RAM) | **260+ tok/s** (Apple Silicon) | Legacy v1 baseline (no formal benchmark suite published) | | |
| #### 3. Code Autocomplete Family (`Ki-Complete`) — Measured on Apple M5 Pro (`llama.cpp`, `Q8_0`) | |
| | Model | Params | Base Model | HumanEval-Infill (1-line) | HumanEval-Infill (multi-line) | HumanEval-Infill (mid-line) | Real Code Exact Line (no ctx / w/ ctx) | Unwanted Extra Lines | Latency (no ctx / w/ ctx) | | |
| |---|---:|---|---:|---:|---:|---:|---:|---:| | |
| | **[Ki-Complete-7B](https://huggingface.co/KvcHub/Ki-Complete-7B)** | 7B | Qwen2.5-Coder-7B | **95.0%** | **53.5%** | **46.3%** | **49.7% / 37.7%** · **52.9% / 41.7%** | 4% (vs 42% base) | 1.00 s / 4.5 s | | |
| | **[Ki-Complete-1.5B](https://huggingface.co/KvcHub/Ki-Complete-1.5B)** | 1.5B | Qwen2.5-Coder-1.5B | 89.4% | 53.4% | 40.9% | 44.0% / 36.0% · 45.1% / 38.6% | **3%** (vs 65% base) | **0.23 s / 1.1 s** | | |