File size: 5,419 Bytes
f0c4c60
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
---
language:
- ii
- zh
- en
license: apache-2.0
library_name: peft
pipeline_tag: text-generation
base_model: Qwen/Qwen3-1.7B-Base
base_model_relation: adapter
datasets:
- TianYeZ1214/NuosuBench
- nanxidajun/NuosuBburma-OCR-Evaluation-Set
tags:
- qwen3
- nuosu
- standard-liangshan-yi
- translation
- peft
- lora
- research
---

# Qwen3-1.7B-Base Nuosu Translation LoRA

This repository contains a research-preview LoRA adapter for translation
between Standard Liangshan Yi (Nuosu), Chinese, and English. It is based on
`Qwen/Qwen3-1.7B-Base` and is not a standalone model.

本仓库发布的是面向凉山规范彝文(诺苏语)的研究预览版翻译 LoRA。它基于
`Qwen/Qwen3-1.7B-Base`,必须与基础模型一起加载,不是完整模型,也不是通用对话模型。

## Intended use / 适用范围

- Chinese-to-Nuosu, Nuosu-to-Chinese, and English-related translation research.
- Reproducible evaluation and continued corpus/model development.
- Explicit translation instructions with deterministic decoding.

该模型适合明确指定翻译方向的研究和实验。它没有经过足够的真实多轮对话训练,不适合作为
通用聊天助手,也不应被用于需要专业母语翻译质量的场景。

## Training data / 训练数据

The adapter was trained through OCR-ground-truth continued pretraining,
dictionary SFT, and short/long translation SFT. Sources used by this run:

- [NuosuBench](https://huggingface.co/datasets/TianYeZ1214/NuosuBench)
- [NuosuBburma OCR Evaluation Set](https://huggingface.co/datasets/nanxidajun/NuosuBburma-OCR-Evaluation-Set)
- [Yi–Chinese Electronic Dictionary](https://www.yixueyanjiu.com/dict/)

NuosuBench was split into fixed train, validation, and held-out research-test
partitions. The held-out partition was not used for gradient training.

## Evaluation / 评测

Deterministic greedy decoding was used with `max_new_tokens=96`.

| Split or target | Records | chrF2 | Exact match |
|---|---:|---:|---:|
| Validation, overall | 192 | 28.1479 | 0.00% |
| Research test, overall | 11,171 | 38.5067 | 17.21% |
| Research test, Nuosu target | 4,263 | 25.1546 | 2.77% |
| Research test, Chinese target | 2,889 | 39.5248 | 13.46% |
| Research test, English target | 811 | 50.0656 | 22.19% |

The 192-row validation gate had no empty outputs or replacement characters and
a 1.04% length-truncation rate. On the full research test, the empty-output
rate was 0.009%, the replacement-character rate was 1.77%, and the
length-truncation rate was 3.72%.

Automatic scores do not establish linguistic correctness. Native-speaker
review remains necessary.

## Known limitations / 已知问题

- Some difficult Chinese-to-Nuosu prompts trigger repetitive Yi syllable
  loops until the generation limit.
- A small number of truncated generations end with the Unicode replacement
  character (`�`).
- Rare expressions, culturally specific phrases, and long translations remain
  unreliable.
- The training distribution is translation-heavy. Open-ended writing and
  multi-turn dialogue behavior are not reliable.
- The model has not received comprehensive native-speaker evaluation.

本模型最明显的问题是少量困难汉译彝输入会产生重复循环,直到达到生成长度上限。因此本版
仅作为 research preview 发布,不应描述为成熟的彝语翻译系统。

## Usage / 使用方法

```python
import torch
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer

base_id = "Qwen/Qwen3-1.7B-Base"
adapter_id = "NiceAsiv/Qwen3-1.7B-Base-Nuosu-LoRA"

tokenizer = AutoTokenizer.from_pretrained(adapter_id)
base = AutoModelForCausalLM.from_pretrained(
    base_id,
    torch_dtype=torch.bfloat16,
    device_map="auto",
)
model = PeftModel.from_pretrained(base, adapter_id)
model.eval()

messages = [
    {
        "role": "user",
        "content": "请把“欢迎来到凉山”翻译成凉山规范彝文,只输出译文。",
    }
]
prompt = tokenizer.apply_chat_template(
    messages,
    tokenize=False,
    add_generation_prompt=True,
)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
stop_ids = sorted(
    {
        tokenizer.eos_token_id,
        tokenizer.convert_tokens_to_ids("<|im_end|>"),
        tokenizer.convert_tokens_to_ids("<|endoftext|>"),
    }
)

with torch.inference_mode():
    output = model.generate(
        **inputs,
        max_new_tokens=96,
        do_sample=False,
        eos_token_id=stop_ids,
        pad_token_id=tokenizer.pad_token_id,
    )

print(
    tokenizer.decode(
        output[0, inputs["input_ids"].shape[-1]:],
        skip_special_tokens=True,
    )
)
```

Use explicit translation instructions and deterministic decoding. Stop and
discard an output if it enters a repetition loop.

## Training summary

- Base model: `Qwen/Qwen3-1.7B-Base`
- Adapter: LoRA, rank 32, alpha 64, dropout 0.05
- Precision: BF16
- Training topology: three GPUs with distributed data parallelism
- Stages: OCR CPT → dictionary SFT → short translation SFT → long translation SFT

## Disclaimer / 免责声明

This artifact is provided for academic and research use. Users are responsible
for validating generated translations and reviewing the terms of each cited
data source. Do not use generated text as authoritative linguistic,
educational, legal, medical, or public-service translation without qualified
human review.