lm-eval pipeline integration (Tier 3 #6)
Source
docs/audits/2026-07-12-technical-due-diligence.md §Tier 3 #6 ("Eval pipeline integration with lm_eval"), Tier 3 #6
Description
The project ships a thin LmEvalAdapter wrapper at
src/llm/evaluation/harness/adapter.py that delegates to
lm_eval.evaluator.evaluate. The contract is leaky:
- No adapter from :class:
llm.models.DecoderModelto lm_eval'sHFLM-style interface (must hand-roll a wrapper each time). - Result objects are passed through opaquely — no structured
extraction of
acc/acc_norm/perplexityetc. into the project's reporting format. - No preset system — running
mmlurequires["mmlu"]plus remembering to passnum_fewshotand other kwargs.
This ticket closes the gap:
LlamaLmEvalLM— a minimallm_eval.api.model.LMsubclass that wraps a :class:DecoderModel+ tokenizer. Batched loglikelihood- greedy-until generation, matching what lm_eval expects from
HFLM. EvalPreset— a frozen dataclass carryingtask,num_fewshot,batch_size,limitand other benchmark kwargs. Ship three presets out of the box (mmlu,arc_easy,wikitext) and let users extend.- Strengthen
LmEvalAdapter: structured result extraction (single-task vs multi-task shapes,resultsvsgroups), CLI-friendlysummarize(results)that emits a Markdown table.
Acceptance criteria
- [ ]
src/llm/evaluation/harness/lm_eval_lm.pyexposesLlamaLmEvalLM(model, tokenizer, batch_size=8, max_length=None)implementing the lm_evalLMprotocol (loglikelihood,loglikelihood_rolling,generate_until). - [ ]
src/llm/evaluation/harness/presets.pyexposesEvalPresetdataclass and three built-in presets:MMLU_PRESET,ARCEASY_PRESET,WIKITEXT_PRESET. - [ ]
src/llm/evaluation/harness/adapter.pyextended withrun_preset(preset, model, tokenizer)andsummarize(results)helpers. - [ ]
lm_evalremains an optional dependency: importing the new modules never raises whenlm_evalis missing; instantiatingLlamaLmEvalLM/ callingadapter.evaluate()raises a clearImportErrorwith the install hint. - [ ] New
tests/evaluation/test_lm_eval_pipeline.py:EvalPresetconstruction +to_lm_eval_kwargs().summarize()flattens lm_eval's nested result shape into a flat dict (using a fixture result, not a real eval).- Soft-dependency contract:
LlamaLmEvalLMraises whenlm_evalis missing.
- [ ] Doc:
docs/guides/evaluation.mdsection on running benchmarks via the lm-eval pipeline.
Estimate
~2 weeks
Labels
audit-2026-07, v0.0.6-audit-followup, eval, correctness,
optional-dep