Skip to content

BatchSampler

gepa.strategies.batch_sampler.BatchSampler

Bases: Protocol[DataId, DataInst]

Yields the minibatch of trainset ids to propose from.

Multi-proposal sampling strategies call next_minibatch_ids once per task within a single iteration (state.i unchanged between calls). Implementations should return a different minibatch on each repeated call within an iteration, so parallel proposal tasks don't all share one minibatch.

Methods:

next_minibatch_ids(loader: DataLoader[DataId, DataInst], state: GEPAState) -> list[DataId]

Source code in gepa/strategies/batch_sampler.py
def next_minibatch_ids(self, loader: DataLoader[DataId, DataInst], state: GEPAState) -> list[DataId]: ...