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

# Gemma 3

Clore.ai पर Google Gemma 3 मल्टिमोडल मॉडल चलाएँ — 15x छोटे आकार पर Llama-405B से बेहतर

Google DeepMind द्वारा मार्च 2025 में जारी Gemma 3, Gemini 2.0 जैसी ही तकनीक पर आधारित है। इसकी सबसे खास उपलब्धि: **27B मॉडल Llama 3.1 405B को मात देता है** LMArena बेंचमार्क पर — अपने आकार से 15 गुना बड़े मॉडल को। यह मूल रूप से मल्टीमॉडल है (टेक्स्ट + इमेज + वीडियो), 128K संदर्भ का समर्थन करता है, और क्वांटाइज़ेशन के साथ एक ही RTX 4090 पर चलता है।

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

* **अपनी क्षमता से कहीं ऊपर प्रदर्शन करता है**: 27B प्रमुख बेंचमार्क्स पर 405B-श्रेणी के मॉडलों को हराता है
* **मूल रूप से मल्टीमॉडल**: टेक्स्ट, इमेज, और वीडियो समझने की क्षमता बिल्ट-इन
* **128K संदर्भ विंडो**: लंबे दस्तावेज़, कोडबेस, बातचीत संसाधित करें
* **चार आकार**: 1B, 4B, 12B, 27B — हर GPU बजट के लिए कुछ न कुछ
* **QAT संस्करण**: Quantization-Aware Training वेरिएंट 27B को उपभोक्ता GPUs पर चलाने देते हैं
* **व्यापक फ्रेमवर्क समर्थन**: Ollama, vLLM, Transformers, Keras, JAX, PyTorch

## मॉडल वेरिएंट

| मॉडल            | पैरामीटर | VRAM (Q4) | VRAM (FP16) | किसके लिए सर्वोत्तम           |
| --------------- | -------- | --------- | ----------- | ----------------------------- |
| Gemma 3 1B      | 1B       | 1.5GB     | 3GB         | एज, मोबाइल, परीक्षण           |
| Gemma 3 4B      | 4B       | 4GB       | 9GB         | कम बजट वाले GPUs, तेज़ कार्य  |
| Gemma 3 12B     | 12B      | 10GB      | 25GB        | संतुलित गुणवत्ता/गति          |
| Gemma 3 27B     | 27B      | 18GB      | 54GB        | सर्वोत्तम गुणवत्ता, प्रोडक्शन |
| Gemma 3 27B QAT | 27B      | 14GB      | —           | उपभोक्ता GPUs के लिए अनुकूलित |

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

| घटक   | Gemma 3 4B | Gemma 3 27B (Q4) | Gemma 3 27B (FP16) |
| ----- | ---------- | ---------------- | ------------------ |
| GPU   | RTX 3060   | RTX 4090         | 2× RTX 4090 / A100 |
| VRAM  | 6GB        | 24GB             | 48GB+              |
| RAM   | 16GB       | 32GB             | 64GB               |
| डिस्क | 10GB       | 25GB             | 55GB               |
| CUDA  | 12.8+      | 12.8+            | 12.8+              |

**अनुशंसित Clore.ai GPU**: RTX 4090 24GB ($0.14–0.42/घंटा) 27B क्वांटाइज़्ड के लिए — यही सबसे अच्छा विकल्प है

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

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

# अलग-अलग आकार चलाएँ
ollama run gemma3:1b     # बहुत छोटा — 1.5GB VRAM
ollama run gemma3:4b     # छोटा — 4GB VRAM
ollama run gemma3:12b    # मध्यम — 10GB VRAM
ollama run gemma3:27b    # बड़ा — 18-20GB VRAM (क्वांटाइज़्ड)

# QAT संस्करण (अनुकूलित क्वांटाइज़ेशन)
ollama run gemma3:27b-qat
```

### Ollama API सर्वर

```bash
ollama serve &

curl http://localhost:11434/v1/chat/completions \\
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemma3:27b",
    "messages": [{"role": "user", "content": "नई API के लिए REST और GraphQL की तुलना करें"}]
  }'
```

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

```bash
# एक छवि का विश्लेषण करें
ollama run gemma3:27b "इस छवि का विस्तार से वर्णन करें" --images ./photo.jpg
```

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

```bash
pip install vllm

# 27B मॉडल सर्व करें
vllm serve google/gemma-3-27b-it \\
  --max-model-len 8192 \
  --gpu-memory-utilization 0.90

# 2 GPUs पर लंबे संदर्भ के साथ सर्व करें
vllm serve google/gemma-3-27b-it \\
  --tensor-parallel-size 2 \\
  --max-model-len 65536

# बजट सेटअप के लिए 4B सर्व करें
vllm serve google/gemma-3-4b-it \\
  --max-model-len 32768
```

## HuggingFace Transformers

### टेक्स्ट जनरेशन

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

model_name = "google/gemma-3-27b-it"

tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
    model_name,
    torch_dtype=torch.bfloat16,
    device_map="auto",
    load_in_4bit=True  # 24GB GPU पर फिट हो जाता है
)

messages = [
    {"role": "user", "content": "इन्सर्ट, सर्च, और डिलीट मेथड्स के साथ एक बाइनरी सर्च ट्री के लिए Python class लिखें"}
]

input_ids = tokenizer.apply_chat_template(messages, return_tensors="pt").to(model.device)
output = model.generate(input_ids, max_new_tokens=2048, temperature=0.7, do_sample=True)
print(tokenizer.decode(output[0][input_ids.shape[-1]:], skip_special_tokens=True))
```

### विज़न (इमेज समझना)

```python
import torch
from transformers import AutoProcessor, Gemma3ForConditionalGeneration
from PIL import Image

model_name = "google/gemma-3-27b-it"
processor = AutoProcessor.from_pretrained(model_name)
model = Gemma3ForConditionalGeneration.from_pretrained(
    model_name,
    torch_dtype=torch.bfloat16,
    device_map="auto"
)

# छवि लोड करें
image = Image.open("screenshot.png")

messages = [
    {"role": "user", "content": [
        {"type": "image", "image": image},
        {"type": "text", "text": "यह स्क्रीनशॉट क्या दिखाता है? सभी UI तत्वों की सूची बनाइए।"}
    ]}
]

inputs = processor.apply_chat_template(messages, return_tensors="pt").to(model.device)
output = model.generate(**inputs, max_new_tokens=1024)
print(processor.decode(output[0], skip_special_tokens=True))
```

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

```bash
docker run --gpus all -p 8000:8000 \\
  -v ~/.cache/huggingface:/root/.cache/huggingface \\
  vllm/vllm-openai:latest \
  --model google/gemma-3-27b-it \\
  --max-model-len 8192
```

## बेंचमार्क हाइलाइट्स

| Benchmark         | Gemma 3 27B                 | Llama 3.1 70B               | Llama 3.1 405B                  |
| ----------------- | --------------------------- | --------------------------- | ------------------------------- |
| LMArena ELO       | 1354                        | 1298                        | 1337                            |
| MMLU              | 75.6                        | 79.3                        | 85.2                            |
| HumanEval         | 72.0                        | 72.6                        | 80.5                            |
| VRAM (Q4)         | 18GB                        | 40GB                        | 200GB+                          |
| **Clore पर लागत** | **$0.14–0.42/hr** (1× 4090) | **$0.28–0.84/hr** (2× 4090) | **मार्केटप्लेस पर उपलब्ध नहीं** |

27B, 1/10th VRAM लागत पर 405B-श्रेणी की संवाद गुणवत्ता देता है।

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

* **27B QAT सबसे अच्छा विकल्प है**: Quantization-Aware Training का मतलब है पोस्ट-ट्रेनिंग क्वांटाइज़ेशन की तुलना में कम गुणवत्ता हानि — इसे एक ही RTX 4090 पर चलाएँ
* **विज़न मुफ़्त है**: किसी अतिरिक्त सेटअप की ज़रूरत नहीं — Gemma 3 छवियों को मूल रूप से समझता है। दस्तावेज़ पार्सिंग, स्क्रीनशॉट विश्लेषण, चार्ट पढ़ने के लिए शानदार
* **छोटे संदर्भ से शुरू करें**: उपयोग करें `--max-model-len 8192` शुरुआत में; VRAM बचाने के लिए केवल ज़रूरत पड़ने पर बढ़ाएँ
* **बजट रन के लिए 4B**: अगर आप RTX 3060/3070 ($0.03–0.07/घंटा) पर हैं, तो 4B मॉडल अभी भी पिछले जनरेशन के 27B मॉडलों से बेहतर प्रदर्शन करता है
* **Google auth की आवश्यकता नहीं**: कुछ मॉडलों के विपरीत, Gemma 3 बिना गेटिंग के डाउनलोड हो जाता है (HuggingFace पर बस लाइसेंस स्वीकार करें)

## समस्या निवारण

| समस्या                           | समाधान                                                                                    |
| -------------------------------- | ----------------------------------------------------------------------------------------- |
| `OutOfMemoryError` 27B पर        | QAT संस्करण का उपयोग करें या घटाएँ `--max-model-len` 4096 तक                              |
| Ollama में विज़न काम नहीं कर रहा | Ollama को नवीनतम संस्करण में अपडेट करें: `curl -fsSL https://ollama.com/install.sh \| sh` |
| जनरेशन की गति धीमी है            | जाँचें कि आप bfloat16 उपयोग कर रहे हैं, float32 नहीं। उपयोग करें `--dtype bfloat16`       |
| मॉडल बेकार आउटपुट दे रहा है      | सुनिश्चित करें कि आप `-it` (instruct-tuned) वेरिएंट उपयोग कर रहे हैं, बेस मॉडल नहीं       |
| डाउनलोड 403 त्रुटि               | <https://huggingface.co/google/gemma-3-27b-it> पर Gemma लाइसेंस स्वीकार करें              |

## अधिक पढ़ें

* [Gemma 3 तकनीकी रिपोर्ट](https://ai.google.dev/gemma)
* [HuggingFace मॉडल कार्ड](https://huggingface.co/google/gemma-3-27b-it)
* [Ollama लाइब्रेरी](https://ollama.com/library/gemma3)
* [Google AI Studio](https://aistudio.google.com/) — GPU किराए पर लेने से पहले Gemma 3 को ऑनलाइन आज़माएँ


---

# 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/gemma3.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.
