Repository navigation
Open
Description
Follow-up to the review of #281. The HELMET port copied a lot of RULER's structure. Today a fix to one copy has to be made by hand in the other, and the copies have already drifted: RULER stops on four newline tokens, while HELMET stops on one. This issue tracks merging the shared code so each fix lands in one place.
Everything below depends on #281 merging first, because that's where the HELMET code lives.
Main items
- One long-context task base. In
evals/tasks/helmet.py,HelmetTaskcopiesRulerTaskfromevals/tasks/ruler.pynearly line for line:__init__, template loading,instances, the metadata skeleton,format_request,request_typeandextract_answer. Move this to a shared base inevals/tasks/common/and make both tasks subclasses of it. - One task factory.
_make_ruler_task_classand_make_helmet_task_classare copies, docstrings included, and both register their classes throughtype(...)plusglobals()injection. Replace them with one registry helper that registers a single class with partial configuration, following the review guide. The stop-sequence drift goes away once there is a single factory. - Shared JSONL and Hub helpers.
_load_jsonlis defined indata/ruler_loader.py,data/helmet_loader.py,data/helmet_kilt_loader.pyanddata/helmet_msmarco_loader.py.- The
hf_hub_downloadwrapper withsilent_tqdmis copied betweenruler_loader.pyandhelmet_loader.py. - Move these, along with the generic
sample_jsonl_rowsandsample_jsonl_by_key, intodata/jsonl.py, plus a Hub-download helper whoserevisionargument is required.
Smaller items in the same area
- Truncation helpers.
_load_reference_tokenizerand_truncate_contextare private names inhelmet_infbench_loader.py, but four loaders import them. Move them into a shared HELMET module under public names. - Metric classes.
NDCGMetric,RougeLF1MetricandRougeLRecallMetricre-implementAccuracyMetric.compute. UseAccuracyMetric(name=..., scorer=...)instead. - ROUGE scorers.
RougeLF1ScorerandRougeLRecallScorerdiffer only in which score they read, so they could be one scorer with a field. - RULER's QA scorer.
RulerQAScorerandruler._normalize_answerduplicateSubstringExactMatchScorerand_squad_normalize_answer. Have RULER use the shared scorer, and make_squad_normalize_answerpublic, since three other modules already import it. - Gold-answer lookup. The "
all_gold_answers, elsegold_answer, wrapped in a list" logic appears about seven times. Make one helper. - Placement. The HELMET-specific scorers (
helmet_judge.py,helmet_summ_prompts.pyandalce.py) belong next to the task in anevals/tasks/helmet/package. In the other direction,HelmetExactMatchScorerbelongs incommon/scorers, andparse_rankingsbelongs with output parsing rather than in a data loader. - HELMET task subclasses. The HELMET subclasses differ only in which loader they call. Give each
HELMET_TASKSentry aloaderandloader_kwargsinstead, which also replaces the key-by-key copying in_generate_helmet_tasks.
Constraints
- Task hashes. Items 1, 2 and 7 touch RULER, and parts of the RULER configuration are serialized into the task hash (stop sequences, metrics). Either keep RULER's hashes unchanged or document the change, as Resolve named primary metrics to their Metric instance #453 does.
- RULER prompts. RULER renders the prebuilt
inputfield from its data files. HELMET's RULER recall tasks render from templates and fields, putting the answer prefix on its own line whereinputhas a space. The shared base needs to keep both behaviors.
Metadata
Metadata
Assignees
Labels
No labels
Activity