Repository navigation
Add Hugging Face Lighteval adapter - #178
Conversation
|
Warning Review limit reached
Next review available in: 40 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughThe PR adds a structural Lighteval adapter for per-sample JSON exports. It supports multiple detail shapes and field aliases, converts metrics into canonical records, rejects aggregate-only files, registers the adapter, and adds tests, fixtures, and documentation. ChangesLighteval adapter support
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant Caller
participant AdapterRegistry
participant LightevalAdapter
participant EvalData
Caller->>AdapterRegistry: submit Lighteval JSON export
AdapterRegistry->>LightevalAdapter: detect and parse payload
LightevalAdapter->>LightevalAdapter: resolve fields and convert detail rows
LightevalAdapter->>EvalData: return canonical evaluation data
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 5
🧹 Nitpick comments (1)
tests/fixtures/lighteval_PROVENANCE.md (1)
5-15: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winPin the fixture source to an immutable artifact.
The source identifies branch
main, and the retrieval path is elided. A reviewer cannot independently retrieve and verify the original Parquet artifact from this document. Record the full upstream commit or blob identifier and an artifact digest.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/fixtures/lighteval_PROVENANCE.md` around lines 5 - 15, Update the provenance documentation for the referenced Lighteval fixture to replace the mutable main-branch reference with the complete immutable upstream commit or blob identifier and the full retrieval path. Add the Parquet artifact’s digest, preserving the existing model, task, timestamp, and fixture details so the source can be independently retrieved and verified.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/adapters.md`:
- Around line 119-138: Document the Lighteval normalization rules in both
docs/adapters.md lines 119-138 and docs/input-formats.md lines 166-176: invalid
or unparseable metric values are skipped rather than raised, standard-error
fields are ignored, valid metrics preserve input order, and conflicting aliases
are treated as malformed. Add the same guidance next to the accepted Lighteval
input shape in both locations, while retaining the existing alias and
metric-selection descriptions.
In `@README.md`:
- Line 341: Update the Lighteval entry in the README to explicitly require JSON
input and state that Parquet files must first be converted, or link to
docs/input-formats.md for these requirements; ensure users are not directed to
pass details_*.parquet directly.
In `@src/evaltrust/adapters/lighteval.py`:
- Around line 203-207: Update _detail_rows() and the task-grouped parsing path
to scan every candidate row for a valid detail record instead of limiting
validation to the first 10 entries or requiring the first item to be
well-formed. Preserve filtering to dictionary rows and accept lists when any
later row matches _looks_like_detail(); add regressions covering a valid 11th
row and a task-grouped list with a malformed first item.
- Around line 248-262: The row-processing loop in _parse_to_records must
revalidate each mapping against the adapter’s detail fingerprint after
_extract_detail_fields and before _example_id. Skip and increment skipped for
rows missing required detail fields such as query, choices, or gold_index, while
preserving existing alias-conflict handling and valid-row emission.
- Around line 264-278: The loop around _metric_score currently increments
skipped for invalid metric fields even when the row emits a record, so
skipped_rows is not a row count. Remove bad_metrics-based increments and update
skipped only when row_had_record remains false; keep record creation and stderr
handling unchanged.
---
Nitpick comments:
In `@tests/fixtures/lighteval_PROVENANCE.md`:
- Around line 5-15: Update the provenance documentation for the referenced
Lighteval fixture to replace the mutable main-branch reference with the complete
immutable upstream commit or blob identifier and the full retrieval path. Add
the Parquet artifact’s digest, preserving the existing model, task, timestamp,
and fixture details so the source can be independently retrieved and verified.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 2b4f2cbf-ac22-4334-8a04-84741384d45e
📒 Files selected for processing (9)
README.mddocs/adapters.mddocs/input-formats.mdsrc/evaltrust/adapters/lighteval.pysrc/evaltrust/adapters/registry.pytests/fixtures/lighteval_PROVENANCE.mdtests/fixtures/lighteval_details_agieval_aqua_rat.jsontests/fixtures/lighteval_results_aggregate.jsontests/test_lighteval_adapter.py
|
Addressed the CodeRabbit review feedback in the latest commit:
Validation:
|
k-dickinson
left a comment
There was a problem hiding this comment.
thanks for contributing; this pr lgtm!
Summary
Fixes #168.
Adds a Hugging Face Lighteval adapter for structurally detecting and normalizing per-sample evaluation details into EvalTrust's canonical schema.
Supported input
The adapter accepts JSON representations of Lighteval per-sample detail records using either of the two official field-name forms currently encountered:
doc,metric, and optionalmodel_response__doc__,__metric__, and optional__model_response__Detection is based entirely on content structure and does not depend on filenames.
If both aliases for the same logical field are present, equal values are accepted; conflicting values are treated as malformed rather than silently choosing one.
Normalization
Aggregate-only Lighteval result files are detected and rejected with a specific explanation because they do not contain the per-example data required by EvalTrust.
Fixture provenance
The main fixture was converted from an official recent Lighteval reference-details Parquet artifact:
agieval:aqua-rat|0HuggingFaceTB/SmolLM2-1.7B-Instruct2025-11-0501bd59882e01ab82971e6ab07c7c39c69ab8664bIt retains the authentic
doc/metric/model_responsestructure while being reduced to three examples and having large token arrays truncated. Full provenance is documented alongside the fixture.Limitations
EvalTrust does not read native Parquet files directly. Lighteval per-sample details must first be represented as JSON.
The adapter targets the current documented and recently observed detail structures rather than claiming compatibility with every historical Lighteval export.
Validation
PYTHON=.venv/bin/python make test— passedgit diff --check— passedNo canonical-schema or dependency changes were required.
Summary by CodeRabbit
New Features
Documentation