Loading video...

Video Failed to Load

Go Home

Turn any AI Model into Reasoning Model with Deepseek r1 <thinking> Architecture. Models like GPT4o and Sonnet 3.5 are Implementation Models But a new breakthrough with Deepseek can make them a Reasoning model. Here's a step-by-step Explanation: 🧵

192,667 views • 1 year ago •via X (Twitter)

14 Comments

Cj Z 🎯's profile picture
Cj Z 🎯1 year ago

Deepseek r1 is an open source AI model competing against o1 model of OpenAI. Which is the Top-Notch Reasoning Model. How Reasoning Models work? User message → Chain of Thought steps → Output The CoT step is the main difference right now between r1 and o1

Cj Z 🎯's profile picture
Cj Z 🎯1 year ago

Deepseek reasoning is realtime, fast and more like human thoughts. o1 is slow and takes 3-4 minutes on average. But what if we use the reasoning power of r1 with model of our choice?

Cj Z 🎯's profile picture
Cj Z 🎯1 year ago

We can do that because r1 provivides the <thinking> </thinking> process in the API as reasoning_content. So we can actually use (Only the reasoning part) of r1 and give this context to any model like (Sonnet 3.5, GPT4o or Gemini Flash 2.0)

Cj Z 🎯's profile picture
Cj Z 🎯1 year ago

The results will be alot better because the Implementation Models now have the Thinking Monologue to understand the user query better. And best part, Deepseek works with OpenAI SDK so you don't need anything extra. Just follow the following steps.

Cj Z 🎯's profile picture
Cj Z 🎯1 year ago

Step 1: Create DeepSeek Client Using OpenAI SDK Initialize the DeepSeek client using the OpenAI SDK. This allows you to send requests to the DeepSeek API.

Cj Z 🎯's profile picture
Cj Z 🎯1 year ago

Step 2: Make a Request for DeepSeek Chat Completion Send a request to DeepSeek to generate a response. Include your input (e.g., a question or task) in the messages parameter.

Cj Z 🎯's profile picture
Cj Z 🎯1 year ago

Step 3: Extract reasoning_content from DeepSeek Response The response from DeepSeek will include a field called reasoning_content, which contains the reasoning or explanation behind the answer.

Cj Z 🎯's profile picture
Cj Z 🎯1 year ago

Step 4:Create OpenAI Client for GPT-4o Now, initialize the OpenAI client to use the GPT-4o model. This will allow you to send requests to OpenAI’s API.

Cj Z 🎯's profile picture
Cj Z 🎯1 year ago

Step 5:Add reasoning_content to System Prompt Combine the reasoning_content from DeepSeek with your original prompt. This will provide GPT-4o with additional context.

Cj Z 🎯's profile picture
Cj Z 🎯1 year ago

Step 6: Get Final Response from GPT-4o Send the combined prompt to GPT-4o and retrieve the final response.

Cj Z 🎯's profile picture
Cj Z 🎯1 year ago

Full Code for your reference.

Cj Z 🎯's profile picture
Cj Z 🎯1 year ago

This is a blessing in disguise for closed source models so they can enhance their performance. Why do we need to use r1 just for reasoning part? Because r1's output window is small (8k) and also it doesn't support tool calling and function calling right now.

Cj Z 🎯's profile picture
Cj Z 🎯1 year ago

So with this technique you can turn any AI model into a reasoning model. We did this in and removed o1 from the circuit now. GPT4o with structured output is providing o1 level responses with r1 reasoning injection. Try it out and Bookmark this.

FRANK E ELKINS's profile picture
FRANK E ELKINS1 year ago

Confused about AI? Get clarity today with Book VI - "The Rational Being!" Understand the benefits & risks, empower your future now by learning what AI really is and how it really works! Also check out the Free Weekly Newsletter "How Things Work: A Brief History of Reality"

Related Videos