Text Generation
Transformers
Safetensors
GGUF
Russian
English
Chinese
qwen3
russian
on-device
edge
mnn
keyboard
work-in-progress
conversational
text-generation-inference
Instructions to use Rahspide/MNN-Pocket-0.3B-RU 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 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") 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") model = AutoModelForCausalLM.from_pretrained("Rahspide/MNN-Pocket-0.3B-RU", 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 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:Q4_K_M # Run inference directly in the terminal: llama cli -hf Rahspide/MNN-Pocket-0.3B-RU: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:Q4_K_M # Run inference directly in the terminal: llama cli -hf Rahspide/MNN-Pocket-0.3B-RU: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:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama cli -hf Rahspide/MNN-Pocket-0.3B-RU:Q4_K_M
Use Docker
docker model run hf.co/Rahspide/MNN-Pocket-0.3B-RU:Q4_K_M
- Llama new
- LM Studio
- Jan
- vLLM
How to use Rahspide/MNN-Pocket-0.3B-RU 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" # 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", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Rahspide/MNN-Pocket-0.3B-RU:Q4_K_M
- SGLang
How to use Rahspide/MNN-Pocket-0.3B-RU 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" \ --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", "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" \ --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", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use Rahspide/MNN-Pocket-0.3B-RU with Ollama:
ollama run hf.co/Rahspide/MNN-Pocket-0.3B-RU:Q4_K_M
- Unsloth Desktop
- Pi
How to use Rahspide/MNN-Pocket-0.3B-RU 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: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:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "Rahspide/MNN-Pocket-0.3B-RU:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use Rahspide/MNN-Pocket-0.3B-RU with Docker Model Runner:
docker model run hf.co/Rahspide/MNN-Pocket-0.3B-RU:Q4_K_M
- Lemonade
How to use Rahspide/MNN-Pocket-0.3B-RU with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull Rahspide/MNN-Pocket-0.3B-RU:Q4_K_M
Run and chat with the model
lemonade run user.MNN-Pocket-0.3B-RU-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use Rahspide/MNN-Pocket-0.3B-RU 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: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:8080/v1 hermes config set model.default Rahspide/MNN-Pocket-0.3B-RU:Q4_K_M
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use Rahspide/MNN-Pocket-0.3B-RU 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: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:8080/v1 \ --custom-model-id "Rahspide/MNN-Pocket-0.3B-RU: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"
docs: model card (work in progress)
Browse files
README.md
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- ru
|
| 4 |
+
- en
|
| 5 |
+
- zh
|
| 6 |
+
license: apache-2.0
|
| 7 |
+
base_model: taobao-mnn/MNN-Pocket-0.3B-Base
|
| 8 |
+
library_name: transformers
|
| 9 |
+
pipeline_tag: text-generation
|
| 10 |
+
datasets:
|
| 11 |
+
- HuggingFaceFW/fineweb-2
|
| 12 |
+
- HuggingFaceFW/fineweb
|
| 13 |
+
tags:
|
| 14 |
+
- russian
|
| 15 |
+
- on-device
|
| 16 |
+
- edge
|
| 17 |
+
- mnn
|
| 18 |
+
- qwen3
|
| 19 |
+
- gguf
|
| 20 |
+
- keyboard
|
| 21 |
+
- work-in-progress
|
| 22 |
+
---
|
| 23 |
+
|
| 24 |
+
# MNN-Pocket-0.3B-RU (work in progress)
|
| 25 |
+
|
| 26 |
+
> **Status: still training.** No weights in this repository yet. This card documents the recipe and the
|
| 27 |
+
> measurements taken so far; checkpoints live in the private repo `Rahspide/mnn-pocket-ru-run`
|
| 28 |
+
> (`ckpt/state.pt`). Sections marked *(pending)* will be filled when training finishes.
|
| 29 |
+
|
| 30 |
+
A continued-pretraining run of [`taobao-mnn/MNN-Pocket-0.3B-Base`](https://huggingface.co/taobao-mnn/MNN-Pocket-0.3B-Base)
|
| 31 |
+
on Russian, aimed at on-device next-word and short-phrase suggestions for an Android keyboard.
|
| 32 |
+
|
| 33 |
+
The goal is not instruction following. The model is trained as a plain causal LM on raw Russian text, so it
|
| 34 |
+
continues a typed prefix instead of answering it. English and Chinese are kept alive with a 25% replay mix.
|
| 35 |
+
|
| 36 |
+
| | |
|
| 37 |
+
|---|---|
|
| 38 |
+
| Base | `taobao-mnn/MNN-Pocket-0.3B-Base` (Qwen3 architecture, 303M non-embedding / 361M total params) |
|
| 39 |
+
| Tokenizer | 65,536 tokens, byte-level BPE, `<|endoftext|>` = 65510 |
|
| 40 |
+
| Training tokens | 1.2B (0.9B ru + 0.204B en + 0.096B zh) |
|
| 41 |
+
| Method | full fine-tune, 1 epoch, no LoRA |
|
| 42 |
+
| Hardware | single Colab T4 16 GB, 4.8k tok/s, ~69 h total |
|
| 43 |
+
| Progress (2026-11-09) | step ~1,100 / 36,621, ~36M tokens |
|
| 44 |
+
|
| 45 |
+
## Why the recipe looks like this: Russian is expensive in this tokenizer
|
| 46 |
+
|
| 47 |
+
The base tokenizer is a distilled 65k vocabulary with almost no Cyrillic merges. Russian comes out
|
| 48 |
+
close to character level — `Спасибо` becomes 6 tokens:
|
| 49 |
+
|
| 50 |
+
```
|
| 51 |
+
"Спасибо" -> ['С', 'п', 'аÑģ', 'и', 'б', 'о']
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
+
Measured on prose samples with the real tokenizer:
|
| 55 |
+
|
| 56 |
+
| Tokenizer | RU chars/token | RU tokens per word | EN chars/token |
|
| 57 |
+
|---|---|---|---|
|
| 58 |
+
| MNN-Pocket / Qwen3-distilled (65,536) | **1.75–1.85** | **≈3.3** | 3.78 |
|
| 59 |
+
| ruGPT3-small (50k, Russian BPE) | 4.2 | ≈1.3 | — |
|
| 60 |
+
|
| 61 |
+
Consequences that shaped the plan:
|
| 62 |
+
|
| 63 |
+
- the same 1.2B-token budget buys ~2.2B Russian characters (~340M words), roughly 2.2× less text than
|
| 64 |
+
a Russian-native tokenizer would fit;
|
| 65 |
+
- on a phone, one suggested Russian word costs ~3 decode steps instead of ~1, which matters for a
|
| 66 |
+
keyboard latency budget;
|
| 67 |
+
- vocabulary surgery (adding a few thousand Cyrillic merges plus an embedding resize) is a separate
|
| 68 |
+
experiment, not part of v1. v1 stays tokenizer-compatible with the base model so it drops into the
|
| 69 |
+
existing MNN / GGUF toolchain.
|
| 70 |
+
|
| 71 |
+
## Training recipe
|
| 72 |
+
|
| 73 |
+
- Full fine-tune from `MNN-Pocket-0.3B-Base`, fp32 master weights with fp16 autocast (T4 has no usable bf16).
|
| 74 |
+
- Sequence length 1024, random windows over a packed `uint16` token stream, `<|endoftext|>` between documents.
|
| 75 |
+
- 32,768 tokens per optimizer step (micro-batch 4 × 1024, gradient accumulation 8).
|
| 76 |
+
- AdamW, β = (0.9, 0.95), weight decay 0.1, gradient clip 1.0, lr 2e-4 with 1% linear warmup and cosine decay.
|
| 77 |
+
- One epoch over 1.2B tokens = 36,621 steps.
|
| 78 |
+
- Checkpoint every 500 steps, uploaded to a private HF repo; training auto-resumes from the last checkpoint
|
| 79 |
+
after a session restart.
|
| 80 |
+
|
| 81 |
+
## Data
|
| 82 |
+
|
| 83 |
+
All sources are public Hugging Face datasets. `*` marks the validation split: the first 100k tokens of each
|
| 84 |
+
stream are held out before training starts, so validation text is never seen.
|
| 85 |
+
|
| 86 |
+
| Language | Dataset | Config | Tokens | Share |
|
| 87 |
+
|---|---|---|---|---|
|
| 88 |
+
| ru | [`HuggingFaceFW/fineweb-2`](https://huggingface.co/datasets/HuggingFaceFW/fineweb-2) | `rus_Cyrl` | 0.90B (100k held out*) | 75% |
|
| 89 |
+
| en | [`HuggingFaceFW/fineweb`](https://huggingface.co/datasets/HuggingFaceFW/fineweb) | `sample-100BT` | 0.204B (100k held out*) | 17% |
|
| 90 |
+
| zh | [`HuggingFaceFW/fineweb-2`](https://huggingface.co/datasets/HuggingFaceFW/fineweb-2) | `cmn_Hani` | 0.096B (100k held out*) | 8% |
|
| 91 |
+
|
| 92 |
+
Licences: FineWeb / FineWeb-2 are ODC-BY 1.0. No scraped Telegram dumps or other unlicensed chat corpora
|
| 93 |
+
were used, so the resulting weights stay publishable.
|
| 94 |
+
|
| 95 |
+
## Evaluation
|
| 96 |
+
|
| 97 |
+
Per language: perplexity, **bits per character**, and top-1 / top-5 next-token accuracy. Bits/char is the
|
| 98 |
+
metric that stays comparable across tokenizers, which perplexity is not.
|
| 99 |
+
|
| 100 |
+
Baseline, the untouched base model (measured 2026-11-09, 100k held-out tokens per language):
|
| 101 |
+
|
| 102 |
+
| Lang | ppl | bits/char | top-1 | top-5 | chars/token |
|
| 103 |
+
|---|---|---|---|---|---|
|
| 104 |
+
| ru | 10.42 | 1.625 | 46.2% | 69.3% | 2.08 |
|
| 105 |
+
| en | 21.85 | 1.016 | 39.9% | 64.1% | 4.40 |
|
| 106 |
+
| zh | 23.95 | 3.274 | 41.9% | 62.0% | 1.42 |
|
| 107 |
+
|
| 108 |
+
Fine-tuned numbers: *(pending)*. The acceptance gate is a clear drop in Russian bits/char with at most a
|
| 109 |
+
~10% regression on English and Chinese bits/char.
|
| 110 |
+
|
| 111 |
+
## Intended use
|
| 112 |
+
|
| 113 |
+
- On-device next-word / short-phrase suggestion in a Russian keyboard.
|
| 114 |
+
- Any task that needs a ~200 MB quantised causal LM that continues Russian text.
|
| 115 |
+
|
| 116 |
+
Not intended for: instruction following, factual question answering, code, long-form reasoning. This is a
|
| 117 |
+
0.36B model trained for 1.2B tokens; its knowledge is narrow by construction.
|
| 118 |
+
|
| 119 |
+
## Limitations
|
| 120 |
+
|
| 121 |
+
- **Work in progress.** No quality claims until the run finishes and the table above is filled.
|
| 122 |
+
- Russian is tokenised near character level (see above): slower decoding and a larger effective cost per
|
| 123 |
+
Russian word than the same model pays for English.
|
| 124 |
+
- Web text only. Register is mostly written/informal blog Russian; no dialogue corpora, no post-training.
|
| 125 |
+
- Capacity is 0.36B. Expect weak facts, weak arithmetic, and drift on long generations.
|
| 126 |
+
- English and Chinese are expected to regress somewhat; the 25% replay mix limits but does not remove this.
|
| 127 |
+
- The ChatML template from the base model is inherited but untrained here — do not use this checkpoint in
|
| 128 |
+
chat mode.
|
| 129 |
+
|
| 130 |
+
## Licence and attribution
|
| 131 |
+
|
| 132 |
+
Weights: Apache-2.0, inherited from the base model. Data: ODC-BY 1.0 (FineWeb, FineWeb-2).
|
| 133 |
+
If you use this model, credit the base release:
|
| 134 |
+
|
| 135 |
+
```bibtex
|
| 136 |
+
@misc{mnn_pocket_03b,
|
| 137 |
+
title = {MNN-Pocket-0.3B},
|
| 138 |
+
author = {Taobao MNN team},
|
| 139 |
+
year = {2026},
|
| 140 |
+
url = {https://huggingface.co/taobao-mnn/MNN-Pocket-0.3B}
|
| 141 |
+
}
|
| 142 |
+
```
|