Skip to content

Shuffle buffer for controlling sample correlation#797

Description

@Aceticia

馃殌 Feature

Add a sample level shuffle buffer like webdataset to StreamingDataloader, to make shuffling more random when datasets are built with some correlation.

Motivation

I have some data that correlates across samples when building, and I observe that when using a smaller number of workers, data correlation. This is because litdata only shuffles within chunk, so when the chunk is large and many samples in the chunk are correlated, the randomly drawn samples are still correlated with each other. Exact shuffle is, in general, not tractable - but a good heuristic can be to maintain a shuffle buffer explicitly like webdataset. As long as the buffer size is larger than a chunk, data correlation might be improved.

My case

Here's an example:
Image

The logged value is the sparsity of input. You can see that different clusters of sparsity persist for quite a while, likely because they are shuffling from the same chunk.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions