{"id":21715236,"url":"https://github.com/fudannlp/irl_gen","last_synced_at":"2025-04-12T19:24:12.544Z","repository":{"id":78772399,"uuid":"159495344","full_name":"FudanNLP/Irl_gen","owner":"FudanNLP","description":"This is implementation of the paper 'Toward Diverse Text Generation with Inverse Reinforcement Learning' https://arxiv.org/abs/1804.11258 IJCAI2018","archived":false,"fork":false,"pushed_at":"2018-11-29T01:39:49.000Z","size":9250,"stargazers_count":33,"open_issues_count":3,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-26T13:45:35.023Z","etag":null,"topics":["inverse-reinforcement-learning","max-entropy","text-generation"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FudanNLP.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2018-11-28T12:01:29.000Z","updated_at":"2025-01-19T12:53:12.000Z","dependencies_parsed_at":"2023-07-21T07:32:34.537Z","dependency_job_id":null,"html_url":"https://github.com/FudanNLP/Irl_gen","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FudanNLP%2FIrl_gen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FudanNLP%2FIrl_gen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FudanNLP%2FIrl_gen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FudanNLP%2FIrl_gen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FudanNLP","download_url":"https://codeload.github.com/FudanNLP/Irl_gen/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248619504,"owners_count":21134465,"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","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":["inverse-reinforcement-learning","max-entropy","text-generation"],"created_at":"2024-11-26T00:41:47.030Z","updated_at":"2025-04-12T19:24:12.537Z","avatar_url":"https://github.com/FudanNLP.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Summary\n\nThis is implementation of the paper 'Toward Diverse Text Generation with Inverse Reinforcement Learning' https://arxiv.org/abs/1804.11258 IJCAI2018\n\n## Requirement\n\nPython \u003e=2.7.12\n\nTensorflow \u003e=1.2.0\n\nnltk == 3.2.5\n\n## Synthetic\n\n```bash\npython irl_generation.py\n```\n\nIn experiment, we add weight **x** to entropy term so that it can be used to adjust the balance of 'quality' and 'diversity' of generated texts. The training process of various **x** is stored in the 'synthetic/save' folder.\n\n![fig](fig.png)\n\n| x      | 0.0   | 0.02  | 0.04  | 0.06 | 0.08 | 0.085 |\n| :----- | ----- | ----- | ----- | ---- | ---- | ----- |\n| Result | 0.916 | 0.918 | 0.914 | 2.89 | 3.46 | 6.91  |\n\n| 0.09 | 0.095 | 0.1  | 0.11 | 0.12 | 0.14 | 0.16 |\n| ---- | ----- | ---- | ---- | ---- | ---- | ---- |\n| 4.78 | 7.36  | 8.38 | 7.76 | 8.24 | 8.03 | 8.26 |\n\n| 0.25 | 0.35 | 0.5  | 0.75 | 1.0  | 1.25 | Ground Truth | MLE  |\n| ---- | ---- | ---- | ---- | ---- | ---- | ------------ | ---- |\n| 8.69 | 8.86 | 9.01 | 9.06 | 9.12 | 9.20 | 5.75         | 9.03 |\n\n## Image COCO\n\n```bash\npython irl_coco.py\n```\n\nThe results are under 50 epochs pretrain and 50 epochs irl training. Smooth function is not used in calucating BLEU(Same with LeakGAN github repo).\n\n| x         | 0.35  | 0.45  | 0.55  | 0.65  | 0.75  |\n| --------- | ----- | ----- | ----- | ----- | ----- |\n| BLEU-2(f) | 0.924 | 0.889 | 0.901 | 0.830 | 0.827 |\n| BLEU-3(f) | 0.851 | 0.789 | 0.800 | 0.671 | 0.647 |\n| BLEU-4(f) | 0.772 | 0.690 | 0.710 | 0.573 | 0.556 |\n| BLEU-5(f) | 0.724 | 0.624 | 0.656 | 0.564 | 0.571 |\n| BLEU-2(b) | 0.813 | 0.851 | 0.846 | 0.881 | 0.883 |\n| BLEU-3(b) | 0.689 | 0.733 | 0.715 | 0.761 | 0.754 |\n| BLEU-4(b) | 0.614 | 0.657 | 0.632 | 0.667 | 0.652 |\n| BLEU-5(b) | 0.590 | 0.627 | 0.605 | 0.618 | 0.606 |\n\nwe also tested with BLEU and Self-BLEU (see TexyGen for details) results are listed here, use same smooth function calculating BLEU in TexyGen github repo:\n\n| x           | 0.35  | 0.45  | 0.55  | 0.65  | 0.75  |\n| ----------- | ----- | ----- | ----- | ----- | ----- |\n| BLEU-2      | 0.922 | 0.887 | 0.906 | 0.828 | 0.824 |\n| BLEU-3      | 0.844 | 0.780 | 0.802 | 0.653 | 0.627 |\n| BLEU-4      | 0.751 | 0.654 | 0.680 | 0.463 | 0.415 |\n| BLEU-5      | 0.645 | 0.513 | 0.559 | 0.308 | 0.256 |\n| Self-BLEU-2 | 0.936 | 0.899 | 0.892 | 0.829 | 0.831 |\n| Self-BLEU-3 | 0.881 | 0.797 | 0.802 | 0.641 | 0.621 |\n| Self-BLEU-4 | 0.829 | 0.701 | 0.716 | 0.464 | 0.408 |\n| Self-BLEU-5 | 0.781 | 0.609 | 0.646 | 0.325 | 0.263 |\n\nExamples of each weight are listed in imagecoco/speech.\n\nMany thanks to SeqGAN and LeakGAN authors, part of my codes are modified from their codes.\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffudannlp%2Firl_gen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffudannlp%2Firl_gen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffudannlp%2Firl_gen/lists"}