> 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/mistral-small.md).

# Mistral Small 3.1

Deploye Mistral Small 3.1 (24B) auf Clore.ai — das ideale Single-GPU-Produktionsmodell

Mistral Small 3.1, veröffentlicht im März 2025 von Mistral AI, ist ein **24-Milliarden-Parameter-dichtes Modell** das weit über sein Gewicht hinaus schlägt. Mit einem 128K-Kontextfenster, nativen Vision-Funktionen, erstklassigem Function Calling und einer **Apache-2.0-Lizenz**, ist es wohl das beste Modell, das Sie auf einer einzelnen RTX 4090 ausführen können. Es übertrifft GPT-4o Mini und Claude 3.5 Haiku in den meisten Benchmarks und passt quantisiert bequem auf Consumer-Hardware.

## Hauptfunktionen

* **24B dichte Parameter** — keine MoE-Komplexität, unkomplizierte Bereitstellung
* **128K-Kontextfenster** — RULER-128K-Score von 81,2 %, schlägt GPT-4o Mini (65,8 %)
* **Native Vision** — Bilder, Diagramme, Dokumente und Screenshots analysieren
* **Apache-2.0-Lizenz** — vollständig offen für kommerzielle und persönliche Nutzung
* **Erstklassiges Function Calling** — native Tool-Nutzung mit JSON-Ausgabe, ideal für agentische Workflows
* **Mehrsprachig** — 25+ Sprachen einschließlich CJK, Arabisch, Hindi und europäischer Sprachen

## Anforderungen

| Komponente | Quantisiert (Q4) | Volle Präzision (BF16)   |
| ---------- | ---------------- | ------------------------ |
| GPU        | 1× RTX 4090 24GB | 2× RTX 4090 oder 1× H100 |
| VRAM       | \~16GB           | \~55 GB                  |
| RAM        | 32 GB            | 64 GB                    |
| Festplatte | 20 GB            | 50GB                     |
| CUDA       | 12.8+            | 12.8+                    |

**Clore.ai-Empfehlung**: RTX 4090 (0,14–0,42 $/Std.) für quantisierte Inferenz — bestes Preis-Leistungs-Verhältnis

## Schnellstart mit Ollama

Der schnellste Weg, Mistral Small 3.1 zum Laufen zu bringen:

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

# Mistral Small 3.1 ausführen (lädt automatisch ~14 GB Q4-Quantisierung herunter)
ollama run mistral-small3.1

# Oder eine bestimmte Quantisierung angeben
ollama run mistral-small3.1:24b-instruct-2503-q4_K_M
```

### Ollama als OpenAI-kompatible API

```bash
# Ollama-Server starten
ollama serve &

# Das Modell abrufen
ollama pull mistral-small3.1

# Über die API abfragen
curl http://localhost:11434/v1/chat/completions \
  -H "Content-Type: application/json" \\
  -d '{
    "model": "mistral-small3.1",
    "messages": [
      {"role": "system", "content": "Du bist ein hilfreicher Coding-Assistent."},
      {"role": "user", "content": "Schreibe einen Python-Decorator für Ratenbegrenzung"}
    ],
    "temperature": 0.15
  }'
```

### Ollama mit Vision

```bash
# Ein Bild zur Analyse senden
curl http://localhost:11434/api/chat -d '{
  "model": "mistral-small3.1",
  "messages": [{
    "role": "user",
    "content": "Was zeigt dieses Bild?",
    "images": ["/path/to/image.jpg"]
  }]
}'
```

## vLLM-Einrichtung (Produktion)

Für Produktions-Workloads mit hohem Durchsatz und gleichzeitigen Anfragen:

```bash
# vLLM installieren (v0.8.1+ erforderlich)
pip install -U vllm

# Überprüfen, ob mistral_common installiert ist (sollte automatisch geschehen)
python -c "import mistral_common; print(mistral_common.__version__)"
```

### Auf einer einzelnen GPU bereitstellen (nur Text)

```bash
vllm serve mistralai/Mistral-Small-3.1-24B-Instruct-2503 \
  --tokenizer-mode mistral \
  --config-format mistral \
  --load-format mistral \
  --tool-call-parser mistral \
  --enable-auto-tool-choice \\
  --max-model-len 32768 \
  --gpu-memory-utilization 0.90
```

### Mit Vision bereitstellen (2 GPUs empfohlen)

```bash
vllm serve mistralai/Mistral-Small-3.1-24B-Instruct-2503 \
  --tokenizer-mode mistral \
  --config-format mistral \
  --load-format mistral \
  --tool-call-parser mistral \
  --enable-auto-tool-choice \\
  --limit-mm-per-prompt 'image=10' \
  --tensor-parallel-size 2 \
  --max-model-len 65536
```

### Den Server abfragen

```python
from openai import OpenAI

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

response = client.chat.completions.create(
    model="mistralai/Mistral-Small-3.1-24B-Instruct-2503",
    messages=[
        {"role": "system", "content": "Du bist ein hilfreicher Assistent. Heute ist 2026-02-20."},
        {"role": "user", "content": "Schreibe eine vollständige REST-API in FastAPI mit CRUD-Operationen für einen Blog"}
    ],
    temperature=0.15,
    max_tokens=4096
)
print(response.choices[0].message.content)
```

## HuggingFace Transformers

Für die direkte Python-Integration und zum Experimentieren:

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

model_name = "mistralai/Mistral-Small-3.1-24B-Instruct-2503"

tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
    model_name,
    torch_dtype=torch.bfloat16,
    device_map="auto",
    load_in_4bit=True  # 4-Bit-Quantisierung — passt auf eine 24-GB-GPU
)

messages = [
    {"role": "system", "content": "Du bist ein hilfreicher Coding-Assistent."},
    {"role": "user", "content": "Implementiere einen binären Suchbaum in Python mit insert-, delete- und search-Methoden"}
]

input_ids = tokenizer.apply_chat_template(messages, return_tensors="pt").to(model.device)

output = model.generate(
    input_ids,
    max_new_tokens=2048,
    temperature=0.15,
    do_sample=True
)
print(tokenizer.decode(output[0][input_ids.shape[-1]:], skip_special_tokens=True))
```

## Beispiel für Function Calling

Mistral Small 3.1 ist eines der besten kleinen Modelle für die Tool-Nutzung:

```python
import json
from openai import OpenAI

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

tools = [
    {
        "type": "function",
        "function": {
            "name": "get_stock_price",
            "description": "Den aktuellen Aktienkurs für ein angegebenes Ticker-Symbol abrufen",
            "parameters": {
                "type": "object",
                "required": ["ticker"],
                "properties": {
                    "ticker": {"type": "string", "description": "Aktien-Tickersymbol (z. B. AAPL)"}
                }
            }
        }
    },
    {
        "type": "function",
        "function": {
            "name": "calculate_portfolio_value",
            "description": "Den Gesamtwert eines Portfolios anhand der Bestände berechnen",
            "parameters": {
                "type": "object",
                "required": ["holdings"],
                "properties": {
                    "holdings": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "ticker": {"type": "string"},
                                "shares": {"type": "number"}
                            }
                        }
                    }
                }
            }
        }
    }
]

response = client.chat.completions.create(
    model="mistralai/Mistral-Small-3.1-24B-Instruct-2503",
    messages=[{"role": "user", "content": "Wie hoch ist der aktuelle Preis von AAPL und MSFT?"}],
    tools=tools,
    tool_choice="auto",
    temperature=0.15
)

for tool_call in response.choices[0].message.tool_calls:
    print(f"Aufruf: {tool_call.function.name}({tool_call.function.arguments})")
```

## Docker-Schnellstart

```bash
# Bereitstellung auf einer einzelnen GPU
docker run --gpus all -p 8000:8000 \
  -v ~/.cache/huggingface:/root/.cache/huggingface \\
  vllm/vllm-openai:latest \
  --model mistralai/Mistral-Small-3.1-24B-Instruct-2503 \
  --tokenizer-mode mistral \
  --config-format mistral \
  --load-format mistral \
  --tool-call-parser mistral \
  --enable-auto-tool-choice \\
  --max-model-len 32768

# Mit Vision-Unterstützung (2 GPUs)
docker run --gpus all -p 8000:8000 \
  -v ~/.cache/huggingface:/root/.cache/huggingface \\
  vllm/vllm-openai:latest \
  --model mistralai/Mistral-Small-3.1-24B-Instruct-2503 \
  --tokenizer-mode mistral \
  --config-format mistral \
  --load-format mistral \
  --tool-call-parser mistral \
  --enable-auto-tool-choice \\
  --limit-mm-per-prompt 'image=10' \
  --tensor-parallel-size 2
```

## Tipps für Clore.ai-Nutzer

* **Die RTX 4090 ist der Sweet Spot**: Bei 0,14–0,42 $/Std. läuft Mistral Small 3.1 auf einer einzelnen RTX 4090 quantisiert mit reichlich Reserven. Bestes Kosten-/Leistungsverhältnis auf Clore.ai für ein universelles LLM.
* **Niedrige Temperatur verwenden**: Mistral AI empfiehlt `temperature=0.15` für die meisten Aufgaben. Höhere Temperaturen verursachen mit diesem Modell inkonsistente Ausgaben.
* **Auch die RTX 3090 funktioniert**: Bei 0,07–0,21 $/Std. läuft die RTX 3090 (24 GB) mit Q4-Quantisierung in Ollama problemlos. Etwas langsamer als die 4090, aber halb so teuer.
* **Ollama für schnelle Setups, vLLM für Produktion**: Mit Ollama haben Sie in 60 Sekunden ein funktionierendes Modell. Für gleichzeitige API-Anfragen und höheren Durchsatz wechseln Sie zu vLLM.
* **Function Calling macht es besonders**: Viele 24B-Modelle können chatten — nur wenige können zuverlässig Tools aufrufen. Das Function Calling von Mistral Small 3.1 ist auf Augenhöhe mit GPT-4o Mini. Erstellen Sie Agenten, API-Backends und Automatisierungspipelines mit Zuversicht.

## Fehlerbehebung

| Problem                               | Lösung                                                                                                                            |
| ------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| `OutOfMemoryError` auf einer RTX 4090 | Verwenden Sie ein quantisiertes Modell über Ollama oder `load_in_4bit=True` in Transformers. Vollständiges BF16 benötigt \~55 GB. |
| Ollama-Modell nicht gefunden          | Verwende `ollama run mistral-small3.1` (offizieller Bibliotheksname).                                                             |
| vLLM-Tokenizer-Fehler                 | Immer `--tokenizer-mode mistral --config-format mistral --load-format mistral`.                                                   |
| Schlechte Ausgabequalität             | Setze `temperature=0.15`. Fügen Sie einen System-Prompt hinzu. Mistral Small reagiert empfindlich auf die Temperatur.             |
| Vision funktioniert nicht auf 1 GPU   | Vision-Funktionen benötigen mehr VRAM. Verwenden Sie `--tensor-parallel-size 2` oder reduzieren Sie `--max-model-len`.            |
| Function Calls geben leer zurück      | Fügen Sie `--tool-call-parser mistral --enable-auto-tool-choice` für vLLM serve.                                                  |

## Weiterführende Lektüre

* [Mistral Small 3.1 auf HuggingFace](https://huggingface.co/mistralai/Mistral-Small-3.1-24B-Instruct-2503)
* [Mistral AI Blogbeitrag](https://mistral.ai/news/mistral-small-3-1/)
* [Ollama-Modellseite](https://ollama.com/library/mistral-small3.1)
* [vLLM-Dokumentation](https://docs.vllm.ai/)
* [Mistral Common Bibliothek](https://github.com/mistralai/mistral-common)
* [Mistral AI Plattform](https://console.mistral.ai/)


---

# 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/mistral-small.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.
