Skip to content

[BUG] MMLU-Pro crashes on real tokenizers; OpenAI server drops model EOS list (eom_id), ignores stream/max_completion_tokens/seed, rejects all requests on ::1 #4014

Closed

Description

@Qubitium

Audit of main @ 5f5eaad. The server was run locally on 127.0.0.1 with tiny models and Llama-3.2-1B-Instruct, and exercised with curl and the official openai Python SDK.

Checked and working:

1. MMLU-Pro crashes before generating anything, on every real tokenizer (high for this feature)

gptqmodel/utils/mmlupro.py:196: length = len(tokenizer(prompt)["input_ids"][0]). For a single string, input_ids is a list[int], so [0] is the first token id and len() raises TypeError: object of type 'int' has no len(). tests/test_mmlupro_prompt_budget.py::_FixedTokenizer always returns a 2-D tensor, which hid it.

Fix: len(tokenizer(prompt)["input_ids"]), and make the test tokenizer return Python lists as HF tokenizers do. Also, when the vLLM/SGLang adapters are used, stop_strings is dropped (it isn't in _build_sampling_params' hf_keys), so generation runs past "Question:" (by reading the code; not run).

2. The OpenAI server overrides the model's EOS list with the tokenizer's single EOS (medium)

gptqmodel/utils/openai_server.py:374 passes eos_token_id=self.tokenizer.eos_token_id, replacing generation_config.eos_token_id, which for Llama-3.x is a list including 128008 <|eom_id|> and 128001. _sequence_end (:404) also checks only one id.

Llama-3.2-1B-Instruct tool call:

  • with generation_config: stops after 14 tokens at <|eom_id|>
  • through the server: runs 72 tokens, invents extra assistant turns and tool results, and still reports finish_reason: "stop"

The same pattern affects GLM-4.x and InternLM2.5 chat.

Fix: use generation_config.eos_token_id (or the union with the tokenizer's), and check all of them in _sequence_end.

3. Request fields silently ignored (medium-low)

  • stream=True: the official SDK receives 0 chunks, after a full generation.
  • max_completion_tokens=5 (the SDK's current name): generates 256 tokens.
  • seed is ignored.
  • OpenAiRequest (:288) accepts any unknown field without complaint.

Fix: implement SSE streaming or reject stream=True with 400, alias max_completion_tokens → max_tokens, honour seed, and use extra="forbid" (or warn).

4. serve(host="::1") rejects every request (low-medium; side effect of #3980)

_allowed_hosts_for (:523) allows "::1", but Starlette's TrustedHost check compares the bracketed "[::1]". Every request, including /health, returns 400 Invalid host header (curl -g http://[::1]:<port>/health). Fix: also allow "[::1]".

Minor, observed:

  • List-form message content (OpenAI content parts) returns 500 on the Qwen chat template.
  • A negative temperature returns 500 instead of 400.
  • There is no /v1/models endpoint.
  • completion_tokens counts the stop-string tokens.

🤖 Generated with Claude Code

Activity

  1. added
    bug
    on Nov 14, 2026
  2. Qubitium commented on Nov 14, 2026

    @Qubitium
    CollaboratorAuthor

    Follow-up on #4033: _restore_rng_state runs in a finally after _generation_lock is released, so it can overwrite the next request's seed. See #4051 item 4.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions