Video yükleniyor...

Video Yüklenemedi

Ana Sayfaya Dön

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 görüntüleme • 1 yıl önce •via X (Twitter)

14 Yorum

Cj Z 🎯 profil fotoğrafı
Cj Z 🎯1 yıl önce

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 🎯 profil fotoğrafı
Cj Z 🎯1 yıl önce

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 🎯 profil fotoğrafı
Cj Z 🎯1 yıl önce

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 🎯 profil fotoğrafı
Cj Z 🎯1 yıl önce

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 🎯 profil fotoğrafı
Cj Z 🎯1 yıl önce

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 🎯 profil fotoğrafı
Cj Z 🎯1 yıl önce

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 🎯 profil fotoğrafı
Cj Z 🎯1 yıl önce

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 🎯 profil fotoğrafı
Cj Z 🎯1 yıl önce

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 🎯 profil fotoğrafı
Cj Z 🎯1 yıl önce

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 🎯 profil fotoğrafı
Cj Z 🎯1 yıl önce

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

Cj Z 🎯 profil fotoğrafı
Cj Z 🎯1 yıl önce

Full Code for your reference.

Cj Z 🎯 profil fotoğrafı
Cj Z 🎯1 yıl önce

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 🎯 profil fotoğrafı
Cj Z 🎯1 yıl önce

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 profil fotoğrafı
FRANK E ELKINS1 yıl önce

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"

Benzer Videolar