跳到主要内容Skip to main content

批大小与轮次Batch Size and Epochs

Batch Size and Epochs

  • 核心概念Core concepts
  • 第四站 · 看懂Station 4 · Under the Hood
  • 引用核验 2026-11-17refs checked 2026-11-17
解决什么问题What problem it solves

批大小是一次更新看多少样本,轮次是整套数据过几遍。Batch size is how many examples one update sees; an epoch is one full pass over the data.

这是什么What it is

批大小影响梯度噪声、显存占用和吞吐;轮次影响模型见过数据多少次。

两者与学习率耦合:批大小变了,合适的学习率通常也要变。

Batch size affects gradient noise, memory use and throughput; epochs affect how often the model sees the data.

Both couple with the learning rate: change the batch size and the suitable learning rate usually changes too.

An epoch is one pass over the dataset; batch size sets how many examples each update sees. Together they set the number of updates.
一个轮次把整套数据过一遍;批大小决定每次更新看多少条,二者共同决定参数更新次数。An epoch is one pass over the dataset; batch size sets how many examples each update sees. Together they set the number of updates.
为什么需要知道Why it matters

「训练 3 轮」不是通用配方;数据量、任务难度和过拟合信号决定该看多少遍。“Train for three epochs” is not a universal recipe. Data volume, task difficulty and overfitting signals decide how many passes are right.

别名Chinese aliases

batch size · epoch · 批次大小 · 训练轮次

出处Sources
  • PyTorch · 数据集与 DataLoader 教程PyTorch datasets and DataLoader tutorial ↗
  • PyTorch · 优化循环教程PyTorch optimization loop tutorial ↗