Fix max_tokens sent as a list by the litellm judge backend#1297
Open
AbhilakshSinghReen wants to merge 1 commit into
Open
Fix max_tokens sent as a list by the litellm judge backend#1297AbhilakshSinghReen wants to merge 1 commit into
AbhilakshSinghReen wants to merge 1 commit into
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.
Fixes #1296
What
JudgeLM.__call_litellmbuildsmax_tokenswith a trailing comma, making it a 1-tuple:litellm serializes that to the JSON array
[64]instead of the integer64, so the request body sent to the provider is malformed.Why it matters
Spec-compliant OpenAI-compatible servers reject the request with
400 Bad Request.JudgeLMthen retries 3x, gives up, and returns the stringas the judge's response — which is passed to
process_judge_response()and scored as if it were a real judgment. The result is silently corrupted judge scores rather than a loud failure.Evidence
Verified against a real vLLM server. Same server, same model, same prompt; the only variable is the tuple:
With this patch the judge call returns
200 OKand produces a real judgment.Full repro (including the captured wire payload showing
"max_tokens": [512]) is in the linked issue.Scope
litellmbackend is affected.vllm,transformers,openai/tgiandinference-providersall passself.max_tokensthrough directly.max_tokensis explicitly set on the judge (it defaults toNone, which skips the branch).mainand in the released0.13.0on PyPI.Note
Happy to add a regression test if you'd like one — the natural place is a unit test that stubs
litellm.completionand asserts themax_tokenskwarg is anint, since litellm isn't in the base test deps.