gguf endpoints_compatible region:us conversational
---
{}
---
Quantization made by Richard Erkhov.

[Github](https://github.com/RichardErkhov)

[Discord](https://discord.gg/pvy7H8DZMG)

[Request more models](https://github.com/RichardErkhov/quant_request)


Llama-3.1-8B-Instuct-Uz - GGUF
- Model creator: https://huggingface.co/behbudiy/
- Original model: https://huggingface.co/behbudiy/Llama-3.1-8B-Instuct-Uz/


| Name | Quant method | Size |
| ---- | ---- | ---- |
| [Llama-3.1-8B-Instuct-Uz.Q2_K.gguf](https://huggingface.co/RichardErkhov/behbudiy_-_Llama-3.1-8B-Instuct-Uz-gguf/blob/main/Llama-3.1-8B-Instuct-Uz.Q2_K.gguf) | Q2_K | 2.96GB |
| [Llama-3.1-8B-Instuct-Uz.IQ3_XS.gguf](https://huggingface.co/RichardErkhov/behbudiy_-_Llama-3.1-8B-Instuct-Uz-gguf/blob/main/Llama-3.1-8B-Instuct-Uz.IQ3_XS.gguf) | IQ3_XS | 3.28GB |
| [Llama-3.1-8B-Instuct-Uz.IQ3_S.gguf](https://huggingface.co/RichardErkhov/behbudiy_-_Llama-3.1-8B-Instuct-Uz-gguf/blob/main/Llama-3.1-8B-Instuct-Uz.IQ3_S.gguf) | IQ3_S | 3.43GB |
| [Llama-3.1-8B-Instuct-Uz.Q3_K_S.gguf](https://huggingface.co/RichardErkhov/behbudiy_-_Llama-3.1-8B-Instuct-Uz-gguf/blob/main/Llama-3.1-8B-Instuct-Uz.Q3_K_S.gguf) | Q3_K_S | 3.41GB |
| [Llama-3.1-8B-Instuct-Uz.IQ3_M.gguf](https://huggingface.co/RichardErkhov/behbudiy_-_Llama-3.1-8B-Instuct-Uz-gguf/blob/main/Llama-3.1-8B-Instuct-Uz.IQ3_M.gguf) | IQ3_M | 3.52GB |
| [Llama-3.1-8B-Instuct-Uz.Q3_K.gguf](https://huggingface.co/RichardErkhov/behbudiy_-_Llama-3.1-8B-Instuct-Uz-gguf/blob/main/Llama-3.1-8B-Instuct-Uz.Q3_K.gguf) | Q3_K | 3.74GB |
| [Llama-3.1-8B-Instuct-Uz.Q3_K_M.gguf](https://huggingface.co/RichardErkhov/behbudiy_-_Llama-3.1-8B-Instuct-Uz-gguf/blob/main/Llama-3.1-8B-Instuct-Uz.Q3_K_M.gguf) | Q3_K_M | 3.74GB |
| [Llama-3.1-8B-Instuct-Uz.Q3_K_L.gguf](https://huggingface.co/RichardErkhov/behbudiy_-_Llama-3.1-8B-Instuct-Uz-gguf/blob/main/Llama-3.1-8B-Instuct-Uz.Q3_K_L.gguf) | Q3_K_L | 4.03GB |
| [Llama-3.1-8B-Instuct-Uz.IQ4_XS.gguf](https://huggingface.co/RichardErkhov/behbudiy_-_Llama-3.1-8B-Instuct-Uz-gguf/blob/main/Llama-3.1-8B-Instuct-Uz.IQ4_XS.gguf) | IQ4_XS | 4.18GB |
| [Llama-3.1-8B-Instuct-Uz.Q4_0.gguf](https://huggingface.co/RichardErkhov/behbudiy_-_Llama-3.1-8B-Instuct-Uz-gguf/blob/main/Llama-3.1-8B-Instuct-Uz.Q4_0.gguf) | Q4_0 | 4.34GB |
| [Llama-3.1-8B-Instuct-Uz.IQ4_NL.gguf](https://huggingface.co/RichardErkhov/behbudiy_-_Llama-3.1-8B-Instuct-Uz-gguf/blob/main/Llama-3.1-8B-Instuct-Uz.IQ4_NL.gguf) | IQ4_NL | 4.38GB |
| [Llama-3.1-8B-Instuct-Uz.Q4_K_S.gguf](https://huggingface.co/RichardErkhov/behbudiy_-_Llama-3.1-8B-Instuct-Uz-gguf/blob/main/Llama-3.1-8B-Instuct-Uz.Q4_K_S.gguf) | Q4_K_S | 4.37GB |
| [Llama-3.1-8B-Instuct-Uz.Q4_K.gguf](https://huggingface.co/RichardErkhov/behbudiy_-_Llama-3.1-8B-Instuct-Uz-gguf/blob/main/Llama-3.1-8B-Instuct-Uz.Q4_K.gguf) | Q4_K | 4.58GB |
| [Llama-3.1-8B-Instuct-Uz.Q4_K_M.gguf](https://huggingface.co/RichardErkhov/behbudiy_-_Llama-3.1-8B-Instuct-Uz-gguf/blob/main/Llama-3.1-8B-Instuct-Uz.Q4_K_M.gguf) | Q4_K_M | 4.58GB |
| [Llama-3.1-8B-Instuct-Uz.Q4_1.gguf](https://huggingface.co/RichardErkhov/behbudiy_-_Llama-3.1-8B-Instuct-Uz-gguf/blob/main/Llama-3.1-8B-Instuct-Uz.Q4_1.gguf) | Q4_1 | 4.78GB |
| [Llama-3.1-8B-Instuct-Uz.Q5_0.gguf](https://huggingface.co/RichardErkhov/behbudiy_-_Llama-3.1-8B-Instuct-Uz-gguf/blob/main/Llama-3.1-8B-Instuct-Uz.Q5_0.gguf) | Q5_0 | 5.21GB |
| [Llama-3.1-8B-Instuct-Uz.Q5_K_S.gguf](https://huggingface.co/RichardErkhov/behbudiy_-_Llama-3.1-8B-Instuct-Uz-gguf/blob/main/Llama-3.1-8B-Instuct-Uz.Q5_K_S.gguf) | Q5_K_S | 5.21GB |
| [Llama-3.1-8B-Instuct-Uz.Q5_K.gguf](https://huggingface.co/RichardErkhov/behbudiy_-_Llama-3.1-8B-Instuct-Uz-gguf/blob/main/Llama-3.1-8B-Instuct-Uz.Q5_K.gguf) | Q5_K | 5.34GB |
| [Llama-3.1-8B-Instuct-Uz.Q5_K_M.gguf](https://huggingface.co/RichardErkhov/behbudiy_-_Llama-3.1-8B-Instuct-Uz-gguf/blob/main/Llama-3.1-8B-Instuct-Uz.Q5_K_M.gguf) | Q5_K_M | 5.34GB |
| [Llama-3.1-8B-Instuct-Uz.Q5_1.gguf](https://huggingface.co/RichardErkhov/behbudiy_-_Llama-3.1-8B-Instuct-Uz-gguf/blob/main/Llama-3.1-8B-Instuct-Uz.Q5_1.gguf) | Q5_1 | 5.65GB |
| [Llama-3.1-8B-Instuct-Uz.Q6_K.gguf](https://huggingface.co/RichardErkhov/behbudiy_-_Llama-3.1-8B-Instuct-Uz-gguf/blob/main/Llama-3.1-8B-Instuct-Uz.Q6_K.gguf) | Q6_K | 6.14GB |
| [Llama-3.1-8B-Instuct-Uz.Q8_0.gguf](https://huggingface.co/RichardErkhov/behbudiy_-_Llama-3.1-8B-Instuct-Uz-gguf/blob/main/Llama-3.1-8B-Instuct-Uz.Q8_0.gguf) | Q8_0 | 7.95GB |




Original model description:
---
license: llama3.1
language:
- uz
- en
base_model: models/Meta-Llama-3.1-8B-Instruct
library_name: transformers
tags:
- llama
- text-generation-inference
- summarization
- translation
- question-answering
datasets:
- yahma/alpaca-cleaned
- behbudiy/alpaca-cleaned-uz
- behbudiy/translation-instruction
metrics:
- bleu
- comet
- accuracy
pipeline_tag: text-generation
---

### Model Description

The LLaMA-3.1-8B-Instruct-Uz model has been instruction-tuned using a mix of publicly available and syntheticly constructed Uzbek and English data to preserve its original knowledge while enhancing its capabilities. This model is designed to support various natural language processing tasks in Uzbek, such as machine translation, summarization, and dialogue systems, ensuring robust performance across these applications.
For details regarding the performance metrics compared to the base model, see [this post.](https://www.linkedin.com/feed/update/urn:li:activity:7241389815559008256/)

- **Developed by:**
  - [Eldor Fozilov](https://www.linkedin.com/in/eldor-fozilov/)
  - [Azimjon Urinov](https://azimjonn.github.io/)
  - [Khurshid Juraev](https://kjuraev.com/)

## How to use

The Llama-3.1-8B-Instruct-Uz model can be used with transformers and with the original `llama` codebase.

### Use with transformers

Starting with `transformers >= 4.43.0` onward, you can run conversational inference using the Transformers `pipeline` abstraction or by leveraging the Auto classes with the `generate()` function.

Make sure to update your transformers installation via `pip install --upgrade transformers`.

```python
import transformers
import torch

model_id = "behbuidy/Llama-3.1-8B-Instruct-Uz"

pipeline = transformers.pipeline(
    "text-generation",
    model=model_id,
    model_kwargs={"torch_dtype": torch.bfloat16},
    device_map="auto",
)

messages = [
    {"role": "system", "content": "Berilgan gap bo'yicha hissiyot tahlilini bajaring."},
    {"role": "user", "content": "Men bu filmni yaxshi ko'raman!"},
]

outputs = pipeline(
    messages,
    max_new_tokens=256,
)
print(outputs[0]["generated_text"][-1])
```

Note: You can also find detailed recipes on how to use the model locally, with `torch.compile()`, assisted generations, quantised and more at [`huggingface-llama-recipes`](https://github.com/huggingface/huggingface-llama-recipes)

### Use with `llama`

Please, follow the instructions in the [repository](https://github.com/meta-llama/llama)

## Information on Evaluation Method

To evaluate on the translation task, we used FLORES+ Uz-En / En-Uz datasets, where we merged the dev and test sets to create a bigger evaluation data for each Uz-En and En-Uz subsets.
We used the following prompt to do one-shot Uz-En evaluation both for the base model and Uzbek-optimized model (for En-Uz eval, we changed the positions of the words "English" and "Uzbek").

```python
  prompt = f'''You are a professional Uzbek-English translator. Your task is to accurately translate the given Uzbek text into English.

  Instructions:
  1. Translate the text from Uzbek to English.
  2. Maintain the original meaning and tone.
  3. Use appropriate English grammar and vocabulary.
  4. If you encounter an ambiguous or unfamiliar word, provide the most likely translation based on context.
  5. Output only the English translation, without any additional comments.

  Example:
  Uzbek: "Bugun ob-havo juda yaxshi, quyosh charaqlab turibdi."
  English: "The weather is very nice today, the sun is shining brightly."

  Now, please translate the following Uzbek text into English:
  "{sentence}"
    '''
```

To assess the model's ability in Uzbek sentiment analysis, we used the **risqaliyevds/uzbek-sentiment-analysis** dataset, for which we created binary labels (0: Negative, 1: Positive) using GPT-4o API (refer to **behbudiy/uzbek-sentiment-analysis** dataset).
We used the following prompt for the evaluation:

```python
prompt = f'''Given the following text, determine the sentiment as either 'Positive' or 'Negative.' Respond with only the word 'Positive' or 'Negative' without any additional text or explanation.

Text: {text}"
'''
```
For Uzbek News Classification, we used **risqaliyevds/uzbek-zero-shot-classification** dataset and asked the model to predict the category of the news using the following prompt:

```python
prompt = f'''Classify the given Uzbek news article into one of the following categories. Provide only the category number as the answer.

Categories:
0 - Politics (Siyosat)
1 - Economy (Iqtisodiyot)
2 - Technology (Texnologiya)
3 - Sports (Sport)
4 - Culture (Madaniyat)
5 - Health (Salomatlik)
6 - Family and Society (Oila va Jamiyat)
7 - Education (Ta'lim)
8 - Ecology (Ekologiya)
9 - Foreign News (Xorijiy Yangiliklar)

Now classify this article:
"{text}"

Answer (number only):"
'''
```

On MMLU, we performed 5-shot evaluation using the following **template** and extracted the first token generated by the model for measuring accuracy:
```python
template = "The following are multiple choice questions (with answers) about [subject area].

[Example question 1]
A. text
B. text
C. text
D. text
Answer: [Correct answer letter]

.
.
.

[Example question 5]
A. text
B. text
C. text
D. text
Answer: [Correct answer letter]

Now, let's think step by step and then provide only the letter corresponding to the correct answer for the below question, without any additional explanation or comments.

[Actual MMLU test question]
A. text
B. text
C. text
D. text
Answer:"
```

 

## More
For more details and examples, refer to the base model below:
https://huggingface.co/meta-llama/Meta-Llama-3.1-8B-Instruct



