jvonrad commited on
Commit
67ffee8
·
verified ·
1 Parent(s): 1236247

Add model card

Browse files
Files changed (1) hide show
  1. README.md +161 -0
README.md ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model: Qwen/Qwen2.5-7B
4
+ library_name: transformers
5
+ pipeline_tag: text-generation
6
+ language:
7
+ - en
8
+ - de
9
+ - id
10
+ - pt
11
+ - ar
12
+ - bn
13
+ - sw
14
+ - es
15
+ - ru
16
+ - fr
17
+ - ja
18
+ - zh
19
+ datasets:
20
+ - jvonrad/WIKI-FACT
21
+ - jvonrad/PolyFact
22
+ tags:
23
+ - multilingual
24
+ - cross-lingual
25
+ - factual-recall
26
+ - cross-lingual-consistency
27
+ - dpo
28
+ - cm-align
29
+ ---
30
+
31
+ # Qwen-2.5-7B CM-Align (EN-pivot DPO)
32
+
33
+ `Qwen/Qwen2.5-7B` post-trained with **CM-Align**, an English-pivot preference-alignment method,
34
+ as a **baseline** in a study of cross-lingual factual recall and consistency.
35
+
36
+ This is the Qwen counterpart of [`jvonrad/OLMo-2-7B-CM-Align`](https://huggingface.co/jvonrad/OLMo-2-7B-CM-Align).
37
+ Weights are **merged** (LoRA adapter folded into the base model), so it loads like any standard
38
+ Qwen2.5 checkpoint.
39
+
40
+ ## Method
41
+
42
+ Adaptation of CM-Align (Zhang et al., EMNLP 2025 Findings, [arXiv:2509.08541](https://arxiv.org/abs/2509.08541))
43
+ to a parallel multilingual factual-QA setting. The procedure is **self-supervised — it never uses
44
+ gold answer labels**:
45
+
46
+ 1. **Preference construction.** For each fact, sample `K=4` free-text answers per language
47
+ (temperature 0.9, top-p 0.95). Embed all candidates with
48
+ [`sentence-transformers/LaBSE`](https://huggingface.co/sentence-transformers/LaBSE).
49
+ Choose as **pivot** the most self-consistent English candidate (highest mean cosine
50
+ similarity to the other English candidates). Then, for every other language, take
51
+ `chosen = argmax` and `rejected = argmin` cosine similarity to that English pivot.
52
+ 2. **DPO training.** Hand-rolled DPO on those preference pairs. The reference distribution is
53
+ the *same* model with the LoRA adapter disabled, so no second copy of the model is held in
54
+ memory. Objective: `L_DPO + gamma * L_NLL`.
55
+
56
+ CM-Align's original embedder was `gte-multilingual-base`; LaBSE is used here because it is the
57
+ cross-lingual encoder used throughout this project.
58
+
59
+ ## Training details
60
+
61
+ | | |
62
+ |---|---|
63
+ | Base model | `Qwen/Qwen2.5-7B` |
64
+ | Data | 40,000 facts from [`jvonrad/WIKI-FACT`](https://huggingface.co/datasets/jvonrad/WIKI-FACT) (train) |
65
+ | Languages | 12 — en, de, id, pt, ar, bn, sw, es, ru, fr, ja, zh |
66
+ | Candidates / language | 4 (temperature 0.9, top-p 0.95) |
67
+ | Embedder | `sentence-transformers/LaBSE` |
68
+ | DPO beta | 0.1 |
69
+ | NLL gamma | 0.0 |
70
+ | Learning rate | 5e-6 |
71
+ | Epochs | 1 |
72
+ | Batch size | 4 x 4 grad-accum |
73
+ | Precision | bf16 |
74
+ | LoRA | r=64, alpha=128, dropout=0.05, on q/k/v/o/gate/up/down projections |
75
+ | Reference model | same model, adapter disabled (`disable_adapter()`) |
76
+
77
+ ## Evaluation
78
+
79
+ Answers are scored by length-normalised log-likelihood over the four options, with the plain
80
+ prompt `Question: {question}\nAnswer:`. Metrics beyond accuracy:
81
+
82
+ - **TotCons** (Total Consistency) — fraction of facts answered correctly in *all* languages.
83
+ - **RankC** — cross-lingual agreement between full option rankings (Qi et al., EMNLP 2023).
84
+ - **AnsAgr** — pairwise answer agreement across language pairs.
85
+
86
+ **PolyFact test** (2,523 facts, 12 languages):
87
+
88
+ | Model | Acc | TotCons | RankC | AnsAgr |
89
+ |---|---|---|---|---|
90
+ | Qwen-2.5-7B (base) | 61.89 | 7.09 | 61.66 | 55.48 |
91
+ | **Qwen-2.5-7B CM-Align** | **64.82** | **10.07** | **64.03** | **58.65** |
92
+
93
+ **Global-MMLU-Lite** (400 facts, 11 languages — Lite has no Russian config):
94
+
95
+ | Model | Acc | TotCons | RankC | AnsAgr |
96
+ |---|---|---|---|---|
97
+ | Qwen-2.5-7B (base) | **63.20** | **13.50** | **69.70** | **64.49** |
98
+ | **Qwen-2.5-7B CM-Align** | 62.07 | 11.00 | 69.52 | 64.17 |
99
+
100
+ Per-language accuracy on PolyFact test:
101
+
102
+ | en | de | id | pt | ar | bn | sw | es | ru | fr | ja | zh |
103
+ |---|---|---|---|---|---|---|---|---|---|---|---|
104
+ | 77.1 | 70.5 | 71.3 | 71.9 | 54.9 | 50.7 | 48.1 | 71.3 | 61.2 | 71.2 | 63.6 | 66.0 |
105
+
106
+ ### Reading these numbers
107
+
108
+ CM-Align gives consistent **in-domain** gains over the base model on PolyFact (all four metrics,
109
+ e.g. Total Consistency 7.09 -> 10.07). **Out of domain** on Global-MMLU-Lite it does not
110
+ transfer: every metric is flat or slightly below base. This model is published as a
111
+ **baseline for comparison**, not as a recommended general-purpose checkpoint.
112
+
113
+ ## Usage
114
+
115
+ ```python
116
+ from transformers import AutoModelForCausalLM, AutoTokenizer
117
+
118
+ model_id = "jvonrad/Qwen-2.5-CM-Align"
119
+ tok = AutoTokenizer.from_pretrained(model_id)
120
+ model = AutoModelForCausalLM.from_pretrained(model_id, dtype="bfloat16", device_map="auto")
121
+
122
+ prompt = "Question: What is the capital of Poland?\nAnswer:"
123
+ out = model.generate(**tok(prompt, return_tensors="pt").to(model.device), max_new_tokens=16)
124
+ print(tok.decode(out[0], skip_special_tokens=True))
125
+ ```
126
+
127
+ This is a **base (non-instruct) model**. Use plain completion-style prompts such as the
128
+ `Question: ... \nAnswer:` form above rather than chat formatting.
129
+
130
+ ## Limitations
131
+
132
+ - Trained only on Wikidata-derived factual QA in 12 languages; it is not a general instruction-following model.
133
+ - Preference pairs are built from the model's own samples via embedding similarity, so they
134
+ inherit LaBSE's similarity biases and can reward fluent-but-wrong answers.
135
+ - Improved cross-lingual consistency can make *incorrect* factual associations more uniform
136
+ across languages as well as correct ones.
137
+ - Evaluation is multiple-choice log-likelihood scoring; it does not measure free-form generation quality.
138
+
139
+ ## Citation
140
+
141
+ The CM-Align method this baseline implements:
142
+
143
+ ```bibtex
144
+ @inproceedings{zhang2025cmalign,
145
+ title = {CM-Align: Consistency-based Multilingual Alignment for Large Language Models},
146
+ author = {Zhang, Xue and others},
147
+ booktitle = {Findings of EMNLP},
148
+ year = {2025}
149
+ }
150
+ ```
151
+
152
+ The RankC consistency metric used above:
153
+
154
+ ```bibtex
155
+ @inproceedings{qi2023crosslingual,
156
+ title = {Cross-Lingual Consistency of Factual Knowledge in Multilingual Language Models},
157
+ author = {Qi, Jirui and Fern{\'a}ndez, Raquel and Bisazza, Arianna},
158
+ booktitle = {EMNLP},
159
+ year = {2023}
160
+ }
161
+ ```