Prosho commited on
Commit
8e64364
·
verified ·
1 Parent(s): 472210a

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +191 -8
README.md CHANGED
@@ -1,14 +1,197 @@
1
  ---
2
- pipeline_tag: translation
3
- language: multilingual
4
- library_name: pear
5
- base_model:
6
- - microsoft/infoxlm-large
7
  license: apache-2.0
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  ---
9
 
10
- # PEAR
11
 
12
- PEAR is a neural machine translation evaluation metric based on pairwise quality estimation.
13
 
14
- This repository contains the PEAR checkpoint for use with the `pear` Python package.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ language:
3
+ - multilingual
 
 
 
4
  license: apache-2.0
5
+ library_name: pytorch
6
+ tags:
7
+ - machine-translation
8
+ - mt-evaluation
9
+ - quality-estimation
10
+ - reference-free
11
+ - pairwise-ranking
12
+ - mbr
13
+ - pear
14
+ metrics:
15
+ - pear
16
+ base_model: microsoft/infoxlm-large
17
+ pipeline_tag: text-classification
18
  ---
19
 
20
+ <div align="center">
21
 
22
+ # 🍐 PEAR: Pairwise Evaluation for Automatic Relative Scoring in Machine Translation
23
 
24
+ [![ACL 2026](https://img.shields.io/badge/ACL-2026-2f6fdd)](https://2026.aclweb.org/)
25
+ [![ACL Anthology](https://img.shields.io/badge/ACL%20Anthology-PEAR-b31b1b)](https://aclanthology.org/2026.acl-long.1953/)
26
+ [![GitHub](https://img.shields.io/badge/GitHub-pairwise--metric-181717?logo=github)](https://github.com/prosho-97/pairwise-metric)
27
+ [![Collection](https://img.shields.io/badge/%F0%9F%A4%97%20HF-PEAR%20collection-ffcc4d)](https://huggingface.co/collections/Prosho/pear)
28
+ [![License](https://img.shields.io/badge/License-Apache%202.0-green)](https://www.apache.org/licenses/LICENSE-2.0)
29
+
30
+ </div>
31
+
32
+ **PEAR** is the compact released PEAR checkpoint for pairwise, reference-free machine translation (MT) evaluation. Given a source segment and two candidate translations, PEAR predicts the **direction** and **magnitude** of their relative quality difference.
33
+
34
+ This model card is for [`Prosho/pear`](https://huggingface.co/Prosho/pear), the standard PEAR model in the [PEAR Hugging Face collection](https://huggingface.co/collections/Prosho/pear).
35
+
36
+ ## Model summary
37
+
38
+ | Field | Value |
39
+ | --- | --- |
40
+ | Model | `Prosho/pear` |
41
+ | Family | PEAR pairwise QE metric |
42
+ | Intended use | Reference-free MT evaluation, reference-anchored scoring, PEAR-based MBR decoding |
43
+ | Backbone | `microsoft/infoxlm-large` |
44
+ | Head | Antisymmetric pairwise regression head |
45
+ | Output | Positive score means the first candidate is preferred over the second |
46
+ | License | Apache-2.0 |
47
+
48
+ ## Installation
49
+
50
+ Install the PEAR inference toolkit from the GitHub repository:
51
+
52
+ ```bash
53
+ git clone https://github.com/prosho-97/pairwise-metric.git
54
+ cd pairwise-metric
55
+ pip install .
56
+ ```
57
+
58
+ For development utilities such as Black:
59
+
60
+ ```bash
61
+ pip install -e ".[dev]"
62
+ ```
63
+
64
+ ## Quick start: pairwise QE scoring
65
+
66
+ ```python
67
+ import pear
68
+
69
+ metric = pear.load_metric("pear") # resolves to Prosho/pear
70
+
71
+ scores = pear.score_pairwise(
72
+ metric,
73
+ sources=["The cat is on the mat."],
74
+ translations_a=["El gato está en la alfombra."],
75
+ translations_b=["El gato está en el mapa."],
76
+ batch_size=16,
77
+ gpus="auto",
78
+ progress_bar=True,
79
+ )
80
+
81
+ print(scores)
82
+ ```
83
+
84
+ Positive scores prefer `translations_a`; negative scores prefer `translations_b`.
85
+
86
+ To score both candidate orders:
87
+
88
+ ```python
89
+ scores = pear.score_pairwise(
90
+ metric,
91
+ sources=["The cat is on the mat."],
92
+ translations_a=["El gato está en la alfombra."],
93
+ translations_b=["El gato está en el mapa."],
94
+ mode="both",
95
+ )
96
+ # {"forward": [...], "reverse": [...]}
97
+ ```
98
+
99
+ ## Reference-anchored PEAR
100
+
101
+ PEAR can also be used with a human reference, or any other anchor translation, as the second candidate:
102
+
103
+ ```python
104
+ scores = pear.score_reference_anchored(
105
+ metric,
106
+ sources=["The cat is on the mat."],
107
+ translations=["El gato está en la alfombra."],
108
+ references=["El gato está sobre la alfombra."],
109
+ batch_size=16,
110
+ )
111
+ ```
112
+
113
+ As in pairwise scoring, `mode="both"` is available for both-order reference-anchored inference.
114
+
115
+ ## PEAR for MBR decoding
116
+
117
+ ```python
118
+ from pear.mbr import pear_utility_matrix, select_mbr_hypothesis
119
+
120
+ metric = pear.load_metric("pear")
121
+ source = "Questa è una traduzione molto buona."
122
+ hypotheses = [
123
+ "This is a good translation.",
124
+ "This is a very good translation.",
125
+ "This is a bad translation.",
126
+ ]
127
+
128
+ utility = pear_utility_matrix(metric, source, hypotheses, mode="half", batch_size=16)
129
+ index, expected_utility = select_mbr_hypothesis(utility)
130
+ print(hypotheses[index], expected_utility)
131
+ ```
132
+
133
+ Use `mode="full"` for all off-diagonal ordered pairs, or `mode="half"` to score only one triangular half and fill the opposite direction by PEAR antisymmetry.
134
+
135
+ ## CLI examples
136
+
137
+ Pairwise TSV input must contain `src`, `mt_0`, and `mt_1` columns:
138
+
139
+ ```bash
140
+ pear score --model pear --input pairs.tsv --output scored.tsv --batch-size 16
141
+ pear score --hf-model Prosho/pear --input pairs.tsv --output scored.tsv --batch-size 16
142
+ ```
143
+
144
+ Reference-anchored TSV input must contain `src`, `mt`, and `ref` columns:
145
+
146
+ ```bash
147
+ pear score --model pear --mode reference --input refs.tsv --output scored.tsv --batch-size 16
148
+ ```
149
+
150
+ MBR input JSONL rows must contain `src` and `hypotheses`:
151
+
152
+ ```bash
153
+ pear mbr --model pear --input nbest.jsonl --output selected.jsonl --utility half --batch-size 16
154
+ ```
155
+
156
+ ## Intended use and limitations
157
+
158
+ PEAR is intended for research and practical MT evaluation workflows where pairwise relative quality estimates are useful. It is especially suitable for:
159
+
160
+ - pairwise reference-free QE-style MT evaluation;
161
+ - reference-anchored relative scoring;
162
+ - MBR decoding utilities where pairwise candidate comparisons are natural.
163
+
164
+ The model is not a general-purpose text quality model. Scores are relative to the two supplied candidates and should be interpreted as pairwise preferences, not standalone absolute quality judgments.
165
+
166
+ ## Citation
167
+
168
+ If you use this model, please cite the PEAR paper:
169
+
170
+ ```bibtex
171
+ @inproceedings{proietti-etal-2026-pear,
172
+ title = "{PEAR}: Pairwise Evaluation for Automatic Relative Scoring in Machine Translation",
173
+ author = "Proietti, Lorenzo and
174
+ Grundkiewicz, Roman and
175
+ Post, Matt",
176
+ editor = "Liakata, Maria and
177
+ Moreira, Viviane P. and
178
+ Zhang, Jiajun and
179
+ Jurgens, David",
180
+ booktitle = "Proceedings of the 64th Annual Meeting of the {A}ssociation for {C}omputational {L}inguistics (Volume 1: Long Papers)",
181
+ month = jul,
182
+ year = "2026",
183
+ address = "San Diego, California, United States",
184
+ publisher = "Association for Computational Linguistics",
185
+ url = "https://aclanthology.org/2026.acl-long.1953/",
186
+ doi = "10.18653/v1/2026.acl-long.1953",
187
+ pages = "42189--42207",
188
+ ISBN = "979-8-89176-390-6"
189
+ }
190
+ ```
191
+
192
+ ## Links
193
+
194
+ - Paper: <https://aclanthology.org/2026.acl-long.1953/>
195
+ - Code: <https://github.com/prosho-97/pairwise-metric>
196
+ - Collection: <https://huggingface.co/collections/Prosho/pear>
197
+ - PEAR-XL: <https://huggingface.co/Prosho/pear-xl>