⚡ Kilat Small 150M Instruct (v3 — ChatML + NEFTune + RPO-DPO)
A 151.5M-Parameter Sub-Quadratic Hybrid Instruct Model (66.5M Active / Token)
Created by Abdul Wahid Rukua (@Airukua) — Post-trained with ChatML SFT (NEFTune) + Regularized RPO-DPO
📌 Overview
Kilat Small 150M Instruct (v3) (AiRukua/kilat-small-150M-instruct) is the ChatML instruction-tuned and preference-aligned release of AiRukua/kilat-small-150M (pre-trained from scratch on 10B tokens of FineWeb-Edu).
Built on the Kilat v2.0 Macro-Synergy architecture (50% $O(1)$ Global Exponential Decay + 50% Latent MLA + DeepSeekMoE Top-2/8 + 1 Shared), this model weighs only ~303 MB in BF16, activates 66.5M parameters per token, and uses 12.0× smaller KV-cache than standard MHA (3.01 MB at N=2048, B=1 BF16).
Key Upgrades in v3
- Dedicated ChatML Special Tokens (
<|im_start|>=50257,<|im_end|>=50258): Initialized viamean_resizing=True(Hewitt, 2021) witheos_token = "<|im_end|>"andpad_token = "<|endoftext|>"(50256). Separating turn-end from pre-training<|endoftext|>preserves multi-turn context without premature document-reset behavior. - Native
apply_chat_templateSupport: Ships with a SmolLM2-style ChatML Jinja2 template that automatically inserts Kilat's default system prompt if omitted. - NEFTune SFT + Regularized RPO-DPO: Full multi-turn SFT with NEFTune embedding noise (
alpha=5.0) followed by SmolLM2-calibrated RPO-DPO (beta=0.5,lr=1e-6,rpo_alpha=0.2NLL anchor) to prevent small-model likelihood displacement.
🚀 Quickstart & Streaming Inference
Install transformers >= 4.46.0 and PyTorch:
pip install --upgrade transformers torch accelerate
1. Interactive Multi-Turn Streaming Chat (apply_chat_template + TextStreamer)
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
model_id = "AiRukua/kilat-small-150M-instruct"
device = "cuda" if torch.cuda.is_available() else "cpu"
dtype = torch.bfloat16 if (device == "cuda" and torch.cuda.is_bf16_supported()) else torch.float32
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
model_id,
trust_remote_code=True,
dtype=dtype,
).to(device).eval()
streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
messages = [
{"role": "system", "content": "You are a helpful AI assistant named Kilat, created by Abdul Wahid Rukua."}
]
print("Kilat ready! Type 'exit' to quit, or 'reset' to clear history.\n")
while True:
user_input = input("User: ").strip()
if not user_input:
continue
if user_input.lower() in {"exit", "quit"}:
break
if user_input.lower() == "reset":
messages = messages[:1]
print("🔄 Conversation reset.\n")
continue
messages.append({"role": "user", "content": user_input})
input_text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True,
)
inputs = tokenizer(input_text, return_tensors="pt").to(device)
print("Kilat: ", end="", flush=True)
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=256,
do_sample=True,
temperature=0.35,
top_p=0.9,
top_k=50,
repetition_penalty=1.12,
use_cache=True,
streamer=streamer,
eos_token_id=tokenizer.eos_token_id,
pad_token_id=tokenizer.pad_token_id,
)
reply = tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True).strip()
messages.append({"role": "assistant", "content": reply})
print()
2. Single-Turn Snippet
messages = [{"role": "user", "content": "Explain what gravity is in two simple sentences."}]
input_text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(input_text, return_tensors="pt").to(device)
with torch.no_grad():
out = model.generate(
**inputs,
max_new_tokens=160,
do_sample=True,
temperature=0.35,
top_p=0.9,
repetition_penalty=1.12,
use_cache=True,
eos_token_id=tokenizer.eos_token_id,
pad_token_id=tokenizer.pad_token_id,
)
print(tokenizer.decode(out[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True).strip())
3. Recommended Decoding Parameters
| Parameter | Recommended Value | Notes |
|---|---|---|
use_cache | True | Enables $O(1)$ Global Decay state + compressed Latent MLA KV-cache |
temperature | 0.25 – 0.60 | Lower (0.25–0.35) for crisp, factual multi-turn chat |
top_p | 0.90 | Nucleus sampling cutoff |
repetition_penalty | 1.10 – 1.15 | Prevents phrase loops without hurting fluency |
eos_token_id | 50258 (<|im_end|>) | Pre-configured in config.json & generation_config.json |
pad_token_id | 50256 (<|endoftext|>) | Distinct from turn-end <|im_end|> |
💬 ChatML Format
tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True) formats conversations automatically into:
<|im_start|>system
You are a helpful AI assistant named Kilat, created by Abdul Wahid Rukua.<|im_end|>
<|im_start|>user
Hi! How are you?<|im_end|>
<|im_start|>assistant
📊 Post-Training Pipeline
Post-training follows the official SmolLM2-135M (alignment-handbook) methodology adapted for Kilat MoE, executed on 1× NVIDIA RTX PRO 6000 Blackwell Server Edition using FP32 master weights + AMP-BF16 autocast, weight_decay=0.0 on all 1D parameters (log_lambda, RMSNorm), and active bias_free MoE router updates:
| Stage | Dataset(s) | Key Recipe & Hyperparameters |
|---|---|---|
| Pre-Training (Base) | HuggingFaceFW/fineweb-edu (10B tokens) | WSD (4e-4), 16,954 steps, Eval Loss ~3.0 (PPL ~20–21) |
| Stage 1 — ChatML SFT | HuggingFaceTB/smol-smoltalk + HuggingFaceTB/everyday-conversations-llama3.1-2k | mean_resizing=True (<|im_start|>/<|im_end|>), NEFTune (alpha=5.0), Cosine (lr=3e-4, 10% warmup), 2 epochs, strict assistant-only loss masking (including <|im_end|>), length-bucketed batching |
| Stage 2 — RPO-DPO | HuggingFaceH4/ultrafeedback_binarized (train_prefs) | SmolLM2-calibrated beta=0.5, lr=1e-6 + RPO NLL anchor (rpo_alpha=0.2) on chosen completions to prevent SLM likelihood displacement, frozen BF16 reference model |
Reproducible Marimo notebook: notebooks/kilat_150m_sft_dpo_marimo.py
🏛️ Architecture & Efficiency
| Specification | Value |
|---|---|
| Architecture | Kilat v2.0 Macro-Synergy (50% Global Decay + 50% Latent MLA + DeepSeekMoE) |
| Total Parameters | 151,467,108 (~151.5M) (~303 MB in BF16 safetensors) |
| Active Parameters / Token | 66,532,452 (~66.5M) (56.1% FFN sparsity) |
| Layers / Hidden / Heads | n_layer=12, n_embd=384, n_head=6 (head_dim=64), latent_dim=96, rope_head_dim=32 |
| MoE Topology | 8 routed experts (Top-2 active) + 1 shared expert (bias_free routing) |
| Context Window | 2,048 tokens (SFT/RPO-DPO trained up to 1,024 tokens) |
KV-Cache Footprint (B=1, BF16) | 3.01 MB @ N=2048 (9 KB constant decay + 1.5 KB/tok MLA — 12.0× smaller vs MHA) |
| Tokenizer & Vocabulary | GPT-2 BPE + ChatML special tokens (vocab_size=50,259, eos=50258, pad=50256) |
⚠️ Limitations & Responsible Use
- Compact 150M Capacity (
66.5Mactive, 10B pre-training tokens): Built for lightweight edge experimentation, educational research, and fast local prototyping—not complex multi-step reasoning, formal math proofs, or production coding. - English Primary: Pre-trained and post-trained primarily on English educational and conversational corpora.
- Factual Hallucination: Small models can confidently generate inaccurate statements; always verify factual claims for critical use cases.
- Safety Alignment: Aligned via lightweight RPO-DPO on UltraFeedback; do not deploy in high-stakes or unmoderated user-facing environments without additional guardrails.
📜 License & Citation
Created by Abdul Wahid Rukua (@Airukua) and released under the Apache 2.0 License.
@misc{rukua2026kilatsmall150minstruct,
title = {Kilat Small 150M Instruct: Sub-Quadratic Hybrid Global Decay + Latent MLA + DeepSeekMoE},
author = {Abdul Wahid Rukua},
year = {2026},
url = {https://huggingface.co/AiRukua/kilat-small-150M-instruct}
}