Table of Contents

Property BatchSize

Namespace
LMKit.Finetuning
Assembly
LM-Kit.NET.dll

BatchSize

Gets or sets the size of the batches used for parallel training.

public int BatchSize { get; set; }

Property Value

int

The default value is 8. The minimum allowable value is 1.

Remarks

The batch size determines the number of samples processed in a single forward and backward pass (iteration).

Impact on Training Quality:

  • Larger batch sizes generally lead to more stable gradient estimates, which can improve training quality.
  • However, excessively large batch sizes may result in diminishing returns in terms of model accuracy improvement.

    Impact on Memory Usage:
  • Increasing the batch size will increase the memory (RAM) usage during training.
  • It is recommended to use the largest batch size that your hardware can support without running out of memory.

    Recommended Usage:
  • Experiment with different batch sizes to find the optimal balance between training speed, memory usage, and model accuracy.
  • Commonly used batch sizes range from 8 to 64, but this can vary based on the specific problem and hardware configuration.