Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[WIP] Remove interleaved thinking for MT thinking model#1135

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
natolambert wants to merge1 commit intomain
base:main
Choose a base branch
Loading
fromolmo-thinker-no-think-strip

Conversation

@natolambert
Copy link
Collaborator

@natolambertnatolambert commentedNov 3, 2025
edited by cursorbot
Loading

Note

Updatesolmo_thinker_no_think to parse assistant messages, extract<think> content, and emit it as a dedicated reasoning block only after the last user turn before the assistant’s final content.

  • Dataset preprocessing — Chat templates:
    • open_instruct/dataset_transformation.py:
      • olmo_thinker_no_think:
        • Tracklast_user_index acrossmessages.
        • For assistant turns, splitcontent to extract reasoning between<think> ... </think> and the remaining assistant text.
        • If the assistant turn is after the last user and reasoning exists, emit a consolidated'<think>...\n</think>' block before assistant content; otherwise output assistant content only.
        • Preserve existing handling forfunctions,function_calls, and message boundaries/EOS.

Written byCursor Bugbot for commitfaab9de. This will update automatically on new commits. Configurehere.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello@natolambert, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a new message formatting template,olmo_thinker_no_think, to theopen_instruct library. The primary purpose of this template is to standardize how conversational turns, particularly those involving the Olmo AI assistant, are structured. It specifically refines the presentation of the assistant's internal reasoning by extracting and consolidating 'thinking' content into a dedicated block, moving away from potentially interleaved formats. Additionally, it ensures consistent handling of system prompts and function calls across different message roles.

Highlights

  • New Jinja Template for Olmo: A new Jinja template,olmo_thinker_no_think, has been introduced inopen_instruct/dataset_transformation.py to manage message formatting for the Olmo AI assistant.
  • Structured Thinking Content: This template processes assistant messages to extract and format 'thinking' content, presenting it within<think> tags as a distinct block, which aligns with the goal of removing interleaved thinking.
  • Function Call Handling: The template includes logic for handling and formatting function calls for system, user, and assistant messages, ensuring they are properly integrated into the conversation structure.
  • Default System Prompt: A default system prompt for Olmo is automatically added if no system message is explicitly provided in the conversation history.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on ourdocumentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either/gemini <command> or@gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

FeatureCommandDescription
Code Review/gemini reviewPerforms a code review for the current pull request in its current state.
Pull Request Summary/gemini summaryProvides a summary of the current pull request in its current state.
Comment@gemini-code-assistResponds in comments when explicitly tagged, both in pull request comments and review comments.
Help/gemini helpDisplays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a.gemini/ folder in the base of the repository. Detailed instructions can be foundhere.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on@gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign uphere.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with theGemini Code Assist IDE Extension.

Footnotes

  1. Review thePrivacy Notices,Generative AI Prohibited Use Policy,Terms of Service, and learn how to configure Gemini Code Assist in GitHubhere. Gemini can make mistakes, so double check it anduse code with caution.

@natolambertnatolambertforce-pushed theolmo-thinker-no-think-strip branch from97f65c4 tofaab9deCompareNovember 3, 2025 19:40
Copy link
Contributor

@gemini-code-assistgemini-code-assistbot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new chat template,olmo_thinker_no_think, designed to remove interleaved thinking and control when reasoning is emitted. My review focuses on improving the robustness and consistency of this new template. I've identified a potential data loss issue in the parsing logic for the<think> block and an inconsistency in the default system prompt compared to otherolmo templates. The suggested changes aim to make the template more reliable and align it with existing conventions.

Comment on lines +429 to +433
"{% if '</think>' in assistant_content %}"
"{% set think_split = assistant_content.split('</think>') %}"
"{% set reasoning_content = think_split[0].rstrip('\\n').split('<think>')[-1].lstrip('\\n') %}"
"{% set assistant_content = think_split[-1].lstrip('\\n') %}"
"{% endif %}"
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The current logic for parsing the<think> block is fragile and can lead to data loss. Specifically, any content before the<think> tag is discarded. For example, if the assistant content isPreamble <think>reasoning</think> Answer, the preamble will be lost.

I suggest a more robust parsing logic that correctly handles content before and after the<think> block, and also ensures both<think> and</think> tags are present before attempting to split.

Suggested change
"{% if '</think>' in assistant_content %}"
"{% setthink_split= assistant_content.split('</think>') %}"
"{% setreasoning_content = think_split[0].rstrip('\\n').split('<think>')[-1].lstrip('\\n') %}"
"{% setassistant_content =think_split[-1].lstrip('\\n') %}"
"{% endif %}"
"{% if '<think>' in assistant_content and '</think>' in assistant_content %}"
"{% set_before_think, _after_think= assistant_content.split('<think>', 1) %}"
"{% set_reasoning, _after_reasoning = _after_think.split('</think>', 1) %}"
"{% setreasoning_content =_reasoning.strip() %}"
"{%set assistant_content = (_before_think ~ _after_reasoning).lstrip('\\n') %}{%endif %}"

"olmo_thinker_no_think": (
"{% set has_system = messages|selectattr('role', 'equalto', 'system')|list|length > 0 %}"
"{% if not has_system %}"
"{{ '<|im_start|>system\nYou are Olmo, a helpful AI assistant built by Ai2. Your date cutoff is December 2024, and your model weights are available at https://huggingface.co/allenai.<|im_end|>\n' }}"
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The default system prompt forolmo_thinker_no_think is missing information about function-calling capabilities. Otherolmo templates include this, and the rest of this template handles functions. This inconsistency could be confusing. For consistency, I suggest updating the default system prompt to mention functions, similar to otherolmo templates.

Suggested change
"{{ '<|im_start|>system\nYou are Olmo, a helpful AI assistant built by Ai2. Your date cutoff is December 2024, and your model weights are available at https://huggingface.co/allenai.<|im_end|>\n' }}"
"{{ '<|im_start|>system\nYou are Olmo, a helpful AI assistant built by Ai2. Your date cutoff is December 2024, and your model weights are available at https://huggingface.co/allenai. You do not currently have access to any functions. <functions></functions><|im_end|>\n' }}"

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

Reviewers

1 more reviewer

@gemini-code-assistgemini-code-assist[bot]gemini-code-assist[bot] left review comments

Reviewers whose approvals may not affect merge requirements

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@natolambert

[8]ページ先頭

©2009-2025 Movatter.jp