Expose response length on BenchmarkRun - #8
Open
amargupta0428 wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Expose response length on BenchmarkRun
Closes #1
What and why
Computing model response length currently requires manually downloading and
parsing the eval logs referenced by
BenchmarkRun.logs(typically on S3) withInspect's
read_eval_log. This PR adds two methods toBenchmarkRunso theclient library handles that directly:
BenchmarkRun.read_eval_log(**kwargs)— fetches and parses the run's evallog from the URL in the
logsfield using Inspect'sread_eval_log. Extrakeyword arguments are passed through.
BenchmarkRun.response_lengths()— returns the response length, in outputtokens, for each sample in the run. Samples without recorded token usage
(e.g. failed samples) count as 0.
inspect-aiis imported lazily, so it remains an optional dependency: it isonly required when these methods are called, and a clear error message is
raised if it is missing. Existing users who don't need eval logs are
unaffected.
Usage
Implementation notes
inspect_ai.log.read_eval_logresolves thelogsURL itself, includings3://paths (S3 credentials must be configured as usual for Inspect).Tests
Added
tests/test_benchmark_run.py(plustests/conftest.pyproviding dummyAirtable env vars). Tests stub out the
inspect_ai.logmodule, so the suiteruns fully offline: