惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
U
Unit 42
H
Help Net Security
博客园_首页
雷峰网
雷峰网
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
博客园 - 【当耐特】
Recent Announcements
Recent Announcements
Recorded Future
Recorded Future
aimingoo的专栏
aimingoo的专栏
爱范儿
爱范儿
C
CXSECURITY Database RSS Feed - CXSecurity.com
The Cloudflare Blog
S
Security @ Cisco Blogs
M
MIT News - Artificial intelligence
Cyberwarzone
Cyberwarzone
Cisco Talos Blog
Cisco Talos Blog
Spread Privacy
Spread Privacy
The GitHub Blog
The GitHub Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
K
Kaspersky official blog
MyScale Blog
MyScale Blog
阮一峰的网络日志
阮一峰的网络日志
C
CERT Recently Published Vulnerability Notes
V
Vulnerabilities – Threatpost
WordPress大学
WordPress大学
C
Cisco Blogs
G
Google Developers Blog
N
News and Events Feed by Topic
P
Palo Alto Networks Blog
Apple Machine Learning Research
Apple Machine Learning Research
Schneier on Security
Schneier on Security
博客园 - 聂微东
Security Latest
Security Latest
Security Archives - TechRepublic
Security Archives - TechRepublic
O
OpenAI News
云风的 BLOG
云风的 BLOG
IT之家
IT之家
PCI Perspectives
PCI Perspectives
Microsoft Security Blog
Microsoft Security Blog
NISL@THU
NISL@THU
小众软件
小众软件
Scott Helme
Scott Helme
大猫的无限游戏
大猫的无限游戏
L
LINUX DO - 最新话题
Microsoft Azure Blog
Microsoft Azure Blog
Simon Willison's Weblog
Simon Willison's Weblog
N
News and Events Feed by Topic
F
Fortinet All Blogs
The Last Watchdog
The Last Watchdog

Benson's blog

Enjoy life Internship AI on academic research How AI Will Change the Mobile Ecosystem Look ahead Goodbye 2025 Hacker News to Kindle Another project How to imporve english Introduction of Fraud detection PopTranslate Last day in netease Better idea between Copilot-typed and CLI-typed assistant Gemini-cli LLM Post-Training experience Papers I readed recently about LLM application Difference between LLMs and traditional computer technology GRPO Weekly-#26 AI Application Weekly-#25 AI infra and application Weekly-#24 First week as LLM inference engineer Weekly-#23 seeking job Weekly-#22 2025 New Year AutoSwitch Translate Goodbye 2024 Weekly-#20 Breaking of glass Cross Entropy Loss of Triton Weekly-#18 Cross Entropy Loss of Triton Weekly-#17 Triton Puzzles Weekly-#16 AutoBuilder Weekly-#15 Starting of tanble tennis Weekly-#14 Accident in life Weekly-#13 Trying of xiaohongshu Weekly-#12 summary of LLM acceleration Outline of LLM acceleration Weekly-#11 Copilot-type products Weekly-#10 Preparation for next journey Weekly-#9 Startup of YouTube Notes of flash-attention How to learn knowledge in new fields? Weekly-#8 Start Reading Notes of LoRA Acceleration of LLM - Matrix Multiplication Weekly-#8 Summary for two month Weekly-#7 Staying home Weekly-#6 Cost of PopTranslate Weekly-#5 Updating of PopTranslate Validated example of LLM acceleration Weekly-#4 First insight of LLM accelerate Weekly-#3 PopTranslate Weekly-#2 The fail of first product Weekly-#1 First week of indie develop slack迁移discord 雅思备考 2024Q3 中文博客合集 English Diary in May 五一游记 开始休假 离职前的状态 2024-01-01 duckdb 看懂的第一个PR learning english in October learning english in September learning english in August top hack news 收集 大模型调研 自动驾驶的小玩具 旅游 扬州+苏州 small talk of learning english 新年新气象-碎碎念 刷剧 感染新冠 强化学习简介 神经网络解释性 全局的模型无关解释方法合集 社区发现算法概览 图神经网络入门(GNN) 我的第一款 iOS APP AtCoder Beginner Contest 268 人的信息输入方式对比 重叠社区检测 人穷极一生到底在追求什么 重拾生活规划 社区发现算法 - Louvain 《幸福的方法》 读《人类简史》有感 妙峰山骑行 黑客帝国 特征交互 特征工程 累计局部效应图 模型解释性-PDP 模型解释性 Web3 入门科普 总结 2022.4 孪生网络做 query 相似度任务 Imagen DeBERTa 读论文 用CNN做query相似度任务
学习 2022.4
Benson · 2022-05-31 · via Benson's blog

1、dropout 和 cos 组合使用带来的问题

孪生网络中,如果 dropout 这一层用于 cos 计算相似度的话,预测阶段的输出值会比训练阶段的值更大,相差一个 dropout 值:$sim_score_{predict} = sim_score_{train} / dropout$ 这是训练和预测阶段 dropout 用法不一致带来的问题。

但这个问题包含一个假设:即 dropout 层所有神经元大小相差不多,正常用法中训练和预测要保持一致性也需要这个假设。 2022.4.3

2、Radam 和 adamW

Radam:adam + warmup,动态调整学习率,在训练初期降低学习率,解决 adam 总是找到效果不好的局部最优解的问题。 adamW:adam + 参数L2正则,取名跟 Radam 比较容易搞混。 2022.4.3

3、Xavier 参数初始化

Xavier 参数初始化能够保证神经网络输入层和输出层的方差保持一致,使得输入空间和输出空间的稀疏程度相似,梯度更加稳定。

图片来自:https://cs230.stanford.edu/section/4/

因为输入层和输出层维度不同,取平均,即 var=2/(dim_in + dim_out) 问题:那么,应该保证参数矩阵的哪一个维度 var=2/(dim_in + dim_out)呢? 我觉得保证 dim_in方差一定即可,但使用pytorch做实验发现两个维度的方差都是固定的该值,何必多此一举呢?很奇怪。 pytorch 实验代码

class="highlight">

1
2
3
4
5
6
7
8
9
import torch
import torch.nn as nn
torch.manual_seed(2022)
w = torch.empty(100, 200)
x = nn.init.xavier_normal_(w)
var = torch.var(x, axis = 0)
print (var.shape, torch.mean(var), torch.std(var), '\n')
var = torch.var(x, axis = 1)
print (var.shape, torch.mean(var), torch.std(var))

output:

class="highlight">

1
2
torch.Size([200]) tensor(0.0067) tensor(0.0010)
torch.Size([100]) tensor(0.0067) tensor(0.0007)

reddit提问被删,stackoverflow和知乎还没人回复,好惨。https://stackoverflow.com/questions/71747402/the-variance-of-which-dimension-is-2-dim-in-dim-out-in-xavier-parameter-init

苏神另外一个视角:从几何的角度看初始化策略,以一定均值和方差初始化参数矩阵时,参数矩阵是一个正交矩阵,正交矩阵一个重要的特点就是保证向量的模长不变,即 $||Wx||^{2}=||x||^{2}$,证明了以一定均值和方差初始化参数的有效性。但 Xavier 参数初始化的目标是保证输入和输出向量的方差不变,苏神几何视角是保证模长不变,当向量均值为0时,方差和模长只相差一个常数因子,目标是等价的,很棒。 https://spaces.ac.cn/archives/7180 2022.4.5

4、DEBERTA

论文:DEBERTA: DECODING-ENHANCED BERT WITH DISENTANGLED ATTENTION 源码: 1、self-attention 中求注意力向量时,将上下文关系和相对位置的关系分开计算 atenntion 注意力分数。 2、注意力增强:decode 中,将绝对位置编码加入到 Transformer 块之后、softmax 之前。 3、样本干扰:常规的对抗样本干扰比较类似样本增强的做法,微调样本使得模型保持结果不便,在NLP任务中,我们微调 embedding 层而不是输入样本,但随模型参数量增大(embedding 层增大?),干扰操作带来的抖动就越严重。该论文发现在 embedding 层进行 Layer Normalization 之后加入干扰,对模型效果提升比较明显,特别是在 large 模型中。 2022.4.16

Trending Tags