Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,96 @@
|
|
| 1 |
---
|
| 2 |
license: mit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
+
datasets:
|
| 4 |
+
- LGAI-EXAONE/KoMT-Bench
|
| 5 |
+
- skt/kobest_v1
|
| 6 |
+
language:
|
| 7 |
+
- ko
|
| 8 |
+
- en
|
| 9 |
+
base_model:
|
| 10 |
+
- K-intelligence/Midm-2.0-Base-Instruct
|
| 11 |
+
tags:
|
| 12 |
+
- LLM
|
| 13 |
+
- Korean
|
| 14 |
+
- AWQ
|
| 15 |
+
- Quantized
|
| 16 |
+
- Mi:dm
|
| 17 |
+
- transformers
|
| 18 |
+
- Safetensors
|
| 19 |
---
|
| 20 |
+
|
| 21 |
+
# Midm-2.0-Base-Instruct - AWQ 4-bit Quantized Version
|
| 22 |
+
|
| 23 |
+
This repository contains the AWQ (Activation-aware Weight Quantization) 4-bit quantized version of the **[K-intelligence/Midm-2.0-Base-Instruct](https://huggingface.co/K-intelligence/Midm-2.0-Base-Instruct)** model by KT AI.
|
| 24 |
+
|
| 25 |
+
This model is the result of a journey to solve real-world performance and cost issues encountered in a production environment. I hope this experience can be a practical guide for other developers facing similar challenges.
|
| 26 |
+
|
| 27 |
+
## Model Details
|
| 28 |
+
|
| 29 |
+
* **Base Model:** `K-intelligence/Midm-2.0-Base-Instruct`
|
| 30 |
+
* **Quantization Method:** AWQ (Activation-aware Weight Quantization)
|
| 31 |
+
* **Quantization Config:**
|
| 32 |
+
* `w_bit`: 4
|
| 33 |
+
* `q_group_size`: 128
|
| 34 |
+
* `zero_point`: True
|
| 35 |
+
* **Library:** `AutoAWQ`
|
| 36 |
+
|
| 37 |
+
## ⚙️ How to Get Started
|
| 38 |
+
|
| 39 |
+
To use this model, you will need to install the `transformers`, `accelerate`, and `autoawq` libraries.
|
| 40 |
+
|
| 41 |
+
```bash
|
| 42 |
+
pip install transformers accelerate autoawq
|
| 43 |
+
Usage Example
|
| 44 |
+
Python
|
| 45 |
+
|
| 46 |
+
import torch
|
| 47 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 48 |
+
|
| 49 |
+
model_id = "jinkyeongk/Midm-2.0-Base-Instruct-AWQ"
|
| 50 |
+
|
| 51 |
+
# Load the tokenizer and model
|
| 52 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 53 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 54 |
+
model_id,
|
| 55 |
+
device_map="auto",
|
| 56 |
+
torch_dtype=torch.float16
|
| 57 |
+
).eval()
|
| 58 |
+
|
| 59 |
+
# Construct the chat prompt
|
| 60 |
+
messages = [
|
| 61 |
+
{"role": "user", "content": "Who are you?"}
|
| 62 |
+
]
|
| 63 |
+
input_ids = tokenizer.apply_chat_template(messages, return_tensors="pt").to(model.device)
|
| 64 |
+
|
| 65 |
+
# Generate a response
|
| 66 |
+
outputs = model.generate(input_ids, max_new_tokens=512, do_sample=True, temperature=0.7)
|
| 67 |
+
response = tokenizer.decode(outputs[0][input_ids.shape[1]:], skip_special_tokens=True)
|
| 68 |
+
|
| 69 |
+
print(response)
|
| 70 |
+
```
|
| 71 |
+
## 📊 Quantization Evaluation
|
| 72 |
+
To measure the performance degradation from quantization, the original (FP16) and quantized (AWQ) models were evaluated against two major Korean benchmarks.
|
| 73 |
+
|
| 74 |
+
* **Ko-Best**: Measures objective knowledge and reasoning skills (Accuracy).
|
| 75 |
+
|
| 76 |
+
* **Ko-MTBench**: Measures subjective conversational ability (Scores graded by GPT-4o as a judge).
|
| 77 |
+
|
| 78 |
+
### Final Evaluation Results
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
| Model | Benchmark | Metric | Score / Accuracy |
|
| 82 |
+
|---|---|---|---|
|
| 83 |
+
| `K-intelligence/Midm-2.0-Base-Instruct` (FP16) | skt/kobest_v1 | hellaswag (Accuracy) | 0.4900 |
|
| 84 |
+
| `jinkyeongk/Midm-2.0-Base-Instruct-AWQ` (AWQ) | skt/kobest_v1 | hellaswag (Accuracy) | **0.4800** |
|
| 85 |
+
| `K-intelligence/Midm-2.0-Base-Instruct` (FP16) | LGAI-EXAONE/KoMT-Bench | Avg. Score (by GPT-4o) | 8.50 / 10.0 |
|
| 86 |
+
| `jinkyeongk/Midm-2.0-Base-Instruct-AWQ` (AWQ) | LGAI-EXAONE/KoMT-Bench | Avg. Score (by GPT-4o) | **6.40 / 10.0** |
|
| 87 |
+
|
| 88 |
+
## Analysis
|
| 89 |
+
|
| 90 |
+
The results from the Ko-Best (hellaswag) benchmark show that the performance drop in objective reasoning ability due to AWQ 4-bit quantization was a mere 1.0 percentage point, which is a negligible decrease.
|
| 91 |
+
|
| 92 |
+
However, in the Ko-MTBench subjective evaluation using GPT-4o as a judge, a more significant performance drop of 2.1 points on average was observed.
|
| 93 |
+
|
| 94 |
+
This suggests that while AWQ quantization maintains performance on well-defined, knowledge-based tasks like multiple-choice questions (Ko-Best), it can lead to some loss in nuance, expressiveness, or the sophistication of reasoning in more open-ended, conversational tasks (Ko-MTBench).
|
| 95 |
+
|
| 96 |
+
Therefore, this quantized model offers a massive improvement in speed and cost-efficiency at the expense of a slight trade-off in creative or complex conversational abilities. Users should consider this trade-off based on their specific application.
|