🩵 Klea-1
Lightweight in size. Heavyweight in reasoning.
✨ Overview
Klea-1 is an advanced, lightweight reasoning model developed by Suraj Kumar Mallick. It packs strong step-by-step thinking, instruction following, and long-context understanding into a footprint small enough to run on modest hardware.
| |
|---|
| Developer | Suraj Kumar Mallick |
| Model type | Decoder-only language model, reasoning-focused |
| Total parameters | 543,456,768 (~540M) |
| Active parameters | ~430M |
| Knowledge Cutoff | Early September 2026 |
| Context window | 256K tokens |
| License | Apache 2.0 |
| Language | English |
🔹 Highlights
- 🧠 Built to reason: produces an explicit thinking trace before its final answer.
- 🪶 Truly lightweight: ~540M total / ~430M active parameters.
- 📚 256K context: handles long documents, codebases, and extended conversations.
- 🎯 Instruction-tuned and preference-aligned: refined with RLHF in the final stage.
- 🔓 Apache 2.0: free for research and commercial use.
🏗️ Training Pipeline
| Stage | Phase | What happens |
|---|
| 1 | Primary pretraining | Trained on large-scale raw web text to build broad language and world knowledge. |
| 2 | Secondary pretraining | Trained on highly curated, specialized data to sharpen domain depth and quality. |
| 3 | Reasoning + instruction tuning | Fine-tuned on reasoning data with instruction following. |
| 4 | Preference tuning | Aligned with human preferences using RLHF. |
📊 Benchmarks
Reasoning & Knowledge
| Benchmark | Setting | Score |
|---|
| GPQA Diamond | – | 89.4 |
| HLE | – | 53.5 |
| AGIEval (EM) | 3–5-shot | 83.5 |
| C-Eval (EM) | 5-shot | 92.1 |
| HellaSwag (EM) | 0-shot | 85.0 |
| SimpleQA-Verified (EM) | 25-shot | 0.1 |
Math & Code
| Benchmark | Setting | Score |
|---|
| GSM8K | 8-shot | 93.5 |
| HumanEval (Pass@1) | 0-shot | 62.0 |
Agentic & Terminal
| Benchmark | Score |
|---|
| Terminal-Bench 2.1 | 76.5 |
| Terminal-Bench 3.0 | 44.0 |
| Terminal-Bench 4.0 | 58.6 |
| CyberGym | 65.5 |
Long Context
| Benchmark | Setting | Score |
|---|
| LongBench-V2 (EM) | 1-shot | 44.7 |
🚀 Quickstart
Install
pip install -U transformers accelerate torch
Chat with Klea-1 (reasoning mode)
Klea-1 thinks first, then answers. Its output wraps the reasoning in <think>…</think> and the final response in <answer>…</answer>.
from transformers import AutoModelForCausalLM, AutoTokenizer
import os
import re
import torch
model_name_or_path = "surajkumarmallick/Klea-1"
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path)
model = AutoModelForCausalLM.from_pretrained(
model_name_or_path,
device_map="auto",
torch_dtype=torch.bfloat16
)
messages = [
{"role": "user", "content": "Write a short summary of the benefits of regular exercise"},
]
tokenized_chat = tokenizer.apply_chat_template(
messages,
tokenize=True,
add_generation_prompt=True,
return_tensors="pt",
return_dict=True, # Ensure it returns a dictionary
enable_thinking=True # Toggle thinking mode (default: True)
)
# Move input dictionary keys to model device
inputs = {k: v.to(model.device) for k, v in tokenized_chat.items()}
outputs = model.generate(**inputs, max_new_tokens=2048)
output_text = tokenizer.decode(outputs[0])
print("output_text =", output_text)
think_pattern = r'<think>(.*?)</think>'
think_matches = re.findall(think_pattern, output_text, re.DOTALL)
answer_pattern = r'<answer>(.*?)</answer>'
answer_matches = re.findall(answer_pattern, output_text, re.DOTALL)
think_content = [match.strip() for match in think_matches][0] if think_matches else "No thinking process found."
answer_content = [match.strip() for match in answer_matches][0] if answer_matches else output_text
print(f"thinking_content: {think_content}\n\n")
print(f"answer_content: {answer_content}\n\n")
Thinking vs. fast mode
| Mode | How to enable |
|---|
| Slow thinking (default) | enable_thinking=True, or prefix the prompt with /think |
| Fast response | enable_thinking=False, or prefix the prompt with /no_think |
Recommended sampling parameters
{
"top_k": 20,
"top_p": 0.8,
"repetition_penalty": 1.05,
"temperature": 0.7
}
💬 System Prompt
For best results, use the default system prompt:
You are Klea 1, an advanced lightweight AI model developed by Suraj Kumar Mallick. Your primary goal is to assist users with their tasks accurately, clearly, and helpfully.
🎯 Intended Use
- Step-by-step reasoning, math, and logic problems
- Coding assistance and terminal / agentic workflows
- Long-document question answering and summarization (up to 256K tokens)
- On-device and low-resource deployments where larger models are impractical
⚠️ Limitations
- As a compact model, factual recall on obscure or long-tail knowledge is limited (see SimpleQA-Verified). Pair it with retrieval for fact-heavy tasks.
- Like all language models, Klea-1 can produce incorrect or biased outputs. Verify important results, especially in high-stakes settings.
- Benchmark scores depend on prompt format, sampling settings, and evaluation harness, so results may vary in your setup.
📄 License
Klea-1 is released under the Apache License 2.0.
📖 Citation
@misc{klea1,
title = {Klea-1: A Lightweight Reasoning Model},
author = {Suraj Kumar Mallick},
year = {2026},
howpublished = {\url{https://huggingface.co/surajkumarmallick/Klea-1}}
}
🩵 Built by Suraj Kumar Mallick 🩵