当前位置:网站首页>【小记】BatchSize的数值是设置的越大越好吗
【小记】BatchSize的数值是设置的越大越好吗
2022-08-11 04:12:00 【Time.Xu】
BatchSize的数值并不是设置的越大越好
通常我们可能会认为设置较大的batchsize时,模型的训练效果会比较好。原因有以下几点:
1、模型由于每次得到较多的训练数据,模型的下降方向会更加准确,模型训练曲线会更加平滑。
2、减少了训练时间。同样的epoch时,batchsize需要的batch数目减少了,所以处理速度变快了。
但是啊但是,
较大的batchsize有以下几点问题需要注意:
1、内存问题。较大的batch可能会造成内存/显存溢出
2、泛化能力下降。这一点是我之前没有考虑到的一点。使用太大的批处理大小可能会在训练期间对网络的准确性产生负面影响,因为它减少了梯度下降的随机性。
使用较小的批处理大小产生更不稳定、更随机的权重更新。这有两个积极的影响。首先,它可以帮助训练“跳出”之前可能陷入的局部最小值,其次,它可以使训练稳定在“更平坦”的最小值,这通常表明泛化性能更好。
怎么选取训练神经网络时的Batch size? - 知乎 (zhihu.com)
上面这篇链接里(侵删)指出:
- 当有足够算力时,选取batch size为32或更小一些。
- 算力不够时,在效率和泛化性之间做trade-off,尽量选择更小的batch size。
- 当模型训练到尾声,想更精细化地提高成绩(比如论文实验/比赛到最后),有一个有用的trick,就是设置batch size为1,即做纯SGD,慢慢把error磨低。
边栏推荐
- Leetcode 108. 将有序数组转换为二叉搜索树
- typedef defines the structure array type
- Read the article, high-performance and predictable data center network
- es-head plugin insert query and conditional query (5)
- 这些云自动化测试工具值得拥有
- LeetCode刷题第11天字符串系列之《 58最后一个单词长度》
- Mysql中事件和定时任务
- 多串口RS485工业网关BL110
- How to delete statements audit log?
- 【FPGA】day22-SPI协议回环
猜你喜欢

什么是机器强化学习?原理是什么?

Rotary array problem: how to realize the array "overall reverse, internal orderly"?"Three-step conversion method" wonderful array

es-head plugin insert query and conditional query (5)
![[C Language] Getting Started](/img/5e/484e3d426a6f1cc0d792a9ba330695.png)
[C Language] Getting Started

北湖区燕泉街道开展“戴头盔·保安全”送头盔活动

【FPGA】day22-SPI protocol loopback

Multi-serial port RS485 industrial gateway BL110

【yolov7系列三】实战从0构建训练自己的数据集

"98 BST and Its Verification" of the 13th day of leetcode brushing series of binary tree series

Differences and connections between distributed and clustered
随机推荐
Use jackson to parse json data in detail
洛谷P4847 银河英雄传说V2
MySQL database storage engine and database creation, modification and deletion
Interchangeability and Measurement Technology—Surface Roughness Selection and Marking Method
Interchangeability and Measurement Techniques - Tolerance Principles and Selection Methods
.NET service registration
洛谷P4061 大吉大利,晚上吃鸡
"3 Longest Substring Without Repeating Characters" on the 17th day of LeetCode brushing
堆排序 和冒泡排序
C# 一周入门高级编程之《C#-LINQ》Day Four
华南师范宋宇老师课堂对话论文翻译
How to learn machine learning?machine learning process
MYSQLg advanced ------ clustered and non-clustered indexes
Watch to monitor
LeetCode刷题第11天字符串系列之《 58最后一个单词长度》
【组成原理 九 CPU】
【FPGA】day21-移动平均滤波器
Callable实现多线程
Interchangeable Measurement Techniques - Geometric Errors
typedef defines the structure array type