# DeepSeek-V3

Führen Sie DeepSeek-V3 aus, das modernste Open-Source-LLM mit außergewöhnlichen Schlussfolgerungsfähigkeiten auf CLORE.AI-GPUs.

{% hint style="success" %}
Alle Beispiele können auf GPU-Servern ausgeführt werden, die über [CLORE.AI Marketplace](https://clore.ai/marketplace).
{% endhint %}

{% hint style="info" %}
**Aktualisiert: DeepSeek-V3-0324 (März 2024)** — Die neueste Revision von DeepSeek-V3 bringt erhebliche Verbesserungen bei der Codeerzeugung, mathematischen Argumentation und allgemeinen Problemlösung. Siehe das [Changelog](#whats-new-in-deepseek-v3-0324) Abschnitt für Details.
{% endhint %}

## Warum DeepSeek-V3?

* **State-of-the-art** - Konkuriert mit GPT-4o und Claude 3.5 Sonnet
* **671B MoE** - 671B Gesamtparameter, 37B aktiv pro Token (effiziente Inferenz)
* **Verbesserte Schlussfolgerung** - DeepSeek-V3-0324 ist deutlich besser in Mathematik und Code
* **Effizient** - MoE-Architektur reduziert Rechenkosten im Vergleich zu dichten Modellen
* **Open Source** - Vollständig offene Gewichte unter MIT-Lizenz
* **Langer Kontext** - 128K Token Kontexfenster

## Was ist neu in DeepSeek-V3-0324

DeepSeek-V3-0324 (Revision März 2024) führt bedeutende Verbesserungen in Schlüsselbereichen ein:

### Codegenerierung

* **+8-12% bei HumanEval** im Vergleich zum ursprünglichen V3
* Besser bei Multi-Datei-Codebasen und komplexen Refaktorierungsaufgaben
* Verbessertes Verständnis moderner Frameworks (FastAPI, Pydantic v2, LangChain v0.3)
* Zuverlässiger bei der Erzeugung vollständigen, ausführbaren Codes ohne Auslassungen

### Mathematische Argumentation

* **+5% beim MATH-500** Benchmark
* Besserer schrittweiser Beweisaufbau
* Verbesserte numerische Genauigkeit bei mehrstufigen Problemen
* Erhöhte Fähigkeit, Fehler mitten in einer Lösung zu identifizieren und zu korrigieren

### Allgemeine Schlussfolgerungen

* Stärkere logische Deduktion und kausale Inferenz
* Besser bei mehrstufigen Planungsaufgaben
* Konsistentere Leistung bei Randfällen und mehrdeutigen Eingaben
* Verbesserte Befolgung von Anweisungen bei komplexen, mehrfachen Einschränkungen

## Schnelle Bereitstellung auf CLORE.AI

**Docker-Image:**

```
vllm/vllm-openai:latest
```

**Ports:**

```
22/tcp
8000/http
```

**Befehl (Mehrere GPUs erforderlich):**

```bash
python -m vllm.entrypoints.openai.api_server \
    --model deepseek-ai/DeepSeek-V3-0324 \
    --host 0.0.0.0 \
    --port 8000 \
    --tensor-parallel-size 8 \
    --trust-remote-code
```

## Zugriff auf Ihren Dienst

Nach der Bereitstellung finden Sie Ihre `http_pub` URL in **Meine Bestellungen**:

1. Gehen Sie zur **Meine Bestellungen** Seite
2. Klicken Sie auf Ihre Bestellung
3. Finden Sie die `http_pub` URL (z. B., `abc123.clorecloud.net`)

Verwenden Sie `https://IHRE_HTTP_PUB_URL` anstelle von `localhost` in den Beispielen unten.

### Überprüfen, ob es funktioniert

```bash
# Prüfen, ob der Dienst bereit ist
curl https://your-http-pub.clorecloud.net/health

# Verfügbare Modelle auflisten
curl https://your-http-pub.clorecloud.net/v1/models

# Version abrufen
curl https://your-http-pub.clorecloud.net/version
```

{% hint style="warning" %}
**Wichtig:** DeepSeek-V3 erfordert **8x A100 80GB** GPUs und erhebliche Downloadzeit. HTTP 502 kann 15–30 Minuten bestehen bleiben, während das Modell heruntergeladen wird.
{% endhint %}

## Modellvarianten

| Modell            | Parameter | Aktiv | Benötigter VRAM | HuggingFace                                                                                             |
| ----------------- | --------- | ----- | --------------- | ------------------------------------------------------------------------------------------------------- |
| DeepSeek-V3-0324  | 671B      | 37B   | 8x80GB          | [deepseek-ai/DeepSeek-V3-0324](https://huggingface.co/deepseek-ai/DeepSeek-V3-0324)                     |
| DeepSeek-V3       | 671B      | 37B   | 8x80GB          | [deepseek-ai/DeepSeek-V3](https://huggingface.co/deepseek-ai/DeepSeek-V3)                               |
| DeepSeek-V3-Base  | 671B      | 37B   | 8x80GB          | [deepseek-ai/DeepSeek-V3-Base](https://huggingface.co/deepseek-ai/DeepSeek-V3-Base)                     |
| DeepSeek-V2.5     | 236B      | 21B   | 4x80GB          | [deepseek-ai/DeepSeek-V2.5](https://huggingface.co/deepseek-ai/DeepSeek-V2.5)                           |
| DeepSeek-V2-Lite  | 16B       | 2.4B  | 16GB            | [deepseek-ai/DeepSeek-V2-Lite](https://huggingface.co/deepseek-ai/DeepSeek-V2-Lite)                     |
| DeepSeek-Coder-V2 | 236B      | 21B   | 4x80GB          | [deepseek-ai/DeepSeek-Coder-V2-Instruct](https://huggingface.co/deepseek-ai/DeepSeek-Coder-V2-Instruct) |

## Hardware-Anforderungen

### Volle Präzision

| Modell           | Minimum       | Empfohlen    |
| ---------------- | ------------- | ------------ |
| DeepSeek-V3-0324 | 8x A100 80GB  | 8x H100 80GB |
| DeepSeek-V2.5    | 4x A100 80GB  | 4x H100 80GB |
| DeepSeek-V2-Lite | RTX 4090 24GB | A100 40GB    |

### Quantisiert (AWQ/GPTQ)

| Modell           | Quantisierung | VRAM   |
| ---------------- | ------------- | ------ |
| DeepSeek-V3-0324 | INT4          | 4x80GB |
| DeepSeek-V2.5    | INT4          | 2x80GB |
| DeepSeek-V2-Lite | INT4          | 8GB    |

## Installation

### Verwendung von vLLM (empfohlen)

```bash
pip install vllm==0.7.3

# DeepSeek-V3-0324 (neueste, 8 GPUs)
python -m vllm.entrypoints.openai.api_server \
    --model deepseek-ai/DeepSeek-V3-0324 \
    --tensor-parallel-size 8 \
    --trust-remote-code \
    --host 0.0.0.0 \
    --port 8000

# Original V3 (noch verfügbar)
python -m vllm.entrypoints.openai.api_server \
    --model deepseek-ai/DeepSeek-V3 \
    --tensor-parallel-size 8 \
    --trust-remote-code \
    --host 0.0.0.0 \
    --port 8000
```

### Verwendung von Transformers

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

model_name = "deepseek-ai/DeepSeek-V3-0324"

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

messages = [{"role": "user", "content": "Erkläre Quantencomputing in einfachen Worten."}]
inputs = tokenizer.apply_chat_template(messages, return_tensors="pt").to(model.device)

outputs = model.generate(inputs, max_new_tokens=512, temperature=0.7)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
```

### Verwendung von Ollama

```bash
# DeepSeek-V3 herunterladen (erfordert erhebliche Ressourcen)
ollama pull deepseek-v3

# Oder leichtere Variante
ollama pull deepseek-coder-v2:16b

# Ausführen
ollama run deepseek-v3
```

## API-Nutzung

### OpenAI-kompatible API (vLLM)

```python
from openai import OpenAI

client = OpenAI(
    base_url="http://localhost:8000/v1",
    api_key="nicht benötigt"
)

response = client.chat.completions.create(
    model="deepseek-ai/DeepSeek-V3-0324",
    messages=[
        {"role": "system", "content": "Du bist ein hilfreicher KI-Assistent."},
        {"role": "user", "content": "Schreibe eine Python-Funktion, um Primzahlen zu finden."}
    ],
    temperature=0.7,
    max_tokens=1000
)

print(response.choices[0].message.content)
```

### Streaming

```python
stream = client.chat.completions.create(
    model="deepseek-ai/DeepSeek-V3-0324",
    messages=[{"role": "user", "content": "Erkläre maschinelles Lernen"}],
    stream=True
)

for chunk in stream:
    if chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="", flush=True)
```

### cURL

```bash
curl http://localhost:8000/v1/chat/completions \
    -H "Content-Type: application/json" \
    -d '{
        "model": "deepseek-ai/DeepSeek-V3-0324",
        "messages": [
            {"role": "user", "content": "Was ist die Hauptstadt von Frankreich?"}
        ],
        "temperature": 0.7
    }'
```

## DeepSeek-V2-Lite (Single GPU)

Für Nutzer mit begrenzter Hardware:

```bash
# Verwendung von vLLM
python -m vllm.entrypoints.openai.api_server \
    --model deepseek-ai/DeepSeek-V2-Lite \
    --trust-remote-code \
    --host 0.0.0.0

# Verwendung von Ollama
ollama run deepseek-coder-v2:16b
```

```python
# Verwendung von Transformers auf einer einzelnen GPU
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch

model = AutoModelForCausalLM.from_pretrained(
    "deepseek-ai/DeepSeek-V2-Lite",
    torch_dtype=torch.float16,
    device_map="cuda",
    trust_remote_code=True
)
tokenizer = AutoTokenizer.from_pretrained("deepseek-ai/DeepSeek-V2-Lite", trust_remote_code=True)
```

## Codegenerierung

DeepSeek-V3-0324 ist erstklassig für Code:

```python
prompt = """Schreibe eine Python-Klasse für einen binären Suchbaum mit:
- einfügen
- suchen
- löschen
- Inorder-Traversal
Fügen Sie Typannotationen und Docstrings hinzu."""

response = client.chat.completions.create(
    model="deepseek-ai/DeepSeek-V3-0324",
    messages=[{"role": "user", "content": prompt}],
    temperature=0.2  # Niedriger für Code
)

print(response.choices[0].message.content)
```

Erweiterte Codeaufgaben, in denen V3-0324 brilliert:

```python
# Multi-Datei-Refactoring
prompt = """Ich habe eine Flask-Anwendung mit dem gesamten Code in app.py (500 Zeilen).
Refaktoriere sie, um das Application-Factory-Muster mit Blueprints zu verwenden für:
- auth (Login, Registrierung, Logout)
- api (REST-Endpunkte)
- admin (Dashboard)
Zeige die komplette Dateistruktur und alle Dateien."""

response = client.chat.completions.create(
    model="deepseek-ai/DeepSeek-V3-0324",
    messages=[{"role": "user", "content": prompt}],
    temperature=0.1,
    max_tokens=4000
)
```

## Mathematik & Schlussfolgerung

```python
# Komplexes Mathematikproblem
prompt = """Beweise, dass für jede ganze Zahl n >= 1 die Summe 1^2 + 2^2 + ... + n^2 = n(n+1)(2n+1)/6 gilt.
Verwende vollständige Induktion und zeige alle Schritte deutlich."""

response = client.chat.completions.create(
    model="deepseek-ai/DeepSeek-V3-0324",
    messages=[{"role": "user", "content": prompt}],
    temperature=0.1  # Sehr niedrig für Mathematik
)

print(response.choices[0].message.content)
```

## Multi-GPU-Konfiguration

### 8x GPU (Vollständiges Modell — V3-0324)

```bash
python -m vllm.entrypoints.openai.api_server \
    --model deepseek-ai/DeepSeek-V3-0324 \
    --tensor-parallel-size 8 \
    --max-model-len 32768 \
    --gpu-memory-utilization 0.9 \
    --trust-remote-code
```

### 4x GPU (V2.5)

```bash
python -m vllm.entrypoints.openai.api_server \
    --model deepseek-ai/DeepSeek-V2.5 \
    --tensor-parallel-size 4 \
    --max-model-len 16384 \
    --trust-remote-code
```

## Leistung

### Durchsatz (Tokens/Sek)

| Modell                | GPUs         | Kontext | Tokens/sec |
| --------------------- | ------------ | ------- | ---------- |
| DeepSeek-V3-0324      | 8x H100      | 32K     | \~85       |
| DeepSeek-V3-0324      | 8x A100 80GB | 32K     | \~52       |
| DeepSeek-V3-0324 INT4 | 4x A100 80GB | 16K     | \~38       |
| DeepSeek-V2.5         | 4x A100 80GB | 16K     | \~70       |
| DeepSeek-V2.5         | 2x A100 80GB | 8K      | \~45       |
| DeepSeek-V2-Lite      | RTX 4090     | 8K      | \~40       |
| DeepSeek-V2-Lite      | RTX 3090     | 4K      | \~25       |

### Zeit bis zum ersten Token (TTFT)

| Modell           | Konfiguration | TTFT     |
| ---------------- | ------------- | -------- |
| DeepSeek-V3-0324 | 8x H100       | \~750ms  |
| DeepSeek-V3-0324 | 8x A100       | \~1100ms |
| DeepSeek-V2.5    | 4x A100       | \~500ms  |
| DeepSeek-V2-Lite | RTX 4090      | \~150ms  |

### Speichernutzung

| Modell           | Präzision | Benötigter VRAM |
| ---------------- | --------- | --------------- |
| DeepSeek-V3-0324 | FP16      | 8x 80GB         |
| DeepSeek-V3-0324 | INT4      | 4x 80GB         |
| DeepSeek-V2.5    | FP16      | 4x 80GB         |
| DeepSeek-V2.5    | INT4      | 2x 80GB         |
| DeepSeek-V2-Lite | FP16      | 20GB            |
| DeepSeek-V2-Lite | INT4      | 10GB            |

## Benchmarks

### DeepSeek-V3-0324 vs Konkurrenz

| Benchmark         | V3-0324 | V3 (ursprünglich) | GPT-4o | Claude 3.5 Sonnet |
| ----------------- | ------- | ----------------- | ------ | ----------------- |
| MMLU              | 88.5%   | 87.1%             | 88.7%  | 88.3%             |
| HumanEval         | 90.2%   | 82.6%             | 90.2%  | 92.0%             |
| MATH-500          | 67.1%   | 61.6%             | 76.6%  | 71.1%             |
| GSM8K             | 92.1%   | 89.3%             | 95.8%  | 96.4%             |
| LiveCodeBench     | 72.4%   | 65.9%             | 71.3%  | 73.8%             |
| Codeforces-Rating | 1850    | 1720              | 1780   | 1790              |

*Hinweis: MATH-500-Verbesserung von V3 → V3-0324 beträgt +5,5 Prozentpunkte.*

## Docker Compose

```yaml
version: '3.8'

services:
  deepseek:
    image: vllm/vllm-openai:latest
    ports:
      - "8000:8000"
    volumes:
      - ~/.cache/huggingface:/root/.cache/huggingface
    environment:
      - HUGGING_FACE_HUB_TOKEN=${HF_TOKEN}
    command: >
      --model deepseek-ai/DeepSeek-V2-Lite
      --host 0.0.0.0
      --port 8000
      --trust-remote-code
      --gpu-memory-utilization 0.9
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: all
              capabilities: [gpu]
```

## Zusammenfassung der GPU-Anforderungen

| Einsatzgebiet           | Empfohlene Konfiguration | Kosten/Stunde |
| ----------------------- | ------------------------ | ------------- |
| Volles DeepSeek-V3-0324 | 8x A100 80GB             | \~$2.00       |
| DeepSeek-V2.5           | 4x A100 80GB             | \~$1.00       |
| Entwicklung/Testing     | RTX 4090 (V2-Lite)       | \~$0.10       |
| Produktions-API         | 8x H100 80GB             | \~$3.00       |

## Kostenabschätzung

Typische CLORE.AI-Marktplatzpreise:

| GPU-Konfiguration | Stundensatz | Tagessatz |
| ----------------- | ----------- | --------- |
| RTX 4090 24GB     | \~$0.10     | \~$2.30   |
| A100 40GB         | \~$0.17     | \~$4.00   |
| A100 80GB         | \~$0.25     | \~$6.00   |
| 4x A100 80GB      | \~$1.00     | \~$24.00  |
| 8x A100 80GB      | \~$2.00     | \~$48.00  |

*Preise variieren je nach Anbieter. Prüfe* [*CLORE.AI Marketplace*](https://clore.ai/marketplace) *auf aktuelle Preise.*

**Geld sparen:**

* Verwenden Sie **Spot** Markt für Entwicklung (oft 30–50% günstiger)
* Bezahlen mit **CLORE** Token
* Verwenden Sie DeepSeek-V2-Lite zum Testen, bevor Sie hochskalieren

## Fehlerbehebung

### Kein Speicher mehr

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

# Oder Quantisierung verwenden
--quantization awq

# Für V2-Lite auf 12GB GPU
--gpu-memory-utilization 0.85
--max-model-len 4096
```

### Modell-Download langsam

```bash
# Vorab herunterladen
huggingface-cli download deepseek-ai/DeepSeek-V3-0324

# Oder Mirror verwenden
export HF_ENDPOINT=https://hf-mirror.com
```

### trust\_remote\_code-Fehler

```bash
# Fügen Sie diesen Flag immer für DeepSeek-Modelle hinzu
--trust-remote-code
```

### Multi-GPU funktioniert nicht

```bash
# Prüfe NCCL
nvidia-smi topo -m

# Setze NCCL-Variablen
export NCCL_DEBUG=INFO
export NCCL_P2P_DISABLE=0
```

## DeepSeek vs Andere

| Funktion   | DeepSeek-V3-0324  | Llama 3.1 405B | Mixtral 8x22B    |
| ---------- | ----------------- | -------------- | ---------------- |
| Parameter  | 671B (37B aktiv)  | 405B           | 176B (44B aktiv) |
| Kontext    | 128K              | 128K           | 64K              |
| Code       | **Ausgezeichnet** | Großartig      | Gut              |
| Mathematik | **Ausgezeichnet** | Gut            | Gut              |
| Min. VRAM  | 8x80GB            | 8x80GB         | 2x80GB           |
| Lizenz     | MIT               | Llama 3.1      | Apache 2.0       |

**Verwenden Sie DeepSeek-V3, wenn:**

* Beste Schlussfolgerungsleistung benötigt wird
* Codegenerierung die primäre Verwendung ist
* Mathematik/Logikaufgaben wichtig sind
* Eine Multi-GPU-Umgebung verfügbar ist
* Vollständig Open-Source-Gewichte (MIT-Lizenz) gewünscht sind

## Nächste Schritte

* [vLLM](https://docs.clore.ai/guides/guides_v2-de/sprachmodelle/vllm) - Bereitstellungsserver
* [DeepSeek-R1](https://docs.clore.ai/guides/guides_v2-de/sprachmodelle/deepseek-r1) - Auf Schlussfolgerungen spezialisiertes Varianten
* [DeepSeek Coder](https://docs.clore.ai/guides/guides_v2-de/sprachmodelle/deepseek-coder) - Code-spezifische Variante
* [Ollama](https://docs.clore.ai/guides/guides_v2-de/sprachmodelle/ollama) - Einfachere Bereitstellung
* [LLM feinabstimmen](https://docs.clore.ai/guides/guides_v2-de/training/finetune-llm) - Benutzerdefiniertes Training
