Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,133 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
pipeline_tag: text-generation
|
| 6 |
+
tags:
|
| 7 |
+
- chat
|
| 8 |
+
- instruct
|
| 9 |
+
- small-model
|
| 10 |
+
- 135m
|
| 11 |
+
- quark
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
# Quark-135M-Instruct
|
| 16 |
+
|
| 17 |
+
Quark‑135M‑Instruct is a **135M parameter** conversational AI assistant, trained from scratch and then fine‑tuned to be **helpful, respectful, honest** and to remember a clear identity.
|
| 18 |
+
|
| 19 |
+
* **Base model:** Quark‑135M (pretrained on 15 B tokens of general‑purpose and mathematical text)
|
| 20 |
+
* **Instruction tuning:** supervised fine‑tuning on a small, curated dataset of identity‑aware conversations
|
| 21 |
+
* **Developers:** OvercastLab and ThingsAI
|
| 22 |
+
* **License:** Apache‑2.0
|
| 23 |
+
|
| 24 |
+
---
|
| 25 |
+
|
| 26 |
+
## Model Architecture
|
| 27 |
+
|
| 28 |
+
The model follows a **Llama‑style decoder‑only transformer** (similar to SmolLM) with the following components:
|
| 29 |
+
|
| 30 |
+
| Component | Value |
|
| 31 |
+
|-------------------|----------------------|
|
| 32 |
+
| Vocab size | 49 152 |
|
| 33 |
+
| Hidden size (`d_model`) | 576 |
|
| 34 |
+
| Number of layers | 30 |
|
| 35 |
+
| Attention heads | 9 |
|
| 36 |
+
| KV heads (GQA) | 3 |
|
| 37 |
+
| Head dim | 64 |
|
| 38 |
+
| FFN dimension | 1 536 |
|
| 39 |
+
| Activation | SwiGLU |
|
| 40 |
+
| Normalization | RMSNorm |
|
| 41 |
+
| Positional encoding| Rotary Embeddings (RoPE, θ=10 000) |
|
| 42 |
+
| Max sequence length | 2 048 |
|
| 43 |
+
| Weight tying | Embedding / LM head |
|
| 44 |
+
|
| 45 |
+
**Total trainable parameters:** ~135 M
|
| 46 |
+
|
| 47 |
+
---
|
| 48 |
+
|
| 49 |
+
## Evaluation Results
|
| 50 |
+
|
| 51 |
+
The table below reports zero‑shot performance on several common benchmarks, evaluated using `lm‑eval‑harness` with `apply_chat_template=True`. All scores are shown as percentages.
|
| 52 |
+
|
| 53 |
+
| Benchmark | Metric | Score |
|
| 54 |
+
|---------------------|-----------|--------:|
|
| 55 |
+
| **HellaSwag** | acc_norm | 31.37% |
|
| 56 |
+
| **ARC-Easy** | acc_norm | 41.46% |
|
| 57 |
+
| **ARC-Challenge** | acc_norm | 25.09% |
|
| 58 |
+
| **PIQA** | acc_norm | 61.26% |
|
| 59 |
+
| **MMLU** (avg) | acc | 23.17% |
|
| 60 |
+
| MMLU Humanities | acc | 24.23% |
|
| 61 |
+
| MMLU Social Sciences| acc | 22.59% |
|
| 62 |
+
| MMLU STEM | acc | 22.04% |
|
| 63 |
+
| MMLU Other | acc | 23.27% |
|
| 64 |
+
| **CommonsenseQA** | acc | 20.56% |
|
| 65 |
+
| **OpenBookQA** | acc_norm | 27.20% |
|
| 66 |
+
| **Winogrande** | acc | 50.20% |
|
| 67 |
+
| **TriviaQA** | exact_match | 0.07% |
|
| 68 |
+
|
| 69 |
+
**Key takeaways:**
|
| 70 |
+
|
| 71 |
+
* **HellaSwag (31.37%)** is above random chance (25%) but far below models pre‑trained on hundreds of billions of tokens. This reflects the modest 15 B token pre‑training budget.
|
| 72 |
+
* **PIQA (61.26%)** shows the model has basic physical reasoning, benefiting from the pre‑training mix.
|
| 73 |
+
* **TriviaQA (0.07%)** confirms the model has **almost no factual recall** – it was not exposed to a large enough knowledge corpus.
|
| 74 |
+
* **MMLU (23.17%)** is near random for a 4‑option task, indicating very limited academic knowledge.
|
| 75 |
+
|
| 76 |
+
---
|
| 77 |
+
|
| 78 |
+
## Intended Use
|
| 79 |
+
|
| 80 |
+
Quark‑135M‑Instruct is a **small conversational assistant** that excels at:
|
| 81 |
+
|
| 82 |
+
- Polite, identity‑aware small talk
|
| 83 |
+
- Refusing gracefully when it doesn’t know something
|
| 84 |
+
- Following simple instructions (e.g., greetings, name recall, basic Q&A)
|
| 85 |
+
|
| 86 |
+
It is **not suitable** for tasks requiring factual accuracy, deep reasoning, or reliable knowledge retrieval.
|
| 87 |
+
|
| 88 |
+
---
|
| 89 |
+
|
| 90 |
+
## Limitations
|
| 91 |
+
|
| 92 |
+
* **Small model size** – 135M parameters are an order of magnitude smaller than current frontier models.
|
| 93 |
+
* **Limited world knowledge** – pre‑trained on only 15 B tokens; it lacks the broad coverage of larger models.
|
| 94 |
+
* **Hallucinates frequently** – when asked questions beyond simple greetings or self‑description, it may invent plausible‑sounding but incorrect answers.
|
| 95 |
+
* **Repetitive loops** – may occasionally repeat phrases or get stuck in loops, especially with low temperature sampling.
|
| 96 |
+
* **Instruction coverage** – fine‑tuned on only 1 500 identity examples; it may not handle out‑of‑domain requests gracefully.
|
| 97 |
+
|
| 98 |
+
---
|
| 99 |
+
|
| 100 |
+
## How to Use
|
| 101 |
+
|
| 102 |
+
```python
|
| 103 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 104 |
+
|
| 105 |
+
model_id = "OvercastLab/Quark-135m-Instruct" # (replace with actual HF repo)
|
| 106 |
+
|
| 107 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 108 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 109 |
+
model_id,
|
| 110 |
+
torch_dtype="auto",
|
| 111 |
+
device_map="auto"
|
| 112 |
+
)
|
| 113 |
+
|
| 114 |
+
messages = [
|
| 115 |
+
{"role": "system", "content": "You are Quark, a helpful, respectful and honest AI assistant created by OvercastLab and ThingsAI together with Mich. Always answer as helpfully and accurately as possible."},
|
| 116 |
+
{"role": "user", "content": "Hi, what's your name?"}
|
| 117 |
+
]
|
| 118 |
+
|
| 119 |
+
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
| 120 |
+
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
|
| 121 |
+
|
| 122 |
+
output_ids = model.generate(
|
| 123 |
+
**inputs,
|
| 124 |
+
max_new_tokens=150,
|
| 125 |
+
do_sample=True,
|
| 126 |
+
temperature=0.2,
|
| 127 |
+
top_k=50,
|
| 128 |
+
top_p=0.95,
|
| 129 |
+
repetition_penalty=1.3,
|
| 130 |
+
eos_token_id=tokenizer.convert_tokens_to_ids(["<|user|>", "<|system|>"]) + [tokenizer.eos_token_id],
|
| 131 |
+
)
|
| 132 |
+
response = tokenizer.decode(output_ids[0][inputs.input_ids.shape[1]:], skip_special_tokens=True)
|
| 133 |
+
print(response)
|