Deep analysis and code generation
1. Deep analysis and code generation
So we've explored a few prompting techniques and use cases, but how about when reasoning mode is needed?2. Recap...
Recall that DeepSeek reasons by default. The model produces a structured response that breaks complex tasks — like data analysis or writing code — into numbered steps, followed by a final answer. The whole thing arrives on the message's content attribute. You can tune the intensity with reasoning effort. The default is high; set it to max for a particularly hard task and the model will spend longer on each step. And remember, with reasoning active, the temperature parameter is silently ignored. Many of the prompting best practices we've discussed previously still stand, but there are some additions to consider for complex reasoning tasks.3. 1. Keep it simple
Firstly, keep prompts simple. Writing concise prompts is generally a good practice, but in reasoning mode, even providing examples can sometimes diminish performance. The few-shot prompts we wrote before may actually confuse the model when reasoning is enabled — it's designed to create its own reasoning steps, and providing too much guidance can interfere with this process.4. 2. Encourage reasoning
Second, actually encouraging the model to reason can enhance this capability. Adding something like this to the end of the prompt encourages the reasoning process. However, this additional performance will likely increase token usage and time-to-response, so consider the needs of the use case when adding this.5. 3. Stay away from simple tasks!
The last point is more around when to enable reasoning than how to use it; put bluntly, stay away from simple tasks! Consider simple tasks the domain of chat mode. With reasoning enabled, the model — when presented with simple tasks requiring a single or very few steps — can overthink and get lost during the thinking process. It may still get to the correct answer eventually, but at much greater cost and time taken than a chat-mode response. This is analogous to humans when asked a really simple question, it can sometimes cause us to doubt ourselves and hesitate on responding.6. 3. Stay away from simple tasks!
Ask DeepSeek for the result of 1+1 and here's what we get back. Even for the simplest possible arithmetic, the model still walks through structured steps before giving the answer — that's the default reasoning at work. For a question this simple, that step-by-step structure is overkill. It costs more tokens and takes longer than a direct chat-style answer would. As reasoning capabilities mature, models are getting better at skipping the formalism when it isn't needed — but for now, save its reasoning for the tasks that actually benefit from it. Let's apply these techniques to prompt the model to solve a multi-step coding problem.7. Example: Code debugging
Code debugging can be tricky. It's an iterative process of thinking, executing code, and updating our knowledge based on the code error or output. Does this sound familiar? This mirrors how the model thinks in reasoning mode,8. Example: Code debugging
so it's perfectly suited to this type of task.9. Example: Code debugging
Let's present the model with a task to fix some code. Notice that we use delimiters here to separate the task and inputs, which is also a good prompting practice. Let's see how the model responds.10. Example: Code debugging
Here's the abbreviated output. The model walks through each line of the function, identifies what's missing, and produces corrected code — all in a single structured response. Reasoning can save you hours in code debugging alone.11. Let's practice!
Let's get reasoning!Create Your Free Account
or
By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.