Instructions to use Alphaplasti/ToneBridge-MiniCPM4.1-8B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Alphaplasti/ToneBridge-MiniCPM4.1-8B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Alphaplasti/ToneBridge-MiniCPM4.1-8B", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("Alphaplasti/ToneBridge-MiniCPM4.1-8B", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Alphaplasti/ToneBridge-MiniCPM4.1-8B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Alphaplasti/ToneBridge-MiniCPM4.1-8B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Alphaplasti/ToneBridge-MiniCPM4.1-8B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Alphaplasti/ToneBridge-MiniCPM4.1-8B
- SGLang
How to use Alphaplasti/ToneBridge-MiniCPM4.1-8B 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 "Alphaplasti/ToneBridge-MiniCPM4.1-8B" \ --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": "Alphaplasti/ToneBridge-MiniCPM4.1-8B", "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 "Alphaplasti/ToneBridge-MiniCPM4.1-8B" \ --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": "Alphaplasti/ToneBridge-MiniCPM4.1-8B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Alphaplasti/ToneBridge-MiniCPM4.1-8B with Docker Model Runner:
docker model run hf.co/Alphaplasti/ToneBridge-MiniCPM4.1-8B
ToneBridge-MiniCPM4.1-8B
ToneBridge-MiniCPM4.1-8B is a full merged fine-tuned model based on
openbmb/MiniCPM4.1-8B.
It was created for the Hugging Face BuildSmall hackathon as the correction model powering the ToneBridge Space.
The model is designed for beginner Mandarin learners. Given a short context, target tone, and one imperfect Chinese sentence, it helps produce a more natural Chinese sentence while preserving the learner's original meaning as much as possible.
This repository contains merged model weights, not only a LoRA adapter.
What It Does
- Corrects short Chinese learner sentences.
- Fixes simple grammar, word order, word choice, and input-method mistakes.
- Adjusts tone when a sentence is inappropriate for the target context.
- Handles beginner-oriented situations such as work messages, informal team messages, friendly messages, formal WeChat messages, and informal WeChat messages.
The model should be used conservatively: if a sentence is already correct and natural enough for the selected context, the best correction may be no change.
Project Context
This model is part of ToneBridge, a Hugging Face Space built for the BuildSmall hackathon. ToneBridge focuses on helping beginner learners bridge the gap between "grammatically understandable" Chinese and Chinese that fits the intended social tone.
Training Data
The model was trained in two fine-tuning stages.
| Stage | Local files | Train rows | Validation rows | Goal |
|---|---|---|---|---|
| Stage 1 | hsk12_english_order_train.jsonl / hsk12_english_order_valid.jsonl |
1,800 | 200 | Correct HSK 1/2-style sentences influenced by English word order. |
| Stage 2 | context_tone_hsk3_train.jsonl / context_tone_hsk3_valid.jsonl |
4,500 | 500 | Adapt HSK 1-3 sentences to the selected context and tone. |
Total generated examples documented in this repository:
- 2,000 HSK 1/2 word-order examples.
- 5,000 HSK 1-3 context/tone examples.
- 7,000 total generated examples.
- 6,300 training rows used across the two stages.
- 700 validation rows used across the two stages.
The training data is synthetic and task-specific. It was generated to reduce exact duplicate source/correction pairs and to cover distinct tones and communication contexts.
The relevant JSONL training files are included in the training_data/ folder of
this repository for transparency.
Training Recipe
The model was fine-tuned with a LoRA/QLoRA workflow:
- Start from
openbmb/MiniCPM4.1-8B. - Train a LoRA adapter on HSK 1/2 English-influenced word-order correction.
- Continue fine-tuning that LoRA on HSK 1-3 context and tone adaptation.
- Merge the final LoRA adapter back into the base model.
- Upload the merged full model to this repository.
Main local artifacts:
- Stage 1 LoRA:
minicpm41-hsk12-english-order-lora - Stage 2 LoRA:
minicpm41-tonebridge-v2-lora - Merged model directory:
ToneBridge-MiniCPM4.1-8B-merged
Prompt Format
The fine-tuning data used chat-style prompts. A typical training prompt looked like this:
System:
你是中文语境校对助手。只输出更合适的句子,不要解释。
User:
上下文:类别:微信非正式;场景:微信朋友聊天,轻松提醒回复;语气:短句、轻松、适合微信朋友聊天。原句的语法基本能懂,但不适合当前语境。
原句:如果你有时间,请回复我关于这个问题的消息。
任务:请根据上下文把原句改成更合适的中文。/no_think
Assistant:
有空回我一下关于这个问题的事。
Intended Use
This model is intended for:
- Mandarin learning tools.
- Beginner sentence correction.
- ToneBridge-style context-aware correction.
- Short Chinese messages where the goal is to preserve meaning while fixing grammar or tone.
It is not intended for long-form rewriting, translation, legal/medical advice, or open-ended assistant chat.
Loading Example
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "Alphaplasti/ToneBridge-MiniCPM4.1-8B"
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
model_id,
trust_remote_code=True,
device_map="auto",
)
For memory-constrained Spaces, load the model in 4-bit quantization.
Limitations
- The training data is synthetic and narrow in scope.
- The model may over-correct sentences that are already acceptable.
- Tone adaptation can be subjective and context-dependent.
- It may not reliably handle advanced Chinese, idioms, long paragraphs, or non-beginner writing.
- For important communication, outputs should be reviewed by a human.
Base Model
This model is derived from openbmb/MiniCPM4.1-8B. Please review and respect the base
model's license and usage conditions.
- Downloads last month
- 25
Model tree for Alphaplasti/ToneBridge-MiniCPM4.1-8B
Base model
openbmb/MiniCPM4.1-8B