495 Downloads Updated 1 month ago
ollama run oamazonasgabriel/minicpm-2b:mlx
ollama launch claude --model oamazonasgabriel/minicpm-2b:mlx
ollama launch opencode --model oamazonasgabriel/minicpm-2b:mlx
ollama launch hermes --model oamazonasgabriel/minicpm-2b:mlx
ollama launch openclaw --model oamazonasgabriel/minicpm-2b:mlx
Model: oamazonasgabriel/minicpm-2b:q4_k_m · oamazonasgabriel/minicpm-2b:bf16 · oamazonasgabriel/minicpm-2b:mlx
A lightweight Ollama build of MiniCPM5-2B, the 2B-class open-source SOTA model from OpenBMB — a dense 2.5B-parameter causal LM built for on-device, local deployment, and resource-constrained scenarios. Reaches 2B-class open-source SOTA across coding, math reasoning, long-context understanding, tool use, and agentic tasks.
The ideal agentic/tool-calling companion for: RTX 5060 Ti 16GB + RTX 4060 Ti 8GB (dual) · RTX 4090 · any NVIDIA setup with 8 GB+ VRAM · Apple Silicon (via MLX)
LlamaForCausalLM — no custom kernels, runs anywhere llama.cpp runsthinking blocks before the final response (returned by Ollama as message.thinking)<function name="..."><param name="...">...</param></function>); tool schemas are injected via the chat template — for full agentic tool loops today, use llama.cpp --jinja or SGLang (--tool-call-parser minicpm5) until Ollama ships a native minicpm5 parser| Property | Value |
|---|---|
| Architecture | llama — dense LlamaForCausalLM |
| Total Parameters | 2,516,756,480 (2.52B) |
| Layers | 42 |
| Attention Heads | 16 Q / 2 KV (GQA) |
| Embedding Length | 2,048 |
| Native Context | 131,072 tokens |
| Modalities | Text |
| Quantization | Q4_K_M (1.6 GB) / F16 (5.0 GB) / MLX 4-bit (1.4 GB) |
| License | Apache 2.0 |
| Upstream | openbmb/MiniCPM5-2B |
| Resource | Minimum | Recommended |
|---|---|---|
| GPU Memory | 8 GB VRAM (Q4_K_M) | 16 GB+ VRAM (BF16) |
| System RAM | 8 GB | 16 GB |
| Disk Space | 2 GB free (Q4_K_M) | 6 GB+ free (BF16) |
| Ollama Version | 0.32.9+ | Latest |
Platform support:
- NVIDIA GPU (dual): 16 GB + 8 GB (RTX 5060 Ti + RTX 4060 Ti) — verified
- NVIDIA GPU (single): 8 GB+ VRAM for Q4_K_M, 16 GB+ for BF16
- Apple Silicon: :mlx tag (1.4 GB, 4-bit MLX) — native Metal performance
- AMD GPU: ROCm-compatible (not verified for this build)
# Linux
curl -fsSL https://ollama.com/install.sh | sh
# macOS / Windows
# Download from https://ollama.com/download
# Pull the 4-bit model (fast, 1.6 GB)
ollama pull oamazonasgabriel/minicpm-2b:q4_k_m
# Run interactively
ollama run oamazonasgabriel/minicpm-2b:q4_k_m
# Single prompt
ollama run oamazonasgabriel/minicpm-2b:q4_k_m \
"Write a Python function to fetch and parse a JSON API"
# Interactive chat
ollama run oamazonasgabriel/minicpm-2b:q4_k_m
# Full precision (5.0 GB)
ollama run oamazonasgabriel/minicpm-2b:bf16
# With a system prompt
ollama run oamazonasgabriel/minicpm-2b:q4_k_m \
--system "You are a rigorous code reviewer"
# Chat completion (thinking + answer)
curl -s http://127.0.0.1:11434/api/chat \
-d '{
"model": "oamazonasgabriel/minicpm-2b:q4_k_m",
"messages": [{"role": "user", "content": "What is 17 * 23?"}],
"stream": false
}'
# Reasoning arrives in "message.thinking", the answer in "message.content"
# OpenAI-compatible endpoint (for agent harnesses)
curl -s http://127.0.0.1:11434/v1/chat/completions \
-d '{
"model": "oamazonasgabriel/minicpm-2b:q4_k_m",
"messages": [{"role": "user", "content": "Hello!"}],
"stream": false
}'
pip install ollama
import ollama
response = ollama.chat(
model='oamazonasgabriel/minicpm-2b:q4_k_m',
messages=[{'role': 'user', 'content': 'Debug this SQL query'}],
)
print(response.message.content)
npm install ollama
import ollama from 'ollama'
const response = await ollama.chat({
model: 'oamazonasgabriel/minicpm-2b:q4_k_m',
messages: [{ role: 'user', content: 'Hello!' }],
})
console.log(response.message.content)
These are baked into the model via its Modelfile:
| Parameter | Value | Rationale |
|---|---|---|
num_ctx |
131072 | Full native context window (max) |
num_gpu |
99 | Offload all layers to GPU |
temperature |
1.0 | OpenBMB official recommendation (think mode) |
top_p |
0.95 | OpenBMB official recommendation |
num_predict |
4096 | Generous output budget for reasoning |
| stop | <\|im_end\|>, </s> |
ChatML + EOS delimiters |
💡 min_p note: llama.cpp’s default
min_p=0.05can cause repetitive output on this model — setmin_p=0.0(OpenBMB recommendation). If you still see repetition, addrepetition_penalty=1.05.
| Component | Size |
|---|---|
| Model weights (Q4_K_M) | ~1.6 GB |
| KV cache (q8_0, 131K context) | ~2.8 GB |
| Ollama process + compute buffers | ~1 GB |
| Total | ~5.5 GB ✅ |
| Context | KV Cache (q8_0) | Fits 8 GB? |
|---|---|---|
| 8,192 | ~0.2 GB | ✅ |
| 32,768 | ~0.7 GB | ✅ |
| 65,536 | ~1.4 GB | ✅ |
| 131,072 (native) | ~2.8 GB | ✅ |
The dense 2.5B model has a tiny footprint — the full 131K context fits on a single 8 GB card.
# Check model is GPU-resident
ollama ps
# Real-time GPU usage (NVIDIA)
watch -n 1 nvidia-smi
# Ollama server logs (Linux)
journalctl -u ollama -n 50 --no-pager
| Symptom | Fix |
|---|---|
| Repetitive output | Set min_p=0.0 (llama.cpp default 0.05 causes repetition on this model) |
Empty content, answer stuck inside thinking |
Raise num_predict (reasoning prompts need 256–512+ tokens) |
| Slow generation on dual-GPU | Ensure OLLAMA_SCHED_SPREAD is off; check ollama ps for CPU offload |
| Tool calling returns malformed XML | Use Q4_K_M or higher — lower quants (Q3/Q2) degrade tool-call formatting |
Add to ~/.config/opencode/opencode.jsonc (or the project’s .opencode/opencode.jsonc):
"oamazonasgabriel/minicpm-2b:q4_k_m": {
"name": "MiniCPM5 2B (Q4_K_M)",
"tools": true
}
Use as agent:
"model": "ollama/oamazonasgabriel/minicpm-2b:q4_k_m"
Tool calling is verified working through ollama’s OpenAI-compatible endpoint — MiniCPM5-2B emits
tool_callsnatively, so OpenCode/nolock/Cline parse them directly.
# Full precision (5.0 GB, best quality)
ollama pull oamazonasgabriel/minicpm-2b:bf16
# Official higher-quality quants from OpenBMB
ollama pull hf.co/openbmb/MiniCPM5-2B-GGUF:Q8_0 # 2.7 GB
# Apple Silicon (MLX 4-bit, 1.4 GB)
ollama pull oamazonasgabriel/minicpm-2b:mlx
| Role | Entity |
|---|---|
| Base Model | OpenBMB |
| Original Model | openbmb/MiniCPM5-2B |
| GGUF Quantization | openbmb/MiniCPM5-2B-GGUF |
| Ollama Packaging | impacte.tech |
| License | Apache 2.0 |
| Resource | URL |
|---|---|
| This model on Ollama | https://ollama.com/oamazonasgabriel/minicpm-2b |
| Upstream model (HuggingFace) | https://huggingface.co/openbmb/MiniCPM5-2B |
| GGUF repo (HuggingFace) | https://huggingface.co/openbmb/MiniCPM5-2B-GGUF |
| MiniCPM GitHub | https://github.com/OpenBMB/MiniCPM |
| Apache 2.0 license | https://www.apache.org/licenses/LICENSE-2.0 |
| Ollama documentation | https://docs.ollama.com |
| Project repository | https://github.com/oamazonasgabriel/ollama-training |
| Built by | impacte.tech |