Views
No views yet
GSAI-ML/LLaDA-8B-Base into a masked-diffusion MT system for Zh→En.The adapter is not the method. Entropy-Valley (EV) is a training-free, decoding-time length selector, implemented inladit/decoding/length_adaptive.py. This adapter is the fixed backbone that EV decodes with — the same weights serve the length-oracle, fixed-ratio, and EV conditions. Only the canvas length handed to the decoder changes.

| Base model | GSAI-ML/LLaDA-8B-Base (8.02B, masked diffusion) |
| Adapter | LoRA r=64, α=128, dropout 0.05 on q/k/v/o_proj + ff_proj/up_proj/ff_out |
| Training data | 200k WMT19 zh-en pairs (Entropy-Valley-Datasets, config enzh, roles swapped), 3 epochs, bf16, 8×H20 |
| Decoding | MED schedule, $T{=}32$ steps, EOS truncation |
| EV candidate grid | $\mathcal{R} = {1.00, 1.10, 1.20, 1.30, 1.40}$, fixed for the direction |
| Prompt template | Translate Chinese to English.\n\nChinese: {src}\nEnglish: |
| Length method | COMET-22 | sacreBLEU |
|---|---|---|
| Fixed ratio 1.2 | 0.8266 | 23.65 |
| Entropy-Valley | 0.8431 | 25.28 |
| Length oracle † | 0.8519 | 27.93 |
1git clone https://github.com/Entropy-Valley/Entropy-Valley.git && cd Entropy-Valley
2pip install -e .1import torch
2from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer
3from peft import PeftModel
4
5from ladit.data.mt_dataset import set_lang_pair
6from ladit.decoding.length_adaptive import entropy_valley_probe, set_mask_token_id as set_ev_mask
7from ladit.decoding.translate import translate_single, set_mask_token_id as set_dec_mask
8
9BASE, ADAPTER = "GSAI-ML/LLaDA-8B-Base", "YanZhanPKU/Entropy-Valley-LLaDA-8B-Zh2En"
10
11tokenizer = AutoTokenizer.from_pretrained(BASE, trust_remote_code=True)
12model = AutoModelForCausalLM.from_pretrained(BASE, trust_remote_code=True,
13 torch_dtype=torch.bfloat16).to("cuda")
14model = PeftModel.from_pretrained(model, ADAPTER).merge_and_unload().eval()
15
16mask_tid = getattr(AutoConfig.from_pretrained(BASE, trust_remote_code=True), "mask_token_id", 126336)
17set_ev_mask(mask_tid); set_dec_mask(mask_tid)
18set_lang_pair("zh-en")
19
20src = "很抱歉,您点的餐可能会晚到一会。"
21n_src = len(tokenizer.encode(src, add_special_tokens=False))
22candidates = sorted({max(1, int(n_src * r)) + 1 for r in (1.00, 1.10, 1.20, 1.30, 1.40)})
23
24L_star = entropy_valley_probe(model, tokenizer, src, candidates)["best_length"]
25out = translate_single(model, tokenizer, src, target_length=L_star,
26 num_steps=32, schedule_name="med")
27print(L_star, out["translation"])1python scripts/decode_eval.py \
2 --model_path /path/to/LLaDA-8B-Base \
3 --lora_path YanZhanPKU/Entropy-Valley-LLaDA-8B-Zh2En \
4 --input_file data/wmt22_enzh_test.jsonl \
5 --output_dir eval_results/zhen_ev \
6 --num_examples 2037 --num_steps 32 --schedule med \
7 --methods "oracle,ratio_1.2,entropy_valley" \
8 --candidate_ratios "1.00,1.10,1.20,1.30,1.40" \
9 --lang_pair zh-en --device cudawmt22_enzh_test.jsonl — --lang_pair zh-en swaps which key is source and which is target.1@inproceedings{zhan2026lengthadaptive,
2 title = {Length-Adaptive Decoding for Masked Diffusion Machine Translation},
3 author = {Zhan, Yan and Hou, Mengkai and Zhang, Wanting and Gao, Zhijun},
4 booktitle = {Proceedings of the 2026 Conference on Empirical Methods in Natural Language Processing (EMNLP)},
5 year = {2026},
6 eprint = {2608.22274},
7 archivePrefix = {arXiv},
8 primaryClass = {cs.CL},
9 url = {https://arxiv.org/abs/2608.22274}
10}GSAI-ML/LLaDA-8B-Base base-model licence. Code is MIT.