Prediction in mini batches using brms

Suppose there is a successfully fitted brms model. The model is to be used to make predictions for a relatively large number of data points. If the prediction is done in one call, the process is killed due to memory usage. The idea is to process the data points in small batches. After each batch, the result is to be summarized on the draw level, which allows for reducing overall memory usage.

The question is in the order with which draws come out of the predict function. Is it safe to assume the order remains the same for all batches so that it is meaningful to group and combine on the draw level later on. In order words, do row 1 from invocation 1 and row 1 from invocation 2 correspond to the same posterior draw?

If you do not specify nsamples, then the order is preserved, yes. When using nsamples, draws are selected randomly which would kill the correspondence.