GEMBA — GPT Estimation Metric Based Assessment
Project description
GEMBA-MQM and GEMBA-DA
Setup
Install required packages with python >= 3.8 (tested with 3.12.7)
pip install -r requirements.txt
Set up secrets either for Azure API or OpenAI API:
export OPENAI_AZURE_ENDPOINT=
export OPENAI_AZURE_KEY=
or
export OPENAI_API_KEY=
Scoring with GEMBA
Install the gemba package with pip install gemba and use the following code:
from gemba import get_gemba_scores
source = ["Hello, how are you?", "I am fine, thank you.", "I am not fine, thank you."]
hypothesis = ["Hallo, wie geht es dir?", "Ich bin gut, danke.", "Ich bin Joel, wer bist du?"]
source_lang = "en"
target_lang = "de"
answers, errors = get_gemba_scores(source, hypothesis, source_lang, target_lang, method="GEMBA-MQM_norm", model="gpt-4o")
for answer, error in zip(answers, errors):
print(answer, error)
Alternatively, you can run the main file on two text files. It assumes two files with the same number of lines. It prints the score for each line pair:
python main.py --source=source.txt --hypothesis=hypothesis.txt --source_lang=English --target_lang=Czech --method="GEMBA-MQM" --model="gpt-4"
The main recommended methods: GEMBA-MQM and GEMBA-DA with the model gpt-4.
Collecting and evaluating experiments for GEMBA-DA
Get mt-metric-eval and download resources:
git clone https://github.com/google-research/mt-metrics-eval.git
cd mt-metrics-eval
pip install .
alias mtme='python3 -m mt_metrics_eval.mtme'
mtme --download
cd ..
mv ~/.mt-metrics-eval/mt-metrics-eval-v2 mt-metrics-eval-v2
Collect data and run the scorer
python gemba_da.py
export PYTHONPATH=mt-metrics-eval:$PYTHONPATH
python evaluate.py
License
GEMBA code and data are released under the CC BY-SA 4.0 license.
Paper
You can read more about GEMBA-DA in our arXiv paper or GEMBA-MQM in our arXiv paper.
How to Cite
GEMBA-MQM
@inproceedings{kocmi-federmann-2023-gemba-mqm,
title = {GEMBA-MQM: Detecting Translation Quality Error Spans with GPT-4},
author = {Kocmi, Tom and Federmann, Christian},
booktitle = "Proceedings of the Eighth Conference on Machine Translation",
month = dec,
year = "2023",
address = "Singapore",
publisher = "Association for Computational Linguistics",
}
GEMBA-DA
@inproceedings{kocmi-federmann-2023-large,
title = "Large Language Models Are State-of-the-Art Evaluators of Translation Quality",
author = "Kocmi, Tom and Federmann, Christian",
booktitle = "Proceedings of the 24th Annual Conference of the European Association for Machine Translation",
month = jun,
year = "2023",
address = "Tampere, Finland",
publisher = "European Association for Machine Translation",
url = "https://aclanthology.org/2023.eamt-1.19",
pages = "193--203",
}
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gemba-0.1.3.tar.gz.
File metadata
- Download URL: gemba-0.1.3.tar.gz
- Upload date:
- Size: 2.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0618995163be0c1cfe8afd9d27b8c29cf9ceb2b50e90b96f37d607a4425d0431
|
|
| MD5 |
ca6b735579bee8783836514ec2e0ef34
|
|
| BLAKE2b-256 |
b31c405218389a6387a1a31dfe3fe85c351c3dfda5362a8adca846a9a47b9806
|
File details
Details for the file gemba-0.1.3-py3-none-any.whl.
File metadata
- Download URL: gemba-0.1.3-py3-none-any.whl
- Upload date:
- Size: 25.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
036e9cb6439c7b8e7b3bbbc856a9c0f313792428d978f8b2ad55d870667f0c76
|
|
| MD5 |
b9a5ca265c6a4b0708f8bc987c6b4375
|
|
| BLAKE2b-256 |
cbbdf1ba35b40b8509582fe53af57d54f1005ca560327f72867208775d32f29a
|