[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-locuslab--open-unlearning":3,"tool-locuslab--open-unlearning":64},[4,17,27,35,43,56],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":16},3808,"stable-diffusion-webui","AUTOMATIC1111\u002Fstable-diffusion-webui","stable-diffusion-webui 是一个基于 Gradio 构建的网页版操作界面，旨在让用户能够轻松地在本地运行和使用强大的 Stable Diffusion 图像生成模型。它解决了原始模型依赖命令行、操作门槛高且功能分散的痛点，将复杂的 AI 绘图流程整合进一个直观易用的图形化平台。\n\n无论是希望快速上手的普通创作者、需要精细控制画面细节的设计师，还是想要深入探索模型潜力的开发者与研究人员，都能从中获益。其核心亮点在于极高的功能丰富度：不仅支持文生图、图生图、局部重绘（Inpainting）和外绘（Outpainting）等基础模式，还独创了注意力机制调整、提示词矩阵、负向提示词以及“高清修复”等高级功能。此外，它内置了 GFPGAN 和 CodeFormer 等人脸修复工具，支持多种神经网络放大算法，并允许用户通过插件系统无限扩展能力。即使是显存有限的设备，stable-diffusion-webui 也提供了相应的优化选项，让高质量的 AI 艺术创作变得触手可及。",162132,3,"2026-04-05T11:01:52",[13,14,15],"开发框架","图像","Agent","ready",{"id":18,"name":19,"github_repo":20,"description_zh":21,"stars":22,"difficulty_score":23,"last_commit_at":24,"category_tags":25,"status":16},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",140436,2,"2026-04-05T23:32:43",[13,15,26],"语言模型",{"id":28,"name":29,"github_repo":30,"description_zh":31,"stars":32,"difficulty_score":23,"last_commit_at":33,"category_tags":34,"status":16},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",107662,"2026-04-03T11:11:01",[13,14,15],{"id":36,"name":37,"github_repo":38,"description_zh":39,"stars":40,"difficulty_score":23,"last_commit_at":41,"category_tags":42,"status":16},3704,"NextChat","ChatGPTNextWeb\u002FNextChat","NextChat 是一款轻量且极速的 AI 助手，旨在为用户提供流畅、跨平台的大模型交互体验。它完美解决了用户在多设备间切换时难以保持对话连续性，以及面对众多 AI 模型不知如何统一管理的痛点。无论是日常办公、学习辅助还是创意激发，NextChat 都能让用户随时随地通过网页、iOS、Android、Windows、MacOS 或 Linux 端无缝接入智能服务。\n\n这款工具非常适合普通用户、学生、职场人士以及需要私有化部署的企业团队使用。对于开发者而言，它也提供了便捷的自托管方案，支持一键部署到 Vercel 或 Zeabur 等平台。\n\nNextChat 的核心亮点在于其广泛的模型兼容性，原生支持 Claude、DeepSeek、GPT-4 及 Gemini Pro 等主流大模型，让用户在一个界面即可自由切换不同 AI 能力。此外，它还率先支持 MCP（Model Context Protocol）协议，增强了上下文处理能力。针对企业用户，NextChat 提供专业版解决方案，具备品牌定制、细粒度权限控制、内部知识库整合及安全审计等功能，满足公司对数据隐私和个性化管理的高标准要求。",87618,"2026-04-05T07:20:52",[13,26],{"id":44,"name":45,"github_repo":46,"description_zh":47,"stars":48,"difficulty_score":23,"last_commit_at":49,"category_tags":50,"status":16},2268,"ML-For-Beginners","microsoft\u002FML-For-Beginners","ML-For-Beginners 是由微软推出的一套系统化机器学习入门课程，旨在帮助零基础用户轻松掌握经典机器学习知识。这套课程将学习路径规划为 12 周，包含 26 节精炼课程和 52 道配套测验，内容涵盖从基础概念到实际应用的完整流程，有效解决了初学者面对庞大知识体系时无从下手、缺乏结构化指导的痛点。\n\n无论是希望转型的开发者、需要补充算法背景的研究人员，还是对人工智能充满好奇的普通爱好者，都能从中受益。课程不仅提供了清晰的理论讲解，还强调动手实践，让用户在循序渐进中建立扎实的技能基础。其独特的亮点在于强大的多语言支持，通过自动化机制提供了包括简体中文在内的 50 多种语言版本，极大地降低了全球不同背景用户的学习门槛。此外，项目采用开源协作模式，社区活跃且内容持续更新，确保学习者能获取前沿且准确的技术资讯。如果你正寻找一条清晰、友好且专业的机器学习入门之路，ML-For-Beginners 将是理想的起点。",84991,"2026-04-05T10:45:23",[14,51,52,53,15,54,26,13,55],"数据工具","视频","插件","其他","音频",{"id":57,"name":58,"github_repo":59,"description_zh":60,"stars":61,"difficulty_score":10,"last_commit_at":62,"category_tags":63,"status":16},3128,"ragflow","infiniflow\u002Fragflow","RAGFlow 是一款领先的开源检索增强生成（RAG）引擎，旨在为大语言模型构建更精准、可靠的上下文层。它巧妙地将前沿的 RAG 技术与智能体（Agent）能力相结合，不仅支持从各类文档中高效提取知识，还能让模型基于这些知识进行逻辑推理和任务执行。\n\n在大模型应用中，幻觉问题和知识滞后是常见痛点。RAGFlow 通过深度解析复杂文档结构（如表格、图表及混合排版），显著提升了信息检索的准确度，从而有效减少模型“胡编乱造”的现象，确保回答既有据可依又具备时效性。其内置的智能体机制更进一步，使系统不仅能回答问题，还能自主规划步骤解决复杂问题。\n\n这款工具特别适合开发者、企业技术团队以及 AI 研究人员使用。无论是希望快速搭建私有知识库问答系统，还是致力于探索大模型在垂直领域落地的创新者，都能从中受益。RAGFlow 提供了可视化的工作流编排界面和灵活的 API 接口，既降低了非算法背景用户的上手门槛，也满足了专业开发者对系统深度定制的需求。作为基于 Apache 2.0 协议开源的项目，它正成为连接通用大模型与行业专有知识之间的重要桥梁。",77062,"2026-04-04T04:44:48",[15,14,13,26,54],{"id":65,"github_repo":66,"name":67,"description_en":68,"description_zh":69,"ai_summary_zh":70,"readme_en":71,"readme_zh":72,"quickstart_zh":73,"use_case_zh":74,"hero_image_url":75,"owner_login":76,"owner_name":77,"owner_avatar_url":78,"owner_bio":79,"owner_company":80,"owner_location":80,"owner_email":80,"owner_twitter":80,"owner_website":81,"owner_url":82,"languages":83,"stars":96,"forks":97,"last_commit_at":98,"license":99,"difficulty_score":10,"env_os":100,"env_gpu":101,"env_ram":100,"env_deps":102,"category_tags":112,"github_topics":113,"view_count":23,"oss_zip_url":80,"oss_zip_packed_at":80,"status":16,"created_at":125,"updated_at":126,"faqs":127,"releases":156},2410,"locuslab\u002Fopen-unlearning","open-unlearning","[NeurIPS D&B '25] The one-stop repository for LLM unlearning","open-unlearning 是一个专为大语言模型（LLM）“遗忘学习”研究打造的一站式开源框架。在 AI 模型需要移除特定敏感数据或版权内容时，如何评估“遗忘”效果是否彻底且不影响其他能力，一直是行业难题。open-unlearning 通过统一 TOFU、MUSE 和 WMDP 等主流评测基准，解决了以往方法分散、评估标准不一的痛点，让研究人员能更高效地验证不同遗忘算法的有效性。\n\n该工具主要面向 AI 研究人员和开发者，支持快速复现和对比 12 种以上的遗忘方法，涵盖 5 类数据集、10 多项评估指标以及 7 种以上的主流模型架构。其独特亮点在于高度的可扩展性：用户不仅能轻松集成新的算法与数据集，还能利用内置的元评估框架，在超过 450 个模型上进行大规模基准测试。此外，项目已整合 lm-evaluation-harness，支持 MMLU、GSM8K 等通用能力评估，确保模型在“遗忘”的同时保持整体智能水平。\n\n作为 NeurIPS D&B '25 收录的成果，open-unlearning 旨在促进社区协作，推动大模型安全与隐私保护技术的标准化发展。无论是探索新型遗忘策略，","open-unlearning 是一个专为大语言模型（LLM）“遗忘学习”研究打造的一站式开源框架。在 AI 模型需要移除特定敏感数据或版权内容时，如何评估“遗忘”效果是否彻底且不影响其他能力，一直是行业难题。open-unlearning 通过统一 TOFU、MUSE 和 WMDP 等主流评测基准，解决了以往方法分散、评估标准不一的痛点，让研究人员能更高效地验证不同遗忘算法的有效性。\n\n该工具主要面向 AI 研究人员和开发者，支持快速复现和对比 12 种以上的遗忘方法，涵盖 5 类数据集、10 多项评估指标以及 7 种以上的主流模型架构。其独特亮点在于高度的可扩展性：用户不仅能轻松集成新的算法与数据集，还能利用内置的元评估框架，在超过 450 个模型上进行大规模基准测试。此外，项目已整合 lm-evaluation-harness，支持 MMLU、GSM8K 等通用能力评估，确保模型在“遗忘”的同时保持整体智能水平。\n\n作为 NeurIPS D&B '25 收录的成果，open-unlearning 旨在促进社区协作，推动大模型安全与隐私保护技术的标准化发展。无论是探索新型遗忘策略，还是系统评估现有方案，它都为相关领域的创新提供了坚实可靠的基础设施。","\u003Cdiv align=\"center\">\n\n![*Open*Unlearning](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Flocuslab_open-unlearning_readme_81190f4e3db0.png)\n\n\u003Ch3>\u003Cstrong>An easily extensible framework unifying LLM unlearning evaluation benchmarks.\u003C\u002Fstrong>\u003C\u002Fh3>\n\n  \u003Cdiv style=\"display: flex; gap: 10px; justify-content: center; align-items: center;\">\n    \u003Ca href=\"https:\u002F\u002Farxiv.org\u002Fabs\u002F2506.12618\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FarXiv-Report-b31b1b?logo=arxiv&logoColor=white\" alt=\"arXiv Paper\"\u002F>\u003C\u002Fa>\n    \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flocuslab\u002Fopen-unlearning\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002Flocuslab\u002Fopen-unlearning?style=social\" alt=\"GitHub Repo stars\"\u002F>\u003C\u002Fa>\n    \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flocuslab\u002Fopen-unlearning\u002Factions\">\u003Cimg src=\"https:\u002F\u002Fgithub.com\u002Flocuslab\u002Fopen-unlearning\u002Factions\u002Fworkflows\u002Ftests.yml\u002Fbadge.svg\" alt=\"Build Status\"\u002F>\u003C\u002Fa>\n    \u003Ca href=\"https:\u002F\u002Fhuggingface.co\u002Fopen-unlearning\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002F%F0%9F%A4%97%20Hugging%20Face-Model-blue\" alt=\"HuggingFace 🤗\"\u002F>\u003C\u002Fa>\n    \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flocuslab\u002Fopen-unlearning\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Frepo-size\u002Flocuslab\u002Fopen-unlearning\" alt=\"GitHub repo size\"\u002F>\u003C\u002Fa>\n    \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flocuslab\u002Fopen-unlearning\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Flanguages\u002Ftop\u002Flocuslab\u002Fopen-unlearning\" alt=\"GitHub top language\"\u002F>\u003C\u002Fa>\n    \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flocuslab\u002Fopen-unlearning\u002Fblob\u002Fmain\u002FLICENSE\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLicense-MIT-blue\" alt=\"License: MIT\"\u002F>\u003C\u002Fa>\n  \u003C\u002Fdiv>\n\u003C\u002Fdiv>\n\n---\n\n## 📖 Overview\n\nWe provide efficient and streamlined implementations of the TOFU, MUSE and WMDP unlearning benchmarks while supporting 12+ unlearning methods, 5+ datasets, 10+ evaluation metrics, and 7+ LLM architectures. Each of these can be easily extended to incorporate more variants.\n\n\nWe invite the LLM unlearning community to collaborate by adding new benchmarks, unlearning methods, datasets and evaluation metrics here to expand OpenUnlearning's features, gain feedback from wider usage and drive progress in the field.\n\n---\n\n> 📝 If you've found this repository or the models we've provided in [HuggingFace](https:\u002F\u002Fhuggingface.co\u002Fopen-unlearning) useful, please cite our [technical report](https:\u002F\u002Farxiv.org\u002Fabs\u002F2506.12618) (bibtex at [*Citing this work*](#-citing-this-work)).\n\n---\n\n### 📢 Updates\n\n### [June 20, 2025]\n\n🚨 Our paper `OpenUnlearning: Accelerating LLM Unlearning via Unified Benchmarking of Methods and Metrics` is now out on [arXiv](https:\u002F\u002Farxiv.org\u002Fabs\u002F2506.12618).\n\n🌟 **Highlights:**\n- A detailed technical report on OpenUnlearning covering the design, features, and implementation.\n- A meta-evaluation framework for benchmarking unlearning evaluations across 450+ models, open-sourced on HuggingFace 🤗: [TOFU Models w & w\u002Fo Knowledge](https:\u002F\u002Fhuggingface.co\u002Fcollections\u002Fopen-unlearning\u002Ftofu-models-w-and-w-o-knowledge-6861e4d935eb99ba162e55cd), [TOFU Unlearned Models](https:\u002F\u002Fhuggingface.co\u002Fcollections\u002Fopen-unlearning\u002Ftofu-unlearned-models-6860f6cf3fe35d0223d92e88).\n- Results benchmarking 8 diverse unlearning methods in one place using 10 evaluation metrics on TOFU.\n\n\u003Cdetails>\n\u003Csummary>\u003Cb>Older Updates\u003C\u002Fb>\u003C\u002Fsummary>\n\n\n#### [May 19, 2025]\n\n- **More Methods!** Added support for unlearning methods [UNDIAL](https:\u002F\u002Faclanthology.org\u002F2025.naacl-long.444\u002F) and [AltPO](https:\u002F\u002Faclanthology.org\u002F2025.coling-main.252\u002F).\n\n#### [May 12, 2025]\n\n- **Another benchmark!** We now support running the [`WMDP`](https:\u002F\u002Fwmdp.ai\u002F) benchmark with its `Zephyr` task model.\n- **More evaluations!**  The [`lm-evaluation-harness`](https:\u002F\u002Fgithub.com\u002FEleutherAI\u002Flm-evaluation-harness) toolkit has been integrated into OpenUnlearning, enabling WMDP evaluations and support for popular general LLM benchmarks, including MMLU, GSM8K, and others.\n\n#### [Apr 6, 2025]\n- **More Metrics!** Added 6 Membership Inference Attacks (MIA) (LOSS, ZLib, Reference, GradNorm, MinK, and MinK++), along with Extraction Strength (ES) and  Exact Memorization (EM) as additional evaluation metrics.\n- **More TOFU Evaluations!** Now includes a holdout set and supports MIA attack-based evaluation. You can now compute MUSE's privleak on TOFU.\n- **More Documentation!** [`docs\u002Flinks.md`](docs\u002Flinks.md) contains resources for each of the implemented features and other useful LLM unlearning resources.\n\nBe sure to run `python setup_data.py` immediately after merging the latest version. This is required to refresh the downloaded eval log files and ensure they're compatible with the latest evaluation metrics.\n\n#### [Mar 27, 2025]\n- **More Documentation: easy contributions and the leaderboard functionality**: We've updated the documentation to make contributing new unlearning methods and benchmarks much easier. Users can document additions better and also update a leaderboard with their results. See [this section](#-how-to-contribute) for details.\n\n#### [Mar 9, 2025]\n- **More Methods!** Added support for [RMU](https:\u002F\u002Farxiv.org\u002Fabs\u002F2403.03218) (representation-engineering based unlearning).\n\n#### [Feb 27, 2025]  \n⚠️ **Repository Update**: This repo replaces the original TOFU codebase at [`github.com\u002Flocuslab\u002Ftofu`](https:\u002F\u002Fgithub.com\u002Flocuslab\u002Ftofu), which is no longer maintained.\n\n\u003C\u002Fdetails>\n\n---\n\n## 🗃️ Available Components\n\nWe provide several variants for each of the components in the unlearning pipeline.\n\n| **Component**          | **Available Options** |\n|------------------------|----------------------|\n| **Benchmarks**        | [TOFU](https:\u002F\u002Farxiv.org\u002Fabs\u002F2401.06121), [MUSE](https:\u002F\u002Fmuse-bench.github.io\u002F), [WMDP](https:\u002F\u002Fwww.wmdp.ai\u002F) |\n| **Unlearning Methods** | GradAscent, GradDiff, NPO, SimNPO, DPO, RMU, UNDIAL, AltPO, SatImp, WGA, CE-U, PDU |\n| **Evaluation Metrics** | Verbatim Probability, Verbatim ROUGE, Knowledge QA-ROUGE, Model Utility, Forget Quality, TruthRatio, Extraction Strength, Exact Memorization, 6 MIA attacks, [lm-evaluation-harness](https:\u002F\u002Fgithub.com\u002FEleutherAI\u002Flm-evaluation-harness) |\n| **Datasets**          | MUSE-News (BBC), MUSE-Books (Harry Potter), TOFU (different splits), WMDP-Bio, WMDP-Cyber |\n| **Model Families**    | TOFU: Llama-3.2, Llama-3.1, Llama-2; MUSE: Llama-2; Additional: Phi-3.5, Phi-1.5, Gemma, Zephyr |\n\n---\n\n\n## 📌 Table of Contents\n- 📖 [Overview](#-overview)\n- 📢 [Updates](#-updates)\n- 🗃️ [Available Components](#%EF%B8%8F-available-components)\n- ⚡ [Quickstart](#-quickstart)\n- 🔄 [Updated TOFU benchmark](#-updated-tofu-benchmark)\n- 🧪 [Running Experiments](#-running-experiments)\n  - 🚀 [Perform Unlearning](#-perform-unlearning)\n  - 📊 [Perform an Evaluation](#-perform-an-evaluation)\n  - 📜 [Running Baseline Experiments](#-running-baseline-experiments)\n- ➕ [How to Contribute](#-how-to-contribute)\n- 📚 [Further Documentation](#-further-documentation)\n- 🔗 [Support & Contributors](#-support--contributors)\n- 📝 [Citing this work](#-citing-this-work)\n- 🤝 [Acknowledgements](#-acknowledgements)\n- 📄 [License](#-license)\n\n---\n\n## ⚡ Quickstart\n\n```bash\n# Environment setup\nconda create -n unlearning python=3.11\nconda activate unlearning\npip install \".[lm-eval]\"\npip install --no-build-isolation flash-attn==2.6.3\n\n# Data setup\npython setup_data.py --eval # saves\u002Feval now contains evaluation results of the uploaded models\n# This downloads log files with evaluation results (including retain model logs)\n# into `saves\u002Feval`, used for evaluating unlearning across supported benchmarks.\n# Additional datasets (e.g., WMDP) are supported — run below for options:\n# python setup_data.py --help\n```\n\n---\n\n### 🔄 Updated TOFU benchmark\n\nWe've updated Open-Unlearning's TOFU benchmark target models to use a wider variety of newer architectures with sizes varying from 1B to 8B. These include Llama 3.2 1B, Llama 3.2 3B, Llama 3.1 8B, and the original Llama-2 7B (re-created) target models from [the old version of TOFU](github.com\u002Flocuslab\u002Ftofu). \n\nFor each architecture, we have finetuned with four different splits of the TOFU datasets: `full`, `retain90`, `retain95`, `retain99`, for a total of 16 finetuned models. The first serves as the target (base model for unlearning) and the rest are retain models used to measure performance against for each forget split. These models are on [HuggingFace](`https:\u002F\u002Fhuggingface.co\u002Fcollections\u002Fopen-unlearning\u002Ftofu-new-models-67bcf636334ea81727573a9f0`) and the paths to these models can be set in the experimental configs or in command-line overrides.\n\n---\n\n## 🧪 Running Experiments\n\nWe provide an easily configurable interface for running evaluations by leveraging Hydra configs. For a more detailed documentation of aspects like running experiments, commonly overriden arguments, interfacing with configurations, distributed training and simple finetuning of models, refer [`docs\u002Fexperiments.md`](docs\u002Fexperiments.md).\n\n### 🚀 Perform Unlearning\n\nAn example command for launching an unlearning process with `GradAscent` on the TOFU `forget10` split:\n\n```bash\npython src\u002Ftrain.py --config-name=unlearn.yaml experiment=unlearn\u002Ftofu\u002Fdefault \\\n  forget_split=forget10 retain_split=retain90 trainer=GradAscent task_name=SAMPLE_UNLEARN\n```\n\n- `experiment`- Path to the Hydra config file [`configs\u002Fexperiment\u002Funlearn\u002Ftofu\u002Fdefault.yaml`](configs\u002Fexperiment\u002Funlearn\u002Ftofu\u002Fdefault.yaml) with default experimental settings for TOFU unlearning, e.g. train dataset, eval benchmark details, model paths etc..\n- `forget_split\u002Fretain_split`- Sets the forget and retain dataset splits.\n- `trainer`- Load [`configs\u002Ftrainer\u002FGradAscent.yaml`](configs\u002Ftrainer\u002FGradAscent.yaml) and override the unlearning method with the handler (see config) implemented in [`src\u002Ftrainer\u002Funlearn\u002Fgrad_ascent.py`](src\u002Ftrainer\u002Funlearn\u002Fgrad_ascent.py).\n\n### 📊 Perform an Evaluation\n\nAn example command for launching a TOFU evaluation process on `forget10` split:\n\n```bash\nmodel=Llama-3.2-1B-Instruct\npython src\u002Feval.py --config-name=eval.yaml experiment=eval\u002Ftofu\u002Fdefault \\\n  model=${model} \\\n  model.model_args.pretrained_model_name_or_path=open-unlearning\u002Ftofu_${model}_full \\\n  retain_logs_path=saves\u002Feval\u002Ftofu_${model}_retain90\u002FTOFU_EVAL.json \\\n  task_name=SAMPLE_EVAL\n```\n\n- `experiment`- Path to the evaluation configuration [`configs\u002Fexperiment\u002Feval\u002Ftofu\u002Fdefault.yaml`](configs\u002Fexperiment\u002Feval\u002Ftofu\u002Fdefault.yaml).\n- `model`- Sets up the model and tokenizer configs for the `Llama-3.2-1B-Instruct` model.\n- `model.model_args.pretrained_model_name_or_path`- Overrides the default experiment config to evaluate a model from a HuggingFace ID (can use a local model checkpoint path as well).\n- `retain_logs_path`- Sets the path to the reference model eval logs that is needed to compute reference model based metrics like `forget_quality` in TOFU.\n\nFor more details about creating and running evaluations, refer [`docs\u002Fevaluation.md`](docs\u002Fevaluation.md).\n\n\n### 📜 Running Baseline Experiments\nThe scripts below execute standard baseline unlearning experiments on the TOFU and MUSE datasets, evaluated using their corresponding benchmarks. The expected results for these are in [`docs\u002Frepro.md`](docs\u002Frepro.md).\n\n```bash\nbash scripts\u002Ftofu_unlearn.sh\nbash scripts\u002Fmuse_unlearn.sh\n```\n\nThe above scripts are not tuned and uses default hyper parameter settings. We encourage you to tune your methods and add your final results in [`community\u002Fleaderboard.md`](community\u002Fleaderboard.md).\n\n---\n\n## ➕ How to Contribute\n\nIf you are interested in contributing to our work, please have a look at [`contributing.md`](docs\u002Fcontributing.md) guide.\n\n\n## 📚 Further Documentation\n\nFor more in-depth information on specific aspects of the framework, refer to the following documents:\n\n| **Documentation**                              | **Contains**                                                                                                       |\n|------------------------------------------------|--------------------------------------------------------------------------------------------------------------------|\n| [`docs\u002Fcontributing.md`](docs\u002Fcontributing.md)       | Instructions on how to add new methods, benchmarks, components such as trainers, benchmarks, metrics, models, datasets, etc.              |\n| [`docs\u002Fevaluation.md`](docs\u002Fevaluation.md)       | Detailed instructions on creating and running evaluation metrics and benchmarks.                                     |\n| [`docs\u002Fexperiments.md`](docs\u002Fexperiments.md)     | Guide on running experiments in various configurations and settings, including distributed training, fine-tuning, and overriding arguments. |\n| [`docs\u002Fhydra.md`](docs\u002Fhydra.md)                 | A short tutorial on Hydra features, Hydra is the configuration management package we use extensively.                                  |\n| [`community\u002Fleaderboard.md`](community\u002Fleaderboard.md)             | Reference results from various unlearning methods run using this framework on TOFU and MUSE benchmarks.              |\n| [`docs\u002Flinks.md`](docs\u002Flinks.md)             | List of all links to the research papers or other sources the implemented features are sourced from.              |\n| [`docs\u002Frepro.md`](docs\u002Frepro.md)            | Results are provided solely for reproducibility purposes, without any parameter tuning.             |\n---\n\n## 🔗 Support & Contributors\n\nDeveloped and maintained by Vineeth Dorna ([@Dornavineeth](https:\u002F\u002Fgithub.com\u002FDornavineeth)) and Anmol Mekala ([@molereddy](https:\u002F\u002Fgithub.com\u002Fmolereddy)).\n\nIf you encounter any issues or have questions, feel free to raise an issue in the repository 🛠️.\n\n## 📝 Citing this work\n\nIf you use OpenUnlearning in your research, please make sure to cite our OpenUnlearning technical report, the TOFU and MUSE benchmarks.\n\n```bibtex\n@article{openunlearning2025,\n  title={{OpenUnlearning}: Accelerating {LLM} Unlearning via Unified Benchmarking of Methods and Metrics},\n  author={Dorna, Vineeth and Mekala, Anmol and Zhao, Wenlong and McCallum, Andrew and Lipton, Zachary C and Kolter, J Zico and Maini, Pratyush},\n  journal={arXiv preprint arXiv:2506.12618},\n  year={2025},\n  url={https:\u002F\u002Farxiv.org\u002Fabs\u002F2506.12618}\n}\n@inproceedings{maini2024tofu,\n  title={{TOFU}: A Task of Fictitious Unlearning for {LLMs}},\n  author={Maini, Pratyush and Feng, Zhili and Schwarzschild, Avi and Lipton, Zachary Chase and Kolter, J Zico},\n  booktitle={First Conference on Language Modeling},\n  year={2024}\n}\n@article{shi2024muse,\n  title={{MUSE}: Machine Unlearning Six-Way Evaluation for Language Models},\n  author={Weijia Shi and Jaechan Lee and Yangsibo Huang and Sadhika Malladi and Jieyu Zhao and Ari Holtzman and Daogao Liu and Luke Zettlemoyer and Noah A. Smith and Chiyuan Zhang},\n  year={2024},\n  eprint={2407.06460},\n  archivePrefix={arXiv},\n  primaryClass={cs.CL},\n  url={https:\u002F\u002Farxiv.org\u002Fabs\u002F2407.06460}\n}\n```\n\u003C\u002Fdetails>\n\n---\n\n### 🤝 Acknowledgements\n\n- This repo is inspired from [LLaMA-Factory](https:\u002F\u002Fgithub.com\u002Fhiyouga\u002FLLaMA-Factory). \n- The [TOFU](https:\u002F\u002Fgithub.com\u002Flocuslab\u002Ftofu) and [MUSE](https:\u002F\u002Fgithub.com\u002Fswj0419\u002Fmuse_bench) benchmarks served as the foundation for our re-implementation. \n\n---\n\n### 📄 License\nThis project is licensed under the MIT License. See the [`LICENSE`](LICENSE) file for details.\n\n---\n\n[![Star History Chart](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Flocuslab_open-unlearning_readme_da0b3cbae9a5.png)](https:\u002F\u002Fwww.star-history.com\u002F#locuslab\u002Fopen-unlearning&Date)\n","\u003Cdiv align=\"center\">\n\n![*Open*Unlearning](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Flocuslab_open-unlearning_readme_81190f4e3db0.png)\n\n\u003Ch3>\u003Cstrong>一个易于扩展的框架，统一了LLM遗忘评估基准。\u003C\u002Fstrong>\u003C\u002Fh3>\n\n  \u003Cdiv style=\"display: flex; gap: 10px; justify-content: center; align-items: center;\">\n    \u003Ca href=\"https:\u002F\u002Farxiv.org\u002Fabs\u002F2506.12618\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FarXiv-Report-b31b1b?logo=arxiv&logoColor=white\" alt=\"arXiv论文\"\u002F>\u003C\u002Fa>\n    \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flocuslab\u002Fopen-unlearning\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002Flocuslab\u002Fopen-unlearning?style=social\" alt=\"GitHub仓库星数\"\u002F>\u003C\u002Fa>\n    \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flocuslab\u002Fopen-unlearning\u002Factions\">\u003Cimg src=\"https:\u002F\u002Fgithub.com\u002Flocuslab\u002Fopen-unlearning\u002Factions\u002Fworkflows\u002Ftests.yml\u002Fbadge.svg\" alt=\"构建状态\"\u002F>\u003C\u002Fa>\n    \u003Ca href=\"https:\u002F\u002Fhuggingface.co\u002Fopen-unlearning\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002F%F0%9F%A4%97%20Hugging%20Face-Model-blue\" alt=\"HuggingFace 🤗\"\u002F>\u003C\u002Fa>\n    \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flocuslab\u002Fopen-unlearning\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Frepo-size\u002Flocuslab\u002Fopen-unlearning\" alt=\"GitHub仓库大小\"\u002F>\u003C\u002Fa>\n    \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flocuslab\u002Fopen-unlearning\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Flanguages\u002Ftop\u002Flocuslab\u002Fopen-unlearning\" alt=\"GitHub主要语言\"\u002F>\u003C\u002Fa>\n    \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flocuslab\u002Fopen-unlearning\u002Fblob\u002Fmain\u002FLICENSE\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLicense-MIT-blue\" alt=\"许可证：MIT\"\u002F>\u003C\u002Fa>\n  \u003C\u002Fdiv>\n\u003C\u002Fdiv>\n\n---\n\n## 📖 概述\n\n我们提供了TOFU、MUSE和WMDP遗忘基准的高效且简化的实现，同时支持12种以上的遗忘方法、5种以上的数据集、10种以上的评估指标以及7种以上的LLM架构。这些组件都可以轻松扩展以纳入更多变体。\n\n\n我们诚邀LLM遗忘社区在此合作，添加新的基准、遗忘方法、数据集和评估指标，以扩展OpenUnlearning的功能，从更广泛的使用中获得反馈，并推动该领域的进步。\n\n---\n\n> 📝 如果您发现本仓库或我们在[HuggingFace](https:\u002F\u002Fhuggingface.co\u002Fopen-unlearning)上提供的模型有用，请引用我们的[技术报告](https:\u002F\u002Farxiv.org\u002Fabs\u002F2506.12618)（BibTeX见[*引用本工作*](#-citing-this-work))。\n\n---\n\n### 📢 更新\n\n### [2025年6月20日]\n\n🚨 我们的论文《OpenUnlearning：通过统一的方法与指标基准加速LLM遗忘》现已在[arXiv](https:\u002F\u002Farxiv.org\u002Fabs\u002F2506.12618)上发表。\n\n🌟 **亮点：**\n- 一份关于OpenUnlearning的设计、功能和实现的详细技术报告。\n- 一个元评估框架，用于对超过450个模型进行遗忘评估基准测试，并已在HuggingFace 🤗上开源：[TOFU模型有无知识](https:\u002F\u002Fhuggingface.co\u002Fcollections\u002Fopen-unlearning\u002Ftofu-models-w-and-w-o-knowledge-6861e4d935eb99ba162e55cd)，[TOFU遗忘模型](https:\u002F\u002Fhuggingface.co\u002Fcollections\u002Fopen-unlearning\u002Ftofu-unlearned-models-6860f6cf3fe35d0223d92e88)。\n- 在TOFU数据集上使用10种评估指标，将8种不同的遗忘方法集中在一个地方进行基准测试的结果。\n\n\u003Cdetails>\n\u003Csummary>\u003Cb>旧版更新\u003C\u002Fb>\u003C\u002Fsummary>\n\n\n#### [2025年5月19日]\n\n- **更多方法！** 增加了对遗忘方法[UNDIAL](https:\u002F\u002Faclanthology.org\u002F2025.naacl-long.444\u002F)和[AltPO](https:\u002F\u002Faclanthology.org\u002F2025.coling-main.252\u002F)的支持。\n\n#### [2025年5月12日]\n\n- **又一个基准！** 现在支持运行[`WMDP`](https:\u002F\u002Fwmdp.ai\u002F)基准测试及其`Zephyr`任务模型。\n- **更多评估！** [`lm-evaluation-harness`](https:\u002F\u002Fgithub.com\u002FEleutherAI\u002Flm-evaluation-harness)工具包已集成到OpenUnlearning中，从而支持WMDP评估以及流行的通用LLM基准测试，包括MMLU、GSM8K等。\n\n#### [2025年4月6日]\n- **更多指标！** 新增了6种成员推理攻击（MIA）（LOSS、ZLib、Reference、GradNorm、MinK和MinK++），以及提取强度（ES）和精确记忆（EM）作为额外的评估指标。\n- **更多的TOFU评估！** 现在包含了一个保留集，并支持基于MIA攻击的评估。您现在可以计算MUSE在TOFU上的隐私泄露情况。\n- **更多文档！** [`docs\u002Flinks.md`](docs\u002Flinks.md)包含了针对每个已实现功能的资源以及其他有用的LLM遗忘相关资源。\n\n请务必在合并最新版本后立即运行`python setup_data.py`。这是为了刷新下载的评估日志文件，确保它们与最新的评估指标兼容。\n\n#### [2025年3月27日]\n- **更多文档：轻松贡献与排行榜功能**：我们更新了文档，使贡献新的遗忘方法和基准变得更加容易。用户可以更好地记录新增内容，并用他们的结果更新排行榜。详情请参阅[这一部分](#-how-to-contribute)。\n\n#### [2025年3月9日]\n- **更多方法！** 增加了对[RMU](https:\u002F\u002Farxiv.org\u002Fabs\u002F2403.03218)（基于表征工程的遗忘）的支持。\n\n#### [2025年2月27日]  \n⚠️ **仓库更新**：本仓库取代了原先位于[`github.com\u002Flocuslab\u002Ftofu`](https:\u002F\u002Fgithub.com\u002Flocuslab\u002Ftofu)的TOFU代码库，该库已不再维护。\n\n\u003C\u002Fdetails>\n\n---\n\n## 🗃️ 可用组件\n\n我们为遗忘流程中的每个组件提供了多种变体。\n\n| **组件**          | **可用选项** |\n|------------------------|----------------------|\n| **基准测试**        | [TOFU](https:\u002F\u002Farxiv.org\u002Fabs\u002F2401.06121), [MUSE](https:\u002F\u002Fmuse-bench.github.io\u002F), [WMDP](https:\u002F\u002Fwww.wmdp.ai\u002F) |\n| **遗忘方法** | GradAscent, GradDiff, NPO, SimNPO, DPO, RMU, UNDIAL, AltPO, SatImp, WGA, CE-U, PDU |\n| **评估指标** | 字面概率、字面ROUGE、知识问答ROUGE、模型效用、遗忘质量、TruthRatio、提取强度、精确记忆、6种MIA攻击、[lm-evaluation-harness](https:\u002F\u002Fgithub.com\u002FEleutherAI\u002Flm-evaluation-harness) |\n| **数据集**          | MUSE-News（BBC）、MUSE-Books（哈利·波特）、TOFU（不同划分）、WMDP-Bio、WMDP-Cyber |\n| **模型家族**    | TOFU：Llama-3.2、Llama-3.1、Llama-2；MUSE：Llama-2；其他：Phi-3.5、Phi-1.5、Gemma、Zephyr |\n\n---\n\n\n## 📌 目录\n- 📖 [概述](#-overview)\n- 📢 [更新](#-updates)\n- 🗃️ [可用组件](#%EF%B8%8F-available-components)\n- ⚡ [快速入门](#-quickstart)\n- 🔄 [更新的TOFU基准](#-updated-tofu-benchmark)\n- 🧪 [运行实验](#-running-experiments)\n  - 🚀 [执行遗忘](#-perform-unlearning)\n  - 📊 [执行评估](#-perform-an-evaluation)\n  - 📜 [运行基线实验](#-running-baseline-experiments)\n- ➕ [如何贡献](#-how-to-contribute)\n- 📚 [进一步文档](#-further-documentation)\n- 🔗 [支持与贡献者](#-support--contributors)\n- 📝 [引用本工作](#-citing-this-work)\n- 🤝 [致谢](#-acknowledgements)\n- 📄 [许可证](#-license)\n\n---\n\n## ⚡ 快速入门\n\n```bash\n\n# 环境设置\nconda create -n unlearning python=3.11\nconda activate unlearning\npip install \".[lm-eval]\"\npip install --no-build-isolation flash-attn==2.6.3\n\n# 数据准备\npython setup_data.py --eval # saves\u002Feval 现在包含已上传模型的评估结果\n# 这会将包含评估结果的日志文件（包括保留模型的日志）下载到 `saves\u002Feval` 目录中，用于在支持的基准上评估遗忘效果。\n# 还支持其他数据集（如 WMDP），可运行以下命令查看选项：\n# python setup_data.py --help\n```\n\n---\n\n### 🔄 更新后的 TOFU 基准测试\n\n我们已更新 Open-Unlearning 的 TOFU 基准测试目标模型，采用了更多样化的较新架构，模型规模从 1B 到 8B 不等。这些模型包括 Llama 3.2 1B、Llama 3.2 3B、Llama 3.1 8B，以及来自 [旧版 TOFU](github.com\u002Flocuslab\u002Ftofu) 的原始 Llama-2 7B（重新创建）目标模型。\n\n对于每种架构，我们都使用 TOFU 数据集的四种不同划分进行了微调：`full`、`retain90`、`retain95`、`retain99`，总共生成了 16 个微调后的模型。其中第一个作为目标模型（用于遗忘的基础模型），其余则是保留模型，用于衡量每个遗忘划分下的性能。这些模型已在 [HuggingFace](`https:\u002F\u002Fhuggingface.co\u002Fcollections\u002Fopen-unlearning\u002Ftofu-new-models-67bcf636334ea81727573a9f0`) 上发布，其路径可以在实验配置或命令行覆盖中进行设置。\n\n---\n\n## 🧪 运行实验\n\n我们提供了一个易于配置的界面来运行评估，利用 Hydra 配置实现。有关运行实验、常用覆盖参数、与配置交互、分布式训练以及简单模型微调等方面的详细文档，请参阅 [`docs\u002Fexperiments.md`](docs\u002Fexperiments.md)。\n\n### 🚀 执行遗忘任务\n\n以下是一个使用 `GradAscent` 方法在 TOFU `forget10` 划分上启动遗忘过程的示例命令：\n\n```bash\npython src\u002Ftrain.py --config-name=unlearn.yaml experiment=unlearn\u002Ftofu\u002Fdefault \\\n  forget_split=forget10 retain_split=retain90 trainer=GradAscent task_name=SAMPLE_UNLEARN\n```\n\n- `experiment`：指向 Hydra 配置文件 [`configs\u002Fexperiment\u002Funlearn\u002Ftofu\u002Fdefault.yaml`](configs\u002Fexperiment\u002Funlearn\u002Ftofu\u002Fdefault.yaml) 的路径，其中包含 TOFU 遗忘任务的默认实验设置，例如训练数据集、评估基准详情、模型路径等。\n- `forget_split\u002Fretain_split`：设置遗忘和保留数据集的划分。\n- `trainer`：加载 [`configs\u002Ftrainer\u002FGradAscent.yaml`](configs\u002Ftrainer\u002FGradAscent.yaml)，并用该处理器（见配置）替换遗忘方法，该处理器实现在 [`src\u002Ftrainer\u002Funlearn\u002Fgrad_ascent.py`](src\u002Ftrainer\u002Funlearn\u002Fgrad_ascent.py) 中。\n\n### 📊 执行评估\n\n以下是一个在 `forget10` 划分上启动 TOFU 评估过程的示例命令：\n\n```bash\nmodel=Llama-3.2-1B-Instruct\npython src\u002Feval.py --config-name=eval.yaml experiment=eval\u002Ftofu\u002Fdefault \\\n  model=${model} \\\n  model.model_args.pretrained_model_name_or_path=open-unlearning\u002Ftofu_${model}_full \\\n  retain_logs_path=saves\u002Feval\u002Ftofu_${model}_retain90\u002FTOFU_EVAL.json \\\n  task_name=SAMPLE_EVAL\n```\n\n- `experiment`：指向评估配置文件 [`configs\u002Fexperiment\u002Feval\u002Ftofu\u002Fdefault.yaml`](configs\u002Fexperiment\u002Feval\u002Ftofu\u002Fdefault.yaml) 的路径。\n- `model`：为 `Llama-3.2-1B-Instruct` 模型设置模型和分词器配置。\n- `model.model_args.pretrained_model_name_or_path`：覆盖默认实验配置，以评估来自 HuggingFace ID 的模型（也可以使用本地模型检查点路径）。\n- `retain_logs_path`：设置参考模型评估日志的路径，用于计算基于参考模型的指标，例如 TOFU 中的 `forget_quality`。\n\n有关创建和运行评估的更多详细信息，请参阅 [`docs\u002Fevaluation.md`](docs\u002Fevaluation.md)。\n\n### 📜 运行基线实验\n以下脚本会在 TOFU 和 MUSE 数据集上执行标准的基线遗忘实验，并使用相应的基准进行评估。这些实验的预期结果已在 [`docs\u002Frepro.md`](docs\u002Frepro.md) 中提供。\n\n```bash\nbash scripts\u002Ftofu_unlearn.sh\nbash scripts\u002Fmuse_unlearn.sh\n```\n\n上述脚本未经过调优，使用的是默认超参数设置。我们鼓励您对方法进行调优，并将最终结果添加到 [`community\u002Fleaderboard.md`](community\u002Fleaderboard.md) 中。\n\n---\n\n## ➕ 如何贡献\n如果您有兴趣为我们的工作做出贡献，请参阅 [`contributing.md`](docs\u002Fcontributing.md) 指南。\n\n## 📚 更多文档\n有关框架特定方面的更深入信息，请参阅以下文档：\n\n| **文档**                              | **内容**                                                                                                       |\n|------------------------------------------------|--------------------------------------------------------------------------------------------------------------------|\n| [`docs\u002Fcontributing.md`](docs\u002Fcontributing.md)       | 关于如何添加新方法、基准、组件（如训练器、基准、指标、模型、数据集等）的说明。              |\n| [`docs\u002Fevaluation.md`](docs\u002Fevaluation.md)       | 创建和运行评估指标及基准的详细说明。                                     |\n| [`docs\u002Fexperiments.md`](docs\u002Fexperiments.md)     | 在各种配置和设置下运行实验的指南，包括分布式训练、微调和参数覆盖。                                     |\n| [`docs\u002Fhydra.md`](docs\u002Fhydra.md)                 | 关于 Hydra 功能的简短教程，Hydra 是我们广泛使用的配置管理工具。                                  |\n| [`community\u002Fleaderboard.md`](community\u002Fleaderboard.md)             | 使用此框架在 TOFU 和 MUSE 基准上运行的各种遗忘方法的参考结果。              |\n| [`docs\u002Flinks.md`](docs\u002Flinks.md)             | 实现功能所依据的所有研究论文或其他来源的链接列表。              |\n| [`docs\u002Frepro.md`](docs\u002Frepro.md)            | 提供的结果仅用于重现性目的，未进行任何参数调优。             |\n\n---\n\n## 🔗 支持与贡献者\n由 Vineeth Dorna ([@Dornavineeth](https:\u002F\u002Fgithub.com\u002FDornavineeth)) 和 Anmol Mekala ([@molereddy](https:\u002F\u002Fgithub.com\u002Fmolereddy)) 开发并维护。\n\n如果您遇到任何问题或有疑问，欢迎随时在仓库中提交问题 🛠️。\n\n## 📝 引用本工作\n\n如果您在研究中使用 OpenUnlearning，请务必引用我们的 OpenUnlearning 技术报告以及 TOFU 和 MUSE 基准测试。\n\n```bibtex\n@article{openunlearning2025,\n  title={{OpenUnlearning}: Accelerating {LLM} Unlearning via Unified Benchmarking of Methods and Metrics},\n  author={Dorna, Vineeth and Mekala, Anmol and Zhao, Wenlong and McCallum, Andrew and Lipton, Zachary C and Kolter, J Zico and Maini, Pratyush},\n  journal={arXiv preprint arXiv:2506.12618},\n  year={2025},\n  url={https:\u002F\u002Farxiv.org\u002Fabs\u002F2506.12618}\n}\n@inproceedings{maini2024tofu,\n  title={{TOFU}: A Task of Fictitious Unlearning for {LLMs}},\n  author={Maini, Pratyush and Feng, Zhili and Schwarzschild, Avi and Lipton, Zachary Chase and Kolter, J Zico},\n  booktitle={First Conference on Language Modeling},\n  year={2024}\n}\n@article{shi2024muse,\n  title={{MUSE}: Machine Unlearning Six-Way Evaluation for Language Models},\n  author={Weijia Shi and Jaechan Lee and Yangsibo Huang and Sadhika Malladi and Jieyu Zhao and Ari Holtzman and Daogao Liu and Luke Zettlemoyer and Noah A. Smith and Chiyuan Zhang},\n  year={2024},\n  eprint={2407.06460},\n  archivePrefix={arXiv},\n  primaryClass={cs.CL},\n  url={https:\u002F\u002Farxiv.org\u002Fabs\u002F2407.06460}\n}\n```\n\u003C\u002Fdetails>\n\n---\n\n### 🤝 致谢\n\n- 本仓库的灵感来源于 [LLaMA-Factory](https:\u002F\u002Fgithub.com\u002Fhiyouga\u002FLLaMA-Factory)。\n- [TOFU](https:\u002F\u002Fgithub.com\u002Flocuslab\u002Ftofu) 和 [MUSE](https:\u002F\u002Fgithub.com\u002Fswj0419\u002Fmuse_bench) 基准测试为我们重新实现的工作奠定了基础。\n\n---\n\n### 📄 许可证\n本项目采用 MIT 许可证授权。详情请参阅 [`LICENSE`](LICENSE) 文件。\n\n---\n\n[![Star History Chart](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Flocuslab_open-unlearning_readme_da0b3cbae9a5.png)](https:\u002F\u002Fwww.star-history.com\u002F#locuslab\u002Fopen-unlearning&Date)","# Open-Unlearning 快速上手指南\n\nOpen-Unlearning 是一个易于扩展的框架，旨在统一大语言模型（LLM）遗忘学习（Unlearning）的评估基准。它支持 TOFU、MUSE 和 WMDP 等主流基准，内置 12+ 种遗忘方法、5+ 数据集及 10+ 评估指标。\n\n## 环境准备\n\n在开始之前，请确保您的系统满足以下要求：\n\n*   **操作系统**: Linux (推荐) 或 macOS\n*   **Python 版本**: 3.11\n*   **硬件**: 支持 CUDA 的 NVIDIA GPU（用于训练和评估）\n*   **依赖管理**: Conda (推荐)\n\n## 安装步骤\n\n建议使用 Conda 创建独立的虚拟环境以避免依赖冲突。\n\n1.  **创建并激活虚拟环境**\n    ```bash\n    conda create -n unlearning python=3.11\n    conda activate unlearning\n    ```\n\n2.  **安装项目依赖**\n    国内用户若遇到 PyPI 下载缓慢，可临时指定清华源加速安装：\n    ```bash\n    pip install \".[lm-eval]\" -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple\n    ```\n\n3.  **安装 Flash Attention**\n    该框架依赖 `flash-attn` 以加速计算，需单独安装指定版本：\n    ```bash\n    pip install --no-build-isolation flash-attn==2.6.3\n    ```\n    *注：若编译失败，请确保已安装对应的 CUDA Toolkit 且版本与 PyTorch 匹配。*\n\n4.  **初始化数据**\n    运行以下脚本下载评估日志文件（包含保留模型日志），这是后续评估遗忘效果所必需的：\n    ```bash\n    python setup_data.py --eval\n    ```\n    *执行后，评估结果日志将保存在 `saves\u002Feval` 目录中。*\n\n## 基本使用\n\n以下示例展示如何在一个简单的流程中执行**遗忘训练**和**效果评估**。\n\n### 1. 执行遗忘训练 (Perform Unlearning)\n\n使用 `GradAscent` 方法在 TOFU 数据集的 `forget10` 分割上进行遗忘训练：\n\n```bash\npython src\u002Ftrain.py --config-name=unlearn.yaml experiment=unlearn\u002Ftofu\u002Fdefault \\\n  forget_split=forget10 retain_split=retain90 trainer=GradAscent task_name=SAMPLE_UNLEARN\n```\n\n*   **experiment**: 加载 TOFU 遗忘任务的默认配置。\n*   **forget_split\u002Fretain_split**: 指定需要遗忘的数据集分割和需要保留的数据集分割。\n*   **trainer**: 指定使用的遗忘算法（此处为 GradAscent）。\n\n### 2. 执行效果评估 (Perform an Evaluation)\n\n训练完成后，使用以下命令评估模型在 `forget10` 分割上的表现。此示例评估从 HuggingFace 加载的 `Llama-3.2-1B-Instruct` 模型：\n\n```bash\nmodel=Llama-3.2-1B-Instruct\npython src\u002Feval.py --config-name=eval.yaml experiment=eval\u002Ftofu\u002Fdefault \\\n  model=${model} \\\n  model.model_args.pretrained_model_name_or_path=open-unlearning\u002Ftofu_${model}_full \\\n  retain_logs_path=saves\u002Feval\u002Ftofu_${model}_retain90\u002FTOFU_EVAL.json \\\n  task_name=SAMPLE_EVAL\n```\n\n*   **model**: 设置模型架构配置。\n*   **pretrained_model_name_or_path**: 指定待评估模型的路径（支持 HuggingFace ID 或本地路径）。\n*   **retain_logs_path**: 指定参考模型（保留模型）的评估日志路径，用于计算 `forget_quality` 等相对指标。\n\n### 3. 运行基线实验 (可选)\n\n若想快速复现 TOFU 或 MUSE 的标准基线实验结果，可直接运行提供的脚本：\n\n```bash\nbash scripts\u002Ftofu_unlearn.sh\nbash scripts\u002Fmuse_unlearn.sh\n```\n\n更多高级配置（如分布式训练、自定义指标或添加新基准）请参考项目文档 `docs\u002Fexperiments.md` 和 `docs\u002Fcontributing.md`。","某医疗 AI 初创团队在发布大模型前，急需彻底移除训练数据中误包含的数千条患者隐私病历，以符合合规要求。\n\n### 没有 open-unlearning 时\n- **基准混乱**：团队需手动拼凑 TOFU、MUSE 等不同评测集，代码适配耗时数周，且难以统一评估标准。\n- **方法试错成本高**：想对比多种“遗忘”算法（如梯度上升或参数编辑），需为每种方法重写底层逻辑，开发效率极低。\n- **评估维度单一**：仅能检测模型是否“忘记”了隐私数据，无法量化验证模型在通用医疗问答（如 MMLU）上的能力是否受损。\n- **复现困难**：缺乏统一的实验框架，团队成员间难以复现彼此的遗忘效果，导致项目进度严重滞后。\n\n### 使用 open-unlearning 后\n- **一站式基准集成**：直接调用内置的 TOFU 和 WMDP 等主流基准，几分钟内即可搭建起标准化的隐私移除评估流水线。\n- **算法灵活切换**：依托支持的 12+ 种遗忘方法，团队可一键切换不同策略进行横向对比，快速锁定兼顾隐私与性能的最优解。\n- **多维全面体检**：利用集成的 10+ 项指标（包括成员推断攻击和提取强度），同时确认隐私已擦除且通用医疗知识保留完好。\n- **高效协作迭代**：基于统一的扩展框架，团队成员可轻松添加新数据集或指标，实验结果可复现，大幅加速了合规上线进程。\n\nopen-unlearning 通过统一基准与多样化算法支持，将原本繁琐的大模型隐私擦除工作转化为高效、可量化的标准流程。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Flocuslab_open-unlearning_81190f4e.png","locuslab","CMU Locus Lab","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Flocuslab_147f21ae.png","Zico Kolter's Research Group",null,"http:\u002F\u002Fwww.zicokolter.com\u002F","https:\u002F\u002Fgithub.com\u002Flocuslab",[84,88,92],{"name":85,"color":86,"percentage":87},"Python","#3572A5",80.8,{"name":89,"color":90,"percentage":91},"Shell","#89e051",19.1,{"name":93,"color":94,"percentage":95},"Makefile","#427819",0.2,515,147,"2026-04-02T09:41:15","MIT","未说明","需要 NVIDIA GPU (因安装 flash-attn)，具体显存需求取决于模型大小 (支持 1B-8B 模型)",{"notes":103,"python":104,"dependencies":105},"建议使用 conda 创建环境。首次运行前必须执行 'python setup_data.py --eval' 以下载评估日志和数据集。项目集成了 lm-evaluation-harness 用于通用基准测试，并支持多种遗忘算法和评估指标。","3.11",[106,107,108,109,110,111],"flash-attn==2.6.3","lm-evaluation-harness","hydra-core","torch","transformers","accelerate",[54,26,13],[114,115,116,117,118,119,120,121,122,123,124],"unlearning","privacy-protection","right-to-be-forgotten","llm-unlearning","benchmarks","llm-evaluation-metrics","llms","open-source","llm-privacy","membership-inference","membership-inference-attacks","2026-03-27T02:49:30.150509","2026-04-06T09:43:41.191129",[128,133,138,143,148,152],{"id":129,"question_zh":130,"answer_zh":131,"source_url":132},11091,"在评估和微调过程中，如何设置 `apply_chat_template` 以确保结果的可复现性？","为了确保持续的可复现性，建议在微调和评估阶段都将 `apply_chat_template` 设置为 `False`。虽然将其设置为 `True` 时结果差异不大，但如果在评估时设置为 `False` 而微调时使用默认设置（通常为 `True`），会导致输入数据不一致，从而引起性能显著下降。统一设置为 `False` 可以解决此问题。","https:\u002F\u002Fgithub.com\u002Flocuslab\u002Fopen-unlearning\u002Fissues\u002F88",{"id":134,"question_zh":135,"answer_zh":136,"source_url":137},11092,"运行 WMDP 数据集实验时遇到内存不足（OOM）错误，尤其是在 CPU 预处理阶段，有什么解决方案？","WMDP 数据集的预处理代码非常消耗 RAM，即使在拥有 1000G 内存的机器上也可能导致 OOM。目前的变通方案是使用配备大显存 GPU 的环境（例如 2 张 A800 80G 显卡）来运行实验，这样可以避免在 CPU 端进行大规模预处理导致的内存溢出问题。如果必须在低资源环境运行，可能需要优化预处理逻辑或分批次处理数据，但官方目前主要推荐在高显存 GPU 环境下运行。","https:\u002F\u002Fgithub.com\u002Flocuslab\u002Fopen-unlearning\u002Fissues\u002F119",{"id":139,"question_zh":140,"answer_zh":141,"source_url":142},11093,"如何正确解读“遗忘质量”（Forget Quality）和“真实比率”（Truth Ratio）之间的关系？为什么遗忘集指标最好的模型不一定具有最高的遗忘质量？","遗忘质量（Forget Quality）衡量的是未学习模型与保留模型在遗忘集上的真实比率（Truth Ratio, TR）的相似程度，而不是 TR 的绝对值高低。目标不是让遗忘集上的 TR 趋近于 1，而是让未学习模型的 TR 尽可能接近保留模型在该数据集上的 TR。例如，如果保留模型在遗忘集上的 TR 为 0.7，那么未学习模型的 TR 也应接近 0.7 才能获得较高的遗忘质量。如果未学习模型的 TR 接近 1 而保留模型是 0.7，反而说明分布差异大，遗忘质量较低。","https:\u002F\u002Fgithub.com\u002Flocuslab\u002Fopen-unlearning\u002Fissues\u002F111",{"id":144,"question_zh":145,"answer_zh":146,"source_url":147},11094,"如何在 OpenUnlearning 项目中添加并使用 WMDP 数据集进行实验？","WMDP 数据集已被集成到项目中（通过 PR #93）。用户可以通过指定 `experiment=unlearn\u002Fwmdp\u002Fdefault.yaml` 并设置 `data_split` 参数（如 'cyber' 或 'bio'）来运行实验。支持的训练器包括 GradAscent、GradDiff、NPO 和 SimNPO 等。注意 WMDP 数据集本身只包含“黄色区域”的相关问题，通过移除这些知识来推断对“红色区域”（危险知识）的移除效果。","https:\u002F\u002Fgithub.com\u002Flocuslab\u002Fopen-unlearning\u002Fissues\u002F80",{"id":149,"question_zh":150,"answer_zh":151,"source_url":132},11095,"在使用 LLaMA 模型进行 TOFU 基准测试复现时，如果遇到检查点评估与最终模型评估不一致的问题，可能的原因是什么？","这种不一致通常源于评估设置与微调设置的不匹配，特别是 `apply_chat_template` 参数的使用。如果在微调时使用了聊天模板而在评估时未使用（或反之），会导致输入分布不同，进而影响评估指标（如 FQ 值可能出现数量级差异）。解决方法是确保微调和评估流程中该参数设置完全一致（建议均设为 `False`），以保证输入数据处理方式相同。",{"id":153,"question_zh":154,"answer_zh":155,"source_url":137},11096,"在多卡环境下运行 WMDP 实验时，推荐的启动命令和配置参数有哪些？","建议使用 `accelerate launch` 启动脚本。示例命令包括设置 `MASTER_PORT`，指定 `CUDA_VISIBLE_DEVICES`，并传递关键参数如 `per_device_train_batch_size=4`、`gradient_accumulation_steps=2`、`ddp_find_unused_parameters=true` 以及 `gradient_checkpointing=true` 以节省显存。同时需指定具体的模型（如 zephyr-7b-beta）、数据分割（cyber\u002Fbio）和训练器类型。",[]]