Instructions to use amiya/qwen2.5-3b-gec-v2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use amiya/qwen2.5-3b-gec-v2 with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("amiya/qwen2.5-3b-gec-v2") prompt = "Write a story about Einstein" messages = [{"role": "user", "content": prompt}] prompt = tokenizer.apply_chat_template( messages, add_generation_prompt=True ) text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Pi
How to use amiya/qwen2.5-3b-gec-v2 with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "amiya/qwen2.5-3b-gec-v2"
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "amiya/qwen2.5-3b-gec-v2" } ] } } }Run Pi
# Start Pi in your project directory: pi
- OpenClaw new
How to use amiya/qwen2.5-3b-gec-v2 with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "amiya/qwen2.5-3b-gec-v2"
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 "amiya/qwen2.5-3b-gec-v2" \ --custom-provider-id mlx-lm \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
- MLX LM
How to use amiya/qwen2.5-3b-gec-v2 with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "amiya/qwen2.5-3b-gec-v2"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "amiya/qwen2.5-3b-gec-v2" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "amiya/qwen2.5-3b-gec-v2", "messages": [ {"role": "user", "content": "Hello"} ] }' - Hermes Agent
How to use amiya/qwen2.5-3b-gec-v2 with Hermes Agent:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "amiya/qwen2.5-3b-gec-v2"
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 amiya/qwen2.5-3b-gec-v2
Run Hermes
hermes
qwen2.5-3b-gec-v2
LoRA fine-tune of Qwen/Qwen2.5-3B-Instruct for English grammatical error correction (GEC). v2 improvements over qwen2.5-3b-gec-bea2019:
- +0.038 F0.5 (0.495 → 0.533) on held-out BEA-dev.
- Mixed training corpus: BEA-2019 W&I+LOCNESS (22,668 pairs) + Grammarly Coedit GEC subset (19,823 pairs) = 42,491 minimal-edit pairs.
- All 36 transformer layers LoRA-adapted (vs 16 in v1) → 14.97 M trainable params (vs 6.65 M).
- 5,000 iters (vs 3,000) on the larger corpus.
- LoRA weights are fused into the base, so this repo is a drop-in replacement for the base model.
Results
| Setting | Precision | Recall | F0.5 |
|---|---|---|---|
| v2 (post-processed, single-pass) | 0.589 | 0.386 | 0.533 |
| v2 + iterative (max-iter 2) | 0.575 | 0.407 | 0.531 |
| v1 (BEA only) | 0.543 | 0.365 | 0.495 |
Scored with ERRANT on a 100-sample held-out BEA-dev split (ABCN.dev.gold.bea19.m2, identity rows skipped). Post-processing strips a small set of BEA-2019 tokenization artifacts (trailing " ." → ".", collapsed double spaces, source-aligned leading-cap).
Validation loss trajectory (held-out 500-pair mix of BEA + Coedit):
| Iter | Val |
|---|---|
| 1 (baseline) | 1.981 |
| 500 | 0.367 |
| 1000 | 0.297 |
| 1500 | 0.319 |
| 2000 | 0.251 |
| 2500 | 0.260 |
| 3000 | 0.231 |
| 3500 | 0.160 (best, promoted) |
| 4000 | 0.248 |
| 4500 | 0.248 |
| 5000 | 0.167 |
Trained 5,000 iters on an Apple M2 Max in ~36 minutes (peak memory 10.5 GB).
Use
from mlx_lm import generate, load
model, tokenizer = load("amiya/qwen2.5-3b-gec-v2")
prompt = tokenizer.apply_chat_template(
[
{"role": "system", "content": "Correct the grammar of the user text. Preserve meaning."},
{"role": "user", "content": "He go to school"},
],
tokenize=False,
add_generation_prompt=True,
)
print(generate(model, tokenizer, prompt=prompt, max_tokens=80))
# -> "He goes to school"
PyTorch users: transformers.AutoModelForCausalLM.from_pretrained("amiya/qwen2.5-3b-gec-v2") works the same.
System prompt
Correct the grammar of the user text. Preserve meaning.
Use that exact prompt for in-distribution behavior. Chat template is Qwen's ChatML.
Recommended decoding
- Greedy (temperature 0).
max_new_tokens~ 1.5× the prompt length.- Single-pass: ~80 tokens / sentence on M2 Max greedy.
- Iterative re-feed: same F0.5 on this dataset (trades precision for recall); add it if you need higher recall.
- Post-processor (~20 LOC, in the source repo) trims
" .", collapses runs of whitespace, and aligns leading capitalisation to the input. Worth +0.01–0.02 F0.5.
Training
- Base:
Qwen/Qwen2.5-3B-Instruct(3.09 B params) - LoRA: rank 16, alpha 32, all 36 layers (vs 16 in v1), 14.97 M trainable (0.485 %)
- Optimizer: AdamW, lr 5e-5
- Batch size: 2, max sequence 256
- Iters: 5,000 (best snapshot at iter 3,500 was promoted)
- Hardware: Apple M2 Max, 32 GB unified RAM, mlx-lm v0.31.3
- Data:
- BEA-2019 W&I+LOCNESS
ABC.train.gold.bea19.m2→ 22,668 unique src→tgt pairs after dropping identity rows. - Grammarly Coedit
train.jsonl, filtered totask == "gec"→ 19,823 pairs after stripping instruction prefixes. - 500 held-out for val.
- BEA-2019 W&I+LOCNESS
Limitations
- ERRANT F0.5 = 0.533 is below the GECToR paper's 0.65+ benchmark. Closing the gap further requires NUCLE + FCE + Lang-8 + the multi-stage curriculum (synthetic pretrain → BEA mid-train → W&I+L finetune).
- Greedy decoding is recommended. Temperature > 0 produces fluent but less-faithful corrections.
- English only.
- Trained on ≤ 256-token sequences; long inputs may degrade.
Comparison to v1
The v1 model is BEA-only and uses a smaller LoRA (16 layers). v2 doubles LoRA capacity and adds Coedit data; the gains come about evenly from both. Use v2 unless you specifically want a smaller-footprint adapter.
Citation
@misc{qwen25_3b_gec_v2,
title = {qwen2.5-3b-gec-v2: LoRA-tuned Qwen2.5-3B for English GEC},
author = {amiya},
year = {2026},
url = {https://huggingface.co/amiya/qwen2.5-3b-gec-v2}
}
Datasets: Bryant et al. The BEA-2019 Shared Task on GEC. Raheja et al. CoEdIT: Text Editing by Task-Specific Instruction Tuning.
- Downloads last month
- 9
Quantized