{"id":31211509,"url":"https://github.com/cyberagentailab/diverse-mbr","last_synced_at":"2025-09-21T05:30:13.447Z","repository":{"id":230878224,"uuid":"762624774","full_name":"CyberAgentAILab/diverse-mbr","owner":"CyberAgentAILab","description":"Code of \"Generating Diverse and High-Quality Texts by Minimum Bayes Risk Decoding\" 2024","archived":false,"fork":false,"pushed_at":"2024-08-15T04:41:30.000Z","size":144,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-10T07:42:50.492Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://aclanthology.org/2024.findings-acl.503/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CyberAgentAILab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-02-24T08:20:14.000Z","updated_at":"2025-08-24T06:38:31.000Z","dependencies_parsed_at":"2024-08-15T05:51:21.986Z","dependency_job_id":null,"html_url":"https://github.com/CyberAgentAILab/diverse-mbr","commit_stats":null,"previous_names":["cyberagentailab/diverse-mbr"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/CyberAgentAILab/diverse-mbr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CyberAgentAILab%2Fdiverse-mbr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CyberAgentAILab%2Fdiverse-mbr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CyberAgentAILab%2Fdiverse-mbr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CyberAgentAILab%2Fdiverse-mbr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CyberAgentAILab","download_url":"https://codeload.github.com/CyberAgentAILab/diverse-mbr/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CyberAgentAILab%2Fdiverse-mbr/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276195627,"owners_count":25601152,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-21T02:00:07.055Z","response_time":72,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-09-21T05:30:12.280Z","updated_at":"2025-09-21T05:30:13.433Z","avatar_url":"https://github.com/CyberAgentAILab.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Diverse Minimum Bayes Risk Decoding\n\nThis repository contains the code for the experiments in [Generating Diverse and High-Quality Texts by Minimum Bayes Risk Decoding](https://aclanthology.org/2024.findings-acl.503/).\n\nThe code is tested on Ubuntu 20.04 using Python 3.8 and CUDA 11.0 (Docker image nvidia/cuda:11.0.3-cudnn8-devel-ubuntu20.04).\nThe code is provided mostly as is with little effort on refactoring.\n\n## Installation\n\n```\ngit clone git@github.com:CyberAgentAILab/diverse-mbr\ncd diverse-mbr\npip install -r requirements.txt\n```\n\n## Usage\n\nThe code runs in two steps.\n1. `sample.sh` samples candidates.\n2. `run_mbr.sh` computes the MBR candidate from the candidates sampled.\n\n### Sampling candidates\n\n```\n./experiments/sample.sh -d [DATASET] -s [NUMBER OF SAMPLES] \n```\n\n### Computing Diverse MBR and KMBR\n\n```\n./experiments/run_mbr.sh -d [DATASET] -s [NUMBER OF SAMPLES] -a [ALGORITHM]\n```\n\n### Example on WMT'19 En-De\n\n1. Use [sacrebleu](https://github.com/mjpost/sacrebleu) to prepare the benchmark dataset.\n```\nmkdir -p ./dataset/wmt19-text\nsacrebleu -t wmt19 -l en-de --echo src \u003e ./dataset/wmt19-text/wmt19.en-de.en\nsacrebleu -t wmt19 -l en-de --echo ref \u003e ./dataset/wmt19-text/wmt19.en-de.de\n```\n\n2. Sample candidates on WMT'19 En-De\n\n```\n./experiments/sample.sh -d wmt19.en-de\n```\n\n3. Computing Diverse MBR and K-Medoid MBR on WMT'19 En-De\n\n```\n./experiments/run_mbr.sh -d wmt19.en-de -m wmt19-en-de -a diverse\n```\n\n\n## Reference\n\n[Yuu Jinnai, Ukyo Honda, Tetsuro Morimura, and Peinan Zhang. 2024. Generating Diverse and High-Quality Texts by Minimum Bayes Risk Decoding. In Findings of the Association for Computational Linguistics ACL 2024, pages 8494–8525, Bangkok, Thailand and virtual meeting. Association for Computational Linguistics.](https://aclanthology.org/2024.findings-acl.503/)\n\nBibtex:\n```\n@inproceedings{jinnai-etal-2024-generating,\n    title = \"Generating Diverse and High-Quality Texts by Minimum {B}ayes Risk Decoding\",\n    author = \"Jinnai, Yuu  and\n      Honda, Ukyo  and\n      Morimura, Tetsuro  and\n      Zhang, Peinan\",\n    editor = \"Ku, Lun-Wei  and\n      Martins, Andre  and\n      Srikumar, Vivek\",\n    booktitle = \"Findings of the Association for Computational Linguistics ACL 2024\",\n    month = aug,\n    year = \"2024\",\n    address = \"Bangkok, Thailand and virtual meeting\",\n    publisher = \"Association for Computational Linguistics\",\n    url = \"https://aclanthology.org/2024.findings-acl.503\",\n    pages = \"8494--8525\",\n}\n```\n\n## Contact\nFor any questions, feel free to raise an issue or contact me at jinnai_yu@cyberagent.co.jp.\n\n\n## Acknowledgements\n\n[MS COCO dataset](https://cocodataset.org/#home) is licensed under a [Creative Commons BY 4.0](https://creativecommons.org/licenses/by/4.0/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcyberagentailab%2Fdiverse-mbr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcyberagentailab%2Fdiverse-mbr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcyberagentailab%2Fdiverse-mbr/lists"}