KaptaanLM is a family of ultra-compact dense and sparse small language models designed from first principles for natural multi-turn conversation, complex deduction, and multi-step Chain-of-Thought (CoT) reasoning on edge and consumer devices.
While frontier language models require hundreds of billions of parameters and gigabytes of memory per token, KaptaanLM demonstrates that disciplined architectural parameter allocation, tied embeddings, per-head QK-RMSNorm, and schema-aligned preference optimization enable micro-models (10M to 50M) to surpass established 135M-parameter baselines in mathematical and multi-step reasoning.
Across all 11,858 official academic benchmark questions evaluated under standard EleutherAI lm-evaluation-harness protocols:
- KaptaanLM-Scout-Omni (9.95M parameters) solves 70% more GSM8K problems than SmolLM-135M at 1/14th the parameter count, delivering 22.95x higher overall mathematical reasoning density and 31.32x higher non-embedding parameter efficiency.
- KaptaanLM-Vanguard-Omni-DPO (25.18M parameters) solves 2.3x more GSM8K problems than SmolLM-135M at 1/5th the parameter count, achieving a 3.49% pass rate with 100% scratchpad adherence and 0.000 repetition rate.
- KaptaanLM-Navigator (52.72M parameters) establishes high-throughput distributed pre-training with JAX/Flax on TPU v5e-8, processing 1.0 Billion tokens in 2.24 hours with monotonic loss descent and a 68.3% perplexity reduction.
All evaluations were executed with hardware-level dual-GPU concurrent sharding on Dual Tesla T4 GPUs (31.28 GB Aggregate VRAM) under Regime 1: Deterministic Anti-Repetition Greedy (temperature=0.0, repetition_penalty=1.12, max_new_tokens=256, stop_token_ids=[0, 2]), adhering strictly to the EleutherAI benchmark specification.
| Academic Benchmark Suite | Evaluation Protocol | Questions | Scout-Omni (10M) | Vanguard-Omni-DPO (25M) | Scout-Reasoning (10M Baseline) | SmolLM-135M Baseline |
|---|---|---|---|---|---|---|
| ARC-Easy | Length-Normalized Likelihood (acc_norm) |
2,376 | 28.79% (684) | 32.07% (762) | 27.06% (643) | 44.19% (1,050) |
| ARC-Challenge | Length-Normalized Likelihood (acc_norm) |
1,172 | 21.67% (254) | 23.81% (279) | 19.45% (228) | 27.82% (326) |
| PIQA | Length-Normalized Likelihood (acc_norm) |
1,838 | 55.60% (1,022) | 56.20% (1,033) | 56.42% (1,037) | 67.46% (1,240) |
| LAMBADA | Exact Next-Word Match (acc) |
5,153 | 8.97% (462) | 13.39% (690) | 8.13% (419) | 24.10% (1,242) |
| GSM8K | Generative CoT Scratchpad (acc_norm) |
1,319 | 2.58% (34) | 3.49% (46) | 1.67% (22) | 1.52% (20) |
| OVERALL | Full Academic Suite (All 5 Tiers) | 11,858 | 20.71% (2,456) | 23.70% (2,810) | 19.81% (2,349) | 32.70% (3,878) |
Accuracy density quantifies the percentage of benchmark accuracy extracted per one million model parameters, separating total parameter count from active non-embedding reasoning parameters:
| Model | Total Params | Non-Embed Params | Suite Acc | Acc / 1M Total Params | Acc / 1M Non-Embed Params | Relative Efficiency (Non-Embed) |
|---|---|---|---|---|---|---|
| SmolLM-135M-Instruct | 134.52M | 106.24M | 32.70% | 0.2431% / 1M | 0.3078% / 1M | 1.00x (Baseline) |
| KaptaanLM-Vanguard-Omni-DPO (25M) | 25.18M | 18.88M | 23.70% | 0.9412% / 1M | 1.2553% / 1M | 4.08x |
| KaptaanLM-Scout-Reasoning-1.0 (10M) | 9.95M | 5.76M | 19.81% | 1.9910% / 1M | 3.4392% / 1M | 11.17x |
| KaptaanLM-Scout-Omni-SFT-1.0 (10M) | 9.95M | 5.76M | 20.71% | 2.0816% / 1M | 3.5955% / 1M | 11.68x |
| Model | Total Params | Non-Embed Params | GSM8K Acc | Math Acc / 1M Total Params | Math Acc / 1M Non-Embed Params | Relative Math Density (Non-Embed) |
|---|---|---|---|---|---|---|
| SmolLM-135M-Instruct | 134.52M | 106.24M | 1.52% | 0.0113% / 1M | 0.0143% / 1M | 1.00x (Baseline) |
| KaptaanLM-Vanguard-Omni-DPO (25M) | 25.18M | 18.88M | 3.49% | 0.1386% / 1M | 0.1849% / 1M | 12.93x |
| KaptaanLM-Scout-Reasoning-1.0 (10M) | 9.95M | 5.76M | 1.67% | 0.1678% / 1M | 0.2899% / 1M | 20.27x |
| KaptaanLM-Scout-Omni-SFT-1.0 (10M) | 9.95M | 5.76M | 2.58% | 0.2593% / 1M | 0.4479% / 1M | 31.32x |
A critical empirical insight is the disparity in token density per non-embedding parameter across tiers:
- Scout (10M): 5.0 Billion tokens across 5.76M non-embedding weights = 868.7 tokens / non-embedding parameter (~870x saturation).
- Vanguard (25M): 5.636 Billion tokens across 18.88M non-embedding weights = 298.4 tokens / non-embedding parameter (~300x saturation).
Scout's attention and reasoning layers were trained with 2.91x higher token density than Vanguard's. Scout approached full theoretical capacity saturation, which explains why its accuracy was highly competitive with Vanguard despite having 2.5x fewer parameters. Vanguard was undertrained relative to its architectural capacity (only ~300x), providing enormous headroom for Vanguard v2.0 when scaled to 600x–700x non-embedding token density (~11B–13B tokens).
From local GPU evaluation across 16 canonical math, logic, code, and conversational prompts under deterministic anti-repetition greedy decoding (temp=0.0, rep_penalty=1.12):
| Model Variant | Math Pass | Logic Pass | Code Pass | Scratchpad Adherence | 4-Gram Repetition | Generation Speed | CRI Score |
|---|---|---|---|---|---|---|---|
| Scout-Instruct-1.0 | 50.0% | 25.0% | 0.0% | 0.0% | 0.000 | 24.5 tok/s | 0.3375 |
| Scout-Reasoning-1.0 | 0.0% | 0.0% | 0.0% | 25.0% | 0.762 | 28.1 tok/s | 0.0488 |
| Scout-Omni-SFT-1.0 | 0.0% | 75.0% | 0.0% | 75.0% | 0.000 | 34.0 tok/s | 0.3625 (10M Winner) |
| Vanguard-Instruct-1.0 | 0.0% | 0.0% | 0.0% | 0.0% | 0.000 | 17.3 tok/s | 0.1000 |
| Vanguard-Reasoning-1.0 | 0.0% | 50.0% | 0.0% | 75.0% | 0.265 | 17.6 tok/s | 0.2735 |
| Vanguard-Omni-SFT-1.0 | 0.0% | 50.0% | 0.0% | 100.0% | 0.017 | 22.1 tok/s | 0.3233 |
| Vanguard-Omni-DPO-1.0 | 50.0% | 25.0% | 33.3% | 100.0% | 0.000 | 22.2 tok/s | 0.5042 (Grand Champion) |
Conventional small language models often adapt large-model hyperparameter templates without adjustment, suffering from severe parameter starvation. KaptaanLM resolves these fundamental constraints through tailored architectural innovations:
In a standard 10M to 25M model, an untied 32,000 or 50,000 token vocabulary consumes 50% to 80% of all parameters in non-reasoning embedding tables (
Attention logit explosion is a primary source of instability when training narrow Transformer layers at high learning rates (
This completely eliminates attention blowup, ensures smooth gradient norms (0.15 to 0.35 in steady state), and prevents NaN occurrences across multi-billion-token training runs.
To permanently eliminate repetitive token loops and logit divergence in micro-models:
- Attention logits are soft-capped at 50.0:
$\text{logits} \leftarrow 50.0 \times \tanh\left(\frac{\text{logits}}{50.0}\right)$ - Output vocabulary logits are soft-capped at 30.0:
$\text{logits} \leftarrow 30.0 \times \tanh\left(\frac{\text{logits}}{30.0}\right)$
- GQA: 2:1 ratio at 10M (8Q / 4KV), 3:1 ratio at 25M (12Q / 4KV), and 4:1 ratio at 50M (16Q / 4KV).
- SWA: Alternates 512-token local sliding window attention with global attention layers, reducing KV-cache RAM footprint by 65% during generation.
We ablated whether multi-step reasoning SFT should be applied on top of dialogue-aligned checkpoints (Branch A: Instruct
- At 10M (Scout): Branch A won. A 10M base foundation has insufficient capacity to learn conversational syntax and deductive planning simultaneously. Dialogue pre-alignment was necessary to stabilize reasoning extraction.
- At 25M (Vanguard): Branch B won decisively (Composite Reasoning Index 0.4167 vs 0.2333). With 25M parameters, conversational dialogue SFT induced negative transfer on algorithmic tasks, whereas direct training on Base unlocked 66.7% deductive logic pass and 33.3% executable Python code synthesis.
Early reasoning micro-models suffered from the bimodal trap: models unpredictably flipped between standard conversational prose and <|thought|> planning scratchpads, leading to infinite repetition loops.
The Omni architecture resolves this by establishing the Universal Scratchpad Contract:
- 100% of samples (conversational dialogue, factual query, mathematics, code) strictly follow the contract:
<|im_start|>assistant\n<|thought|>\n{procedural scratchpad}\n<|thought|>\n{answer}<|im_end|>. - Schema-Aligned DPO: Direct Preference Optimization was applied with negative pairs capturing discursive loops, format drops, and repetitive rambling.
In head-to-head testing across all 11,858 academic questions:
- Pure SFT (
KaptaanLM-Vanguard-Omni-SFT-1.0) scored 0.08% on GSM8K and 0.00% on LAMBADA due to conversational format lock-in. - Schema-Aligned DPO (
KaptaanLM-Vanguard-Omni-DPO-1.0) eliminated format lock-in, elevating LAMBADA to 13.39% and jumping GSM8K from 0.08% to 3.49% (a 43.6x performance multiplication).
| Model Tier | Total Params | Non-Embed Params | Reasoning % | Layers | Heads (Q / KV) | Pre-Train Tokens | Status | ||
|---|---|---|---|---|---|---|---|---|---|
| Scout (10M) | 9.95M | 5.76M | 57.85% | 8 | 256 | 8 / 4 (2:1) | 680 | 5.0 Billion | Completed (Full Fleet) |
| Vanguard (25M) | 25.18M | 18.88M | 75.01% | 12 | 384 | 12 / 4 (3:1) | 1,024 | 5.64 Billion | Completed (Full Fleet) |
| Navigator (50M) | 52.72M | 44.34M | 84.11% | 16 | 512 | 16 / 4 (4:1) | 1,376 | 1.0B Pilot (30B Fdn) | Pilot Completed (TPU) |
| Commander (75M) | 73.18M | 62.96M | 86.03% | 18 | 640 | 20 / 4 (5:1) | 1,728 | 45.0B Foundation | Planned Architecture |
| Sovereign (100M) | 106.06M | 93.77M | 88.41% | 22 | 768 | 24 / 4 (6:1) | 2,048 | 60.0B Foundation | Planned Architecture |
Due to parameter scaling limits on consumer hardware, KaptaanLM transitions post-100M to fine-grained sparse MoE with shared experts:
| MoE Model Tier | Total Parameters | Active Parameters | Routing Scheme | Target Tokens | Inference Footprint |
|---|---|---|---|---|---|
| Corsair-MoE | 161M | 45M | Top-2 from 8 routed + 1 shared | 80 Billion | 4GB RAM (Mobile/Edge) |
| Admiral-MoE | 323M | 75M | Top-2 from 8 routed + 1 shared | 150 Billion | 6GB RAM (Consumer PC) |
| Dreadnought-MoE | 655M | 142M | Top-2 from 12 routed + 2 shared | 300 Billion | 8GB VRAM (Single GPU) |
| Armada-MoE | 1.21B | 224M | Top-2 from 16 routed + 2 shared | 600 Billion | 12GB VRAM (Single GPU) |
Full MoE mathematical routing and expert capacity details are documented in docs/MOE_ROADMAP.md.
Pre-training across Scout (5.0B tokens) and Vanguard (5.64B tokens) used a Warmup-Stable-Decay (WSD) schedule, stabilizing loss before entering the cosine cooldown annealing phase where learning rate was dropped by 95% while increasing the proportion of synthetic math and Python code data.
- Execution: 1,000,000,000 tokens across 3,815 steps (Global batch size 128 = 262,144 tokens/step).
-
Loss Descent: Monotonic descent from 10.1630 down to 2.0172 during cosine cooldown to
$\eta = 7.5 \times 10^{-5}$ . - Generalization: Held-out 131k-token validation perplexity dropped from 98.77 to 31.27 (a 68.3% perplexity reduction).
-
HBM Rematerialization: Activation rematerialization (
nn.remat(KaptaanBlock)) confined peak HBM to 2.85 GB / 15.75 GB per core (>81% safety headroom).
All canonical configurations, tokenizers, generation settings, and model cards are tracked in this repository under finalized_models/. Model weights and complete model cards are hosted directly on Hugging Face:
| Model Tier | Model Name | Role / Status | Weights Format | Hugging Face Repository |
|---|---|---|---|---|
| 10M | KaptaanLM-Scout-Omni-SFT-1.0 |
10M Champion (CRI: 0.3625) | PyTorch FP32 (39.8 MB) | kaptaan45/KaptaanLM-Scout-10M |
| 10M | KaptaanLM-Scout-Reasoning-1.0 |
Branch A Specialist (1.67% GSM8K) | PyTorch FP32 (56.6 MB) | kaptaan45/KaptaanLM-Scout-10M |
| 10M | KaptaanLM-10M-1.0 |
Base Foundation (5.0B tokens) | PyTorch FP32 (56.6 MB) | kaptaan45/KaptaanLM-Scout-10M |
| 10M | KaptaanLM-10M-0.5 |
Intermediate Plateau (3.0B tokens) | PyTorch FP32 (56.6 MB) | kaptaan45/KaptaanLM-Scout-10M |
| 10M | KaptaanLM-10M-0.1 |
Pilot Checkpoint (163M tokens) | PyTorch FP32 (39.8 MB) | kaptaan45/KaptaanLM-Scout-10M |
| 25M | KaptaanLM-Vanguard-Omni-DPO-1.0 |
Grand Champion (CRI: 0.5042) | PyTorch FP32 (100.7 MB) | kaptaan45/KaptaanLM-Vanguard-25M |
| 25M | KaptaanLM-Vanguard-Reasoning-1.0 |
Branch B Winner (CRI: 0.4167) | PyTorch FP32 (100.7 MB) | kaptaan45/KaptaanLM-Vanguard-25M |
| 25M | KaptaanLM-Vanguard-1.0 |
Base Foundation (5.64B tokens) | PyTorch FP32 (100.7 MB) | kaptaan45/KaptaanLM-Vanguard-25M |
| 25M | KaptaanLM-Vanguard-Instruct-1.0 |
SFT + DPO Dialogue Winner | PyTorch FP32 (100.7 MB) | kaptaan45/KaptaanLM-Vanguard-25M |
| 25M | KaptaanLM-25M-0.1 |
Pilot Checkpoint (500M tokens) | PyTorch FP32 (125.8 MB) | kaptaan45/KaptaanLM-Vanguard-25M |
| 50M | KaptaanLM-50M-0.1 |
50M Pilot Converged Model | PyTorch / JAX (211.5 MB) | kaptaan45/KaptaanLM-Navigator-50M |
| 50M | Kaptaan-50M_step3815 |
JAX Final Pilot Checkpoint | Flax State Dict (632.4 MB) | kaptaan45/KaptaanLM-Navigator-50M |
| 50M | Kaptaan-50M_late_plateau |
Pre-cooldown Foundation State | Flax State Dict (632.4 MB) | kaptaan45/KaptaanLM-Navigator-50M |
Install the package in editable mode with dependencies:
git clone https://github.com/rudy-07/KaptaanLM.git
cd KaptaanLM
pip install -e .
import torch
from tokenizers import Tokenizer
from kaptaan.config import CONFIG_25M
from kaptaan.torch.model import KaptaanForCausalLM
# Load canonical configuration and architecture
config = CONFIG_25M
model = KaptaanForCausalLM(config)
# Load weights and tokenizer
weights_path = "finalized_models/25M/omni/KaptaanLM-Vanguard-Omni-DPO-1.0.pt"
model.load_state_dict(torch.load(weights_path, map_location="cpu"))
model.eval()
tokenizer = Tokenizer.from_file("finalized_models/25M/omni/tokenizer.json")
# Format prompt using ChatML contract
prompt = "<|im_start|>user\nIf 3 workers build 3 chairs in 3 days, how many workers are needed to build 12 chairs in 6 days?<|im_end|>\n<|im_start|>assistant\n"
input_ids = torch.tensor([tokenizer.encode(prompt).ids], dtype=torch.long)
# Mandatory decoding parameters for Omni and Reasoning models
with torch.no_grad():
output_ids = model.generate(
input_ids,
max_new_tokens=256,
temperature=0.0, # Deterministic argmax guarantees algebraic precision
repetition_penalty=1.12, # Eliminates 4-gram cycling
stop_token_ids=[0, 2] # <|endoftext|> and <|im_end|>
)
response = tokenizer.decode(output_ids[0].tolist())
print(response)
Expected output structure:
<|thought|>
Calculate worker productivity: 3 workers produce 3 chairs in 3 days.
Rate per worker per day = 3 / (3 * 3) = 1/3 chair per worker-day.
Total work required = 12 chairs.
Time available = 6 days.
Chairs needed per day = 12 / 6 = 2 chairs/day.
Number of workers needed = 2 / (1/3) = 6 workers.
<|thought|>
To build 12 chairs in 6 days, 6 workers are required.
Launch the interactive terminal chat client with live token streaming and scratchpad rendering:
python scripts/chat.py --model finalized_models/25M/omni/KaptaanLM-Vanguard-Omni-DPO-1.0.pt --tier 25M
python run_tests.py
The KaptaanLM initiative establishes a predictable scaling roadmap transitioning from dense foundation models to fine-grained sparse MoEs:
- KaptaanLM-Vanguard-2.0 (25M): Extended pre-training to 12.0B–15.0B tokens (~650x non-embedding token density) to eliminate the undertraining deficit and unlock full 25M architectural headroom over Scout.
-
KaptaanLM-Navigator (50M Foundation): 30.0 Billion tokens (~676x non-embedding token density), 16 layers,
$d_{\text{model}}=512$ , targeting >10%–15% GSM8K and >45% ARC-Easy. -
KaptaanLM-Commander (75M Foundation): 45.0 Billion tokens, 18 layers,
$d_{\text{model}}=640$ , intermediate checkpointing at 20B and 35B tokens. -
KaptaanLM-Sovereign (100M Foundation): 60.0 Billion tokens, 22 layers,
$d_{\text{model}}=768$ , the terminal dense baseline before transitioning to MoE routing.
- KaptaanLM-Corsair-MoE (161M Total / 45M Active): Top-2 routing across 8 fine-grained experts + 1 shared expert. Target: 80B tokens, 4GB RAM edge footprint.
- KaptaanLM-Admiral-MoE (323M Total / 75M Active): Top-2 routing across 8 fine-grained experts + 1 shared expert. Target: 150B tokens, 6GB RAM footprint.
- KaptaanLM-Dreadnought-MoE (655M Total / 142M Active): Top-2 routing across 12 fine-grained experts + 2 shared experts. Target: 300B tokens, 8GB VRAM footprint.
- KaptaanLM-Armada-MoE (1.21B Total / 224M Active): Top-2 routing across 16 fine-grained experts + 2 shared experts. Target: 600B tokens, 12GB VRAM single-GPU footprint.
- Kaptaan-Vision: Ultra-lightweight vision-language adapter connecting SigLIP micro-encoders to Navigator-50M for on-device multimodal reasoning.
- Vulkan / ONNX Embedded Runtime: Zero-dependency C++ inference engine for real-time edge robotics, Android, iOS, and embedded microcontrollers.
The KaptaanLM initiative establishes an open-source research blueprint for high-density reasoning small language models (<100M parameters) deployable entirely on consumer CPUs, smartphones, and edge robotics.
- Validated 10M & 25M Fleets: Completed 5.0B token (Scout) and 5.64B token (Vanguard) pre-training, SFT, and DPO alignment.
- Superior Reasoning Density: Solved 46 GSM8K questions at 25M (3.49%), outperforming SmolLM-135M (1.52%) at 1/5th the compute footprint.
- Validated Distributed Architecture: Completed 1.0B token Navigator-50M pilot on TPU hardware with zero numerical divergence and a 68.3% perplexity reduction.
- Token Budget: 30.0 Billion tokens delivering ~676x non-embedding parameter token density (eliminating the undertraining deficit).
- Target Compute: Google Cloud TPU v5e-8 (or TPU v6e) allocation.
- Estimated Runtime: 7.5 to 9.5 wall-clock hours.
- Expected Outcome: Surpassing 10%–15% GSM8K pass rate and 45%+ ARC-Easy at 52M parameters, unlocking verifiable local edge intelligence without cloud dependencies.
KaptaanLM/
├── assets/
│ └── images/ # Publication-grade 300 DPI evaluation figures and charts
├── docs/ # Architectural specifications and evaluation reports
│ ├── ARCHITECTURE.md # Tensor mathematics, tied embeddings, and parameter budgets
│ ├── MOE_ROADMAP.md # Post-100M Mixture of Experts (MoE) architectural roadmap
│ ├── SCALING_ROADMAP.md # 10M -> 100M scaling path and reasoning ablation protocol
│ ├── DATASET_STRATEGY.md # Streaming data curation, 16k tokenizer, and deduplication
│ ├── OFFICIAL_BENCHMARK_REPORT_OMNI.md # Full 11,858-question publication report
│ ├── TRAINING_TPU_JAX.md # JAX/Flax TPU v5e-8 NamedSharding and remat guide
│ └── TRAINING_GPU_PYTORCH.md# PyTorch bfloat16 + SDPA guide (NVIDIA RTX 6000 Ada)
├── finalized_models/ # Model cards, configurations, tokenizers, and SHA-256 checksums
│ ├── 10M/ # Scout model cards and canonical files
│ ├── 25M/ # Vanguard model cards and canonical files
│ └── 50M/ # Navigator TPU pilot model card and configuration
├── kaptaan/ # Core Python library
│ ├── config.py # Canonical architecture definitions (10M, 25M, 50M, 75M, 100M)
│ ├── jax/ # JAX/Flax distributed implementation (TPU v5e-8 optimized)
│ │ ├── model.py # Flax Transformer with QK-Norm, SwiGLU, SWA, soft-capping
│ │ ├── trainer.py # WSD scheduler, AdamW, and JIT compilation
│ │ └── data.py # Streaming token packing to 2,048 sequence length
│ ├── torch/ # PyTorch implementation for CUDA and CPU
│ │ ├── model.py # PyTorch Transformer with SDPA and tied embeddings
│ │ └── trainer.py # DDP training engine
│ ├── tokenizer/ # BPE 16,384 vocabulary trainer and ChatML wrapper
│ └── eval/ # 16-problem coding benchmark and repetition diagnostics
├── notebooks/ # Clean, reproducible Kaggle and Colab notebooks
├── results/ # Certified evaluation JSONs and benchmark records
├── scripts/ # Production CLI tools, benchmark harnesses, and figure generators
├── tests/ # Automated unit test suite
├── pyproject.toml # Standard PEP 517 build configuration
├── requirements.txt # Production dependencies
├── LICENSE # Apache 2.0 License
└── README.md # Master repository documentation
If you utilize the KaptaanLM architecture, models, or empirical findings in your research or application, please cite:
@software{kaptaanlm2026,
author = {Shekhar, Rudransh},
title = {KaptaanLM: Conversational and Reasoning Small Language Models (10M - 100M -> MoE)},
url = {https://github.com/rudy-07/KaptaanLM},
year = {2026}
}
This project is licensed under the Apache License 2.0. See the LICENSE file for details.






