Skip to content

fix(inspect): align GenerateConfig field names with current inspect-ai (fixes #1327) - #1328

Open
sk8ordie84 wants to merge 2 commits into
huggingface:mainfrom
sk8ordie84:fix/inspect-ai-generateconfig-fields
Open

fix(inspect): align GenerateConfig field names with current inspect-ai (fixes #1327)#1328
sk8ordie84 wants to merge 2 commits into
huggingface:mainfrom
sk8ordie84:fix/inspect-ai-generateconfig-fields

Conversation

@sk8ordie84

Copy link
Copy Markdown

Fixes #1327.

A fresh pip install lighteval resolves inspect-ai to the latest release, and lighteval eval crashes at startup for any model/task with a pydantic ValidationError, because three GenerateConfig field names in main_inspect.py no longer exist upstream.

Changes:

  • frequence_penaltyfrequency_penalty (typo; matches the inspect-ai field name)
  • log_probslogprobs (matches the inspect-ai field name)
  • response_format is passed through only when the installed inspect-ai still accepts it (GenerateConfig.model_fields check); otherwise it is ignored with a warning. The field was removed upstream in inspect-ai ≥ 0.3.141, so unconditionally passing it can never work there.

Verified on inspect-ai 0.3.257 (Python 3.12):

  • the repro command from the issue (lighteval eval mockllm/model "lighteval|gsm8k|0" --max-samples 4 --log-dir out) now completes and writes results;
  • --frequency-penalty 0.5 --logprobs are accepted and forwarded;
  • --response-format '{"type":"object"}' no longer crashes (ignored with a warning on current inspect-ai).

Note: the two renamed CLI flags were unusable on current installs (startup crash), so the rename does not break any working invocation. Happy to add a deprecation alias if preferred.

lighteval eval forwards its generation options to inspect_ai_eval_set(), which
passes anything it does not declare itself on to GenerateConfig. Three of those
names are not GenerateConfig fields in current inspect-ai, so the Inspect-backed
eval path raises a pydantic ValidationError at run time:

  frequence_penalty -> frequency_penalty
  log_probs         -> logprobs
  response_format   -> no longer a GenerateConfig field

The first two are now mapped at the call site, leaving the CLI parameters
unchanged. --frequency-penalty is added alongside the existing (misspelled)
--frequence-penalty so both spellings work; --log-probs is untouched, since a
Python field named logprobs does not require the flag to be renamed.

response_format is forwarded only when the installed GenerateConfig accepts it,
with a warning otherwise, so the flag keeps working on older inspect-ai and is
ignored rather than fatal on newer.

Fixes huggingface#1327
Reads the keyword names out of the inspect_ai_eval_set(...) call in
main_inspect.py rather than restating them, so it keeps checking the real call
site as that call site changes. Any name that inspect_ai.eval_set does not
declare must be a field the installed GenerateConfig accepts.

Fails on main today, naming frequence_penalty, log_probs and response_format.
@sk8ordie84
sk8ordie84 force-pushed the fix/inspect-ai-generateconfig-fields branch from b038d69 to 5c19f66 Compare September 11, 2026 12:31
@sk8ordie84

Copy link
Copy Markdown
Author

Status update, and a fix to my own patch.

My original patch renamed the CLI parameters, which would have broken existing
invocations using --frequence-penalty and --log-probs. That was unnecessary: the
bug is in what lighteval forwards to inspect_ai_eval_set, not in the CLI surface,
so the fix now sits at the call boundary. The existing CLI spellings remain
accepted; --frequency-penalty is added as an alias for the existing misspelled
flag, and --log-probs is left as it is.

I also re-checked the underlying problem against inspect-ai 0.3.263 on Python
3.12. The Inspect-backed eval path still raises a GenerateConfig ValidationError
with the names currently on main: frequence_penalty, log_probs and
response_format are not GenerateConfig fields in current inspect-ai. The patch
maps the first two at the call site and passes response_format only when the
installed GenerateConfig accepts it, warning otherwise. main_inspect.py is
unchanged since this PR was opened, so it still applies cleanly.

Added a regression test. It reads the keyword names out of the
inspect_ai_eval_set(...) call in main_inspect.py rather than restating them, so
it keeps checking the real call site as that call site changes. It fails on main
today, naming the three fields, and passes with this patch.

Happy to split the regression test into its own PR if that would make review
easier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

lighteval eval crashes on fresh install: GenerateConfig rejects frequence_penalty / log_probs / response_format with current inspect-ai

1 participant