{"id":20298113,"url":"https://github.com/ahans30/goldfish-loss","last_synced_at":"2025-05-07T20:34:21.526Z","repository":{"id":244727339,"uuid":"816080006","full_name":"ahans30/goldfish-loss","owner":"ahans30","description":"[NeurIPS 2024] Goldfish Loss: Mitigating Memorization in Generative LLMs","archived":false,"fork":false,"pushed_at":"2024-11-17T02:39:14.000Z","size":1420,"stargazers_count":74,"open_issues_count":0,"forks_count":5,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-11-17T03:25:43.641Z","etag":null,"topics":["deep-learning","memorization","transformer"],"latest_commit_sha":null,"homepage":"https://arxiv.org/abs/2406.10209","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ahans30.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}},"created_at":"2024-06-17T01:57:23.000Z","updated_at":"2024-11-17T02:39:18.000Z","dependencies_parsed_at":"2024-06-17T03:23:30.005Z","dependency_job_id":"6dbb3f1f-8fe2-44c9-af33-22d1d5d8b6ff","html_url":"https://github.com/ahans30/goldfish-loss","commit_stats":null,"previous_names":["ahans30/goldfish-loss"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahans30%2Fgoldfish-loss","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahans30%2Fgoldfish-loss/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahans30%2Fgoldfish-loss/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahans30%2Fgoldfish-loss/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ahans30","download_url":"https://codeload.github.com/ahans30/goldfish-loss/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252953717,"owners_count":21830890,"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":["deep-learning","memorization","transformer"],"created_at":"2024-11-14T16:02:11.418Z","updated_at":"2025-05-07T20:34:21.513Z","avatar_url":"https://github.com/ahans30.png","language":"Python","funding_links":[],"categories":["A01_文本生成_文本对话"],"sub_categories":["大语言对话模型及数据"],"readme":"\n# Goldfish Loss: Mitigating Memorization in Generative LLMs [[paper]](https://arxiv.org/abs/2406.10209)[[checkpoints]](https://huggingface.co/collections/tomg-group-umd/goldfish-loss-mitigating-memorization-in-llms-66c175becb6aab07744f7272)\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"assets/goldfish-loss.jpg\" width=\"200\" height=\"200\" alt=\"A very smart goldfish\"\u003e\n\u003c/p\u003e\n\n\n#### We introduce goldfish loss — a strikingly simple technique to mitigating extractable memorization in large language models.\n\n## Getting Started\n\nThis codebase is setup to (pre)train large language models in a distributed training setup using SLURM. This repo is written and tested on AMD compute-nodes and is a fork of Lightning AI's [LitGPT repository](https://github.com/Lightning-AI/litgpt).\n\nFor implementation of goldfish loss, please checkout [`apply_goldfish`](https://github.com/ahans30/goldfish-loss/blob/70bfad87dcf69da2921bcad08e662925ab2ab60b/lit_gpt/utils.py#L241) method in `lit_gpt/utils.py`.\n\n### Installation\nBefore running below command, checkout the script and setup path variables specific to your compute instance (e.g. `INSTALLDIR`).\n\n```bash\n$ bash install.sh\n```\n\nThis will take some time, but will create a folder called `goldfish_loss` and a folder called `tiny_plugins_rccl` in the installation directory (which is `$HOME` by default). The conda folder contains a fully functional conda environment containing all neccessary packages to run our training scripts. The RCCL folder contains code for the interconnect plugin that is crucial for multi-node jobs. You can enable this environment by using `source activate ${INSTALLDIR}/\u003cPATH-TO-ENV_NAME\u003e`.\n\nPlease note, this installation is specific for AMD's compute nodes and is written as such.\n\n\n## Usage\n\nBelow command will invocate a python script that will inturn queue a SLURM job specific to frontier cluster used for this work. You can use `--dryrun` to retrieve the `sbatch` script that can be tuned for other clusters.\n\n```bash\n$ launch_scripts/launch_jobs_1b_hashtable.sh\n```\n\nYou can find the training config in `launch_scripts/config/` in yaml format.\n\n\n## Contributing\n\nThis is WIP repo and we are working on porting all experiments from the paper.\n\nWe believe in open source community development. Feel free to add things, open issues, start pull requests, or reach out to us with any thoughts or questions.\n\n## Cite our work\n\nIf you find our work useful, please cite our paper:\n\n```bibtex\n@inproceedings{\n  hans2024goldfishloss,\n  title={Be like a Goldfish, Don't Memorize! Mitigating Memorization in Generative {LLM}s},\n  author={Abhimanyu Hans and John Kirchenbauer and Yuxin Wen and Neel Jain and Hamid Kazemi and Prajwal Singhania and Siddharth Singh and Gowthami Somepalli and Jonas Geiping and Abhinav Bhatele and Tom Goldstein},\n  booktitle={The Thirty-eighth Annual Conference on Neural Information Processing Systems},\n  year={2024},\n  url={https://openreview.net/forum?id=DylSyAfmWs}\n}\n```\n\n## Acknowledgements\n1. This codebase is developed as a collective effort from [tomg-group-umd](https://github.com/tomg-group-umd) members for LLM (pre)training and is fork of the [LitGPT codebase](https://github.com/Lightning-AI/litgpt).\n1. This code is tested on *frontier* resources of the Oak Ridge Leadership Computing Facility at the Oak Ridge National Laboratory which is supported by the Office of Science of the U.S. Department of Energy under Contract No. DE-AC05-00OR22725. This project is supported by the award for computer time was provided by the U.S. Department of Energy’s (DOE) Innovative and Novel Computational Impact on Theory and Experiment (INCITE) Program. Financial support was provided by the ONR MURI program and the AFOSR MURI program. Private support was provided by Capital One Bank, the Amazon Research Award program, and Open Philanthropy. Further support was provided by the National Science Foundation (IIS-2212182), and by the NSF TRAILS Institute (2229885).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahans30%2Fgoldfish-loss","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fahans30%2Fgoldfish-loss","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahans30%2Fgoldfish-loss/lists"}