Repository navigation
Add ruler-plus extending RULER evals to 2m tokens - #276
Conversation
Adds ruler_lc_* tasks and suites mirroring the existing RULER family (same scorers, prompting behavior, and task types) but reading pre-generated data from a local Weka path (jopetty/RULER) instead of the allenai/ruler_data HF release, extending context sizes up to 2097152 tokens (vs. the original 131072 cap). RulerTask is refactored to be extensible via _tasks_registry, _name_prefix, and _get_data_root() so RulerLcTask can reuse it without duplicating loading/registration logic. Existing ruler_* tasks are unaffected. Co-Authored-By: Claude Sonnet 5 <[email protected]>
undfined
left a comment
There was a problem hiding this comment.
Overall lgtm! 2 things to consider in comments.
…ition Renames the ruler-lc task/suite family to ruler-plus, switches data loading from a local Weka path to the allenai/ruler-plus HuggingFace dataset repo (downloaded via snapshot_download), and increases the per-condition sample limit from 100 to 512. Co-Authored-By: Claude Sonnet 5 <[email protected]>
undfined
left a comment
There was a problem hiding this comment.
Let's try and reduce the I/O and memory footprint a bit.
-
snapshot_download() fetches the entire ~109 GB repository for every task, even though each task needs only one shard. Can we download just the requested task/context file when possible?
-
The loader reads the full multi-GB shard before applying limit, so small runs still incur the full memory and I/O cost. Can we apply the limit while reading the data? Have we run the full suite without exhausting our system memory?
Addresses review feedback on PR allenai#276: snapshot_download() was pulling the entire ~109 GB allenai/ruler-plus repo per task even though each task only needs one shard, and the loader read a shard's full contents into memory before applying the sample limit. Switches to hf_hub_download() for the single requested shard, and reservoir-samples (Algorithm R) while streaming the JSONL instead of materializing the whole file, so peak memory is proportional to the sample limit rather than shard size. Co-Authored-By: Claude Sonnet 5 <[email protected]>
* Add ruler-lc: long-context RULER tasks/suites reading from local disk Adds ruler_lc_* tasks and suites mirroring the existing RULER family (same scorers, prompting behavior, and task types) but reading pre-generated data from a local Weka path (jopetty/RULER) instead of the allenai/ruler_data HF release, extending context sizes up to 2097152 tokens (vs. the original 131072 cap). RulerTask is refactored to be extensible via _tasks_registry, _name_prefix, and _get_data_root() so RulerLcTask can reuse it without duplicating loading/registration logic. Existing ruler_* tasks are unaffected. Co-Authored-By: Claude Sonnet 5 <[email protected]> * Rename ruler-lc to ruler-plus, load data from HF, and sample 512/condition Renames the ruler-lc task/suite family to ruler-plus, switches data loading from a local Weka path to the allenai/ruler-plus HuggingFace dataset repo (downloaded via snapshot_download), and increases the per-condition sample limit from 100 to 512. Co-Authored-By: Claude Sonnet 5 <[email protected]> * Dependabot too noisy for now (#286) * Download only the needed ruler-plus shard and stream-sample it Addresses review feedback on PR #276: snapshot_download() was pulling the entire ~109 GB allenai/ruler-plus repo per task even though each task only needs one shard, and the loader read a shard's full contents into memory before applying the sample limit. Switches to hf_hub_download() for the single requested shard, and reservoir-samples (Algorithm R) while streaming the JSONL instead of materializing the whole file, so peak memory is proportional to the sample limit rather than shard size. Co-Authored-By: Claude Sonnet 5 <[email protected]> --------- Co-authored-by: Claude Sonnet 5 <[email protected]> Co-authored-by: Tyler Murray <[email protected]>
b89bee1 to
1e8aba0
Compare
|
6aad682 addresses these points:
In local testing, setting |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #276 +/- ##
=======================================
Coverage ? 62.31%
=======================================
Files ? 501
Lines ? 42935
Branches ? 6660
=======================================
Hits ? 26756
Misses ? 14732
Partials ? 1447 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Update: this branch is merged with current @undfined, your 8/14 change request is addressed in 6aad682:
The data now comes from |
gregorybchris
left a comment
There was a problem hiding this comment.
This review was generated by an agent following
REVIEW_GUIDE.md. It is not from a human reviewer. Reply in the PR thread and a maintainer will follow up.
Nice extension. Loading one shard with hf_hub_download and streaming it is the right fix for a ~109 GB repo, and reusing RulerTask keeps prompting and scoring in one place. There are two things to fix before merge.
I found eight issues. The first two affect persisted per-instance results and task identity, so they should be fixed before merge. The next three cover parity with the existing RULER tasks, data availability, and missing tests. The rest are structure and nits.
What I checked: CI is green. Locally, ruff check, ruff format --check, and pytest tests/ --ignore=tests/integration pass (2793 passed). ty reports one warning in unrelated sandbox code. I confirmed that all 130 data/{size}/{task}/validation.jsonl paths in RULER_PLUS_TASKS exist in allenai/ruler-plus at b1c317b5. I also confirmed that the ruler-plus prompt (input + answer_prefix) matches the original RULER input string for niah_s_1__4096.
Blocking
-
src/olmo_eval/evals/tasks/ruler_plus.py:59
Many NIAH shards reuse the sameindexvalue for different records, sonative_idis not unique within a task. I loaded every 4096 shard and counted uniqueindexvalues out of 512 rows each:task unique ids / 512 niah_s_1 453 niah_s_2 364 niah_s_3 342 niah_mk_1 452 niah_mk_2 504 niah_mk_3 65 niah_mv 313 niah_mq 439 vt, cwe, fwe, qa_1, qa_2 512 The colliding rows are different samples. For example, index 636 in
niah_single_1appears three times with answers4226067,9153566, and3117788. I reproduced the effect end to end:get_task("ruler_plus_niah_mk_3__4096").instancesyields 512 instances with 65 distinctmetadata["id"]values. The original RULER shards I checked (niah_s_1__4096,niah_s_2__4096) have unique ids.build_predictionswritesmetadata["id"]asnative_id(src/olmo_eval/runners/io/builders.py:125). Pairwise analysis aligns and dedupes instances by(experiment_pk, task_hash, native_id)(src/olmo_eval/analysis/pairwise.py:701-705). With these shards, 447 of 512niah_mk_3__4096instances would silently drop out of pairwise comparisons, and per-instance rows in storage can't be told apart.Please derive the id from something unique per record, such as the row's line number in the shard, captured in the loader before sampling so it stays stable across
limitvalues. Please also add a test asserting that ids are unique across a shard with repeatedindexvalues. Separately, do you know why the generator emits duplicate indexes (index range 185 to 14680 for a 512-row shard)? If it runs in chunks that each restart numbering, the data may deserve a note on the dataset card.# ruler_plus_loader.py: tag each record with its row position before sampling for row, line in enumerate(f): ... record = json.loads(line) record["_row"] = row # ruler_plus.py "id": f"{doc.get('index', index)}_{doc['_row']}",
-
src/olmo_eval/data/ruler_plus_loader.py:48andsrc/olmo_eval/data/ruler_plus_loader.py:36
The data a task reads is not part of its identity.RulerTaskhas nodata_source, soTaskConfig.to_dict()serializesdata_source: None. The task hash is the same regardless of which data was loaded. Two paths change the data without changing the hash:hf_hub_downloadhas norevision, so it followsmain. Re-uploading any shard changes every future result under the same task hash and artifact name.OLMO_EVAL_RULER_PLUS_DATA_DIRswaps in arbitrary local data. I confirmed thatto_dict()is identical with and without the variable set.
Please pin the dataset revision (current head is
b1c317b593ffe0ea34ef3c045f5bb7842f797cc0). A future data change should then ship as a new revision under a versioned name (:v2), matching how we version other fixes.RULER_PLUS_REVISION = "b1c317b593ffe0ea34ef3c045f5bb7842f797cc0" ... return hf_hub_download( repo_id=RULER_PLUS_REPO_ID, repo_type="dataset", filename=filename, revision=RULER_PLUS_REVISION, )
For the env override, could we either drop it, or record its use somewhere persisted (for example the resolved data path in instance metadata, or a distinct task name)? That way a run on regenerated data can't be mistaken for a run on the published data. This gap is partly a framework problem.
RulerTaskloads data outside theDataSourceabstraction, so nothing about its data reaches the hash, and the original RULER tarball download is unpinned in the same way. A follow-up issue to route RULER-family data identity throughto_dictwould fix both.
Non-blocking
-
src/olmo_eval/data/ruler_plus_tasks.py:19-90
The generation budgets differ from the existingruler_*tasks at the same sizes. NIAH uses 128 here vs. 50 (100 for mk_3/mq, 250 to 300 for mv),cwe120 vs. 100,vt30 vs. 50, andqa_*32 vs. 50. The sample count also rises from 100 to 512 per condition. The new values look like upstream RULER'stokens_to_generate, whileruler_tasks.pyfollows HELMET. Could you state in the PR description and the module docstring which reference ruler-plus matches? Could you also post a small parity table comparingruler_plus_*__{4096..131072}withruler_*for one model? Otherwise readers will assumeruler_plus_niah__32768andruler_niah__32768are directly comparable. One specific concern:niah_mvat 128 tokens vs. 300 may truncate multi-value answers for verbose models. -
src/olmo_eval/data/ruler_plus_loader.py:24
allenai/ruler-plusis currently private (I could only read it with an authenticated token), so no one outside Ai2 can run these tasks. This follows up on the earlier review thread. Please either make the dataset public before merge, or name the tasks as internal and file an issue to make the data public. The generator is referenced as a personal fork (jopetty/RULER). Could the docstrings also pin the commit used to generate the data? -
No tests are added. Please add direct unit tests for:
load_ruler_plus_shard: reservoir sampling returnsmax_samplesrows, is deterministic for a seed, skips blank lines, and returns everything whenmax_samplesis None or exceeds the shard size.get_ruler_plus_data_file: the env-override path, and theFileNotFoundErrorfor a missing file.RulerPlusTask.process_doc: concatenatesanswer_prefix, returnsNonewithoutinput, and produces unique ids (finding 1).- Registration: all 130 tasks and the per-size suites are registered, and
ruler_plus_*names don't shadowruler_*ones.
A tiny JSONL fixture in
tests/andmonkeypatch.setenvcover all of this without network access. -
src/olmo_eval/evals/tasks/ruler.py:290
Makingmake_ruler_task_classpublic extends thetype(...)plusglobals()[...]class generation to a second module. The guide prefers__init_subclass__or one class withpartialconfiguration. The pattern predates this PR, so I'm not asking for the refactor here. Could you file an issue to replace it for both RULER families?
Nits
- Nit:
src/olmo_eval/evals/tasks/ruler.py:103_get_data_roothas no override.RulerPlusTaskoverrides_load_datainstead. Consider dropping the hook and its docstring mention until something needs it. - Nit:
src/olmo_eval/data/ruler_plus_tasks.py:110The per-sizemax_gen_toksdict branch is dead, since no ruler-plus entry uses a dict. - Nit:
src/olmo_eval/evals/suites/ruler_plus.py:4,41"all 13 tasks" is an exact count that will go stale. "All tasks" is enough. - Nit:
src/olmo_eval/data/ruler_plus_tasks.py:10CONTEXT_SIZEScould be a tuple. - Nit:
src/olmo_eval/evals/tasks/ruler_plus.py:49The hard-codedseed=42ignoresconfig.seed(inherited fromRulerTask). Every shard has exactly 512 rows, so at the default limit, sampling returns the whole shard and this only matters for--limitruns.
Before merge
Please fix the duplicate native_id values (blocking 1) and pin the dataset revision and handle the env override (blocking 2), each with a regression test. Please also resolve dataset visibility or file the internal-only issue (non-blocking 2). Once those land and CI is green, you may merge. Follow-up issues worth filing: routing RULER-family data identity through TaskConfig.to_dict, and replacing the dynamic class generation in ruler.py/ruler_plus.py.
The generator's `index` field is not a sample id: in niah.py it is overwritten with the needle's character offset, so it repeats within a shard (65 distinct values across 512 rows in niah_mk_3__4096). Instances now take their id from their row in the shard, recorded before sampling so it does not depend on the limit. Shards are downloaded at a pinned allenai/ruler-plus revision. Since the task hash does not cover RULER data, each instance records where its data came from, so runs on a local OLMO_EVAL_RULER_PLUS_DATA_DIR copy can be told apart from runs on the published data. Also: sample with config.seed, note that budgets follow upstream RULER rather than HELMET, drop the unused _get_data_root hook and per-size max_gen_toks branch, and add unit tests for the loader, task and suites. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
RULER vs RULER+ comparison run on
|
allenai/ruler-plus stays private: its haystacks include Paul Graham essay excerpts that we can't relicense for redistribution. Say so in the loader, task and suite docstrings, and turn the Hub's not-found error for a token without access into one that explains how to get the data. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Update: merged current Agent review (9/29), addressed in 0e1b83c Blocking
Non-blocking
Nits: all five done: The three reuse threads are answered inline (#454 / #455). @gregorybchris, could you take a look at the fixes above? |
There was a problem hiding this comment.
This review was generated by an agent following
REVIEW_GUIDE.md. It is not from a human reviewer.
Thanks, both blocking items are resolved at ab452f6.
- Unique ids.
ruler_plus_niah_mk_3__4096now yields 512 unique ids out of 512 instances (65 before), andniah_mv__4096yields 512 out of 512. Both checked against the real shards. - Data identity. The revision is pinned, and
metadata["data_source"]is written to the requests output, so a run on local data can be told apart from a run on the published data.
Visibility, budgets, tests and the nits are all addressed, and CI is green.
Adds
ruler_plus_*tasks and suites mirroring the existing RULER tasks/suites, but reading pre-generated data from theallenai/ruler-plusHuggingFace dataset, which extends context sizes from RULER's 131072 cap up to 2097152 tokens (4k → 2m, doubling at each step).Tasks:
ruler_plus_{task}__{size}for every RULER task at each of the ten context sizes. Suites:ruler_plus_{category}__{size}andruler_plus_all__{size}.Data loading: each task downloads only its own shard (
data/{size}/{task}/validation.jsonl) viahf_hub_downloadand streams it line by line, so a task never pulls the full ~109 GB repository or holds a whole shard in memory.OLMO_EVAL_RULER_PLUS_DATA_DIRoverrides the Hub with a local directory of the same layout for anyone who regenerates the data themselves.Comparability with
ruler_*: ruler-plus generation budgets follow upstream RULER's per-tasktokens_to_generate, with 512 samples per condition, whereasruler_*follows HELMET's budgets with 100 samples. Token counts also use the Dolma tokenizer. Scores are therefore not directly comparable at the same context size; see the RULER vs RULER+ comparison.Demo run: https://beaker.org/orgs/ai2/workspaces/linear-rnns/work/01KZPE3PYQN125A0Q52SMR3QJK?taskId=01KZPE3PYXRXJG0DASG01GYB6G&jobId=01KZPE3Q2C997APBS38DFVEA9N