Instructions to use KoarAI/LFM2.5-350M-Thinking-0003 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use KoarAI/LFM2.5-350M-Thinking-0003 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="KoarAI/LFM2.5-350M-Thinking-0003") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("KoarAI/LFM2.5-350M-Thinking-0003") model = AutoModelForCausalLM.from_pretrained("KoarAI/LFM2.5-350M-Thinking-0003", 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=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use KoarAI/LFM2.5-350M-Thinking-0003 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "KoarAI/LFM2.5-350M-Thinking-0003" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "KoarAI/LFM2.5-350M-Thinking-0003", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/KoarAI/LFM2.5-350M-Thinking-0003
- SGLang
How to use KoarAI/LFM2.5-350M-Thinking-0003 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 "KoarAI/LFM2.5-350M-Thinking-0003" \ --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": "KoarAI/LFM2.5-350M-Thinking-0003", "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 "KoarAI/LFM2.5-350M-Thinking-0003" \ --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": "KoarAI/LFM2.5-350M-Thinking-0003", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use KoarAI/LFM2.5-350M-Thinking-0003 with Docker Model Runner:
docker model run hf.co/KoarAI/LFM2.5-350M-Thinking-0003
📌 Release Note: Model Revision 0003
Model Revision:
0003
Key Architecture & Dataset Improvements:
- Anti-Overfitting Training Policy: Trained with a calibrated 2.3 epochs limit with a cosine learning rate scheduler (
lr=2.5e-5), preventing catastrophic forgetting and repetition loops while preserving pristine generation fluency.- Multi-Teacher Distillation Mix (2,831 hand-crafted samples):
r0b0tlab/qwen3.8-max-distillation-50k(quality_score >= 6): Deep mathematical, algorithmic, and code reasoning distilled directly from Qwen 3.8 Max (700 samples).Vikhrmodels/GrandMaster-PRO-MAX: High-quality natural Russian conversational mastery and instruction following (800 samples).iamtarun/python_code_instructions_18k_alpaca: Clean Python algorithms, web development, and code syntax generation (600 samples).open-thoughts/OpenThoughts-114k: Step-by-step verification and multi-hop Chain-of-Thought traces encapsulated in<think>blocks (431 samples).TIGER-Lab/MMLU-Pro: Complex STEM, business, logic, and law benchmark multiple-choice reasoning (300 samples).
🌟 Overview
KoarAI/LFM2.5-350M-Thinking-0003 is an ultra-compact, high-efficiency hybrid reasoning language model featuring native Chain-of-Thought (CoT) thinking capabilities.
Built upon the state-of-the-art Liquid Foundation Model architecture (LiquidAI/LFM2.5-350M), this model underwent 100% Full Parameter Fine-Tuning in bfloat16 precision. Despite having only 350 Million parameters, it produces structured internal step-by-step logic inside native <think> ... </think> blocks before delivering clean, concise final answers.
💡 Native Thinking Mode Example
<|im_start|>user
Сколько букв 'р' в слове 'программирование'?<|im_end|>
<|im_start|>assistant
<think>
1. Слово: 'программирование'.
2. Разберем по буквам: п-р-о-г-р-а-м-м-и-р-о-в-а-н-и-е.
3. Позиции буквы 'р':
- 2-я буква: 'р' (п-Р-о...)
- 5-я буква: 'р' (...г-Р-а...)
- 10-я буква: 'р' (...и-Р-о...)
4. Итого: 3 буквы 'р'.
</think>
В слове «программирование» содержится **3** буквы «р».<|im_end|>
⚡ Quickstart (Transformers)
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "KoarAI/LFM2.5-350M-Thinking-0003"
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.bfloat16 if torch.cuda.is_available() else torch.float32,
device_map="auto",
trust_remote_code=True
)
messages = [
{"role": "user", "content": "Solve step-by-step: 32 + 32 - 42"}
]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=512,
temperature=0.6,
top_p=0.9,
do_sample=True,
pad_token_id=tokenizer.eos_token_id
)
print(tokenizer.decode(outputs[0][inputs['input_ids'].shape[1]:], skip_special_tokens=False))
⚙️ Training Specifications
| Parameter | Specification |
|---|---|
| Base Model | LiquidAI/LFM2.5-350M |
| Fine-Tuning Method | Full Fine-Tuning (100% parameters) |
| Precision | bfloat16 / fp16 |
| Epochs | 2.1 |
| Learning Rate | 2.5e-5 (Cosine schedule with 5% warmup) |
| Effective Batch Size | 8 (batch_size=2, gradient_accumulation_steps=4) |
| Max Sequence Length | 512 tokens |
| Special Tokens | <think>, </think> |
📦 GGUF Quantized Versions
Quantized GGUF versions for llama.cpp, Ollama, LM Studio, and Jan are available at:
👉 KoarAI/LFM2.5-350M-Thinking-0003-GGUF
🐨 Maintained by KoarAI Lab
Released for the open-source AI community by KoarAI.
- Downloads last month
- 1,022