Skip to content

Add a regression test for truncated-then-full sample-cache runs#1291

Open
shipbehaves wants to merge 1 commit into
huggingface:mainfrom
shipbehaves:test/cache-subset-then-full
Open

Add a regression test for truncated-then-full sample-cache runs#1291
shipbehaves wants to merge 1 commit into
huggingface:mainfrom
shipbehaves:test/cache-subset-then-full

Conversation

@shipbehaves

Copy link
Copy Markdown
Contributor

Follow-up to #1040, where running with --max-samples 10 and then without it served back the cached truncated data.

On current main the reported symptom no longer reproduces. Verified two ways:

  • unit level: a subset run followed by a full run against the same cache returns the full set, reusing the already-cached docs and reprocessing only the missing ones (the @cached wrapper appends not-yet-cached docs to docs_not_cached and reloads the full requested set)
  • end to end on a fresh environment (pinned to 64f4f5a): lighteval accelerate on arc:challenge with --max-samples 10, then again without it, sharing the cache dir; the first run cached exactly 10 samples and the second run computed and returned all 1172

This PR adds a regression test that locks the per-doc contract so the original bug cannot silently come back: after a truncated run, a full run must return the full set, reuse the cached docs, and reprocess only the missing ones. The test uses DummyModel (no model download, CPU-only, runs in a few seconds) and was verified red-green by temporarily suppressing the reprocessing in get_samples_to_process_and_cache.

One observation from the end-to-end check, possibly worth a separate issue: the two runs landed in different task-hash cache slots. _get_task_hash hashes LightevalTaskConfig.__str__(lite=True), and that string includes the solver's function repr with a memory address ([<function multiple_choice.<locals>.solve at 0x...>]), which changes every process. So cache slots are currently never shared across CLI invocations for tasks with a solver, which quietly defeats cross-run reuse. Happy to open a small follow-up PR to stabilize the hash input (e.g. use qualified names instead of default function reprs) if useful.

Closes #1040

Running with --max-samples N and then again without it must not serve back
only the truncated cache. The cached decorator already handles this on the
current default branch: it reprocesses the docs that are not cached yet and
returns the full requested set while reusing the already-cached ones. Lock
that behavior with a DummyModel-based test (CPU-only, no model download)
that asserts the full set comes back, cached docs are reused, and only the
missing doc is reprocessed. Verified red-green by temporarily suppressing
the reprocessing.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] [eval] --max-samples 10 and then without, you get the cached data from the previous run.

1 participant