{"id":31211506,"url":"https://github.com/cyberagentailab/model-based-mbr","last_synced_at":"2025-09-21T05:30:13.464Z","repository":{"id":238662882,"uuid":"762628550","full_name":"CyberAgentAILab/model-based-mbr","owner":"CyberAgentAILab","description":"Code of \"Model-Based Minimum Bayes Risk Decoding for Text Generation\" 2024","archived":false,"fork":false,"pushed_at":"2024-08-15T05:01:46.000Z","size":157,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-10T07:42:50.575Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://proceedings.mlr.press/v235/jinnai24a.html","language":"Jupyter Notebook","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:35:06.000Z","updated_at":"2025-07-10T10:50:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"12d6aba0-cbe9-4140-98fc-e710e3588bec","html_url":"https://github.com/CyberAgentAILab/model-based-mbr","commit_stats":null,"previous_names":["cyberagentailab/model-based-mbr"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/CyberAgentAILab/model-based-mbr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CyberAgentAILab%2Fmodel-based-mbr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CyberAgentAILab%2Fmodel-based-mbr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CyberAgentAILab%2Fmodel-based-mbr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CyberAgentAILab%2Fmodel-based-mbr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CyberAgentAILab","download_url":"https://codeload.github.com/CyberAgentAILab/model-based-mbr/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CyberAgentAILab%2Fmodel-based-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.130Z","updated_at":"2025-09-21T05:30:13.449Z","avatar_url":"https://github.com/CyberAgentAILab.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Model-Based Minimum Bayes Risk Decoding\n\n\nThis repository contains the code for the experiments in [Model-Based Minimum Bayes Risk Decoding](https://proceedings.mlr.press/v235/jinnai24a.html).\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).\n\n## Installation\n\n```\ngit clone git@github.com/CyberAgentAILab/model-based-mbr\ncd model-based-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 and MBMBR outputs from the sampled candidates.\n\n### 1. Sampling candidates\n\n```\n./experiments/sample.sh -d [DATASET] -s [NUMBER OF SAMPLES] \n```\n\n### 2. Computing the MBR and MBMBR outputs\n\n```\n./experiments/run_mbr.sh -d [DATASET] -s [NUMBER OF SAMPLES]\n```\n\n\n## Example: 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. Sampling sequences on WMT'19 En-De\n\n```\n./experiments/sample.sh -d wmt19.en-de -s 32\n```\n\n3. Computing the MBR output on WMT'19 En-De\n\n```\n./experiments/run_mbr.sh -d wmt19.en-de -s 32\n```\n\n## mbrs Library\n\nMBMBR is also implemented in the [mbrs](https://github.com/naist-nlp/mbrs) library and is available via pypi: \n\n```pip install mbrs```\n\nThe mbrs library is maintained for running various versions of MBR decoding algorithms. It is compatible with both Huggingface's transformers and fairseq. \n\n## Reference\n\n[Jinnai, Y., Morimura, T., Honda, U., Ariu, K. \u0026amp; Abe, K.. (2024). Model-Based Minimum Bayes Risk Decoding for Text Generation. \u003ci\u003eProceedings of the 41st International Conference on Machine Learning\u003c/i\u003e, in \u003ci\u003eProceedings of Machine Learning Research\u003c/i\u003e.](https://proceedings.mlr.press/v235/jinnai24a.html)\n\nBibtex:\n```\n\n@InProceedings{pmlr-v235-jinnai24a,\n  title = \t {Model-Based Minimum {B}ayes Risk Decoding for Text Generation},\n  author =       {Jinnai, Yuu and Morimura, Tetsuro and Honda, Ukyo and Ariu, Kaito and Abe, Kenshi},\n  booktitle = \t {Proceedings of the 41st International Conference on Machine Learning},\n  pages = \t {22326--22347},\n  year = \t {2024},\n  editor = \t {Salakhutdinov, Ruslan and Kolter, Zico and Heller, Katherine and Weller, Adrian and Oliver, Nuria and Scarlett, Jonathan and Berkenkamp, Felix},\n  volume = \t {235},\n  series = \t {Proceedings of Machine Learning Research},\n  month = \t {21--27 Jul},\n  publisher =    {PMLR},\n  pdf = \t {https://raw.githubusercontent.com/mlresearch/v235/main/assets/jinnai24a/jinnai24a.pdf},\n  url = \t {https://proceedings.mlr.press/v235/jinnai24a.html},\n}\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## 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%2Fmodel-based-mbr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcyberagentailab%2Fmodel-based-mbr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcyberagentailab%2Fmodel-based-mbr/lists"}