> For the complete documentation index, see [llms.txt](https://docs.clore.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.clore.ai/guides/guides_v2-de/sprachmodelle/deepseek-r1.md).

# DeepSeek-R1-Reasoning-Modell

Führe das Open-Source-Reasoning-Modell DeepSeek-R1 auf Clore.ai-GPUs aus

{% hint style="success" %}
Alle Beispiele laufen auf GPU-Servern, die über die [CLORE.AI-Marktplatz](https://clore.ai/marketplace). RTX-4090-Instanzen beginnen bei 0,14–0,42 $/Std.
{% endhint %}

## Überblick

DeepSeek-R1 ist ein Reasoning-Modell mit 671 Milliarden Parametern und offenen Gewichten, das im Januar 2025 von DeepSeek unter der **Apache 2.0** Lizenz veröffentlicht wurde. Es ist das erste offene Modell, das OpenAI o1 in Mathematik-, Coding- und wissenschaftlichen Benchmarks erreicht — und dabei seine gesamte Gedankenkette durch explizite `<think>` Tags offenlegt.

Das vollständige Modell verwendet **Mixture-of-Experts (MoE)** mit 37 Milliarden aktiven Parametern pro Token, wodurch Inferenz trotz der beeindruckenden Parameterzahl praktikabel bleibt. Für die meisten Praktiker sind die **destillierten Varianten** (1,5 Mrd. → 70 Mrd.) praktischer: Sie übernehmen R1s Reasoning-Muster durch Wissensdestillation in die Basisarchitekturen von Qwen-2.5 und Llama-3 und laufen auf Standard-GPUs.

## Hauptfunktionen

* **Explizite Gedankenkette** — jede Antwort beginnt mit einem `<think>` Block, in dem das Modell überlegt, zurückspringt und sich selbst korrigiert, bevor es eine endgültige Antwort ausgibt
* **Durch Reinforcement Learning trainiert** — die Reasoning-Fähigkeit entsteht aus RL-Belohnungssignalen statt aus von Hand erstellten Chain-of-Thought-Daten
* **Sechs destillierte Varianten** — 1,5B-, 7B-, 8B-, 14B-, 32B- und 70B-Parametermodelle, die aus dem vollständigen 671B-Modell in Qwen- und Llama-Architekturen destilliert wurden
* **Apache-2.0-Lizenz** — vollständig kommerziell, keine Lizenzgebühren, keine Nutzungsbeschränkungen
* **Breite Framework-Unterstützung** — Ollama, vLLM, llama.cpp, SGLang, Transformers und TGI funktionieren sofort
* **AIME 2024 Pass\@1: 79,8 %** — gleichauf mit OpenAI o1 in Wettbewerbs-Mathematik
* **Codeforces 2029 Elo** — übertrifft o1s 1891 im Programmierwettbewerb

## Modellvarianten

| Variante                        | Parameter        | Architektur  | FP16-VRAM | Q4 VRAM  | Q4-Datenträger |
| ------------------------------- | ---------------- | ------------ | --------- | -------- | -------------- |
| DeepSeek-R1 (vollständiges MoE) | 671B (37B aktiv) | DeepSeek MoE | \~1,3 TB  | \~350 GB | \~340 GB       |
| R1-Distill-Llama-70B            | 70B              | Llama 3      | 140 GB    | 40 GB    | 42 GB          |
| R1-Distill-Qwen-32B             | 32B              | Qwen 2.5     | 64 GB     | 22 GB    | 20 GB          |
| R1-Distill-Qwen-14B             | 14B              | Qwen 2.5     | 28 GB     | 10 GB    | 9 GB           |
| R1-Distill-Llama-8B             | 8B               | Llama 3      | 16 GB     | 6 GB     | 5,5 GB         |
| R1-Distill-Qwen-7B              | 7B               | Qwen 2.5     | 14 GB     | 5 GB     | 4,5 GB         |
| R1-Distill-Qwen-1.5B            | 1.5B             | Qwen 2.5     | 3 GB      | 2 GB     | 1,2 GB         |

### Eine Variante wählen

| Anwendungsfall                                           | Empfohlene Variante    | GPU auf Clore                                                                                                                 |
| -------------------------------------------------------- | ---------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| Schnelle Experimente, Edge-Tests                         | R1-Distill-Qwen-1.5B   | Beliebige GPU                                                                                                                 |
| Kostengünstiger Einsatz, schnelle Inferenz               | R1-Distill-Qwen-7B     | RTX 3090 (0,07–0,21 $/Std.)                                                                                                   |
| Optimal für den Produktiveinsatz auf einer einzelnen GPU | R1-Distill-Qwen-14B Q4 | [RTX 4090](https://clore.ai/rent-4090.html?utm_source=docs\&utm_medium=guide\&utm_campaign=deepseek-r1) (0,14–0,42 $/Std.)    |
| Beste Qualität pro Dollar (empfohlen)                    | R1-Distill-Qwen-32B Q4 | [RTX 4090 24 GB](https://clore.ai/rent-4090.html?utm_source=docs\&utm_medium=guide\&utm_campaign=deepseek-r1) oder A100 40 GB |
| Maximale destillierte Qualität                           | R1-Distill-Llama-70B   | 2× A100 80 GB                                                                                                                 |
| Forschung, vollständiges Reasoning                       | DeepSeek-R1 671B       | 8× H100-Cluster                                                                                                               |

### HuggingFace-Repositories

| Variante            | Repository                                                                                                    |
| ------------------- | ------------------------------------------------------------------------------------------------------------- |
| Vollständiges R1    | [deepseek-ai/DeepSeek-R1](https://huggingface.co/deepseek-ai/DeepSeek-R1)                                     |
| Llama-70B-Destillat | [deepseek-ai/DeepSeek-R1-Distill-Llama-70B](https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Llama-70B) |
| Qwen-32B-Destillat  | [deepseek-ai/DeepSeek-R1-Distill-Qwen-32B](https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Qwen-32B)   |
| Qwen-14B-Destillat  | [deepseek-ai/DeepSeek-R1-Distill-Qwen-14B](https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Qwen-14B)   |
| Llama-8B-Destillat  | [deepseek-ai/DeepSeek-R1-Distill-Llama-8B](https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Llama-8B)   |
| Qwen-7B-Destillat   | [deepseek-ai/DeepSeek-R1-Distill-Qwen-7B](https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Qwen-7B)     |
| Qwen-1,5B-Destillat | [deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B](https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B) |

## Anforderungen

{% hint style="warning" %}
**Multi-GPU-Rigs der 80GB-Klasse sind auf dem Clore.ai-Marktplatz nicht gelistet.** Die größten heute gelisteten Systeme sind 4× RTX PRO 6000 Blackwell (je 96 GB, 380 GB gesamt) und 8–11× RTX 5090 (je 32 GB). Kapazitäten für A100 / H200 / B200 werden als [Bare Metal](https://clore.ai/bare-metal) auf Anfrage verkauft. Prüfe [GPU-Preise & Verfügbarkeit](/guides/guides_v2-de/erste-schritte/pricing.md) bevor du eine Bereitstellung dimensionierst.
{% endhint %}

| Komponente | Minimum (7B Q4) | Empfohlen (32B Q4) |
| ---------- | --------------- | ------------------ |
| GPU-VRAM   | 6 GB            | 24 GB              |
| System-RAM | 16 GB           | 32 GB              |
| Festplatte | 10 GB           | 30 GB              |
| CUDA       | 12.8+           | 12.8+              |
| Docker     | 24.0+           | 25.0+              |

## Ollama-Schnellstart

Ollama übernimmt Quantisierung, Download und Bereitstellung automatisch — der schnellste Weg zu einem laufenden DeepSeek-R1.

### Installieren und ausführen

```bash
# Ollama installieren
curl -fsSL https://ollama.com/install.sh | sh

# Herunterladen und ausführen (Variante wählen):
ollama run deepseek-r1:1.5b    # Edge / Test
ollama run deepseek-r1:7b      # Budget — passt auf jede GPU mit 8 GB+
ollama run deepseek-r1:14b     # ideal für RTX 4090
ollama run deepseek-r1:32b     # A100 / 2× RTX 4090
ollama run deepseek-r1:70b     # 2× A100 80 GB
```

### Beispiel für eine interaktive Sitzung

```
>>> Beweise, dass √2 irrational ist.

<think>
Ich verwende einen Beweis durch Widerspruch.
Nehmen wir an, √2 ist rational, also √2 = p/q, wobei p und q ganze Zahlen mit ggT(p,q) = 1 sind.
Dann gilt 2 = p²/q², woraus p² = 2q² folgt.
Das bedeutet, p² ist gerade, also muss p gerade sein. Schreibe p = 2k.
Einsetzen: (2k)² = 2q² → 4k² = 2q² → q² = 2k².
Also ist q² ebenfalls gerade, was bedeutet, dass q gerade ist.
Aber wenn p und q beide gerade sind, dann ist ggT(p,q) ≥ 2, was unserer Annahme widerspricht.
</think>

**Beweis, dass √2 irrational ist (durch Widerspruch):**

Nehmen wir an, √2 = p/q in vollständig gekürzter Form (ggT(p,q) = 1). Quadrieren ergibt p² = 2q².
Da p² gerade ist, ist p gerade — schreibe p = 2k. Dann gilt 4k² = 2q², also q² = 2k²,
womit q ebenfalls gerade ist. Das widerspricht ggT(p,q) = 1. ∎
```

### Verwende die OpenAI-kompatible API

```bash
# Ollama als Server starten (falls noch nicht läuft)
ollama serve &

# Abfrage per curl
curl -s http://localhost:11434/v1/chat/completions \
  -H "Content-Type: application/json" \\
  -d '{
    "model": "deepseek-r1:32b",
    "messages": [{"role": "user", "content": "Factorisiere x^4 - 1 vollständig über den ganzen Zahlen."}],
    "temperature": 0.6
  }' | python3 -m json.tool
```

### Python-Client (über OpenAI SDK)

```python
from openai import OpenAI

client = OpenAI(base_url="http://localhost:11434/v1", api_key="ollama")

response = client.chat.completions.create(
    model="deepseek-r1:32b",
    messages=[
        {"role": "user", "content": "Schreibe eine Python-Funktion, um die längste palindromische Teilzeichenkette zu finden."}
    ],
    temperature=0.6,
    max_tokens=4096,
)
print(response.choices[0].message.content)
```

## vLLM-Produktionssetup

vLLM liefert den höchsten Durchsatz für die Bereitstellung für mehrere Nutzer mit Continuous Batching, PagedAttention und Prefix-Caching.

### Eine GPU — 7B / 14B

```bash
pip install vllm

# 7B auf jeder GPU mit 16 GB+
vllm serve deepseek-ai/DeepSeek-R1-Distill-Qwen-7B \
    --host 0.0.0.0 --port 8000 \
    --max-model-len 16384

# 14B auf RTX 4090 (24 GB)
vllm serve deepseek-ai/DeepSeek-R1-Distill-Qwen-14B \
    --host 0.0.0.0 --port 8000 \
    --max-model-len 16384 \
    --gpu-memory-utilization 0.92
```

### Mehrere GPUs — 32B (empfohlen)

```bash
vllm serve deepseek-ai/DeepSeek-R1-Distill-Qwen-32B \
    --host 0.0.0.0 --port 8000 \
    --tensor-parallel-size 2 \
    --max-model-len 32768 \
    --gpu-memory-utilization 0.90 \\
    --enable-prefix-caching
```

> **Tipp:** Der 32B Q4 GPTQ- oder AWQ-Checkpoint passt auf eine einzelne RTX 4090 (24 GB):
>
> ```bash
> vllm serve deepseek-ai/DeepSeek-R1-Distill-Qwen-32B \
>     --quantization awq --host 0.0.0.0 --port 8000 \
>     --max-model-len 16384
> ```

### Mehrere GPUs — 70B

```bash
vllm serve deepseek-ai/DeepSeek-R1-Distill-Llama-70B \
    --host 0.0.0.0 --port 8000 \
    --tensor-parallel-size 4 \
    --max-model-len 32768 \
    --gpu-memory-utilization 0.90
```

### Den vLLM-Endpunkt abfragen

```bash
curl -s http://localhost:8000/v1/chat/completions \
  -H "Content-Type: application/json" \\
  -d '{
    "model": "deepseek-ai/DeepSeek-R1-Distill-Qwen-32B",
    "messages": [{"role": "user", "content": "Löse: Finde alle Primzahlen p, sodass p^2 + 2 ebenfalls prim ist."}],
    "temperature": 0.6,
    "max_tokens": 4096
  }'
```

## Transformers / Python (mit `<think>` Tag-Parsing)

Verwende HuggingFace Transformers, wenn du eine feingranulare Kontrolle über die Generierung benötigst oder R1 in eine Python-Pipeline integrieren möchtest.

### Einfache Generierung

```python
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch, re

MODEL = "deepseek-ai/DeepSeek-R1-Distill-Qwen-7B"

tokenizer = AutoTokenizer.from_pretrained(MODEL, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
    MODEL,
    torch_dtype=torch.bfloat16,
    device_map="auto",
    trust_remote_code=True,
)

prompt = "Wie ist die Summe der ersten 100 positiven ganzen Zahlen?"
messages = [{"role": "user", "content": prompt}]
input_text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(input_text, return_tensors="pt").to(model.device)

with torch.no_grad():
    output = model.generate(
        **inputs,
        max_new_tokens=2048,
        temperature=0.6,
        do_sample=True,
    )

full_response = tokenizer.decode(output[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True)
print(full_response)
```

### Parsing `<think>` Tags

```python
def parse_r1_response(text: str) -> dict:
    """Teile eine DeepSeek-R1-Antwort in Denk- und Antwortteile auf."""
    think_match = re.search(r"<think>(.*?)</think>", text, re.DOTALL)
    thinking = think_match.group(1).strip() if think_match else ""
    answer = re.sub(r"<think>.*?</think>", "", text, flags=re.DOTALL).strip()
    return {
        "thinking": thinking,
        "answer": answer,
        "thinking_tokens": len(thinking.split()),
    }

result = parse_r1_response(full_response)
print(f"Das Modell hat für {result['thinking_tokens']} Wörter nachgedacht")
print(f"Antwort: {result['answer']}")
```

### Streaming mit `<think>` Zustandsverfolgung

```python
from openai import OpenAI

client = OpenAI(base_url="http://localhost:8000/v1", api_key="unused")

stream = client.chat.completions.create(
    model="deepseek-ai/DeepSeek-R1-Distill-Qwen-32B",
    messages=[{"role": "user", "content": "Leite aus ax² + bx + c = 0 die quadratische Formel her."}],
    stream=True,
    max_tokens=4096,
    temperature=0.6,
)

in_think = False
for chunk in stream:
    token = chunk.choices[0].delta.content or ""
    if "<think>" in token:
        in_think = True
        print("[Denkphase] ", end="", flush=True)
        continue
    if "</think>" in token:
        in_think = False
        print("\n[Antwort] ", end="", flush=True)
        continue
    if not in_think:
        print(token, end="", flush=True)
print()
```

## Docker-Bereitstellung auf Clore.ai

### Ollama Docker (am einfachsten)

**Docker-Image:** `ollama/ollama` **Ports:** `22/tcp, 11434/http`

```bash
# Auf der Clore-Instanz
docker run -d --gpus all \
    -v ollama_data:/root/.ollama \
    -p 11434:11434 \
    --name deepseek-r1 \
    ollama/ollama

# Modell herunterladen und bereitstellen
docker exec deepseek-r1 ollama pull deepseek-r1:32b
```

### vLLM Docker (Produktion)

**Docker-Image:** `vllm/vllm-openai:latest` **Ports:** `22/tcp, 8000/http`

```yaml
# docker-compose.yml
version: "3.8"
services:
  deepseek-r1:
    image: vllm/vllm-openai:latest
    ports:
      - "8000:8000"
    volumes:
      - hf_cache:/root/.cache/huggingface
    environment:
      - HUGGING_FACE_HUB_TOKEN=${HF_TOKEN:-}
    command: >
      --model deepseek-ai/DeepSeek-R1-Distill-Qwen-32B
      --host 0.0.0.0 --port 8000
      --tensor-parallel-size 2
      --max-model-len 32768
      --gpu-memory-utilization 0.90
      --enable-prefix-caching
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: all
              capabilities: [gpu]
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
      interval: 30s
      timeout: 10s
      retries: 5
      start_period: 300s
volumes:
  hf_cache:
```

Auf Clore.ai bereitstellen:

1. Öffnen [clore.ai/marketplace](https://clore.ai/marketplace)
2. Filtern nach **2× GPU, insgesamt 48 GB+ VRAM** (z. B. 2× RTX 4090 oder A100 80 GB)
3. Setze das Docker-Image auf `vllm/vllm-openai:latest`
4. Port zuordnen **8000** als HTTP
5. Füge den Befehl aus der obigen Compose-Datei in den Startbefehl ein
6. Verbinde dich über den HTTP-Endpunkt, sobald der Health-Check bestanden wurde

## Tipps für Clore.ai-Bereitstellungen

### Die richtige GPU wählen

| Budget        | GPU              | Tägliche Kosten | Beste Variante                       |
| ------------- | ---------------- | --------------- | ------------------------------------ |
| Minimal       | RTX 3090 (24 GB) | 0,30–1,00 $     | R1-Distill-Qwen-7B oder 14B Q4       |
| Standard      | RTX 4090 (24 GB) | 0,50–2,00 $     | R1-Distill-Qwen-14B FP16 oder 32B Q4 |
| Produktion    | A100 80 GB       | 3–8 $           | R1-Distill-Qwen-32B FP16             |
| Hohe Qualität | 2× A100 80 GB    | 6–16 $          | R1-Distill-Llama-70B FP16            |

### Performance-Optimierung

* **Temperatur 0,6** ist die empfohlene Standardvorgabe für Reasoning-Aufgaben — DeepSeeks eigene Arbeiten verwenden diesen Wert
* **Setze `max_tokens` großzügig** — Reasoning-Modelle erzeugen lange `<think>` Blöcke; 4096+ für nicht triviale Probleme
* **Prefix-Caching aktivieren** (`--enable-prefix-caching` in vLLM), wenn ein gemeinsamer Systemprompt verwendet wird
* **Parallelität begrenzen** (`--max-num-seqs 16`) für Reasoning-Workloads — jede Anfrage verwendet mehr Rechenleistung als ein Standard-Chat
* **Verwende Q4-Quantisierung** um 32B auf eine einzelne 24-GB-GPU mit minimalem Qualitätsverlust zu packen (das Destillat komprimiert R1s Wissen bereits)

### Überlegungen zur Kontextlänge

Reasoning-Modelle verbrauchen mehr Kontext als Standard-Chat-Modelle wegen des `<think>` Blocks:

| Aufgabenkomplexität           | Typische Denklänge | Benötigter Gesamtkontext |
| ----------------------------- | ------------------ | ------------------------ |
| Einfache Arithmetik           | \~100 Tokens       | \~300 Tokens             |
| Code-Generierung              | \~500–1000 Tokens  | \~2000 Tokens            |
| Wettbewerbs-Mathematik (AIME) | \~2000–4000 Tokens | \~5000 Tokens            |
| Mehrstufige Forschungsanalyse | \~4000–8000 Tokens | \~10.000 Tokens          |

## Fehlerbehebung

### Speicher erschöpft (OOM)

```bash
# Kontextlänge reduzieren
--max-model-len 8192    # statt 32768

# Gleichzeitige Sequenzen begrenzen
--max-num-seqs 8

# Quantisierung verwenden
--quantization awq      # oder gptq
```

### Modell erzeugt kein `<think>` Block

Einige Systemprompts unterdrücken das Denken. Vermeide Anweisungen wie „kurz fassen“ oder „erkläre deine Überlegungen nicht“. Verwende einen minimalen Systemprompt oder gar keinen:

```python
# Gut — erhält das Reasoning
messages = [{"role": "user", "content": "..."}]

# Schlecht — kann das Denken unterdrücken
messages = [
    {"role": "system", "content": "Sei extrem kurz. Keine Erklärungen."},
    {"role": "user", "content": "..."}
]
```

### Wiederholend oder in einer Schleife `<think>` Ausgabe

Senke die Temperatur, um die Zufälligkeit in der Reasoning-Kette zu verringern:

```python
temperature = 0.0   # Deterministisch — am besten für Mathe/Code
temperature = 0.3   # Leichte Variation — gut für Analysen
```

### Langsames erstes Token (hohes TTFT)

Das ist zu erwarten — das Modell erzeugt `<think>` Tokens vor der sichtbaren Antwort. Für latenzsensitive Anwendungen, bei denen kein Reasoning nötig ist, verwende [DeepSeek-V3](/guides/guides_v2-de/sprachmodelle/deepseek-v3.md) stattdessen.

### Download stockt auf der Clore-Instanz

HuggingFace-Downloads können bei einigen Anbietern langsam sein. Cache das Modell vorab in ein persistentes Volume:

```bash
# Einmal in ein Volume herunterladen
huggingface-cli download deepseek-ai/DeepSeek-R1-Distill-Qwen-32B \
    --local-dir /data/models/deepseek-r1-32b

# vLLM auf den lokalen Pfad zeigen lassen
vllm serve /data/models/deepseek-r1-32b --host 0.0.0.0 --port 8000
```

## Weiterführende Lektüre

* [DeepSeek-R1-Papier](https://arxiv.org/abs/2501.12948) — *Anreize für Reasoning-Fähigkeiten in LLMs mittels Reinforcement Learning*
* [DeepSeek-R1 GitHub](https://github.com/deepseek-ai/DeepSeek-R1) — Offizielles Repository mit Model Cards
* [DeepSeek-V3-Leitfaden](/guides/guides_v2-de/sprachmodelle/deepseek-v3.md) — Nicht-Reasoning-Allzweckmodell aus demselben Labor
* [vLLM-Anleitung](/guides/guides_v2-de/sprachmodelle/vllm.md) — Umfassendes Setup für den Produktiveinsatz
* [Ollama-Anleitung](/guides/guides_v2-de/sprachmodelle/ollama.md) — Einfache lokale Bereitstellung für jedes Modell
* [Open-WebUI-Leitfaden](/guides/guides_v2-de/sprachmodelle/open-webui.md) — Chat-Oberfläche mit nativer `<think>` Tag-Darstellung
* [Qwen 2.5-Leitfaden](/guides/guides_v2-de/sprachmodelle/qwen25.md) — Die Basisarchitektur, die von den meisten R1-Destillaten verwendet wird


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.clore.ai/guides/guides_v2-de/sprachmodelle/deepseek-r1.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
