Text Generation
Transformers
Safetensors
GGUF
English
lfm2
kailu
kvchub
small-language-model
hybrid
short-convolution
conversational
Instructions to use KvcHub/KaiLu3 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use KvcHub/KaiLu3 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="KvcHub/KaiLu3") 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/KaiLu3") model = AutoModelForCausalLM.from_pretrained("KvcHub/KaiLu3", 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/KaiLu3 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/KaiLu3 # Run inference directly in the terminal: llama cli -hf KvcHub/KaiLu3
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf KvcHub/KaiLu3 # Run inference directly in the terminal: llama cli -hf KvcHub/KaiLu3
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/KaiLu3 # Run inference directly in the terminal: ./build/bin/llama cli -hf KvcHub/KaiLu3
Use Docker
docker model run hf.co/KvcHub/KaiLu3
- Llama new
- LM Studio
- Jan
- vLLM
How to use KvcHub/KaiLu3 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "KvcHub/KaiLu3" # 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/KaiLu3", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/KvcHub/KaiLu3
- SGLang
How to use KvcHub/KaiLu3 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/KaiLu3" \ --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/KaiLu3", "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/KaiLu3" \ --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/KaiLu3", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use KvcHub/KaiLu3 with Ollama:
ollama run hf.co/KvcHub/KaiLu3
- Unsloth Desktop
- Docker Model Runner
How to use KvcHub/KaiLu3 with Docker Model Runner:
docker model run hf.co/KvcHub/KaiLu3
- Lemonade
How to use KvcHub/KaiLu3 with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull KvcHub/KaiLu3
Run and chat with the model
lemonade run user.KaiLu3-{{QUANT_TAG}}List all available models
lemonade list
- Atomic Chat
Upload 2 files
Browse files
LICENSE
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
KaiLu 3 License
|
| 2 |
+
Version 1.0, November 2026
|
| 3 |
+
Copyright (c) 2026 KvcHub. All rights reserved except as granted below.
|
| 4 |
+
|
| 5 |
+
In short: KaiLu 3 is free for personal, non-commercial use. Any business or
|
| 6 |
+
commercial use needs written permission from KvcHub first.
|
| 7 |
+
|
| 8 |
+
1. What this license covers
|
| 9 |
+
"KaiLu 3" means the model weights, tokenizer, configuration files and
|
| 10 |
+
documentation that KvcHub publishes under this license, and any version
|
| 11 |
+
made from them, including fine-tuned, merged, quantized, distilled or
|
| 12 |
+
converted versions ("Derivatives").
|
| 13 |
+
|
| 14 |
+
2. Free personal use
|
| 15 |
+
You may download, run, study, modify and fine-tune KaiLu 3 free of charge
|
| 16 |
+
for personal, non-commercial purposes. This includes hobby projects,
|
| 17 |
+
learning, teaching, and non-commercial research.
|
| 18 |
+
|
| 19 |
+
3. Sharing
|
| 20 |
+
You may share KaiLu 3 or your Derivatives for non-commercial purposes only,
|
| 21 |
+
and only if you:
|
| 22 |
+
a. include a copy of this license;
|
| 23 |
+
b. credit "KaiLu 3 by KvcHub" with a link to https://kvchub.com; and
|
| 24 |
+
c. clearly say if you changed it.
|
| 25 |
+
Derivatives stay under this license.
|
| 26 |
+
|
| 27 |
+
4. Business use needs permission
|
| 28 |
+
Commercial use of KaiLu 3 or its Derivatives is not allowed without a
|
| 29 |
+
separate written agreement with KvcHub, made before the use starts.
|
| 30 |
+
Commercial use includes, for example:
|
| 31 |
+
a. using it in, or to build, any product or service that is sold, licensed,
|
| 32 |
+
subscribed to, or earns money in any way, including through ads;
|
| 33 |
+
b. offering it to others through an API, app or hosted service for money;
|
| 34 |
+
c. using it in the work of a company or organization for business purposes;
|
| 35 |
+
d. using it to do paid work for clients.
|
| 36 |
+
To ask for permission, contact KvcHub at hello@kvchub.com.
|
| 37 |
+
|
| 38 |
+
5. Your outputs
|
| 39 |
+
KvcHub claims no rights in text you create with KaiLu 3 while using it
|
| 40 |
+
as this license allows.
|
| 41 |
+
|
| 42 |
+
6. Responsible use
|
| 43 |
+
You are responsible for how you use KaiLu 3 and what it produces. You must
|
| 44 |
+
not use it to break any law or to harm other people.
|
| 45 |
+
|
| 46 |
+
7. Other licenses
|
| 47 |
+
KaiLu 3 learned from third-party datasets listed in its model card. Those
|
| 48 |
+
datasets keep their own licenses, and this license grants no rights to them.
|
| 49 |
+
|
| 50 |
+
8. No warranty
|
| 51 |
+
KaiLu 3 is provided "as is", without warranties of any kind, express or
|
| 52 |
+
implied, including fitness for a particular purpose and accuracy. It can
|
| 53 |
+
make mistakes; check its answers before relying on them.
|
| 54 |
+
|
| 55 |
+
9. Limitation of liability
|
| 56 |
+
To the fullest extent the law allows, KvcHub is not liable for any damages
|
| 57 |
+
or losses arising from the use of, or inability to use, KaiLu 3.
|
| 58 |
+
|
| 59 |
+
10. Ending of rights
|
| 60 |
+
If you break this license, your rights under it end automatically.
|
| 61 |
+
KvcHub may publish new versions of this license; the version that came
|
| 62 |
+
with your copy of KaiLu 3 applies to that copy.
|
README.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: other
|
| 3 |
+
license_name: kailu-3-license
|
| 4 |
+
license_link: https://huggingface.co/<your-username>/KaiLu-3/blob/main/LICENSE
|
| 5 |
+
language:
|
| 6 |
+
- en
|
| 7 |
+
library_name: transformers
|
| 8 |
+
pipeline_tag: text-generation
|
| 9 |
+
inference: false
|
| 10 |
+
tags:
|
| 11 |
+
- kailu
|
| 12 |
+
- kvchub
|
| 13 |
+
- small-language-model
|
| 14 |
+
- hybrid
|
| 15 |
+
- short-convolution
|
| 16 |
+
- lfm2
|
| 17 |
+
- conversational
|
| 18 |
+
datasets:
|
| 19 |
+
- HuggingFaceFW/fineweb-edu
|
| 20 |
+
- HuggingFaceTB/smollm-corpus
|
| 21 |
+
- DKYoon/SlimPajama-6B
|
| 22 |
+
- HuggingFaceTB/finemath
|
| 23 |
+
- wikimedia/wikipedia
|
| 24 |
+
- OpenCoder-LLM/opc-annealing-corpus
|
| 25 |
+
- HuggingFaceTB/smol-smoltalk
|
| 26 |
+
- HuggingFaceH4/ultrafeedback_binarized
|
| 27 |
+
- nvidia/HelpSteer2
|
| 28 |
+
- Anthropic/hh-rlhf
|
| 29 |
+
---
|
| 30 |
+
|
| 31 |
+
# KaiLu 3
|
| 32 |
+
|
| 33 |
+
**A small language model with a big brain. Built from scratch by [KvcHub](https://kvchub.com).**
|
| 34 |
+
|
| 35 |
+
KaiLu 3 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.
|
| 36 |
+
|
| 37 |
+
## Model details
|
| 38 |
+
|
| 39 |
+
| | |
|
| 40 |
+
|---|---|
|
| 41 |
+
| Parameters | 329,353,216 |
|
| 42 |
+
| Layers | 24: 16 gated short-convolution (kernel 3), 8 attention (layers 3, 6, 9, 12, 15, 18, 21, 23) |
|
| 43 |
+
| Width | hidden 1,024, SwiGLU feed-forward 2,816 |
|
| 44 |
+
| Attention | 16 query heads, 4 key-value heads (grouped-query), QK-norm, RoPE θ = 1,000,000 |
|
| 45 |
+
| Context | 1,024 tokens |
|
| 46 |
+
| Vocabulary | 32,768 tokens (byte-level BPE) |
|
| 47 |
+
| Embeddings | input and output shared |
|
| 48 |
+
| Weights | bfloat16, safetensors |
|
| 49 |
+
| Format | `Lfm2ForCausalLM` in 🤗 Transformers (4.54+). KaiLu 3 shares LFM2's layer layout only: it was trained from scratch and contains no LFM2 weights. |
|
| 50 |
+
|
| 51 |
+
## How it was made
|
| 52 |
+
|
| 53 |
+
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%.
|
| 54 |
+
2. **Supervised fine-tuning:** about 460K conversations from smol-smoltalk, one pass, learning only from the assistant replies.
|
| 55 |
+
3. **Preference tuning (DPO, β = 0.1):** answer pairs from UltraFeedback (binarized), HelpSteer2 preferences and Anthropic HH-RLHF (up to 60K pairs).
|
| 56 |
+
|
| 57 |
+
## Chat format
|
| 58 |
+
|
| 59 |
+
KaiLu 3 learned from conversations written like this:
|
| 60 |
+
|
| 61 |
+
```
|
| 62 |
+
<|system|>
|
| 63 |
+
You are KaiLu, a helpful assistant.
|
| 64 |
+
<|user|>
|
| 65 |
+
Hi!
|
| 66 |
+
<|assistant|>
|
| 67 |
+
Hello! How can I help?<|endoftext|>
|
| 68 |
+
```
|
| 69 |
+
|
| 70 |
+
Each reply ends with `<|endoftext|>`.
|
| 71 |
+
|
| 72 |
+
## Limitations
|
| 73 |
+
|
| 74 |
+
KaiLu 3 is a small model. It can state wrong facts confidently, lose track in long conversations and write buggy code.
|
| 75 |
+
It works best in English and within 1,024 tokens. It has had no safety testing beyond its preference tuning, so check
|
| 76 |
+
its answers before relying on them.
|
| 77 |
+
|
| 78 |
+
## License
|
| 79 |
+
|
| 80 |
+
**Free for personal use. Business use needs permission.** KaiLu 3 is released under the [KaiLu 3 License](https://huggingface.co/<your-username>/KaiLu-3/blob/main/LICENSE):
|
| 81 |
+
you can use, study and modify it for free for personal and non-commercial purposes. For any business or commercial use,
|
| 82 |
+
contact KvcHub at [hello@kvchub.com](mailto:hello@kvchub.com) first. The datasets it learned from keep their own licenses.
|
| 83 |
+
|
| 84 |
+
Built by [KvcHub](https://kvchub.com).
|