Skip to content

Add a strip_thinking task option that drops the reasoning trace before scoring - #361

Merged
abhishekraok merged 5 commits into
mainfrom
abhishekr/strip-thinking
Sep 9, 2026
Merged

abhishekraok merged 5 commits into
mainfrom
abhishekr/strip-thinking

Conversation

@abhishekraok

@abhishekraok abhishekraok commented Sep 8, 2026 •

Copy link
Copy Markdown
Collaborator

Claude Code · https://claude.ai/code/session_01RKJs8PPByCsRbgCucpXmLq — agent-written, Abhishek reviewed the request

Problem

Reasoning models emit <think>...</think> before the answer. Scorers that read output.text directly (IFEval constraints, PopQA containment, LLM judges) score the trace along with the answer: IFEval's "no commas" / word-count / keyword checks fail on the reasoning, and containment scorers credit entity names mentioned while thinking. oe-eval handles this with the r1_style output processor (oe_eval/models/output_processors.py); olmo-eval has no equivalent outside the safety tasks' answer_extractor, which output.text-based scorers never see.

Change

  • TaskConfig.strip_thinking: bool = False. When set, Task.strip_thinking_traces removes everything up to the last </think> (same regex as oe-eval). The runner calls it before score_responses in both scoring paths, so tasks that override score_responses (AstaBench SQA, ExpertQA, FrontierScience, LitSearch, ResearchQA, SAGE) are covered. Outputs with no closing tag are scored as-is, also matching oe-eval.
  • The pre-strip text is kept in output.metadata["original_text"] and written to the prediction row, so trace length and termination rate can be audited from the artifact (metadata is otherwise not serialized). Logprobs describe the whole generation, so BitsPerByteScorer and the prediction row's logits_per_char / bits_per_byte normalize by original_text when present; the row also carries num_chars_all next to num_chars.
  • strip_thinking is accepted as a -o task override; it can also be baked into a variant via register_variant(..., strip_thinking=True).

Usage

olmo-eval beaker launch ... -t ifeval -o max_tokens=32768 -o temperature=0.6 -o top_p=0.95 -o do_sample=true -o strip_thinking=true

Verification

  • ruff check / ruff format --check / ty check clean on the touched files; tests/evals/tasks/test_base.py, tests/cli/test_utils.py, tests/runners pass (103 tests).
  • Exercised on Beaker against an OLMoE3 latent-KDA Dolci-Think SFT checkpoint (smoke 01M21JA557YTZJJFPA897DXP2J): IFEval and a MATH chat variant scored only the post-</think> text (e.g. 1300 generated tokens, 915 visible characters), extracted answers came from the answer rather than the trace.
  • Tests: TestStripThinking in tests/evals/tasks/test_base.py (closed tag, last-tag-wins, unterminated, no tag, idempotence, default off, to_dict); tests/runners/test_strip_thinking_runner.py (a task overriding score_responses still sees stripped text through finalize_task); tests/runners/io/test_builders.py (original_text, num_chars_all, logprob normalization); tests/common/test_bits_per_byte_scorer.py. 154 tests pass across the touched areas.

Not included here: the olmo3adapt MATH/AIME chat variants that reproduce oe-eval's olmo3:adapt configs. They sit on abhishekr/paper-protocol and can follow as a separate PR.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RKJs8PPByCsRbgCucpXmLq

…e scoring

Reasoning models emit `<think>...</think>` before the answer. Scorers that read
output.text directly (IFEval constraints, PopQA containment, judges) then score
the trace as well as the answer: IFEval's "no commas" or word-count checks fail
on the reasoning, and containment scorers pick up entity names mentioned while
thinking. oe-eval handles this with the `r1_style` output processor; olmo-eval
had no equivalent outside the safety tasks' answer_extractor, which scorers
that use output.text never see.

`TaskConfig.strip_thinking` (default False; `-o strip_thinking=true` from the
CLI, or set on a variant) removes everything up to the last `</think>` in
`score_responses` before answer extraction, matching oe-eval's regex. Outputs
with no closing tag (budget exhausted mid-thought) are scored as-is, also as in
oe-eval. The pre-strip text is kept in `output.metadata["original_text"]` and
written to the prediction row, so trace length and termination rate can be
audited from the artifact; metadata is otherwise not serialized.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01RKJs8PPByCsRbgCucpXmLq
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 8, 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-08T23:59:16.950224Z e4c9c92 PR opened
ℹ️ 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: e4c9c92628

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

abhishekraok and others added 2 commits September 9, 2026 00:37
…e original text

Two review findings. Tasks that override score_responses (AstaBench SQA,
ExpertQA, FrontierScience, LitSearch, ResearchQA, SAGE) never reached the
strip inside Task.score_responses, so `-o strip_thinking=true` silently
scored the unstripped text there. The strip is now Task.strip_thinking_traces,
called by both runner scoring paths (results.score_and_store and
preparation.finalize_task) before score_responses; it is idempotent and a
no-op unless the config enables it.

Logprobs describe the whole generation, so bits_per_byte and logits_per_char
divided full-sequence logprobs by the stripped answer's length. BitsPerByteScorer
and build_predictions now normalize by original_text when present, and the
prediction row carries num_chars_all alongside num_chars.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01RKJs8PPByCsRbgCucpXmLq
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