Lightning-AI / Lightning-AI/litData
Shuffle buffer for controlling sample correlation
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 614
- Forks
- 106
- Avg merge
- 15h 8m
- Merged PRs (30d)
- 22
Description
## 🚀 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:
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating StreamingDataloader and reading how it currently shuffles samples within chunks. Determine where a configurable sample-level shuffle buffer would fit; done means the dataloader provides the requested buffer behavior and improves mixing across correlated samples without breaking existing loading behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data-engineering
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100