# llama.cpp guide: run GGUF models locally

> Complete guide to llama.cpp – install it, run GGUF models, enable GPU acceleration, and read the benchmark output. The engine behind Ollama, explained.

*Source: https://velstech.net/llama-cpp-guide.hi (Hindi translation of https://velstech.net/llama-cpp-guide) · Updated: 2026-08-30*

*Markdown version. [Read the interactive guide](https://velstech.net/llama-cpp-guide.hi). English Markdown: https://velstech.net/llama-cpp-guide.md.*

---

llama.cpp वह engine है जिस पर Ollama, LM Studio और अधिकांश अन्य local AI tools अंदर ही अंदर चलते हैं। यह एक C++ library है जो GGUF model को लोड करती है और उन्हें आपके CPU, GPU या दोनों पर चलाती है, जिसमें NVIDIA CUDA, AMD ROCm और Vulkan का support है।

यह गाइड basics कवर करती है: इसे कैसे इंस्टॉल करें, model कैसे चलाएँ, अपना GPU कैसे enable करें, और benchmark output को कैसे पढ़ें। अंत तक आप ठीक से जान जाएँगे कि `1713 ms / 373 tok = 4.60 ms/tok = 217.6 tok/s` का क्या अर्थ है (और क्या यह पर्याप्त तेज़ है)।

## Installation

llama.cpp प्राप्त करने का सबसे आसान तरीका इसे source से build करना है। आपको C++ compiler और `cmake` चाहिए:

```
git clone https://github.com/ggerganov/llama.cpp
cd llama.cpp
mkdir build && cd build
cmake .. -DLLAMA_METAL=OFF
make -j$(nproc)
```

GPU acceleration के लिए सही flag जोड़ें:

- NVIDIA CUDA: cmake .. -DLLAMA_CUDA=ON

- AMD ROCm: cmake .. -DLLAMA_HIPBLAS=ON

- Vulkan: cmake .. -DLLAMA_VULKAN=ON

- Apple Metal: cmake .. -DLLAMA_METAL=ON

यदि आप Ubuntu पर AMD card के साथ हैं, तो [ROCm installation guide](https://velstech.net/install-rocm-ubuntu) prerequisites कवर करती है।

## Model चलाना

एक GGUF फ़ाइल डाउनलोड करें (कौन सी चुनें इसके लिए [GGUF explained](https://velstech.net/gguf-explained) देखें), फिर चलाएँ:

```
./build/bin/llama-cli -m path/to/model.q4_k_m.gguf -p "Hello, who are you?" -n 256
```

यह model को लोड करता है, prompt चलाता है और 256 tokens generate करता है। output में timing जानकारी शामिल होती है जो बताती है कि यह कितनी तेज़ चला:

```
1713 ms / 373 tok = 4.60 ms/tok = 217.6 tok/s
eval time = 1713 ms / 373 tok (4.60 ms/tok, 217.6 tok/s)
```

पहला नंबर **prompt eval** है (model आपका सवाल कितनी तेज़ी से पढ़ता है)। दूसरा **decode** है (वह उत्तर कितनी तेज़ी से generate करता है)। chat के लिए decode speed मायने रखती है – यह text की वह stream है जो आप देखते हैं। लंबे documents के लिए prompt eval अधिक महत्वपूर्ण है।

## GPU acceleration

डिफ़ॉल्ट रूप से llama.cpp CPU पर चलता है। layers को अपने GPU पर offload करने के लिए `-ngl` flag (GPU layers की संख्या) का उपयोग करें:

```
./build/bin/llama-cli -m model.gguf -p "Hello" -n 256 -ngl 999
```

`-ngl 999` सभी layers को GPU पर offload कर देता है। यदि आपके पास सीमित VRAM है, तो `-ngl N` का उपयोग करें जहाँ N fit होने वाले layers की संख्या है। [LLM VRAM Calculator](https://velstech.net/llm-vram-calculator) अनुमान लगाने में मदद कर सकता है।

ROCm वाले AMD GPU के लिए आपको GPU और CPU में weights को बाँटने से बचाने के लिए `--load-mode none` की आवश्यकता हो सकती है। [Qwen ROCm vs Vulkan benchmark](https://velstech.net/qwen-27b-ridge-rocm-vs-vulkan) दिखाता है कि व्यवहार में यह कैसे काम करता है।

## अपने hardware को benchmark करना

llama.cpp का built-in timing output ही आपको चाहिए। ज्ञात परिणामों से तुलना करने के लिए समान parameters (model, quantization, context, backend) का उपयोग करें और decode tok/s नोट करें। फिर [VelsTech benchmark database](https://velstech.net/benchmarks/index) में देखें कि आपका hardware कैसा प्रदर्शन करता है।

## मुख्य flags चीट-शीट

| Flag | क्या करता है |
| --- | --- |
| -m | GGUF model फ़ाइल का path |
| -p | Prompt text |
| -n | Generate करने के लिए tokens की संख्या |
| -c | Context size (जैसे -c 16384 16K के लिए) |
| -ngl | GPU पर offload करने के लिए layers (999 = सभी) |
| -t | Thread count (default: सभी cores) |
| --repeat-penalty | Repetition को penalize करें (default 1.1) |
| --temp | Sampling temperature (0.0 = deterministic, 1.0 = creative) |

## अगले कदम

llama.cpp नींव है। अधिकांश लोग इसे सीधे कभी उपयोग नहीं करते – वे Ollama का उपयोग करते हैं, जो इसे user-friendly CLI और API में wrap करता है। लेकिन यह जानना कि llama.cpp कैसे काम करता है, आपको यह समझने में मदद करता है कि Ollama क्या कर रहा है, और यह [benchmarking](https://velstech.net/benchmarks/index) और fine-tuning के लिए आवश्यक है। यदि आप local AI में नए हैं, तो [getting started](https://velstech.net/how-to-get-started-local-ai) गाइड से शुरू करें – यह Ollama का उपयोग करती है, जो llama.cpp पर बना है।

---

*VelsTech – https://velstech.net/llama-cpp-guide.hi.md*
