HOW-TO · INF

How to run DeepSeek-R1 reasoning models for complex problem-solving

intermediate15 minBy Fredoline Eruo
PREREQUISITES

DeepSeek-R1 model pulled via Ollama

What this does

DeepSeek-R1-style models are reasoning-optimized and may expose a reasoning trace before the final answer, depending on the runtime and model variant. This guide walks through running R1 for multi-step math, logic, and coding problems.

Steps

  1. Pull the R1 variant suited to your hardware.

    ollama pull deepseek-r1:32b
    

    Expected: Download and registration of the model.

  2. Run the model with a reasoning prompt.

    ollama run deepseek-r1:32b
    

    Input: "If a train leaves station A at 60 mph and another leaves station B at 80 mph, 300 miles apart, when do they meet?"

  3. Inspect the reasoning trace and final answer. Different runtimes expose reasoning differently. Treat hidden reasoning as implementation-specific, then verify the final answer with a known problem.

  4. Use the API for programmatic access.

    curl -s http://localhost:11434/api/generate \
      -d '{"model": "deepseek-r1:32b", "prompt": "Prove that sqrt(2) is irrational.", "stream": false}' \
      | jq -r '.response'
    

Verification

# Run a known math problem
ollama run deepseek-r1:32b "What is 1234 * 5678?"
# Expected: Correct answer 7,006,652 preceded by multi-step reasoning

Common failures

  • Model outputs generic text without reasoning: Ensure you are using the R1 variant (not base DeepSeek-V3). R1 is fine-tuned for chain-of-thought.
  • Extremely long reasoning chains: R1 can generate thousands of tokens in reasoning. Reserve num_ctx of at least 8192.
  • High latency: Use quantized R1 (q4_k_m) for faster inference on consumer GPUs.

Operator checkpoint

Before treating this as solved, write down the local runtime, model or package version, hardware/backend if relevant, and the verification output. This keeps the guide useful as a Will-It-Run style decision instead of a one-off command transcript.

Operator checkpoint

Before treating this as solved, write down the local runtime, model or package version, hardware/backend if relevant, and the verification output. This keeps the guide useful as a Will-It-Run style decision instead of a one-off command transcript.

Related guides

RELATED GUIDES