> 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

Gemma 3, जिसे मार्च 2025 में Google DeepMind ने जारी किया, उसी तकनीक पर बना है जो 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 को कंज्यूमर GPU पर चलने देते हैं
* **व्यापक फ्रेमवर्क समर्थन**: 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  | 11.8+      | 11.8+            | 12.0+              |

**अनुशंसित Clore.ai GPU**: 27B क्वांटाइज़्ड के लिए RTX 4090 24GB (\~$0.5–2/दिन) — यह आदर्श विकल्प है

## 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 क्लास लिखो"}
]

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 = [
    def analyze_image(image_path, question):
        {"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
```

## बेंचमार्क मुख्य बिंदु

| बेंचमार्क         | 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.5–2/दिन** | **$3–6/दिन**  | **$12–24/दिन** |

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

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

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

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

| समस्या                           | समाधान                                                                                      |
| -------------------------------- | ------------------------------------------------------------------------------------------- |
| `OutOfMemoryError` 27B पर        | QAT वर्ज़न का उपयोग करें या घटाएँ `--max-model-len` को 4096                                 |
| Ollama में विज़न काम नहीं कर रहा | Ollama को नवीनतम में अपडेट करें: `curl -fsSL https://ollama.com/install.sh \| sh`           |
| धीमी जनरेशन स्पीड                | जाँचें कि आप float32 नहीं बल्कि bfloat16 का उपयोग कर रहे हैं। उपयोग करें `--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.
