LLM - R1 强化学习 DRPO 策略优化 DAPO 与 Dr. GRPO 算法 教程

欢迎关注我的CSDN:https://spike.blog.csdn.net/
本文地址:https://spike.blog.csdn.net/article/details/146533892


DAPO

在强化学习算法中,DAPO (Decoupled Clip and Dynamic Sampling Policy Optimization),通过解耦裁剪和动态采样策略提升模型的推理能力。与 GRPO (Group Relative Policy Optimization) 相比,DRPO 移除 KL 散度惩罚项,允许模型在长推理任务中自由探索,同时,通过调整上下裁剪范围,增加低概率 Token 探索能力,有效缓解熵崩溃问题。DRPO 引入动态采样策略,过滤掉准确率为 0 或 1 的无效样本,确保每个批次中的样本,具有有效的梯度信号,从而提升训练效率和模型的收敛速度。Dr. GRPO (GRPO Done Right) 解决 GRPO 优化中的偏差问题,提出的改进方案,通过删除长度归一化项和标准差标准化项,解决 GRPO 可能导致错误响应逐渐变长的问题。同时,Dr. GRPO 在掩码均值函数中,将 mask.sum(axis=dim) 替换为固定值 MAX_TOKENS,以确保优化目标的无偏性。能够有效缓解优化偏差,显著减少错误回答的长度,同时保持模型的推理性能。

DAPO,即 Decoupled Clip and Dynamic sAmpling Policy Optimization,解耦剪裁与动态采样策略优化

  • DAPO: an Open-Source LLM Reinforcement Learning System at Scale

Dr. GRPO,即 GRPO Done Right

  • Dr. GRPO: Understanding R1-Zero-Like Training: A Critical Perspective

GitHub:

  • DAPO:https://dapo-sia.github.io/
  • Dr. GRPO:https://github.com/sail-sg/understand-r1-zero

标准的 GRPO,如下:
1 G ∑ i = 1 G 1 ∣ o i ∣ ∑ t = 1 ∣ o i ∣ { m i n [ π θ ( o i , t ∣ q , o i , < t ) π θ o l d ( o i , t ∣ q , o i , < t ) A ^ i , t , c l i p ( π θ ( o i , t ∣ q , o i , < t ) π θ o l d ( o i , t ∣ q , o i , < t ) , 1 − ϵ , 1 + ϵ ) A ^ i , t ] − β D K L ( π θ ∣ ∣ π r e f ) } w h e r e A ^ i , t = R ( q , o i ) − m e a n ( { R ( q , o i ) , . . . , R ( q , o G ) } ) s t d ( { R ( q , o i ) , . . . , R ( q , o G ) } ) \frac{1}{G}\sum_{i=1}^{G} \frac{1}{|o_{i}|}\sum_{t=1}^{|o_{i}|} \big\{ min \big[ \frac{\pi_{\theta}(o_{i,t}|q,o_{i,<t})}{\pi_{\theta_{old}}(o_{i,t}|q,o_{i,<t})}\hat{A}_{i,t}, clip(\frac{\pi_{\theta}(o_{i,t}|q,o_{i,<t})}{\pi_{\theta_{old}}(o_{i,t}|q,o_{i,<t})}, 1-\epsilon, 1+\epsilon)\hat{A}_{i,t} \big] -\beta \mathbb{D}_{KL}(\pi_{\theta}||\pi_{ref}) \big\} \\ where \ \hat{A}_{i,t}=\frac{R(q,o_{i}) - mean(\{R(q,o_{i}),...,R(q,o_{G})\})}{std(\{R(q,o_{i}),...,R(q,o_{G})\})} G1i=1Goi1t=1oi{min[πθold(oi,tq,oi,<t)πθ(oi,tq,oi,<t)A^i,t,clip(πθold(oi,tq,oi,<t)πθ(oi,tq,oi,<t),1ϵ,1+ϵ)A^i,t]βDKL(πθ∣∣πref)}where A^i,t=std({R(q,oi),...,R(q,oG)})R(q,oi)mean({R(q,oi),...,R(q,oG)})
DAPO (Decoupled Clip and Dynamic sAmpling Policy Optimization),即 解耦剪裁与动态采样策略优化,即 (1) 增加 Clip 上界范围,(2) 去除 全正或全错的采样,(3) 修改 Token-Level 全平均 代替 Sample-Level 分组平均。
1 ∑ i = 1 G ∣ o i ∣ 1 G ∑ i = 1 G ∑ t = 1 ∣ o i ∣ { m i n [ π θ ( o i , t ∣ q , o i , < t ) π θ o l d ( o i , t ∣ q , o i , < t ) A ^ i , t , c l i p ( π θ ( o i , t ∣ q , o i , < t ) π θ o l d ( o i , t ∣ q , o i , < t ) , 1 − ϵ l o w , 1 + ϵ u p ) A ^ i , t ] } w h e r e A ^ i , t = R ( q , o i ) − m e a n ( { R ( q , o i ) , . . . , R ( q , o G ) } ) s t d ( { R ( q , o i ) , . . . , R ( q , o G ) } ) s . t . 0 < ∣ { o i ∣ i s _ e q u i v a l e n t ( a , o i ) } ∣ < G \frac{1}{\sum_{i=1}^{G}|o_{i}|} \frac{1}{G}\sum_{i=1}^{G} \sum_{t=1}^{|o_{i}|} \big\{ min \big[ \frac{\pi_{\theta}(o_{i,t}|q,o_{i,<t})}{\pi_{\theta_{old}}(o_{i,t}|q,o_{i,<t})}\hat{A}_{i,t}, clip(\frac{\pi_{\theta}(o_{i,t}|q,o_{i,<t})}{\pi_{\theta_{old}}(o_{i,t}|q,o_{i,<t})}, 1-\epsilon_{low}, 1+\epsilon_{up})\hat{A}_{i,t} \big] \big\} \\ where \ \hat{A}_{i,t}=\frac{R(q,o_{i}) - mean(\{R(q,o_{i}),...,R(q,o_{G})\})}{std(\{R(q,o_{i}),...,R(q,o_{G})\})} \\ s.t. \ 0 < \big| \{{o_{i}|is\_equivalent(a,o_{i})} \} \big| < G i=1Goi1G1i=1Gt=1oi{min[πθold(oi,tq,oi,<t)πθ(oi,tq,oi,<t)A^i,t,clip(πθold(oi,tq,oi,<t)πθ(oi,tq,oi,<t),1ϵlow,1+ϵup)A^i,t]}where A^i,t=std({R(q,oi),...,R(q,oG)})R(q,oi)mean({R(q,oi),...,R(q,oG)})s.t. 0< {oiis_equivalent(a,oi)} <G
Dr. GRPO (GRPO Done Right),即 运行正确的 GRPO,即 (1)去掉 序列长度 1 ∣ o i ∣ \frac{1}{|o_{i}|} oi1,(2)去掉 优势方差 s t d std std,如下:
1 G ∑ i = 1 G ∑ t = 1 ∣ o i ∣ { m i n [ π θ ( o i , t ∣ q , o i , < t ) π θ o l d ( o i , t ∣ q , o i , < t ) A ^ i , t , c l i p ( π θ ( o i , t ∣ q , o i , < t ) π θ o l d ( o i , t ∣ q , o i , < t ) , 1 − ϵ , 1 + ϵ ) A ^ i , t ] ) } w h e r e A ^ i , t = R ( q , o i ) − m e a n ( { R ( q , o i ) , . . . , R ( q , o G ) } ) \frac{1}{G}\sum_{i=1}^{G} \sum_{t=1}^{|o_{i}|} \big\{ min \big[ \frac{\pi_{\theta}(o_{i,t}|q,o_{i,<t})}{\pi_{\theta_{old}}(o_{i,t}|q,o_{i,<t})}\hat{A}_{i,t}, clip(\frac{\pi_{\theta}(o_{i,t}|q,o_{i,<t})}{\pi_{\theta_{old}}(o_{i,t}|q,o_{i,<t})}, 1-\epsilon, 1+\epsilon)\hat{A}_{i,t} \big]) \big\} \\ where \ \hat{A}_{i,t}=R(q,o_{i}) - mean(\{R(q,o_{i}),...,R(q,o_{G})\}) G1i=1Gt=1oi{min[πθold(oi,tq,oi,<t)πθ(oi,tq,oi,<t)A^i,t,clip(πθold(oi,tq,oi,<t)πθ(oi,tq,oi,<t),1ϵ,1+ϵ)A^i,t])}where A^i,t=R(q,oi)mean({R(q,oi),...,R(q,oG)})

DAPO 移除 KL 散度 (Removing KL Divergence):KL 惩罚用于调节 在线策略 与 冻结参考策略 之间的散度。

  • 在 强化学习人类反馈(RLHF) 场景中,强化学习的目标是,避免与初始模型偏离太远,对齐模型的行为。
  • 训练 长思维链(long-CoT) 的模型,模型分布可能显著偏离初始模型,因此,KL 惩罚没有必要。

Dr. GRPO,同样,移除 KL 散度,即:

  • KL 正则化项,通常用于从人类反馈中强化学习,其中 r r r 是从 π r e f \pi_{ref} πref 收集的数据中,学习得到的奖励模型。正则化有助于防止 π θ \pi_{\theta} πθ 过度偏离奖励模型准确的分布。
  • 推理模型的强化学习微调,通常使用基于规则的验证器作为 r r r,消除分布偏移的担忧,因此,可以移除 KL 项
  • 节省在训练过程中由 π r e f \pi_{ref} πref 所需的显存和计算资源,而且,可能为 RL 训练带来更好的性能。
  • 因此,假设 β D K L \beta \mathbb{D}_{KL} βDKL 项的参数 β = 0 \beta=0 β=0

在 TRL - GRPO 的 KL 散度参数中,即

  • β = 0.04 \beta = 0.04 β=0.04,default,GRPOConfig
  • 在 math 训练中, β = 0.001 \beta=0.001 β=0.001 ,也是降低 KL 散度权重。

1. DAPO 策略

DAPO 去除 KL 散度项、使用基于规则的奖励模型(Rule-based Reward Modeling)。

DAPO 核心包括:

  1. Clip-Higher (裁剪上界):促进系统多样性,避免熵坍塌(Entropy Collapse),在 策略梯度损失(Policy Gradient Loss) 中,通过增加重要性采样比率的 剪裁上界(Upper Clip) 缓解。
    • 提升 Clip 上界,正例(A>0),低概率 Token 绝对提升能力增强,有效释放低概率路径的探索潜能,缓解策略熵的快速降低。
    • 保持 Clip 下界,避免策略急剧收缩。
    • ϵ l o w = 0.2 , ϵ h i g h = 0.28 \epsilon_{low}=0.2,\epsilon_{high}=0.28 ϵlow=0.2ϵhigh=0.28
  2. Dynamic Sampling (动态采样):提高训练效率和稳定性,提出动态采样策略,筛选出准确率为 1 和 0 的提示组(Prompt Groups),确保每个批次中,有效梯度的提示数量保持一致。
  3. Token-level Policy Gradient Loss (Token-Level 策略梯度损失):避免 长思维链的强化学习(long-CoT RL) 中,无意义的 Pattern 惩罚较低,效果显著。
    • GRPO:先在 部分(Generation Level) 取平均,再在 整体(Group Level) 取平均。
    • DAPO:在 Group 中,全部 Generation 全部 Tokens,一起取平均。
  4. Overlong Reward Shaping (过长奖励规范):使用 超长过滤(Overlong Filtering) 策略,隐藏(Mask) 截断样本(Truncated Samples) 的损失,显著稳定训练过程,提高性能,降低奖励噪声(Reward Noise)。

软过长惩罚(Soft Overlong Punishment),即:
R l e n g t h ( y ) = { 0 , ∣ y ∣ ≤ L m a x − L c a c h e L m a x − L c a c h e − ∣ y ∣ L c a c h e , L m a x − L c a c h e < ∣ y ∣ ≤ L m a x − 1 , L m a x < ∣ y ∣ R_{length}(y) = \begin{cases} 0, &|y|\le L_{max} - L_{cache} \\ \frac{L_{max} - L_{cache} - |y|}{L_{cache}}, &L_{max} - L_{cache} < |y| \le L_{max} \\ -1, &L_{max} < |y| \end{cases} Rlength(y)= 0,LcacheLmaxLcachey,1,yLmaxLcacheLmaxLcache<yLmaxLmax<y

DAPO 流程:

DAPO

2. Dr. GRPO 策略

Dr. GRPO 解决 GRPO 的 2 个偏差(Biases):

  1. 响应长度偏差(Response-level length bias):即 除以 ∣ o i ∣ |o_{i}| oi
    • 正向优势 ( A ^ i , t > 0 \hat{A}_{i,t}>0 A^i,t>0) 回答正确,短回答的梯度更新大,长回答的梯度更新小。
    • 负向优势 ( A ^ i , t < 0 \hat{A}_{i,t}<0 A^i,t<0) 回答错误,长回答的惩罚较小,短回答的惩罚较大。
    • 去掉 除以 ∣ o i ∣ |o_{i}| oi 之后,避免回答长短的影响,只考虑奖励函数值。
  2. 问题难度偏差(Question-level difficulty bias):即 优势 A ^ i , t \hat{A}_{i,t} A^i,t 除以 s t d ( { R ( q , o i ) , . . . , R ( q , o G ) } ) std(\{R(q,o_{i}),...,R(q,o_{G})\}) std({R(q,oi),...,R(q,oG)})
    • 标准差较低的问题,在策略更新过程中,赋予更高的权重。
    • 批次归一化是合理的,但是,问题级别归一化,导致目标函数中不同问题的权重有所不同。
    • 模型训练更偏向于,回答一致性较高的问题,降低探索能力。

3. TRL GRPO 实现

TRL 代码中,计算 GRPO 的逻辑:

# 1. advantages 优势的计算过程
# Gather the reward per function: this part is crucial, because the rewards are normalized per group and the
# completions may be distributed across processes
rewards_per_func = gather(rewards_per_func)# Apply weights to each reward function's output and sum
rewards = (rewards_per_func * self.reward_weights.to(device).unsqueeze(0)).nansum(dim=1)# Compute grouped-wise rewards
mean_grouped_rewards = rewards.view(-1, self.num_generations).mean(dim=1)
std_grouped_rewards = rewards.view(-1, self.num_generations).std(dim=1)# Normalize the rewards to compute the advantages
mean_grouped_rewards = mean_grouped_rewards.repeat_interleave(self.num_generations, dim=0)
std_grouped_rewards = std_grouped_rewards.repeat_interleave(self.num_generations, dim=0)
advantages = rewards - mean_grouped_rewards
if self.args.scale_rewards:advantages = advantages / (std_grouped_rewards + 1e-4)# KL 散度
per_token_kl = torch.exp(ref_per_token_logps - per_token_logps) - (ref_per_token_logps - per_token_logps) - 1# 2. Loss 的计算过程
# Compute the loss
advantages = inputs["advantages"]
# When using num_iterations == 1, old_per_token_logps == per_token_logps, so we can skip it's computation (see
# _generate_and_score_completions) and use per_token_logps.detach() instead.
old_per_token_logps = inputs["old_per_token_logps"] if self.num_iterations > 1 else per_token_logps.detach()
coef_1 = torch.exp(per_token_logps - old_per_token_logps)
coef_2 = torch.clamp(coef_1, 1 - self.epsilon_low, 1 + self.epsilon_high)
per_token_loss1 = coef_1 * advantages.unsqueeze(1)
per_token_loss2 = coef_2 * advantages.unsqueeze(1)
per_token_loss = -torch.min(per_token_loss1, per_token_loss2)
if self.beta != 0.0:per_token_loss = per_token_loss + self.beta * per_token_kl
loss = (per_token_loss * completion_mask).sum() / completion_mask.sum()

4. loss 是 0 不代表 gradient 是 0

loss = 0 也可以反向传播,更新梯度:

  • loss 是 0,gradient 可能不是 0

l o s s ( w ) = ( w − 1 ) 2 − 1 ∂ l o s s ∂ w = 2 w − 2 \begin{align} loss(w) &= (w-1)^{2} - 1 \\ \frac{\partial{loss}}{\partial{w}} &= 2w - 2 \end{align} loss(w)wloss=(w1)21=2w2

  • 当 loss 是 0 时,w=0,梯度 gradient 是 -2,学习 = 学习率 * 梯度,假设,学习率 η = 0.1 \eta=0.1 η=0.1

w n e w = w − η ⋅ g = 0 − ( 0.1 × ( − 2 ) ) = 0.2 w_{new} = w - \eta \cdot g = 0 - (0.1\times(-2)) = 0.2 wnew=wηg=0(0.1×(2))=0.2

  • gradient 是 0,则不可优化

测试:

import torch
x = torch.tensor([3.0], requires_grad=True)
y1 = x-x
y1.backward()
print(f"Grad for x-x: {x.grad.item()}")  # 0.0x.grad.zero_()
y2 = x - x.detach()
y2.backward()
print(f"Grad for x - x.detach(): {x.grad.item()}")  # 1.0

参考:

  • GitHub - GRPO questions
  • GitHub - Add warning when negative KL
  • 知乎 - DAPO中的CLIP trick

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/899158.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

美摄科技智能汽车视频延迟摄影解决方案,开启智能出行新视界

在智能汽车时代&#xff0c;车载影像技术正以前所未有的速度发展&#xff0c;成为提升驾乘体验和满足用户多样化需求的关键因素。美摄科技凭借其卓越的技术实力和创新精神&#xff0c;推出了智能汽车视频延迟摄影解决方案&#xff0c;为智能汽车行业带来了一场视觉盛宴。 一、…

[250325] Claude AI 现已支持网络搜索功能!| ReactOS 0.4.15 发布!

目录 Claude AI 现已支持网络搜索功能&#xff01;ReactOS 0.4.15 发布&#xff01; Claude AI 现已支持网络搜索功能&#xff01; 近日&#xff0c;Anthropic 公司宣布&#xff0c;其 AI 助手 Claude 现在可以进行网络搜索&#xff0c;为用户提供更及时、更相关的回复。这项新…

代码规范之Variable Names变量名

代码规范之Variable Names变量名 golang中 官方文档&#xff1a;https://go.dev/wiki/CodeReviewComments#variable-names Variable names in Go should be short rather than long. This is especially true for local variables with limited scope. Prefer c to lineCoun…

Mybatis_plus

前言 Mybatis_plus 是在 mybatis 的基础上进行了增强&#xff0c;在 MyBatis 的基础上只做增强不做改变&#xff0c;为简化开发、提高效率而生。本文章只做简单的使用介绍&#xff0c;更加详细的内容大家可以参考官网。 下面是mybatis_plus 官网地址&#xff1a; mybatis_plu…

深圳问顶安全科技有限公司asktopsec是做什么的?

深圳问顶安全科技有限公司&#xff0c;是一家专业的AI与应用安全公司。 全球领先的AI、Android、IOS应用安全解决方案提供商&#xff0c;官网&#xff1a;https://asktopsec.com 问顶安全主要为企业提供AI和应用安全服务 移动应用安全检测、移动应用安全加固、AI智能体安全、AI…

鸿蒙OS 5 架构设计探秘:从分层设计到多端部署

文章目录 鸿蒙OS架构设计探秘&#xff1a;从分层设计到多端部署一、鸿蒙的分层架构设计二、模块化设计的精髓三、智慧分发设计&#xff1a;资源的动态调度四、一次开发&#xff0c;多端部署的实践总结与思考 鸿蒙OS架构设计探秘&#xff1a;从分层设计到多端部署 最近两年来&a…

idea 没有 add framework support(添加框架支持)选项

在 IntelliJ IDEA 2023 中&#xff0c;若需通过设置手动添加 “添加框架支持” 菜单项&#xff0c;可按照以下步骤操作&#xff1a; 手动添加 “添加框架支持” 菜单项 打开设置 点击顶部菜单栏的 File&#xff08;文件&#xff09; -> Settings&#xff08;设置&#xff09…

计算机网络--传输层(2)

传输层核心机制深度解析 一、可靠传输实现机制 1. 校验和机制 技术原理&#xff1a; 使用16位二进制反码求和算法&#xff0c;计算范围包括TCP伪首部&#xff08;12字节&#xff09;、TCP首部&#xff08;20字节&#xff09;和数据部分接收端重新计算校验和&#xff0c;若与…

再探带权并查集

典型例题 Acwing 权值 故名思义&#xff0c;在带权并查集中&#xff0c;我们需要让每个节点携带一个**“权值”**。 那么这个权值应该是什么呢&#xff1f;其实答案就在并查集当中。 由于在并查集当中我们可以在 O ( 1 ) O(1) O(1) 时间内找到一个节点的根节点&#xff0c;那…

Vala编成语言教程-构造函数和析构函数

构造函数 Vala支持两种略有不同的构造方案&#xff1a;我们将重点讨论Java/C#风格的构造方案&#xff0c;另一种是GObject风格的构造方案。 Vala不支持构造函数重载的原因与方法重载不被允许的原因相同&#xff0c;这意味着一个类不能有多个同名构造函数。但这并不构成问题&…

本地部署Stable Diffusion生成爆火的AI图片

直接上代码 Mapping("/send") Post public Object send(Body String promptBody) { JSONObject postSend new JSONObject(); System.out.println(promptBody); JSONObject body JSONObject.parseObject(promptBody); List<S…

python爬虫WASM

WASM 一.WASM简介 1.1 WASM定义 ​ WebAssembly(简称wasm)是一个虚拟指令集体系架构(virtual ISA),整体架构包括核心的ISA定义、二进制编码、程序语义的定义与执行,以及面向不同的嵌入环境(如Web)的应用编程接口(WebAssembly API)。是一种运行在现代网络浏览器中的…

Docker镜像迁移方案

Docker镜像迁移方案 文章目录 Docker镜像迁移方案一&#xff1a;背景二&#xff1a;操作方式三&#xff1a;异常原因参考&#xff1a; 一&#xff1a;背景 比如机器上已经有先有的容器&#xff0c;但是docker pull的时候是失败的二&#xff1a;操作方式 1、停止正在运行的容器…

关于跨域问题(本地前端访问服务器端接口跨域出错)

问题来源&#xff1a; 当服务器封装了接口但是本地电脑端前端访问出现跨域问题。 解决方案&#xff1b; 1、使用ipconfig 查看本地电脑的ip地址 ipconfig 2、在后端接口处配置如下代码 allow_origins["http://本地ip地址:3001", # 局域网内其他设备访问的本地…

边缘计算 vs. 云计算,谁才是工业物联网的未来?

前言 在物联网&#xff08;IoT&#xff09;飞速发展的今天&#xff0c;边缘计算正在彻底改变数据的处理、存储和分析方式。传统的IoT设备数据通常需要发送到云端进行处理&#xff0c;但随着设备数量的激增&#xff0c;这种模式在延迟、带宽和安全性方面暴露出诸多局限。边缘计…

dell 台式机 电脑 纽扣电池 如何取下?

dell 台式机 电脑 纽扣电池 如何取下&#xff1f; 戴尔-optiplex-3060-塔式机-服务手册

NFC 智能门锁全栈解决方案:移动端、服务器、Web 管理平台

目录 一、系统整体架构 二、移动端 APP 开发 2.1 开发环境与基础准备 2.2 主要功能模块 2.3 示例代码&#xff08;Android/Kotlin 简化示例&#xff09; 三、后台服务开发 3.1 环境准备 3.2 主要功能 3.3 示例代码&#xff08;Node.js Express 简化示例&#xff09; …

DDR4、DDR5、固态硬盘(SSD)和机械硬盘(HDD)在连续读/写、随机读/写性能的对比分析

以下是关于DDR4、DDR5、固态硬盘&#xff08;SSD&#xff09;和机械硬盘&#xff08;HDD&#xff09;在连续读/写、随机读/写性能的对比分析&#xff0c;结合技术特性与应用场景的总结&#xff1a; 一、性能对比表格 存储类型连续读&#xff08;MB/s&#xff09;连续写&#x…

【AI】MAC版本本地Stable Diffusion web ui安装

文章目录 前言环境依赖homebrewpython3下载stable-diffusion-webui webui模型准备模型网站 中文页面设置提示词转汉语转英文controlnet安装controlnet模型下载 结尾 前言 目前&#xff0c;市面上已经出现了很多用Ai 绘图制作的作品&#xff0c;用于自媒体或者商业等。例如表情…

Linux 云服务器开放端口

首先找到你买服务器的官网&#xff0c;我这里是阿里云 点击这里的控制台 这里先点手动添加&#xff0c;再看自己是UDP还是TCP协议&#xff0c;找到对应的协议&#xff0c;目的就填你想开放的端口&#xff0c;源填所有IP/4 0.0.0.0 添加备注点击保存就开放好了。