lance-format / lance-format/lance
[feat] better support for filterable torch samplers
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 7.1k
- Forks
- 852
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 272
Description
Currently the ShardedBatchSampler does not support a filter. This is because it assigns index ranges to processes before scanning and, if we apply the filter during the scan, that will result in different processes getting a different number of rows. However, sampling and filtering is something we'd like to be able to support.
-
If the user knows the filter is not very selective (or the filtered rows are evenly distributed throughout the dataset) then we should let them use the
ShardedBatchSamplerwith a filter. The result will not be too far from ideal. This would require us to support a filtered "take scan" which we do not have today. -
We can use a reservoir sampler to jitter the inputs. With a large enough reservoir the result should be significantly reordered even if it isn't perfectly random.
-
We can first do a filtered scan to row ids (which could be stored as a compressed bitmap), shuffle the row ids, and then divide the shuffled ranges amongst the inputs. This will be the most random and balanced solution but it will require materializing the row ids.
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 the ShardedBatchSampler and the scan and filter paths it uses. Compare the filtered take scan, reservoir sampling, and materialized row-ID approaches, then define which approach should be implemented; done means filtered sampling works across processes with acceptable balance and reordering.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- pytorch, rust
- Domain
- machine-learning
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100