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

# Mistral Small 3.1

Mistral Small 3.1, जिसे Mistral AI ने मार्च 2025 में जारी किया था, एक **24-बिलियन पैरामीटर का घना मॉडल** जो अपने वजन से कहीं अधिक प्रदर्शन करता है। 128K कॉन्टेक्स्ट विंडो, नेटिव विजन क्षमताओं, सर्वश्रेष्ठ-इन-क्लास फ़ंक्शन कॉलिंग, और एक **Apache 2.0 लाइसेंस**यह तर्कसंगत रूप से सबसे अच्छा मॉडल हो सकता है जिसे आप एकल RTX 4090 पर चला सकते हैं। यह अधिकांश बेंचमार्क पर GPT-4o Mini और Claude 3.5 Haiku से बेहतर प्रदर्शन करता है जबकि क्वांटाइज़ किए जाने पर उपभोक्ता हार्डवेयर पर आराम से फिट हो जाता है।

## प्रमुख विशेषताएँ

* **24B डेंस पैरामीटर** — कोई MoE जटिलता नहीं, सीधे तैनाती
* **128K संदर्भ विंडो** — RULER 128K स्कोर 81.2%, GPT-4o Mini (65.8%) से बेहतर
* **नेटिव विजन** — छवियों, चार्टों, दस्तावेज़ों और स्क्रीनशॉट्स का विश्लेषण करें
* **Apache 2.0 लाइसेंस** — वाणिज्यिक और व्यक्तिगत उपयोग के लिए पूर्ण रूप से खुला
* **उत्कृष्ट फ़ंक्शन कॉलिंग** — JSON आउटपुट के साथ नेटिव टूल उपयोग, एजेंटिक वर्कफ़्लोज़ के लिए आदर्श
* **बहुभाषी** — CJK, अरबी, हिंदी और यूरोपीय भाषाओं सहित 25+ भाषाएँ

## आवश्यकताएँ

| घटक   | क्वांटाइज़्ड (Q4) | पूर्ण सटीकता (BF16)    |
| ----- | ----------------- | ---------------------- |
| GPU   | 1× RTX 4090 24GB  | 2× RTX 4090 या 1× H100 |
| VRAM  | \~16GB            | \~55GB                 |
| RAM   | 32GB              | 64GB                   |
| डिस्क | 20GB              | 50GB                   |
| CUDA  | 11.8+             | 12.0+                  |

**Clore.ai सिफारिश**: क्वांटाइज़्ड इंफरेंस के लिए RTX 4090 (\~$0.5–2/दिन) — सर्वश्रेष्ठ मूल्य/प्रदर्शन अनुपात

## Ollama के साथ त्वरित शुरुआत

Mistral Small 3.1 को चलाने का सबसे तेज़ तरीका:

```bash
# Ollama इंस्टॉल करें
curl -fsSL https://ollama.com/install.sh | sh

# Mistral Small 3.1 चलाएँ (स्वतः-डाउनलोड ~14GB Q4 क्वांटाइज़ेशन)
ollama run mistral-small3.1

# या एक विशिष्ट क्वांटाइज़ेशन निर्दिष्ट करें
ollama run mistral-small3.1:24b-instruct-2503-q4_K_M
```

### OpenAI-Compatible API के रूप में Ollama

```bash
# Ollama सर्वर प्रारंभ करें
ollama serve &

# मॉडल खींचें
ollama pull mistral-small3.1

# API के माध्यम से प्रश्न पूछें
curl http://localhost:11434/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "mistral-small3.1",
    "messages": [
      {"role": "system", "content": "आप एक सहायक कोडिंग असिस्टेंट हैं."},
      {"role": "user", "content": "Write a Python decorator for rate limiting"}
    ],
    "temperature": 0.15
  }'
```

### विजन के साथ Ollama

```bash
# विश्लेषण के लिए एक छवि भेजें
curl http://localhost:11434/api/chat -d '{
  "model": "mistral-small3.1",
  "messages": [{
    "role": "user",
    "content": "What does this image show?",
    "images": ["/path/to/image.jpg"]
  }]
}'
```

## vLLM सेटअप (प्रोडक्शन)

उत्पादन कार्यभार के लिए जिनमें उच्च थ्रूपुट और समवर्ती अनुरोध हों:

```bash
# vLLM स्थापित करें (v0.8.1+ आवश्यक)
pip install -U vllm

# सुनिश्चित करें कि mistral_common स्थापित है (स्वचालित होना चाहिए)
python -c "import mistral_common; print(mistral_common.__version__)"
```

### एकल GPU पर सेवा (केवल टेक्स्ट)

```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
```

### विजन के साथ सेवा (2 GPUs की सिफारिश)

```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
```

### सर्वर से प्रश्न पूछें

```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": "You are a helpful assistant. Today is 2026-02-20."},
        {"role": "user", "content": "Write a complete REST API in FastAPI with CRUD operations for a blog"}
    ],
    temperature=0.15,
    max_tokens=4096
)
print(response.choices[0].message.content)
```

## HuggingFace Transformers

प्रत्यक्ष Python एकीकरण और प्रयोग के लिए:

```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-बिट क्वांटाइज़ेशन — 24GB GPU पर फिट होता है
)

messages = [
    {"role": "system", "content": "आप एक सहायक कोडिंग असिस्टेंट हैं."},
    {"role": "user", "content": "Implement a binary search tree in Python with insert, delete, and search methods"}
]

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))
```

## फ़ंक्शन कॉलिंग उदाहरण

Mistral Small 3.1 उपकरण उपयोग के लिए सर्वश्रेष्ठ छोटे मॉडलों में से एक है:

```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": "Get the current stock price for a given ticker symbol",
            "parameters": {
                "type": "object",
                "required": ["ticker"],
                "properties": {
                    "ticker": {"type": "string", "description": "Stock ticker symbol (e.g., AAPL)"}
                }
            }
        }
    },
    {
        "type": "function",
        "function": {
            "name": "calculate_portfolio_value",
            "description": "Calculate total portfolio value given holdings",
            "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": "What's the current price of AAPL and MSFT?"}],
    tools=tools,
    tool_choice="auto",
    temperature=0.15
)

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

## Docker त्वरित शुरुआत

```bash
# एकल 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

# विजन समर्थन के साथ (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
```

## Clore.ai उपयोगकर्ताओं के लिए सुझाव

* **RTX 4090 सबसे उपयुक्त है**: $0.5–2/दिन पर, एकल RTX 4090 क्वांटाइज़्ड Mistral Small 3.1 चला सकता है और कुछ जगह बचा कर रखता है। सामान्य-उद्देश्य LLM के लिए Clore.ai पर सर्वश्रेष्ठ लागत/प्रदर्शन अनुपात।
* **कम तापमान का उपयोग करें**: Mistral AI सुझाव देता है `temperature=0.15` अधिकांश कार्यों के लिए। उच्च तापमान इस मॉडल के साथ असंगत आउटपुट का कारण बनते हैं।
* **RTX 3090 भी काम करता है**: $0.3–1/दिन पर, RTX 3090 (24GB) Ollama के साथ Q4 क्वांटाइज़्ड ठीक से चलाता है। 4090 की तुलना में थोड़ा धीमा लेकिन कीमत में आधा है।
* **त्वरित सेटअप के लिए Ollama, उत्पादन के लिए vLLM**: Ollama आपको 60 सेकंड में कार्यरत मॉडल देता है। समवर्ती API अनुरोधों और उच्च थ्रूपुट के लिए, vLLM पर स्विच करें।
* **फ़ंक्शन कॉलिंग इसे विशेष बनाती है**: कई 24B मॉडल चैट कर सकते हैं — कुछ ही भरोसेमंद तरीके से टूल कॉल कर पाते हैं। Mistral Small 3.1 की फ़ंक्शन कॉलिंग GPT-4o Mini के समकक्ष है। एजेंट, API बैकएंड और ऑटोमेशन पाइपलाइनों का आत्मविश्वास के साथ निर्माण करें।

## समस्याओं का निवारण

| समस्या                           | समाधान                                                                                                                                 |
| -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| `OutOfMemoryError` RTX 4090 पर   | Ollama के माध्यम से या क्वांटाइज़्ड मॉडल का उपयोग करें `load_in_4bit=True` Transformers में। पूर्ण BF16 को \~55GB की आवश्यकता होती है। |
| Ollama मॉडल नहीं मिला            | उपयोग करें `ollama run mistral-small3.1` (आधिकारिक लाइब्रेरी नाम)।                                                                     |
| vLLM टोकनाइज़र त्रुटियाँ         | हमेशा पास करें `--tokenizer-mode mistral --config-format mistral --load-format mistral`.                                               |
| खराब आउटपुट गुणवत्ता             | सेट करें `temperature=0.15`. एक सिस्टम प्रॉम्प्ट जोड़ें। Mistral Small तापमान के प्रति संवेदनशील है।                                   |
| 1 GPU पर विजन काम नहीं कर रहा है | विजन सुविधाओं को अधिक VRAM की आवश्यकता होती है। उपयोग करें `--tensor-parallel-size 2` या घटाएँ `--max-model-len`.                      |
| फ़ंक्शन कॉल खाली लौटते हैं       | जोड़ें `--tool-call-parser mistral --enable-auto-tool-choice` vLLM serve में।                                                          |

## अधिक पढ़ने के लिए

* [HuggingFace पर Mistral Small 3.1](https://huggingface.co/mistralai/Mistral-Small-3.1-24B-Instruct-2503)
* [Mistral AI ब्लॉग पोस्ट](https://mistral.ai/news/mistral-small-3-1/)
* [Ollama मॉडल पेज](https://ollama.com/library/mistral-small3.1)
* [vLLM दस्तावेज़ीकरण](https://docs.vllm.ai/)
* [Mistral Common लाइब्रेरी](https://github.com/mistralai/mistral-common)
* [Mistral AI प्लेटफ़ॉर्म](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-hi/language-models/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.
