#Resoning Preservation Does Not Work

10 messages · Page 1 of 1 (latest)

gritty oliveBOT
#

@lilac cargo

Description:
I am trying reasoning preservation (https://openrouter.ai/docs/guides/best-practices/reasoning-tokens#example-preserving-reasoning-blocks-with-openrouter-and-claude). But I find it is not working.

What I've Tried:
I am asking the model to generate a 4-digit number in mind, and output the sum of the digits. I check the reasoning summary to ensure the reasoning content contains this number. Then, I passed the reasoning content back to the model and ask it to output this 4-digit number. However, all the models cannot recall this number, which means reasoning content preservation is broken.

API/Model: openai/gpt-5, google/gemini-3-pro-preview

OpenRouter Documentation

Learn how to use reasoning tokens to enhance AI model outputs. Implement step-by-step reasoning traces for better decision making and transparency.

#

I'm an AI assistant - my answers may be incorrect and I cannot see screenshots. Please verify information with the OpenRouter docs.

To help debug your reasoning preservation issue, I need a bit more information:

  1. Can you share the exact API request and response payloads you used—including how you passed the reasoning details back to the model?
  2. What is the full content of the reasoning block or reasoning_details you are passing in the follow-up call?
  3. Are you using the reasoning blocks exactly as returned by the first model call, without modification or truncation?

These details are essential to pinpoint if the problem is with the API usage, payload structure, or a model limitation.

-# This is an automated response powered by Answer HQ. Use !mute to stop the bot from responding, or !close when your question is resolved.

lilac cargo
#

I am using this script.

from openai import OpenAI

model = "gpt-5.2"

client = OpenAI(
  base_url="https://openrouter.ai/api/v1",
  api_key="sk-or-v1-",
)

# First API call with reasoning
response = client.chat.completions.create(
  model=model,
  # model="openai/gpt-5.2",
  messages=[
          {
            "role": "user",
            "content": "Please think ONLY ONE random 4-digit number in your mind. Calculate the product of the 4 digits minus the sum of the 4 digits. Your response should only include the final answer."
          }
        ],
  extra_body={"reasoning": {"effort": "high"}}
)

# Extract the assistant message with reasoning_details
response = response.choices[0].message
print(response.content)

# Preserve the assistant message with reasoning_details
messages = [
  {"role": "user", "content": "Please think ONLY ONE random 4-digit number in your mind. Calculate the product of the 4 digits minus the sum of the 4 digits. Your response should only include the final answer."},
  {
    "role": "assistant",
    "content": response.content,
    "reasoning_details": response.reasoning_details  # Pass back unmodified
  },
  {"role": "user", "content": "Please tell me the 4-digit number that you generated. If you do not remember the exact number, please say I don't know. "}
]
print(response.reasoning_details)

# Second API call - model continues reasoning from where it left off
response2 = client.chat.completions.create(
  model=model,
  messages=messages,
  extra_body={"reasoning": {"effort": "high"}}
)
print(response2.choices[0].message.content)
print(response2.choices[0].message.reasoning)
gritty oliveBOT
#

Thank you for providing your code and detailed description. Based on the reasoning tokens documentation:

  • "When providing reasoning_details blocks, the entire sequence of consecutive reasoning blocks must match the outputs generated by the model during the original request; you cannot rearrange or modify the sequence of these blocks."
  • The main purpose of reasoning block preservation is for tool use and multi-step tasks, to let the model "continue reasoning from where it left off." However, there is no guarantee that models will "recall" arbitrary internal thinking details such as a number they generated, especially if it is not part of the assistant message content.

The preservation of reasoning_details is primarily about allowing the model to maintain the logical context and flow for tasks like tool use, not necessarily as a memory mechanism for arbitrary hidden variables. The model may not have access to, or recall, the random value it generated in a previous turn unless the value is explicitly output or referenced in the conversation.

Key points from the docs:

  • "Preserving reasoning blocks is useful specifically for tool calling... Reasoning continuity: The reasoning blocks capture the model’s step-by-step reasoning that led to tool requests. When you post tool results, including the original reasoning ensures the model can continue its reasoning from where it left off."
  • "When continuing a conversation, preserve the complete reasoning_details when passing messages back to the model so it can continue reasoning from where it left off."
    Reasoning Tokens Guide

Summary:
What you are observing is expected b...

#

...ehavior. Reasoning preservation is not designed to let the model recall arbitrary internal values like a random number generated in its own reasoning block. It is designed for logical continuity in multi-step and tool-using conversations.

If you need the model to "remember" a value, include it explicitly in the assistant message content or as part of the conversation context.

For more details, please review the Reasoning Tokens Guide. If you believe your use case should work differently, contact mods through the Discord server for clarification.

-# This is an automated response powered by Answer HQ. Use !mute to stop the bot from responding, or !close when your question is resolved.

lilac cargo
#

!mute <@&1094455453599137872> <@&1384697330254610442> @austere python Could you help check this problem? Thank you.

gritty oliveBOT
#

🔇 Thread muted. The bot will no longer respond here.

austere python
#

this is dictated by the model's chat template