[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-OpenLMLab--MOSS-RLHF":3,"tool-OpenLMLab--MOSS-RLHF":61},[4,18,26,36,44,53],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":17},4358,"openclaw","openclaw\u002Fopenclaw","OpenClaw 是一款专为个人打造的本地化 AI 助手，旨在让你在自己的设备上拥有完全可控的智能伙伴。它打破了传统 AI 助手局限于特定网页或应用的束缚，能够直接接入你日常使用的各类通讯渠道，包括微信、WhatsApp、Telegram、Discord、iMessage 等数十种平台。无论你在哪个聊天软件中发送消息，OpenClaw 都能即时响应，甚至支持在 macOS、iOS 和 Android 设备上进行语音交互，并提供实时的画布渲染功能供你操控。\n\n这款工具主要解决了用户对数据隐私、响应速度以及“始终在线”体验的需求。通过将 AI 部署在本地，用户无需依赖云端服务即可享受快速、私密的智能辅助，真正实现了“你的数据，你做主”。其独特的技术亮点在于强大的网关架构，将控制平面与核心助手分离，确保跨平台通信的流畅性与扩展性。\n\nOpenClaw 非常适合希望构建个性化工作流的技术爱好者、开发者，以及注重隐私保护且不愿被单一生态绑定的普通用户。只要具备基础的终端操作能力（支持 macOS、Linux 及 Windows WSL2），即可通过简单的命令行引导完成部署。如果你渴望拥有一个懂你",349277,3,"2026-04-06T06:32:30",[13,14,15,16],"Agent","开发框架","图像","数据工具","ready",{"id":19,"name":20,"github_repo":21,"description_zh":22,"stars":23,"difficulty_score":10,"last_commit_at":24,"category_tags":25,"status":17},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,"2026-04-05T11:01:52",[14,15,13],{"id":27,"name":28,"github_repo":29,"description_zh":30,"stars":31,"difficulty_score":32,"last_commit_at":33,"category_tags":34,"status":17},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 真正成长为懂上",150037,2,"2026-04-10T23:33:47",[14,13,35],"语言模型",{"id":37,"name":38,"github_repo":39,"description_zh":40,"stars":41,"difficulty_score":32,"last_commit_at":42,"category_tags":43,"status":17},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 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",108322,"2026-04-10T11:39:34",[14,15,13],{"id":45,"name":46,"github_repo":47,"description_zh":48,"stars":49,"difficulty_score":32,"last_commit_at":50,"category_tags":51,"status":17},6121,"gemini-cli","google-gemini\u002Fgemini-cli","gemini-cli 是一款由谷歌推出的开源 AI 命令行工具，它将强大的 Gemini 大模型能力直接集成到用户的终端环境中。对于习惯在命令行工作的开发者而言，它提供了一条从输入提示词到获取模型响应的最短路径，无需切换窗口即可享受智能辅助。\n\n这款工具主要解决了开发过程中频繁上下文切换的痛点，让用户能在熟悉的终端界面内直接完成代码理解、生成、调试以及自动化运维任务。无论是查询大型代码库、根据草图生成应用，还是执行复杂的 Git 操作，gemini-cli 都能通过自然语言指令高效处理。\n\n它特别适合广大软件工程师、DevOps 人员及技术研究人员使用。其核心亮点包括支持高达 100 万 token 的超长上下文窗口，具备出色的逻辑推理能力；内置 Google 搜索、文件操作及 Shell 命令执行等实用工具；更独特的是，它支持 MCP（模型上下文协议），允许用户灵活扩展自定义集成，连接如图像生成等外部能力。此外，个人谷歌账号即可享受免费的额度支持，且项目基于 Apache 2.0 协议完全开源，是提升终端工作效率的理想助手。",100752,"2026-04-10T01:20:03",[52,13,15,14],"插件",{"id":54,"name":55,"github_repo":56,"description_zh":57,"stars":58,"difficulty_score":32,"last_commit_at":59,"category_tags":60,"status":17},4721,"markitdown","microsoft\u002Fmarkitdown","MarkItDown 是一款由微软 AutoGen 团队打造的轻量级 Python 工具，专为将各类文件高效转换为 Markdown 格式而设计。它支持 PDF、Word、Excel、PPT、图片（含 OCR）、音频（含语音转录）、HTML 乃至 YouTube 链接等多种格式的解析，能够精准提取文档中的标题、列表、表格和链接等关键结构信息。\n\n在人工智能应用日益普及的今天，大语言模型（LLM）虽擅长处理文本，却难以直接读取复杂的二进制办公文档。MarkItDown 恰好解决了这一痛点，它将非结构化或半结构化的文件转化为模型“原生理解”且 Token 效率极高的 Markdown 格式，成为连接本地文件与 AI 分析 pipeline 的理想桥梁。此外，它还提供了 MCP（模型上下文协议）服务器，可无缝集成到 Claude Desktop 等 LLM 应用中。\n\n这款工具特别适合开发者、数据科学家及 AI 研究人员使用，尤其是那些需要构建文档检索增强生成（RAG）系统、进行批量文本分析或希望让 AI 助手直接“阅读”本地文件的用户。虽然生成的内容也具备一定可读性，但其核心优势在于为机器",93400,"2026-04-06T19:52:38",[52,14],{"id":62,"github_repo":63,"name":64,"description_en":65,"description_zh":66,"ai_summary_zh":67,"readme_en":68,"readme_zh":69,"quickstart_zh":70,"use_case_zh":71,"hero_image_url":72,"owner_login":73,"owner_name":73,"owner_avatar_url":74,"owner_bio":75,"owner_company":75,"owner_location":75,"owner_email":75,"owner_twitter":75,"owner_website":75,"owner_url":76,"languages":77,"stars":86,"forks":87,"last_commit_at":88,"license":89,"difficulty_score":90,"env_os":91,"env_gpu":92,"env_ram":93,"env_deps":94,"category_tags":108,"github_topics":109,"view_count":32,"oss_zip_url":75,"oss_zip_packed_at":75,"status":17,"created_at":113,"updated_at":114,"faqs":115,"releases":116},6478,"OpenLMLab\u002FMOSS-RLHF","MOSS-RLHF","Secrets of RLHF in Large Language Models Part I: PPO","MOSS-RLHF 是一套专注于大语言模型人类反馈强化学习（RLHF）的开源解决方案，旨在帮助研究者攻克模型对齐过程中的训练难题。在大模型落地应用中，奖励机制设计复杂、环境交互困难以及高昂的试错成本，往往导致基于 PPO 算法的 RLHF 训练难以稳定收敛。MOSS-RLHF 正是为了解决这一痛点而生，它通过深入剖析 PPO 算法内部机制，创新性地提出了\"PPO-max\"算法，显著提升了模型训练的稳定性，确保经过监督微调（SFT）的模型能更精准地与人类价值观对齐。\n\n该项目不仅公开了完整的训练代码，还发布了具有强大跨模型泛化能力的中英文奖励模型，有效降低了重新标注人类偏好数据的成本。此外，团队还开源了经过清洗和偏好强度标注的 HH-RLHF 数据集，以及基于 Llama-7B 和 OpenChineseLlama-7B 的多个关键阶段模型（包括奖励模型、SFT 模型及最终策略模型）。作为荣获 NIPS 2023 相关研讨会最佳论文奖的成果，MOSS-RLHF 特别适合人工智能研究人员、大模型开发者以及对模型安全对齐技术感兴趣的技术团队使用，是探索大模型“安全着陆”与指令遵循能力的有力工","MOSS-RLHF 是一套专注于大语言模型人类反馈强化学习（RLHF）的开源解决方案，旨在帮助研究者攻克模型对齐过程中的训练难题。在大模型落地应用中，奖励机制设计复杂、环境交互困难以及高昂的试错成本，往往导致基于 PPO 算法的 RLHF 训练难以稳定收敛。MOSS-RLHF 正是为了解决这一痛点而生，它通过深入剖析 PPO 算法内部机制，创新性地提出了\"PPO-max\"算法，显著提升了模型训练的稳定性，确保经过监督微调（SFT）的模型能更精准地与人类价值观对齐。\n\n该项目不仅公开了完整的训练代码，还发布了具有强大跨模型泛化能力的中英文奖励模型，有效降低了重新标注人类偏好数据的成本。此外，团队还开源了经过清洗和偏好强度标注的 HH-RLHF 数据集，以及基于 Llama-7B 和 OpenChineseLlama-7B 的多个关键阶段模型（包括奖励模型、SFT 模型及最终策略模型）。作为荣获 NIPS 2023 相关研讨会最佳论文奖的成果，MOSS-RLHF 特别适合人工智能研究人员、大模型开发者以及对模型安全对齐技术感兴趣的技术团队使用，是探索大模型“安全着陆”与指令遵循能力的有力工具。","# MOSS-RLHF\n\n**Congratulations**🎉🎉🎉 We received **the best paper award** at NIPS 2023 Workshop on Instruction Tuning and Instruction Following!\n\n庆祝🎉🎉🎉, \"Secrets of RLHF in Large Language Models Part I: PPO\" 荣获 NIPS 2023 Workshop on Instruction Tuning and Instruction Following 最佳论文奖！！！\n\n\u003Cp align=\"center\" width=\"100%\">\n\u003Ca href=\"https:\u002F\u002Farxiv.org\u002Fabs\u002F2307.04964\" target=\"_blank\">\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FOpenLMLab_MOSS-RLHF_readme_f0c566ac95b8.png\" alt=\"MOSS\" style=\"width: 50%; min-width: 300px; display: block; margin: auto;\">\u003C\u002Fa>\n\n[![Code License](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FCode%20License-Apache_2.0-brightgreen.svg)](.\u002FLICENSE)\n[![Data License](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FData%20License-CC%20BY--NC%204.0-blue.svg)](.\u002FDATA_LICENSE)\n[![Model License](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FModel%20License-GNU%20AGPL%203.0-red.svg)](.\u002FMODEL_LICENSE)\n\n### *MOSS-RLHF  👉 \u003Ca href=\"https:\u002F\u002Fopenlmlab.github.io\u002FMOSS-RLHF\u002F\" target=\"_blank\">[Home page]*\n\n### *\"Secrets of RLHF in Large Language Models Part I: PPO\" 👉 \u003Ca href=\"https:\u002F\u002Farxiv.org\u002Fabs\u002F2307.04964\" target=\"_blank\">[Technical report I]\u003C\u002Fa>*\n\n### *\"Secrets of RLHF in Large Language Models Part II: Reward Modeling\" 👉 \u003Ca href=\"https:\u002F\u002Farxiv.org\u002Fabs\u002F2401.06080\" target=\"_blank\">[Technical report II]\u003C\u002Fa>*\n\n## 🌟🌟🌟 Breaking News\n\n👉 Mon, 15. January 2024. We have released the code for training the reward model and the annotated hh-rlhf dataset([hh-rlhf-strength-cleaned)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Ffnlp\u002Fhh-rlhf-strength-cleaned \"https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Ffnlp\u002Fhh-rlhf-strength-cleaned\")!\n\n👉 Fri, 12. January 2024. We have released the second paper **\"Secrets of RLHF in Large Language Models Part II: Reward Modeling\"**!\n\n## 🌟 News\n\n👉 Wed, 12. July 2023. We have released Chinese reward model based OpenChineseLlama-7B!\n[moss-rlhf-reward-model-7B-zh](https:\u002F\u002Fhuggingface.co\u002FAblustrund\u002Fmoss-rlhf-reward-model-7B-zh\u002Ftree\u002Fmain)\n`\u003Cbr>`\n\n👉 Thu, 13. July 2023. We have released English reward model and SFT model based Llama-7B!\n[moss-rlhf-reward-model-7B-en](https:\u002F\u002Fhuggingface.co\u002Ffnlp\u002Fmoss-rlhf-reward-model-7B-en)\n\n[moss-rlhf-sft-model-7B-en](https:\u002F\u002Fhuggingface.co\u002Ffnlp\u002Fmoss-rlhf-sft-model-7B-en)\n`\u003Cbr>`\n\n👉 Wait a minute ! Thu, 14. July 2023. We have released English policy model after aligning with RLHF!\n[moss-rlhf-policy-model-7B-en](https:\u002F\u002Fhuggingface.co\u002Ffnlp\u002Fmoss-rlhf-policy-model-7B-en)\n`\u003Cbr>`\n\n## 🧾 Open-source List\n\n### RL related\n\n- [X] Open source code for RL training in large language models.\n- [X] A 7B Chinese reward model based on openChineseLlama.\n- [X] A 7B English reward model based on Llama-7B.\n- [X] SFT model for English.\n- [X] Policy model for English after RLHF.\n\n### RM related\n\n- [X] Open source code for reward model training in large language models.\n- [X] HH-RLHF dataset with preference strength annotation.\n- [X] HH-RLHF validation set cleaned by GPT-4.\n\n- ...\n\n## 🌠 Introduction\n\nDue to the challenges of reward design, environment interaction, and agent training, coupled with huge trial and error cost of large language models, there is a significant barrier for AI researchers to motivate the development of technical alignment and safe landing of LLMs. The stable training of RLHF has still been a puzzle.\nIn this technical report, we intend to help researchers to train their models stably with human feedback.\n\nContributions are summarized as follows:\n\n1) We release competitive Chinese and English reward models, respectively, which have good cross-model generalization ability, alleviating the cost of relabeling human preference data;\n2) We conduct in-depth analysis on the inner workings of PPO algorithm and propose the PPO-max algorithm to ensure stable model training;\n3) We release the complete PPO-max codes to ensure that the LLMs in the current SFT stage can be better aligned with humans.\n\n\u003Cdiv align=\"center\" width=\"100%\">\n\u003Cimg style=\"width: 80%; min-width: 500px; display: block; margin: auto; margin-bottom: 20px\" alt=\"MOSS-RLHF\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FOpenLMLab_MOSS-RLHF_readme_bd8a339af87c.jpg\">\n\u003C\u002Fdiv>\n\n\u003Cdiv align=\"center\" width=\"100%\">\n\u003Cimg style=\"width: 80%; min-width: 500px; display: block; margin: auto; margin-bottom: 20px\" alt=\"MOSS-RLHF\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FOpenLMLab_MOSS-RLHF_readme_b90acfdf639d.jpg\">\n\u003C\u002Fdiv>\n\n## 🔩 Requirements & Setup\n\nThis repository works on Python 3.8 and PyTorch 1.13.1.\n\nWe recommend using the **conda** virtual environment to run the code.\n\n#### Step 1: Create a new Python virtual environment\n\n```bash\nconda update conda -n base -c defaults\nconda create -n rlhf python=3.8\nconda activate rlhf\n```\n\n#### Step 2: Install PyTorch and TensorBoard\n\n```bash\nconda install pytorch==1.13.1 pytorch-cuda=11.7 tensorboard -c pytorch -c nvidia\n```\n\n#### Step 3: Install the remaining dependencies\n\n```bash\nconda install datasets accelerate safetensors chardet cchardet -c huggingface -c conda-forge\npip3 install transformers sentencepiece einops triton==1.0.0 rouge jionlp==1.4.14 nltk sacrebleu cpm_kernels\n\napt install libaio-dev\nDS_BUILD_OPS=1 pip install deepspeed\n```\n\n## ✨ Start training your own model!\n\n### Training PPO model\n\nRun code in a few steps.\n\n#### Step 1: Recover Reward model weights\n\nWe can not directly release the full weight of the reward model because of protocol restrictions.\nYou can merge the diff weight with original Llama-7B to recover the reward model we used.\n\nWe upload the diff models, thanks to tatsu-lab, you can recover the reward model follow these steps:\n\n```bash\n1) Download the weight diff into your local machine. The weight diff is located at:\n# For English:\n# SFT model\nhttps:\u002F\u002Fhuggingface.co\u002Ffnlp\u002Fmoss-rlhf-sft-model-7B-en\n# Reward model\nhttps:\u002F\u002Fhuggingface.co\u002Ffnlp\u002Fmoss-rlhf-reward-model-7B-en\n# Policy model\nhttps:\u002F\u002Fhuggingface.co\u002Ffnlp\u002Fmoss-rlhf-policy-model-7B-en\n\n# For Chinese:\nhttps:\u002F\u002Fhuggingface.co\u002FAblustrund\u002Fmoss-rlhf-reward-model-7B-zh\u002Ftree\u002Fmain\n\n2) Merge the weight diff with the original Llama-7B:\n# For English:\n# Reward model\npython merge_weight_en.py recover --path_raw decapoda-research\u002Fllama-7b-hf --path_diff .\u002Fmodels\u002Fmoss-rlhf-reward-model-7B-en\u002Fdiff --path_tuned .\u002Fmodels\u002Fmoss-rlhf-reward-model-7B-en\u002Frecover --model_type reward\n# SFT model\npython merge_weight_en.py recover --path_raw decapoda-research\u002Fllama-7b-hf --path_diff .\u002Fmodels\u002Fmoss-rlhf-sft-model-7B-en\u002Fdiff --path_tuned .\u002Fmodels\u002Fmoss-rlhf-sft-model-7B-en\u002Frecover --model_type sft\n# Policy model\npython merge_weight_en.py recover --path_raw decapoda-research\u002Fllama-7b-hf --path_diff .\u002Fmodels\u002Fmoss-rlhf-policy-model-7B-en\u002Fdiff --path_tuned .\u002Fmodels\u002Fmoss-rlhf-policy-model-7B-en\u002Frecover --model_type policy\n# For Chinese:\npython merge_weight_zh.py recover --path_raw decapoda-research\u002Fllama-7b-hf --path_diff .\u002Fmodels\u002Fmoss-rlhf-reward-model-7B-zh\u002Fdiff --path_tuned .\u002Fmodels\u002Fmoss-rlhf-reward-model-7B-zh\u002Frecover\n```\n\n#### Step 2: Select your own SFT model.\n\nBecause of some limitations, we can not release the **Chinese** SFT model (Currently).\nYou can use your own SFT model, or a strong base model instead of our SFT model.\n\n#### Step 3: Start training\n\nRun the command below.\n\n```\n# For Chinese:\n# You need to use your own sft model currently.\nbash train_ppo_zh.sh\n\n# For English:\n# We have loaded the sft model and reward model to huggingface.\nbash train_ppo_en.sh\n\n```\n\n### Training reward model\n\nTo train the reward model, you need to specify the initial model (`--hf_model_name_or_path`) for the reward model (e.g., meta-llama\u002FLlama-2-7b-hf) and preference dataset(`--data_path`) (such as hh-rlhf, or you can use our provided [annotated hh-rlhf](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Ffnlp\u002Fhh-rlhf-strength-cleaned \"https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Ffnlp\u002Fhh-rlhf-strength-cleaned\") which has a format consistent with the training code), and run the command below.\n\n```\n# annotated dataset: https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Ffnlp\u002Fhh-rlhf-strength-cleaned\n# Assuming you have specified the --hf_model_name_or_path and --data_path parameters.\nbash train_rm.sh\n```\n\n## Citation\n\n```bibtex\n@article{zheng2023secrets,\n      title={Secrets of RLHF in Large Language Models Part I: PPO}, \n      author={Rui Zheng and Shihan Dou and Songyang Gao and Wei Shen and Binghai Wang and Yan Liu and Senjie Jin and Qin Liu and Limao Xiong and Lu Chen and Zhiheng Xi and Yuhao Zhou and Nuo Xu and Wenbin Lai and Minghao Zhu and Rongxiang Weng and Wensen Cheng and Cheng Chang and Zhangyue Yin and Yuan Hua and Haoran Huang and Tianxiang Sun and Hang Yan and Tao Gui and Qi Zhang and Xipeng Qiu and Xuanjing Huang},\n      year={2023},\n      eprint={2307.04964},\n      archivePrefix={arXiv},\n      primaryClass={cs.CL}\n}\n```\n```bibtex\n@misc{wang2024secrets,\n      title={Secrets of RLHF in Large Language Models Part II: Reward Modeling}, \n      author={Binghai Wang and Rui Zheng and Lu Chen and Yan Liu and Shihan Dou and Caishuang Huang and Wei Shen and Senjie Jin and Enyu Zhou and Chenyu Shi and Songyang Gao and Nuo Xu and Yuhao Zhou and Xiaoran Fan and Zhiheng Xi and Jun Zhao and Xiao Wang and Tao Ji and Hang Yan and Lixing Shen and Zhan Chen and Tao Gui and Qi Zhang and Xipeng Qiu and Xuanjing Huang and Zuxuan Wu and Yu-Gang Jiang},\n      year={2024},\n      eprint={2401.06080},\n      archivePrefix={arXiv},\n      primaryClass={cs.AI}\n}\n```\n","# MOSS-RLHF\n\n**恭喜**🎉🎉🎉 我们在 NIPS 2023 指令微调与指令遵循研讨会上荣获 **最佳论文奖**！\n\n庆祝🎉🎉🎉, \"大型语言模型中RLHF的奥秘 第一部分：PPO\" 荣获 NIPS 2023 Workshop on Instruction Tuning and Instruction Following 最佳论文奖！！！\n\n\u003Cp align=\"center\" width=\"100%\">\n\u003Ca href=\"https:\u002F\u002Farxiv.org\u002Fabs\u002F2307.04964\" target=\"_blank\">\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FOpenLMLab_MOSS-RLHF_readme_f0c566ac95b8.png\" alt=\"MOSS\" style=\"width: 50%; min-width: 300px; display: block; margin: auto;\">\u003C\u002Fa>\n\n[![代码许可证](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FCode%20License-Apache_2.0-brightgreen.svg)](.\u002FLICENSE)\n[![数据许可证](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FData%20License-CC%20BY--NC%204.0-blue.svg)](.\u002FDATA_LICENSE)\n[![模型许可证](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FModel%20License-GNU%20AGPL%203.0-red.svg)](.\u002FMODEL_LICENSE)\n\n### *MOSS-RLHF  👉 \u003Ca href=\"https:\u002F\u002Fopenlmlab.github.io\u002FMOSS-RLHF\u002F\" target=\"_blank\">[首页]*\n\n### *\"大型语言模型中RLHF的奥秘 第一部分：PPO\" 👉 \u003Ca href=\"https:\u002F\u002Farxiv.org\u002Fabs\u002F2307.04964\" target=\"_blank\">[技术报告I]\u003C\u002Fa>*\n\n### *\"大型语言模型中RLHF的奥秘 第二部分：奖励建模\" 👉 \u003Ca href=\"https:\u002F\u002Farxiv.org\u002Fabs\u002F2401.06080\" target=\"_blank\">[技术报告II]\u003C\u002Fa>*\n\n## 🌟🌟🌟 最新消息\n\n👉 2024年1月15日，星期一。我们发布了训练奖励模型的代码以及标注了偏好强度的hh-rlhf数据集([hh-rlhf-strength-cleaned)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Ffnlp\u002Fhh-rlhf-strength-cleaned \"https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Ffnlp\u002Fhh-rlhf-strength-cleaned\")！\n\n👉 2024年1月12日，星期五。我们发布了第二篇论文 **\"大型语言模型中RLHF的奥秘 第二部分：奖励建模\"**！\n\n## 🌟 新闻\n\n👉 2023年7月12日，星期三。我们发布了基于OpenChineseLlama-7B的中文奖励模型！\n[moss-rlhf-reward-model-7B-zh](https:\u002F\u002Fhuggingface.co\u002FAblustrund\u002Fmoss-rlhf-reward-model-7B-zh\u002Ftree\u002Fmain)\n`\u003Cbr>`\n\n👉 2023年7月13日，星期四。我们发布了基于Llama-7B的英文奖励模型和SFT模型！\n[moss-rlhf-reward-model-7B-en](https:\u002F\u002Fhuggingface.co\u002Ffnlp\u002Fmoss-rlhf-reward-model-7B-en)\n\n[moss-rlhf-sft-model-7B-en](https:\u002F\u002Fhuggingface.co\u002Ffnlp\u002Fmoss-rlhf-sft-model-7B-en)\n`\u003Cbr>`\n\n👉 等等！2023年7月14日，星期四。我们发布了经过RLHF对齐后的英文策略模型！\n[moss-rlhf-policy-model-7B-en](https:\u002F\u002Fhuggingface.co\u002Ffnlp\u002Fmoss-rlhf-policy-model-7B-en)\n`\u003Cbr>`\n\n## 🧾 开源列表\n\n### RL相关\n\n- [X] 大型语言模型中RL训练的开源代码。\n- [X] 基于openChineseLlama的7B中文奖励模型。\n- [X] 基于Llama-7B的7B英文奖励模型。\n- [X] 英文版的SFT模型。\n- [X] 经过RLHF对齐后的英文策略模型。\n\n### RM相关\n\n- [X] 大型语言模型中奖励模型训练的开源代码。\n- [X] 包含偏好强度标注的HH-RLHF数据集。\n- [X] 经GPT-4清理过的HH-RLHF验证集。\n- [X] ...\n\n## 🌠 引言\n\n由于奖励函数设计、环境交互以及智能体训练等方面的挑战，再加上大型语言模型需要付出巨大的试错成本，这使得AI研究人员在推动技术对齐和确保LLM安全落地方面面临巨大障碍。目前，RLHF的稳定训练仍然是一个难题。\n在这份技术报告中，我们旨在帮助研究人员通过人类反馈更稳定地训练他们的模型。\n\n我们的贡献总结如下：\n\n1) 我们分别发布了具有竞争力的中文和英文奖励模型，这些模型具备良好的跨模型泛化能力，从而降低了重新标注人类偏好数据的成本；\n2) 我们深入分析了PPO算法的工作原理，并提出了PPO-max算法以确保模型训练的稳定性；\n3) 我们公开了完整的PPO-max代码，以确保当前处于SFT阶段的LLM能够更好地与人类需求保持一致。\n\n\u003Cdiv align=\"center\" width=\"100%\">\n\u003Cimg style=\"width: 80%; min-width: 500px; display: block; margin: auto; margin-bottom: 20px\" alt=\"MOSS-RLHF\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FOpenLMLab_MOSS-RLHF_readme_bd8a339af87c.jpg\">\n\u003C\u002Fdiv>\n\n\u003Cdiv align=\"center\" width=\"100%\">\n\u003Cimg style=\"width: 80%; min-width: 500px; display: block; margin: auto; margin-bottom: 20px\" alt=\"MOSS-RLHF\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FOpenLMLab_MOSS-RLHF_readme_b90acfdf639d.jpg\">\n\u003C\u002Fdiv>\n\n## 🔩 需求与设置\n\n本仓库适用于Python 3.8和PyTorch 1.13.1。\n\n我们建议使用**conda**虚拟环境来运行代码。\n\n#### 步骤1：创建一个新的Python虚拟环境\n\n```bash\nconda update conda -n base -c defaults\nconda create -n rlhf python=3.8\nconda activate rlhf\n```\n\n#### 步骤2：安装PyTorch和TensorBoard\n\n```bash\nconda install pytorch==1.13.1 pytorch-cuda=11.7 tensorboard -c pytorch -c nvidia\n```\n\n#### 步骤3：安装剩余的依赖项\n\n```bash\nconda install datasets accelerate safetensors chardet cchardet -c huggingface -c conda-forge\npip3 install transformers sentencepiece einops triton==1.0.0 rouge jionlp==1.4.14 nltk sacrebleu cpm_kernels\n\napt install libaio-dev\nDS_BUILD_OPS=1 pip install deepspeed\n```\n\n## ✨ 开始训练属于你的模型吧！\n\n### 训练PPO模型\n\n只需几个步骤即可运行代码。\n\n#### 步骤1：恢复奖励模型权重\n\n由于协议限制，我们无法直接发布奖励模型的完整权重。\n你可以将差分权重与原始Llama-7B合并，从而恢复我们所使用的奖励模型。\n\n感谢tatsu-lab提供了差分模型，你可以按照以下步骤恢复奖励模型：\n\n```bash\n1) 将权重差分下载到本地。权重差分位于：\n# 对于英文：\n# SFT模型\nhttps:\u002F\u002Fhuggingface.co\u002Ffnlp\u002Fmoss-rlhf-sft-model-7B-en\n# 奖励模型\nhttps:\u002F\u002Fhuggingface.co\u002Ffnlp\u002Fmoss-rlhf-reward-model-7B-en\n# 策略模型\nhttps:\u002F\u002Fhuggingface.co\u002Ffnlp\u002Fmoss-rlhf-policy-model-7B-en\n\n# 对于中文：\nhttps:\u002F\u002Fhuggingface.co\u002FAblustrund\u002Fmoss-rlhf-reward-model-7B-zh\u002Ftree\u002Fmain\n\n2) 将权重差分与原始Llama-7B合并：\n# 对于英文：\n# 奖励模型\npython merge_weight_en.py recover --path_raw decapoda-research\u002Fllama-7b-hf --path_diff .\u002Fmodels\u002Fmoss-rlhf-reward-model-7B-en\u002Fdiff --path_tuned .\u002Fmodels\u002Fmoss-rlhf-reward-model-7B-en\u002Frecover --model_type reward\n# SFT模型\npython merge_weight_en.py recover --path_raw decapoda-research\u002Fllama-7b-hf --path_diff .\u002Fmodels\u002Fmoss-rlhf-sft-model-7B-en\u002Fdiff --path_tuned .\u002Fmodels\u002Fmoss-rlhf-sft-model-7B-en\u002Frecover --model_type sft\n# 策略模型\npython merge_weight_en.py recover --path_raw decapoda-research\u002Fllama-7b-hf --path_diff .\u002Fmodels\u002Fmoss-rlhf-policy-model-7B-en\u002Fdiff --path_tuned .\u002Fmodels\u002Fmoss-rlhf-policy-model-7B-en\u002Frecover --model_type policy\n# 对于中文：\npython merge_weight_zh.py recover --path_raw decapoda-research\u002Fllama-7b-hf --path_diff .\u002Fmodels\u002Fmoss-rlhf-reward-model-7B-zh\u002Fdiff --path_tuned .\u002Fmodels\u002Fmoss-rlhf-reward-model-7B-zh\u002Frecover\n```\n\n#### 步骤2：选择你自己的SFT模型。\n\n由于一些限制，我们暂时无法发布**中文**的SFT模型。\n你可以使用自己的SFT模型，或者用一个强大的基础模型来替代我们的SFT模型。\n\n#### 步骤3：开始训练\n\n运行下面的命令。\n\n```\n# 对于中文：\n\n# 目前你需要使用自己的 SFT 模型。\nbash train_ppo_zh.sh\n\n# 英文版：\n# 我们已将 SFT 模型和奖励模型上传至 Hugging Face。\nbash train_ppo_en.sh\n\n```\n\n### 训练奖励模型\n\n要训练奖励模型，你需要指定奖励模型的初始模型（`--hf_model_name_or_path`，例如 meta-llama\u002FLlama-2-7b-hf）以及偏好数据集（`--data_path`，如 hh-rlhf；你也可以使用我们提供的 [标注过的 hh-rlhf](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Ffnlp\u002Fhh-rlhf-strength-cleaned \"https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Ffnlp\u002Fhh-rlhf-strength-cleaned\")，其格式与训练代码一致），然后运行以下命令。\n\n```\n# 标注数据集：https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Ffnlp\u002Fhh-rlhf-strength-cleaned\n# 假设你已经指定了 --hf_model_name_or_path 和 --data_path 参数。\nbash train_rm.sh\n```\n\n## 引用\n\n```bibtex\n@article{zheng2023secrets,\n      title={大型语言模型中 RLHF 的秘密 第一部分：PPO}, \n      author={Rui Zheng、Shihan Dou、Songyang Gao、Wei Shen、Binghai Wang、Yan Liu、Senjie Jin、Qin Liu、Limao Xiong、Lu Chen、Zhiheng Xi、Yuhao Zhou、Nuo Xu、Wenbin Lai、Minghao Zhu、Rongxiang Weng、Wensen Cheng、Cheng Chang、Zhangyue Yin、Yuan Hua、Haoran Huang、Tianxiang Sun、Hang Yan、Tao Gui、Qi Zhang、Xipeng Qiu、Xuanjing Huang},\n      year={2023},\n      eprint={2307.04964},\n      archivePrefix={arXiv},\n      primaryClass={cs.CL}\n}\n```\n```bibtex\n@misc{wang2024secrets,\n      title={大型语言模型中 RLHF 的秘密 第二部分：奖励建模}, \n      author={Binghai Wang、Rui Zheng、Lu Chen、Yan Liu、Shihan Dou、Caishuang Huang、Wei Shen、Senjie Jin、Enyu Zhou、Chenyu Shi、Songyang Gao、Nuo Xu、Yuhao Zhou、Xiaoran Fan、Zhiheng Xi、Jun Zhao、Xiao Wang、Tao Ji、Hang Yan、Lixing Shen、Zhan Chen、Tao Gui、Qi Zhang、Xipeng Qiu、Xuanjing Huang、Zuxuan Wu、Yu-Gang Jiang},\n      year={2024},\n      eprint={2401.06080},\n      archivePrefix={arXiv},\n      primaryClass={cs.AI}\n}\n```","# MOSS-RLHF 快速上手指南\n\nMOSS-RLHF 是一个专注于大语言模型（LLM）人类反馈强化学习（RLHF）的开源项目，提供了稳定的 PPO 训练代码、奖励模型（Reward Model）训练方案以及中英文预训练模型权重。本项目荣获 NIPS 2023 Workshop 最佳论文奖，旨在降低 RLHF 的技术门槛，帮助研究者稳定地训练对齐人类的模型。\n\n## 环境准备\n\n本项目基于 **Python 3.8** 和 **PyTorch 1.13.1** 开发。推荐使用 `conda` 创建独立的虚拟环境以避免依赖冲突。\n\n**系统要求：**\n*   操作系统：Linux (推荐)\n*   Python 版本：3.8\n*   PyTorch 版本：1.13.1 (需匹配 CUDA 11.7)\n*   硬件：支持 CUDA 的 NVIDIA GPU\n\n## 安装步骤\n\n请按照以下顺序执行命令来配置运行环境。\n\n### 1. 创建并激活虚拟环境\n\n```bash\nconda update conda -n base -c defaults\nconda create -n rlhf python=3.8\nconda activate rlhf\n```\n\n### 2. 安装 PyTorch 和 TensorBoard\n\n建议使用官方源安装指定版本的 PyTorch：\n\n```bash\nconda install pytorch==1.13.1 pytorch-cuda=11.7 tensorboard -c pytorch -c nvidia\n```\n\n### 3. 安装其他依赖\n\n安装 HuggingFace 生态及相关工具库，并编译 DeepSpeed 算子：\n\n```bash\nconda install datasets accelerate safetensors chardet cchardet -c huggingface -c conda-forge\npip3 install transformers sentencepiece einops triton==1.0.0 rouge jionlp==1.4.14 nltk sacrebleu cpm_kernels\n\n# 安装系统级依赖\napt install libaio-dev\n\n# 编译并安装 DeepSpeed\nDS_BUILD_OPS=1 pip install deepspeed\n```\n\n## 基本使用\n\n使用前需先恢复模型权重（由于协议限制，官方发布的是权重差值 diff weights），然后选择策略进行训练。\n\n### 第一步：恢复模型权重\n\n你需要下载官方的 diff 权重，并将其与原始的 Llama-7B 模型合并以恢复完整的 Reward Model、SFT Model 或 Policy Model。\n\n**下载权重地址：**\n*   **英文模型:**\n    *   SFT: `fnlp\u002Fmoss-rlhf-sft-model-7B-en`\n    *   Reward: `fnlp\u002Fmoss-rlhf-reward-model-7B-en`\n    *   Policy: `fnlp\u002Fmoss-rlhf-policy-model-7B-en`\n*   **中文模型:**\n    *   Reward: `Ablustrund\u002Fmoss-rlhf-reward-model-7B-zh`\n\n**合并权重命令：**\n\n```bash\n# --- 英文模型恢复 ---\n\n# 恢复 Reward Model\npython merge_weight_en.py recover --path_raw decapoda-research\u002Fllama-7b-hf --path_diff .\u002Fmodels\u002Fmoss-rlhf-reward-model-7B-en\u002Fdiff --path_tuned .\u002Fmodels\u002Fmoss-rlhf-reward-model-7B-en\u002Frecover --model_type reward\n\n# 恢复 SFT Model\npython merge_weight_en.py recover --path_raw decapoda-research\u002Fllama-7b-hf --path_diff .\u002Fmodels\u002Fmoss-rlhf-sft-model-7B-en\u002Fdiff --path_tuned .\u002Fmodels\u002Fmoss-rlhf-sft-model-7B-en\u002Frecover --model_type sft\n\n# 恢复 Policy Model\npython merge_weight_en.py recover --path_raw decapoda-research\u002Fllama-7b-hf --path_diff .\u002Fmodels\u002Fmoss-rlhf-policy-model-7B-en\u002Fdiff --path_tuned .\u002Fmodels\u002Fmoss-rlhf-policy-model-7B-en\u002Frecover --model_type policy\n\n# --- 中文模型恢复 ---\n# 注意：目前未公开中文 SFT 模型，此处仅演示恢复中文 Reward Model\npython merge_weight_zh.py recover --path_raw decapoda-research\u002Fllama-7b-hf --path_diff .\u002Fmodels\u002Fmoss-rlhf-reward-model-7B-zh\u002Fdiff --path_tuned .\u002Fmodels\u002Fmoss-rlhf-reward-model-7B-zh\u002Frecover\n```\n\n### 第二步：开始训练\n\n#### 场景 A：训练 PPO 模型 (对齐阶段)\n\n*   **英文环境**：可直接使用官方提供的 SFT 和 Reward 模型路径（需在脚本中确认路径配置）。\n*   **中文环境**：由于暂未开源中文 SFT 模型，请使用你自己训练的 SFT 模型替换脚本中的路径。\n\n```bash\n# 启动中文 PPO 训练 (需自行准备 SFT 模型)\nbash train_ppo_zh.sh\n\n# 启动英文 PPO 训练\nbash train_ppo_en.sh\n```\n\n#### 场景 B：训练奖励模型 (Reward Modeling)\n\n你可以使用原始的 Llama 系列模型作为基座，配合偏好数据集（如 HH-RLHF 或官方清洗过的带强度标注的数据集 `fnlp\u002Fhh-rlhf-strength-cleaned`）进行训练。\n\n```bash\n# 示例：训练奖励模型\n# 请确保在 train_rm.sh 中指定了 --hf_model_name_or_path (基座模型) 和 --data_path (数据集路径)\nbash train_rm.sh\n```","某金融科技公司正在开发一款面向客户的智能理财顾问，需要确保模型在提供投资建议时既专业准确，又严格符合合规要求且语气亲切。\n\n### 没有 MOSS-RLHF 时\n- **训练极不稳定**：团队尝试自行复现 PPO 算法进行对齐，但常因奖励信号波动导致模型崩溃或输出乱码，调试周期长达数周。\n- **偏好数据成本高昂**：缺乏高质量的中文奖励模型，必须依赖大量人工标注用户偏好数据来微调，耗时耗力且难以覆盖长尾场景。\n- **安全对齐效果差**：模型偶尔会生成过于激进的投资建议或忽略风险提示，传统监督微调（SFT）难以彻底纠正这种“幻觉”行为。\n- **泛化能力不足**：自建的简单奖励模型仅在特定测试集有效，一旦面对真实用户多样化的提问风格，评分准确性大幅下降。\n\n### 使用 MOSS-RLHF 后\n- **训练稳定高效**：直接采用 MOSS-RLHF 开源的 PPO-max 算法代码，利用其改进的稳定机制，仅用少量迭代就完成了策略模型的对齐训练。\n- **复用高质量奖励模型**：直接加载官方发布的基于 OpenChineseLlama 的 7B 中文奖励模型，无需重新标注数据即可精准评估模型回复的合规性与有用性。\n- **显著提升安全性**：经过 RLHF 对齐后的策略模型能主动拒绝高风险请求，并在回答中自然融入必要的风险免责声明，符合金融监管标准。\n- **跨场景适应性强**：得益于奖励模型优秀的跨模型泛化能力，系统在面对用户口语化、模糊化的理财咨询时，依然能给出结构清晰、逻辑严密的回答。\n\nMOSS-RLHF 通过提供稳定的 PPO-max 算法和高质量的预训练奖励模型，大幅降低了大模型人类对齐的技术门槛与试错成本。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FOpenLMLab_MOSS-RLHF_d5c83844.png","OpenLMLab","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002FOpenLMLab_8461a44a.png",null,"https:\u002F\u002Fgithub.com\u002FOpenLMLab",[78,82],{"name":79,"color":80,"percentage":81},"Python","#3572A5",97.2,{"name":83,"color":84,"percentage":85},"Shell","#89e051",2.8,1420,105,"2026-03-31T08:21:26","Apache-2.0",4,"Linux","需要 NVIDIA GPU，CUDA 11.7 (通过 pytorch-cuda=11.7 安装)，显存大小未说明（建议 24GB+ 以运行 7B 模型及 RLHF 训练）","未说明",{"notes":95,"python":96,"dependencies":97},"1. 强烈建议使用 conda 虚拟环境。2. 安装 DeepSpeed 前需先执行 'apt install libaio-dev'。3. 由于协议限制，官方未直接发布完整的奖励模型权重，需下载差分权重并与原始 Llama-7B 模型合并后才能使用。4. 目前暂未开源中文 SFT 模型，中文训练需使用自有的 SFT 模型或强基座模型替代。5. 训练涉及 PPO 算法，对显存和稳定性要求较高。","3.8",[98,99,100,101,102,103,104,105,106,107],"pytorch==1.13.1","transformers","deepspeed","accelerate","datasets","tensorboard","sentencepiece","einops","triton==1.0.0","safetensors",[35,14],[110,111,112],"rlhf","alignment","ai-safety","2026-03-27T02:49:30.150509","2026-04-11T10:01:54.202675",[],[]]