Post
227
** Extracting Reasoning Prompts with DeepSeek-R1: A Step Towards Better AI Reasoning **
Hi everyone! 👋
I’m excited to share a small but impactful project I’ve been working on, where I extracted **reasoning prompts** using the **DeepSeek-R1 model**. Reasoning prompts are a powerful way to understand how AI models arrive at their answers, and they can be used to train smaller, more efficient models to generate reasoning. Let me walk you through the process and explain why this is important.
---
#### **The Code: Extracting Reasoning Prompts**
Here’s the code I used to extract reasoning prompts from the
data: umarigan/deepseek-r1-reasoning-prompts
Hi everyone! 👋
I’m excited to share a small but impactful project I’ve been working on, where I extracted **reasoning prompts** using the **DeepSeek-R1 model**. Reasoning prompts are a powerful way to understand how AI models arrive at their answers, and they can be used to train smaller, more efficient models to generate reasoning. Let me walk you through the process and explain why this is important.
---
#### **The Code: Extracting Reasoning Prompts**
Here’s the code I used to extract reasoning prompts from the
openaccess-ai-collective/oo-gpt4-filtered
dataset:from tqdm import tqdm
import time
reasoning_data = []
for example in tqdm(ds, desc="answering"):
try:
response = client.chat.completions.create(
model='deepseek-reasoner', # Using DeepSeek-R1 for reasoning
messages=[
{"role": "system", "content": example['system_prompt']},
{"role": "user", "content": example['question']},
],
stream=False,
max_tokens=4096,
temperature=0.7,
)
answer = response.choices[0].message.content
reasoning = response.choices[0].message.reasoning_content
reasonng_example = {
"id": example['id'],
"question": example['question'],
'answer': answer,
'reasoning': reasoning,
}
reasoning_data.append(reasonng_example)
except Exception as e:
print(f"Error translating example: {e}")
time.sleep(3) # Wait for 3 seconds before continuing
continue # Skip the current example and move to the next one
data: umarigan/deepseek-r1-reasoning-prompts