Instructions to use Rahspide/MNN-Pocket-0.3B-RU-Chat with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Rahspide/MNN-Pocket-0.3B-RU-Chat with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Rahspide/MNN-Pocket-0.3B-RU-Chat") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Rahspide/MNN-Pocket-0.3B-RU-Chat") model = AutoModelForCausalLM.from_pretrained("Rahspide/MNN-Pocket-0.3B-RU-Chat", 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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use Rahspide/MNN-Pocket-0.3B-RU-Chat with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf Rahspide/MNN-Pocket-0.3B-RU-Chat:Q4_K_M # Run inference directly in the terminal: llama cli -hf Rahspide/MNN-Pocket-0.3B-RU-Chat:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf Rahspide/MNN-Pocket-0.3B-RU-Chat:Q4_K_M # Run inference directly in the terminal: llama cli -hf Rahspide/MNN-Pocket-0.3B-RU-Chat:Q4_K_M
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf Rahspide/MNN-Pocket-0.3B-RU-Chat:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama cli -hf Rahspide/MNN-Pocket-0.3B-RU-Chat:Q4_K_M
Use Docker
docker model run hf.co/Rahspide/MNN-Pocket-0.3B-RU-Chat:Q4_K_M
- Llama new
- LM Studio
- Jan
- vLLM
How to use Rahspide/MNN-Pocket-0.3B-RU-Chat with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Rahspide/MNN-Pocket-0.3B-RU-Chat" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Rahspide/MNN-Pocket-0.3B-RU-Chat", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Rahspide/MNN-Pocket-0.3B-RU-Chat:Q4_K_M
- SGLang
How to use Rahspide/MNN-Pocket-0.3B-RU-Chat 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 "Rahspide/MNN-Pocket-0.3B-RU-Chat" \ --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": "Rahspide/MNN-Pocket-0.3B-RU-Chat", "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 "Rahspide/MNN-Pocket-0.3B-RU-Chat" \ --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": "Rahspide/MNN-Pocket-0.3B-RU-Chat", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use Rahspide/MNN-Pocket-0.3B-RU-Chat with Ollama:
ollama run hf.co/Rahspide/MNN-Pocket-0.3B-RU-Chat:Q4_K_M
- Unsloth Desktop
- Pi
How to use Rahspide/MNN-Pocket-0.3B-RU-Chat with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf Rahspide/MNN-Pocket-0.3B-RU-Chat:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:9931/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "Rahspide/MNN-Pocket-0.3B-RU-Chat:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use Rahspide/MNN-Pocket-0.3B-RU-Chat with Docker Model Runner:
docker model run hf.co/Rahspide/MNN-Pocket-0.3B-RU-Chat:Q4_K_M
- Lemonade
How to use Rahspide/MNN-Pocket-0.3B-RU-Chat with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull Rahspide/MNN-Pocket-0.3B-RU-Chat:Q4_K_M
Run and chat with the model
lemonade run user.MNN-Pocket-0.3B-RU-Chat-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use Rahspide/MNN-Pocket-0.3B-RU-Chat with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf Rahspide/MNN-Pocket-0.3B-RU-Chat:Q4_K_M
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:9931/v1 hermes config set model.default Rahspide/MNN-Pocket-0.3B-RU-Chat:Q4_K_M
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use Rahspide/MNN-Pocket-0.3B-RU-Chat with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf Rahspide/MNN-Pocket-0.3B-RU-Chat:Q4_K_M
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:9931/v1 \ --custom-model-id "Rahspide/MNN-Pocket-0.3B-RU-Chat:Q4_K_M" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Configure the model in Pi
# Install Pi:
npm install -g @earendil-works/pi-coding-agent# Add to ~/.pi/agent/models.json:
{
"providers": {
"llama-cpp": {
"baseUrl": "http://localhost:9931/v1",
"api": "openai-completions",
"apiKey": "none",
"models": [
{
"id": "Rahspide/MNN-Pocket-0.3B-RU-Chat:"
}
]
}
}
}Run Pi
# Start Pi in your project directory:
piStatus: v2.0 in this repository since 2026-11-25. Same base, rebuilt recipe: a filtered corpus, a layer of answers that obey an explicit format requirement, and whole-example batches. 12.2 M tokens of SFT, about 1.1 h on one Kaggle T4. The previous weights (v1, 2026-11-10) are kept on the
v1branch of this repository, with the MNN build and the GGUF files as they were.
Russian instruction-following assistant, built by SFT on top of
Rahspide/MNN-Pocket-0.3B-RU. It answers instead of
continuing; that dialogue shape is what SFT bought.
What changed from v1
v1 was tuned on 50 M tokens. The rebuild mattered more than the budget:
| v1 | v2 | |
|---|---|---|
| Training corpus | 24.8 M unique tokens of general chat, 55 % of answers over 1 000 characters | 8.5 M unique tokens: filtered general chat plus 1 014 examples whose answer obeys an explicit format requirement |
| Batch construction | random 1 024-token windows of the token stream | whole examples, each one complete, padded to the batch |
| Form constraints in the data | 2.7 % of prompts asked for a format | the constraint layer is oversampled to 35 % of training slots |
| SFT budget | 50 M tokens | 12.2 M tokens |
Three defects in the v1 data, measured before the rebuild:
- A third of the training windows contained no instruction at all, only a continuation of somebody's answer. The model was trained to keep writing essays.
- Only 2.7 % of prompts asked for a specific shape of answer, and half of those were answered in the wrong shape inside the training data itself.
- Examples longer than the training window were cut in half, so the model saw answers that stopped mid-sentence.
v2 drops examples that answer a different question, role-play personas and rows rated low by the dataset's own scorer, truncates long answers at a sentence boundary instead of at the window edge, and adds the format layer. The measured effect on 90 prompts with an explicit requirement:
| Requirement compliance (1–5) | v1 | v2 |
|---|---|---|
| mean score | 2.52 | 3.81 |
| paired difference against v1 | — | +1.29 (t = 6.9, n = 90) |
The improvement is larger than a token-count change explains. The recipe was the binding constraint.
Two models, two jobs
Sister — MNN-Pocket-0.3B-RU |
This model — MNN-Pocket-0.3B-RU-Chat |
|
|---|---|---|
| Job | continue text | follow instructions |
| Input | a prefix, often mid-sentence | a system + user message |
| Output | the plausible continuation | an answer |
| Trained with | continued pretraining on 1.2 B tokens of raw text | instruction tuning on top of that model |
| Choose it for | keyboard suggestions, autocomplete, prefix completion | chat, Q&A, short rewrites |
| Do not choose it for | assistant behaviour: it will continue your question instead of answering it | autocomplete: it will answer instead of continuing |
The two tasks reward opposite behaviour. Trained on both jobs, one checkpoint answers when it should continue, and continues when it should answer.
Why start from the Russian continuation model
The base MNN-Pocket-0.3B is bilingual zh/en and has essentially no Russian; a direct SFT of the official
instruct model would fight both problems at once (new language and new format). Starting from the continuation
model means Russian is already paid for, and SFT only has to teach the dialogue shape.
Recipe (as run)
- Start point:
Rahspide/MNN-Pocket-0.3B-RU. - Chat template: the model's own ChatML (
<|im_start|>/<|im_end|>), untouched. - Loss only on assistant tokens; system and user turns are masked context.
- One whole example per sequence. Batches pad to the longest example in the batch; no example is ever cut across two windows.
- 610 optimizer steps, 12.2 M tokens of SFT in total, checkpoints every 300 steps.
- 85 / 15 Russian-to-English sampling per slot; the English share keeps bilingual instruction following.
- 35 % of Russian slots are drawn from the format layer, the rest from the filtered general-chat corpus.
- lr 1e-4, cosine, 5 % warmup, full fine-tuning, bf16 autocast on T4 with fp32 master weights.
- About 1.1 h on one Kaggle T4 at roughly 3 100 tokens/s.
Data (as used)
| Dataset | Role | Licence |
|---|---|---|
IlyaGusev/saiga_scored |
Russian instructions: 9 723 filtered dialogues + 1 014 format-layer examples (10 737 in total, 10 201 in the training split), 4.85 M tokens | see dataset card |
HuggingFaceH4/ultrachat_200k |
English replay: 6 000 dialogues (5 700 in the training split), 3.67 M tokens | MIT |
Filters on saiga_scored: Russian only, rows flagged is_bad_by_regex dropped, dataset score below 6 dropped,
dialogues of 80–6 000 characters and 2–8 turns kept, rows where the assistant answer shares no content word
with the question dropped, role-play personas and chatty system prompts dropped. Answers longer than 600
tokens are cut at a sentence boundary. The format layer is synthetic: a strong teacher model answered 1 014
held-out Russian questions under an explicit format instruction, and answers that did not satisfy the
instruction were thrown away.
Evaluation
150 held-out Russian prompts from the saiga_scored validation slice, greedy decoding, the model's own
template. A judge model (gpt-6.2-sol, temperature 0) scored v1 and v2 on the same answers, so the difference
is paired.
| Axis (1–5) | v1 | v2 | paired difference |
|---|---|---|---|
| follows the instruction | 1.57 | 1.61 | +0.05 (t = 0.6) |
| naturalness | 2.30 | 2.21 | −0.09 (t = −1.0) |
| correct refusal | 4.89 | 4.89 | +0.00 |
| coherence | 1.75 | 2.01 | +0.25 (t = 2.4) |
90 of the same prompts carry an explicit requirement — one sentence, two sentences, exactly three bullet points, a phrase of at most five words, at most 50 words, no lists:
| Axis (1–5) | v1 | v2 | paired difference |
|---|---|---|---|
| requirement followed | 2.52 | 3.81 | +1.29 (t = 6.9) |
| answer quality | 1.20 | 1.32 | +0.12 (t = 1.3) |
Automatic checks over the same 150 answers:
| Check | v1 | v2 |
|---|---|---|
| empty answers | 1 | 0 |
| echoes the prompt | 4 | 5 |
| mean answer length, words | 30.2 | 29.1 |
| distinct-2 (higher = less repetition) | 0.936 | 0.950 |
| answers more than half Cyrillic | 140 / 150 | 132 / 150 |
Byte-level bits per byte on val_v2, the same corpus and the same tool for every model: v1 0.6360, v2 0.6225.
Independent benchmark
ARC-Challenge run by the True Performance Network Workbench on a rented
GPU, on the public weights of this repository at revision b11bdf9b — the same model.safetensors
(sha256 b573289b…) that main carries now:
| task | arc_challenge, 0-shot, task-default generation length |
| evaluator | lm-eval 0.4.12 + transformers 5.10.4, vLLM backend, single NVIDIA H100 80 GB |
acc_norm |
26.2 % ± 1.3 |
acc |
20.0 % ± 1.2 |
| samples | 1 172 |
| order wall-clock and cost | 9 minutes, $7.10 |
For a model this size this is a result worth having: random guessing on the same four-way task scores 25 %.
The SFT taught the shape of a dialogue answer rather than encyclopedic science, and the number measures
exactly that gap. The raw order record, including the evaluator string and the measured VRAM, is in
review/tpn_arc_challenge.json.
Builds
| Build | Size | Download | Note |
|---|---|---|---|
| Q8_0 | 309 MB | gguf/MNN-Pocket-0.3B-RU-Chat-Q8_0.gguf |
near-lossless |
| Q4_K_M | 223 MB | gguf/MNN-Pocket-0.3B-RU-Chat-Q4_K_M.gguf |
phone size |
| Q4_1 | 208 MB | gguf/MNN-Pocket-0.3B-RU-Chat-Q4_1.gguf |
smallest GGUF, slower prompt processing |
| MNN INT4 | 167 MB | mnn/MNN-Pocket-0.3B-RU-Chat-INT4 | Android, MNN runtime |
llama-cli -hf Rahspide/MNN-Pocket-0.3B-RU-Chat:Q4_K_M --jinja -p "Объясни, что такое инфляция" -n 60
The MNN build uses the MNN runtime (llm_demo, built with -DMNN_BUILD_LLM=ON). Runtime sources:
alibaba/MNN, the
LLM export and inference guide, and the
official Android app apps/Android/MnnLlmChat.
Its llm_config.json keeps the ChatML template, so it answers out of the box:
cd mnn/MNN-Pocket-0.3B-RU-Chat-INT4 && llm_demo config.json prompt.txt
Measured with llama-bench on a 16-thread x86 CPU, no GPU, 5 repetitions, on the published files: prompt
processing 632 t/s on Q4_K_M and 395 t/s on Q4_1; generation 97 t/s on Q4_K_M and 89 t/s on Q4_1. The host was shared and
busy during the run (standard deviation ±24 t/s), so treat the numbers as indicative rather than a benchmark.
Apply the model's own ChatML template (--jinja in llama.cpp, apply_chat_template in transformers). Without
it the model continues text instead of answering and behaves like its sister.
config.json carries both rope_parameters (transformers 5.x) and the legacy rope_theta (transformers 4.x).
Transformers 4.x ignores the new field and falls back to a default that inflates perplexity by 2.6×; with
both fields present the weights load correctly on either version.
Reproduce
# chat smoke test through the model's own template
python bench/chat_smoke.py --model Rahspide/MNN-Pocket-0.3B-RU-Chat --cpu
# throughput of the quantised build
LLAMA_CLI=/path/to/llama-cli bash bench/bench_cpu.sh gguf/MNN-Pocket-0.3B-RU-Chat-Q4_K_M.gguf --chat
bench/chat_smoke.py applies the chat template from tokenizer_config.json, generates greedily and asserts that
the answer does not echo the prompt, which is a cheap check that the template and the checkpoint still match.
bench/bench_cpu.sh --chat wraps the prompt in ChatML before timing, so the numbers are comparable with the
table above.
Limitations
- 303 M parameters (0.30 B): short answers, weak facts, no reliable multi-step reasoning. Answer quality sits near 1.3 of 5 on the judge's scale; this is a small assistant.
- Russian SFT data is mostly machine-translated or model-generated; style is flatter than human chat.
- Answers are slightly less often fully Russian than v1 (132 against 140 of 150) — the English replay share is the same, but the format layer was written by a teacher that occasionally answered in English.
- The sister's tokenizer cost applies here too: about 3.3 tokens per Russian word, so ~3× more decode steps per Russian sentence than for English. The vocabulary is byte-level, so rare and uppercase Cyrillic letters can end up split across tokens; a streaming decoder has to buffer partial UTF-8 sequences.
- Not a coding model, not a tool-calling model, no long-context dialogue.
Releases
| Date | Version | What changed |
|---|---|---|
| 2026-11-10 | v1.0 | Assistant released: 50 M-token SFT (18.8 M ru + 6 M en), bf16 weights, GGUF Q8_0 / Q4_K_M, ChatML smoke test passing |
| 2026-11-11 | v1.1 | MNN INT4 build for Android: 165 MB, ChatML template included, ~80 tok/s decode |
| 2026-11-25 | v2.0 | Recipe rebuilt and the weights in this repository replaced: filtered corpus, 1 014-example format layer, whole-example batches, 12.2 M tokens of SFT. Requirement compliance 2.52 → 3.81, coherence 1.75 → 2.01, bytes-bpb 0.6360 → 0.6225. v1 weights stay on the v1 branch |
| 2026-11-10 | v1.0 (sister) | Continuation checkpoint released: 1.2 B-token CPT, same base |
Licence and attribution
Weights: Apache-2.0, inherited through MNN-Pocket-0.3B-RU from taobao-mnn/MNN-Pocket-0.3B-Base.
@misc{mnn_pocket_03b,
title = {MNN-Pocket-0.3B},
author = {Taobao MNN team},
year = {2026},
url = {https://huggingface.co/taobao-mnn/MNN-Pocket-0.3B}
}
- Downloads last month
- 1,915
Model tree for Rahspide/MNN-Pocket-0.3B-RU-Chat
Base model
taobao-mnn/MNN-Pocket-0.3B-Base


Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp# Start a local OpenAI-compatible server: llama serve -hf Rahspide/MNN-Pocket-0.3B-RU-Chat: