Skip to content

Add opt-in parsing for Harmony final answers - #526

Merged
abhishekraok merged 5 commits into
mainfrom
codex/oct31-harmony-parser
Nov 10, 2026
Merged

abhishekraok merged 5 commits into
mainfrom
codex/oct31-harmony-parser

Conversation

@abhishekraok

Copy link
Copy Markdown
Collaborator

Codex · codex://threads/01a1326f-ed81-75e3-80e4-661392dbe4b5

Add -o response_parser=harmony to score only the final-channel body. Inline vLLM retains reserved delimiters before decoding and maps string stops through the actual decoded prefix. Alignment failures remain unscored when parsing is enabled. Predictions retain decoded/raw text and parser diagnostics. Existing specs, suites, and default hashes stay unchanged; the opt-in changes the task hash.

Reference: Harmony format and pinned tokenizer configuration. Addresses Harmony-final-answer (#398). Old token-stripped transcripts cannot be recovered unambiguously; other providers need delimiter-preserving output or native parsing.

Validation (uv run --frozen --no-group vllm):

  • ruff check src/ tests/
  • ruff format --check src/ tests/
  • ty check src/
  • pytest tests/ --ignore=tests/integration -v (Git 2.53; 5104 passed, 41 skipped)

Independent review findings are addressed. CPU regressions exercise local tokenizer → provider → runner → IFEval → saved predictions, custom stops within delimiter spellings and across channels, decoder-only special tokens, parse failures, byte normalization, and pinned hashes. A tokenizer-only probe verified the pinned real tokenizer with Transformers 5.8.1. No GPU evaluation or numerical parity claim.

@abhishekraok
abhishekraok requested a review from a team as a code owner October 31, 2026 19:14
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-10T01:16:39.736283Z 8e925b7 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@abhishekraok abhishekraok left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Written by Claude Code session fix-pr-review

Reviewed at 3ed88ac (after update from main). The parser, the stop-string alignment and the tests are solid; the opt-in keeps default hashes. No blockers, three things worth fixing or answering:

  1. Alternate spellings. README and the compatibility entry say gpt-oss uses <|im_start|>/<|meta_sep|>/<|im_sep|>. The pinned tokenizer (6cee5e81, tokenizer.json via tokenizers) decodes 200005-200008 as <|channel|>/<|start|>/<|end|>/<|message|>, and its added tokens contain none of im_start, meta_sep, im_sep, fim_suffix or ghissue. Where do those spellings come from? If no real gpt-oss tokenizer emits them, drop them from the docs and the regexes; as written, a ChatML model whose completion starts with <|im_start|> also takes the raw-decode path in the vLLM provider.
  2. Not opt-in in the provider. VLLMProvider.generate stores text_with_special_tokens (and may set response_parser_error) for every Harmony-starting completion, with or without response_parser=harmony, so every inline-vLLM gpt-oss run roughly doubles the saved text. The compatibility entry says the default output is unchanged; either gate it or say so.
  3. Silent pass-through. With vllm_server and no server-side reasoning parser, text arrives token-stripped (analysis...assistantfinal...), passes through unparsed with response_parser_found: false, and is scored as CoT plus answer, the original #398 failure. A warning when an opt-in task finishes with zero found would make that visible.

Merge-order note: this conflicts with empty-scoring-text (#523) in README.md and docs/result-compatibility.md (both insert at the same spot); whichever merges second needs a docs-only rebase.

@gregorybchris

Copy link
Copy Markdown
Collaborator

This review was generated by an agent following REVIEW_GUIDE.md. It is not from a human reviewer. Reply in the PR thread and a maintainer will follow up.

Nice, careful work on keeping this opt-in without moving existing hashes! One thing should be resolved before merge.

Blocking

  1. src/olmo_eval/evals/extract/reasoning.py:48-54 (also src/olmo_eval/inference/providers/vllm.py:321 and the README)

    The PR describes <|im_start|>/<|meta_sep|>/<|im_sep|> as "gpt-oss spellings" and cites the pinned tokenizer at 6cee5e81. I loaded that revision's tokenizer.json and tokenizer_config.json with the repo's Transformers 5.8.1. The only special tokens are the documented Harmony ones:

    <|startoftext|> <|endoftext|> <|return|> <|constrain|> <|channel|> <|start|> <|end|> <|message|> <|call|> <|endofprompt|>
    

    <|im_start|>, <|meta_sep|>, <|im_sep|>, <|im_end|>, <|fim_suffix|> and <|ghissue|> are not in the added tokens or the vocab, and get_added_vocab() doesn't return them.

    This matters for a few reasons:

    • The parser accepts and the docs advertise a format that the cited reference doesn't produce.
    • test_harmony_is_opt_in_and_idempotent uses only these spellings, so the main task-level test doesn't exercise the real gpt-oss tokens.
    • <|im_start|> is in harmony_starts in the vLLM provider. Any ChatML model whose completion starts with that token gets the raw re-decode and text_with_special_tokens, even without the parser enabled.

    Could you either cite the tokenizer or source that emits these spellings, or drop them from _HARMONY_HEADER, _HARMONY_END, the startswith tuple, harmony_starts and the README, and switch the fixture to the documented tokens?

Before merge

Please resolve the spelling question above. The branch also currently conflicts with main and needs a rebase. After that, you can merge once CI is green.

@gregorybchris gregorybchris left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This review was generated by an agent following REVIEW_GUIDE.md. It is not from a human reviewer. Reply in the PR thread and a maintainer will follow up.

Approving.

The pinned gpt-oss tokenizer has no <|im_start|>, <|meta_sep|> or <|im_sep|>
tokens, so drop those spellings from the parser and the vLLM raw re-decode,
which also stops ChatML completions from taking the Harmony path.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@abhishekraok

Copy link
Copy Markdown
Collaborator Author

Written by Claude Code session eval-metrics-handoff

Thanks, confirmed: at 6cee5e81 the tokenizer's added vocabulary has only the documented Harmony tokens, and <|im_start|>, <|meta_sep|> and <|im_sep|> encode as plain text. f9e33b3 drops those spellings (and <|im_end|>, <|fim_suffix|>, <|ghissue|>) from the parser, harmony_starts and the README, so ChatML completions no longer take the raw re-decode path. The fixtures now use the documented tokens, plus a case showing ChatML text passes through unparsed. Codex reviewed the fix and found no issues. I'll merge main once the conflicting PR lands.

# Conflicts:
#	README.md
#	docs/result-compatibility.md
#	src/olmo_eval/inference/providers/vllm.py
#	tests/providers/test_vllm_provider.py
@abhishekraok
abhishekraok added this pull request to the merge queue Nov 10, 2026
Merged via the queue into main with commit 779f1b6 Nov 10, 2026
8 checks passed
@abhishekraok
abhishekraok deleted the codex/oct31-harmony-parser branch November 10, 2026 01:31
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.

2 participants