fix(cache): make multi-split document IDs unique - #1368
Open
linhongyu510 wants to merge 1 commit into
Open
Conversation
linhongyu510
marked this pull request as ready for review
August 30, 2026 03:44
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1363.
LightevalTask._get_docs_from_split()currently restartsenumerate()for every evaluation split and assigns each document the numeric-string index. Multi-split tasks therefore produce duplicate IDs such as["0", "1", "0"].SampleCacheuses that ID as its per-task Parquet key, so collisions can crash cache reads or silently return one split's response for another split's document.This change prefixes the positional ID with the split name only when more than one split is requested:
validation:0,validation:1,test:00Compatibility
Single-split tasks keep their existing IDs and cache keys. Existing multi-split numeric cache rows no longer match the new split-aware IDs, so affected samples are recomputed once instead of being silently rebound. New split-aware rows can coexist with old rows and round-trip independently.
This focused fix does not add duplicate-ID validation inside
SampleCache; that broader defensive policy remains open for maintainer guidance on #1363.Duplicate-work check
I searched open PRs by issue number,
doc.id,split:index, multi-split cache, and sample-ID collision keywords. No open PR addresses #1363 or this collision.Tests
Baseline on
origin/main:['0', '1', '0']After this change:
uv run pytest tests/unit/tasks/test_lighteval_task.py -q: 4 passeduv run ruff check src/lighteval/tasks/lighteval_task.py tests/unit/tasks/test_lighteval_task.py: passeduv run ruff format --check src/lighteval/tasks/lighteval_task.py tests/unit/tasks/test_lighteval_task.py: passedgit diff --check: passedAn expanded cache-suite run produced 11 passed and 1 skipped; six
test_cache_decorator_presencesubtests require the optional vLLM backend and fail during placeholder attribute access on this macOS environment. They do not exercise the changed ID or cache path.AI assistance
AI assistance was used for investigation, implementation, test generation, and drafting this description. I reviewed the diff and ran every command reported above.