--batch-size
๐ฆ AthenaAI is an AI-powered ensemble machine-learning trading bot for PocketOption, built on BinaryOptionsToolsV2 โ Get it on GitLab
๐ฌ Need help? Join the Chipa Discord ยท โก Go no-code with ChipaEditor
Mini-batch size used when training the neural model.
| Type | int (samples per batch) |
| Default | 2048 |
| Maps to | TrainerConfig.nn_batch_size |
| Read in | train.py โ src/training/trainer.py (Trainer._train_nn()) โ src/training/torch_model.py (TorchMLPClassifier.fit()) |
What it does
_train_nn() passes nn_batch_size to TorchMLPClassifier(batch_size=...). In fit(), the training data becomes a TensorDataset wrapped in a DataLoader(ds, batch_size=self.batch_size, shuffle=True); each optimizer step processes one batch, moved to the training device (cuda/mps/cpu). Shuffling happens within the training set only โ the chronological train/holdout split from --test-split already happened, so no future data leaks in.
Batch size affects only the neural model; the sklearn online models use their own fixed chunk size (TrainerConfig.online_batch = 5000, not CLI-exposed).
Choosing a value
- Larger batches mean fewer optimizer steps per epoch (faster on GPU) but more GPU memory per step; the loss-visible effect of fewer, less noisy gradient updates can also change what learning rate works best.
- CUDA out of memory: lower this first โ the training guide suggests e.g.
--batch-size 512โ or shrink--hidden. The feature vectors are small, so at the default128,64network even 2048 is light on modern GPUs; OOM usually indicates a very large--hidden. - On CPU, very large batches gain little; values in the 256โ2048 range are all reasonable.
Examples
python train.py --batch-size 512 # if you hit GPU out-of-memory
python train.py --batch-size 4096 --lr 2e-3Interactions
--hiddenโ the other memory-footprint knob.--lrโ larger batches often tolerate/need a higher learning rate.--no-nnโ makes this flag a no-op.--cpuโ removes GPU memory limits from the equation.
See also
๐ฌ Unsure how this interacts with the rest of the configuration? Ask in the Chipa Discord โ or prototype strategies no-code with ChipaEditor.