[Converge] Larger batch size?
size Batch
2023-09-27 14:23:24 时间
Ref: Effect of batch size on training dynamics
- Don’t decay the learning rate increase the batch size
- Hypothesis: larger batch sizes don’t generalize as well because the model cannot travel far enough in a reasonable number of training epochs.
- Finding: better solutions can be far away from the initial weights and if the loss is averaged over the batch then large batch sizes simply do not allow the model to travel far enough to reach the better solutions for the same number of training epochs.
大家一般都有这样的默认, 调大batch size就要增大学习率, 这是为什么呢?
在比较大batch和小batch时,一般默认都是相同epoch去比较,这样大batch训练iteration次数会更少, 此时如果学习率不做任何调整, 大batch训练更少iteration, 导致拟合程度较低, 精度也会低, 因此需要对学习率做调整, 一个大batch包含样本更多, 避免了小batch包含极端样本的情况, 方差更小, 意味着使用大batch计算下来的梯度方向更可信, 因此可以使用一个更大的learning rate
在比较大batch和小batch时,一般默认都是相同epoch去比较,这样大batch训练iteration次数会更少, 此时如果学习率不做任何调整, 大batch训练更少iteration, 导致拟合程度较低, 精度也会低, 因此需要对学习率做调整, 一个大batch包含样本更多, 避免了小batch包含极端样本的情况, 方差更小, 意味着使用大batch计算下来的梯度方向更可信, 因此可以使用一个更大的learning rate
盲目增大 Batch_Size 有何坏处?
内存利用率提高了,但是内存容量可能撑不住了。
跑完一次 epoch(全数据集)所需的迭代次数减少,要想达到相同的精度,其所花费的时间大大增加了,从而对参数的修正也就显得更加缓慢。
Batch_Size 增大到一定程度,其确定的下降方向已经基本不再变化。
Conclusion: use the default one.
相关文章
- C++-容器-string:删除string最后一个字符【str.pop_back()、str.erase(str.end()-1)、str=str.substr(0, str.size()-1)】
- 用vs2002实现tupe/Cons,以及对应的make,at,size,for_each操作
- STL容器-- fixed-size array 用法
- MySQL导入数据库1118错误解决方案[ERR] 1118 - Row size too large (> 8126). Changing some columns to TEXT or BLOB
- Spring Data Mongodb的API及案例(exists、gt、in、is、orOperator 、regex、size)
- mongodb:修改oplog.rs 的大小size
- Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mysqld variable and try again
- -bash: ulimit: core file size: cannot modify limit: Operation not permitted
- mobile webiste 中的css的font-size em及line-height等换算
- NR PDSCH(三) TB size determination
- 第20课:Spark Streaming中动态Batch Size实现初探
- Pytorch dataloader报错 RuntimeError: stack expects each tensor to be equal size, but got [4] at entry 0 and [5] at entry 1
- [译] 使用 CSS 的 font-size-adjust 属性改善网页排版
- 『0015』 - Solidity Types - 动态字节数组(Dynamically-sized byte array)、固定大小字节数组(Fixed-size byte arrays)、string之间的转换关系
- 测量uniform size 表空间中的bit map block 中的1 bit 能管理多少空间