--- license: apache-2.0 base_model: Qwen/Qwen3-1.7B-Base language: - zh - en pipeline_tag: translation library_name: transformers tags: - translation - qwen3 - zh-en - en-zh - sft - cpo - grpo datasets: - haoranxu/ALMA-Human-Parallel --- # Interpreter-Qwen3-1.7B A 1.7B Chinese↔English translation model, trained from [`Qwen/Qwen3-1.7B-Base`](https://huggingface.co/Qwen/Qwen3-1.7B-Base) via a three-stage pipeline **SFT → CPO → GRPO**. On WMT23 it **matches the 1.8B reference [HY-MT1.5-1.8B](https://huggingface.co/tencent/HY-MT1.5-1.8B) on zh→en COMET** with fewer parameters. ## Results (WMT23, COMET = `Unbabel/wmt22-comet-da`) Full pipeline progression + ablations. **This model is the `+ GRPO` row.** | Stage | zh→en BLEU | zh→en COMET | en→zh BLEU | en→zh COMET | |---|---|---|---|---| | Qwen3-1.7B-Base (5-shot) | 21.83 | 0.7950 | 41.15 | 0.8490 | | + SFT | 19.65 | 0.7863 | 40.74 | 0.8384 | | + CPO (LoRA) | 19.16 | 0.8017 | 32.69 | 0.8507 | | **+ GRPO (this model)** | 20.31 | **0.8053** | 33.69 | **0.8540** | | SFT → GRPO (skip CPO) | 22.85 | 0.8003 | 41.97 | 0.8540 | | HY-MT1.5-1.8B (reference) | 17.84 | 0.8052 | 31.74 | 0.8669 | zh→en COMET reaches parity with the 1.8B reference (0.8053 vs 0.8052); BLEU stays above the reference in both directions; en→zh COMET trails the larger reference by ~0.013. ### Findings - **COMET climbs monotonically** across stages (CPO gives the biggest jump, GRPO refines); final gain over base 5-shot is +0.010 zh→en / +0.005 en→zh COMET. - **Alignment tax shows up in BLEU.** The raw base with 5-shot prompting is already a strong baseline; SFT alone underperforms it on all four metrics, and CPO trades ~8.5 en→zh BLEU for its COMET gain (COMET-optimized preference training favors adequacy over lexical overlap). - **The CPO step is optional.** A tuned **SFT → GRPO** run (skipping CPO) matches the full pipeline's COMET while keeping BLEU high (22.85 / 41.97) — beating base 5-shot on all four metrics, the only variant to do so. ## Usage The model uses the ChatML chat format with a fixed translation instruction; `<|im_end|>` is the stop token. Greedy decoding is recommended. ```python from transformers import AutoModelForCausalLM, AutoTokenizer import torch model_id = "Ismantic/Interpreter-Qwen3-1.7B" tok = AutoTokenizer.from_pretrained(model_id) model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16).cuda().eval() def translate(text, direction="zh2en"): if direction == "zh2en": instr = f"Translate the following text from Chinese to English.\nChinese: {text}\nEnglish:" else: instr = f"Translate the following text from English to Chinese.\nEnglish: {text}\nChinese:" prompt = f"<|im_start|>user\n{instr}<|im_end|>\n<|im_start|>assistant\n" ids = tok(prompt, return_tensors="pt").to(model.device) out = model.generate(**ids, max_new_tokens=256, do_sample=False, eos_token_id=tok.convert_tokens_to_ids("<|im_end|>")) return tok.decode(out[0][ids.input_ids.shape[1]:], skip_special_tokens=True).strip() print(translate("人工智能正在深刻改变我们的生活方式。", "zh2en")) print(translate("The quick brown fox jumps over the lazy dog.", "en2zh")) ``` vLLM works too (feed the same ChatML prompt, `stop=["<|im_end|>"]`). For a quick interactive demo, grab `translate.py` from this repo and run `python translate.py` (needs `vllm`) — type sentences, zh↔en auto-detected. ## Training - **Base**: `Qwen/Qwen3-1.7B-Base` - **SFT**: full fine-tune on ChatML translation pairs (ALMA + X-ALMA parallel corpora, ~36.8K, WMT22/23 leakage removed), loss on the assistant turn only. - **CPO**: LoRA preference training (DPO loss + NLL) on ~44K self-generated preference pairs (candidates scored by COMET; 25.7% of `chosen` replaced with COMET-better HY-MT1.5-7B translations), then merged. - **GRPO**: full-parameter RL with a reference-based `wmt22-comet-da` COMET reward plus a 4-gram repetition penalty, using WMT17–21 source prompts. Prompt template is fixed and identical across training and inference. BLEU tokenization: `zh` for en→zh, `13a` for zh→en. WMT23 is the primary (uncontaminated) test set; gains were cross-checked on WMT23/24 + Flores-200 to rule out COMET reward-hacking. ## License & attribution Released under Apache-2.0, following the base model `Qwen/Qwen3-1.7B-Base`. Training data derives from the ALMA / X-ALMA parallel & preference corpora and WMT news test sets; HY-MT1.5-7B was used only to generate a subset of CPO preference targets. Please also respect the licenses of those upstream models and datasets.