Update README.md
Browse files
README.md
CHANGED
|
@@ -1,73 +1,138 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
-
|
| 8 |
-
-
|
| 9 |
-
-
|
| 10 |
-
-
|
| 11 |
-
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
```python
|
| 27 |
-
from transformers import
|
| 28 |
|
| 29 |
model_name = "OvercastLab/Quark-50m-Instruct"
|
| 30 |
-
model = AutoModelForCausalLM.from_pretrained(model_name, trust_remote_code=True)
|
| 31 |
-
tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
|
| 32 |
-
|
| 33 |
-
inputs = tokenizer("Hello, how are you?", return_tensors="pt")
|
| 34 |
-
outputs = model.generate(**inputs, max_new_tokens=50)
|
| 35 |
-
print(tokenizer.decode(outputs[0]))
|
| 36 |
-
|
| 37 |
-
Training Details
|
| 38 |
-
|
| 39 |
-
Effective batch size: 64 sequences per step (4 micro-batches × 16 gradient accumulation)
|
| 40 |
|
| 41 |
-
|
|
|
|
| 42 |
|
| 43 |
-
|
|
|
|
|
|
|
|
|
|
| 44 |
|
| 45 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
-
|
|
|
|
|
|
|
| 48 |
|
| 49 |
-
|
| 50 |
|
| 51 |
-
|
|
|
|
| 52 |
|
| 53 |
-
|
| 54 |
|
| 55 |
-
|
| 56 |
|
| 57 |
-
|
|
|
|
|
|
|
|
|
|
| 58 |
|
| 59 |
-
|
| 60 |
|
| 61 |
-
|
| 62 |
|
| 63 |
-
|
| 64 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
|
| 66 |
-
|
| 67 |
-
author = {OvercastLab},
|
| 68 |
-
title = {Quark: A 50M Parameter Lightweight Language Model},
|
| 69 |
-
year = {2025},
|
| 70 |
-
publisher = {Hugging Face},
|
| 71 |
-
howpublished = {\url{https://huggingface.co/OvercastLab/Quark-50m-Instruct}}
|
| 72 |
-
}
|
| 73 |
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
- code
|
| 5 |
+
license: apache-2.0
|
| 6 |
+
tags:
|
| 7 |
+
- smol
|
| 8 |
+
- pretraining
|
| 9 |
+
- instruct
|
| 10 |
+
- 50M
|
| 11 |
+
- causal-lm
|
| 12 |
+
- gqa
|
| 13 |
+
- swiglu
|
| 14 |
+
- rmsnorm
|
| 15 |
+
datasets:
|
| 16 |
+
- HuggingFaceTB/smollm-corpus
|
| 17 |
+
metrics:
|
| 18 |
+
- perplexity
|
| 19 |
+
model-index:
|
| 20 |
+
- name: Quark-50m-Instruct
|
| 21 |
+
results: []
|
| 22 |
+
pipeline_tag: text-generation
|
| 23 |
+
---
|
| 24 |
+
|
| 25 |
+
# Quark-50m-Instruct
|
| 26 |
+
|
| 27 |
+
**Quark-50m-Instruct** is a small (≈50M parameters) decoder-only language model, fine-tuned for instruction following.
|
| 28 |
+
It is built on the same architecture as the now‑abandoned “SmolLM” family and was fully pretrained on 5 billion tokens from
|
| 29 |
+
[HuggingFaceTB/smollm‑corpus](https://huggingface.co/datasets/HuggingFaceTB/smollm-corpus).
|
| 30 |
+
|
| 31 |
+
- **Model type:** Causal Language Model (LLaMA‑style decoder)
|
| 32 |
+
- **Architecture:** GQA · SwiGLU · RMSNorm · RoPE · Weight‑tying
|
| 33 |
+
- **Pretraining tokens:** 5 B
|
| 34 |
+
- **Fine‑tuning:** Instruction‑tuned (details below)
|
| 35 |
+
- **Creators:** [OvercastLab](https://huggingface.co/OvercastLab) (research & development lab for ML/AI)
|
| 36 |
+
- **Release date:** 22 April 2026
|
| 37 |
+
|
| 38 |
+
## Model Summary
|
| 39 |
+
|
| 40 |
+
Quark-50m-Instruct is designed to be an efficient assistant that can run on consumer GPUs (e.g., RTX 3070 with 8 GB VRAM)
|
| 41 |
+
and even on CPU for light workloads. It is **not** competitive with large models on knowledge‑intensive tasks,
|
| 42 |
+
but it excels at:
|
| 43 |
+
|
| 44 |
+
- Simple conversational tasks
|
| 45 |
+
- Code generation and explanation (Python)
|
| 46 |
+
- Short text rewriting and summarisation
|
| 47 |
+
- On‑device / edge inference
|
| 48 |
+
|
| 49 |
+
The architecture closely follows the efficient‑small‑LM blueprint popularised by SmolLM:
|
| 50 |
+
|
| 51 |
+
| Component | Details |
|
| 52 |
+
|-------------|-------------------------------|
|
| 53 |
+
| Vocab size | 49,152 |
|
| 54 |
+
| Hidden size | 384 |
|
| 55 |
+
| Layers | 24 |
|
| 56 |
+
| Attention | Grouped Query (6 Q heads, 2 KV heads) |
|
| 57 |
+
| FFN | SwiGLU with 1,024 intermediate |
|
| 58 |
+
| Position | RoPE (θ = 10,000) |
|
| 59 |
+
| Normalisation | RMSNorm (pre‑block) |
|
| 60 |
+
|
| 61 |
+
Total trainable parameters: **≈48 M** (with weight tying).
|
| 62 |
+
|
| 63 |
+
## Uses
|
| 64 |
+
|
| 65 |
+
### Direct Use
|
| 66 |
+
The model can be used via the 🤗 Transformers library for standard text generation.
|
| 67 |
+
It expects chat‑formatted input (see example below).
|
| 68 |
+
|
| 69 |
+
### Downstream Use
|
| 70 |
+
Because of the open Apache‑2.0 license, you may fine‑tune Quark-50m‑Instruct on your own data for
|
| 71 |
+
domain‑specific tasks – for instance, a customer‑support bot, a code reviewer, or a story writer.
|
| 72 |
+
|
| 73 |
+
### Limitations
|
| 74 |
+
- Limited world knowledge (stopped at mid‑2025 pretraining data).
|
| 75 |
+
- Short context window (2,048 tokens).
|
| 76 |
+
- Small size means it can make more factual mistakes than larger models.
|
| 77 |
+
|
| 78 |
+
## How to Get Started
|
| 79 |
|
| 80 |
```python
|
| 81 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 82 |
|
| 83 |
model_name = "OvercastLab/Quark-50m-Instruct"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
|
| 85 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 86 |
+
model = AutoModelForCausalLM.from_pretrained(model_name, device_map="auto")
|
| 87 |
|
| 88 |
+
messages = [
|
| 89 |
+
{"role": "system", "content": "You are Quark, a helpful assistant."},
|
| 90 |
+
{"role": "user", "content": "Explain group query attention in one sentence."}
|
| 91 |
+
]
|
| 92 |
|
| 93 |
+
inputs = tokenizer.apply_chat_template(
|
| 94 |
+
messages,
|
| 95 |
+
tokenize=True,
|
| 96 |
+
add_generation_prompt=True,
|
| 97 |
+
return_tensors="pt"
|
| 98 |
+
).to(model.device)
|
| 99 |
|
| 100 |
+
outputs = model.generate(inputs, max_new_tokens=128)
|
| 101 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))```
|
| 102 |
+
## Training Details
|
| 103 |
|
| 104 |
+
### Pretraining
|
| 105 |
|
| 106 |
+
The base model was pretrained from scratch on a single NVIDIA RTX 3070 (8 GB VRAM).
|
| 107 |
+
Training took approximately **X days** (wall clock) and consumed about **Y kWh** (see [Environmental Impact](#environmental-impact)).
|
| 108 |
|
| 109 |
+
#### Data mix
|
| 110 |
|
| 111 |
+
Quark‑50m was trained on exactly 5 billion tokens sampled from `HuggingFaceTB/smollm-corpus` with the following proportions:
|
| 112 |
|
| 113 |
+
| Subset | Share | Tokens |
|
| 114 |
+
|-------------------|-------|--------|
|
| 115 |
+
| cosmopedia‑v2 | 60% | 3.0 B |
|
| 116 |
+
| fineweb‑edu‑dedup | 40% | 2.0 B |
|
| 117 |
|
| 118 |
+
All data was tokenised with the official [Cosmo2 tokenizer](https://huggingface.co/HuggingFaceTB/cosmo2-tokenizer) (vocab size 49,152).
|
| 119 |
|
| 120 |
+
#### Hyperparameters (pretraining)
|
| 121 |
|
| 122 |
+
| Parameter | Value |
|
| 123 |
+
|-------------------------|----------------------------|
|
| 124 |
+
| Sequence length | 2,048 |
|
| 125 |
+
| Micro‑batch size | 4 |
|
| 126 |
+
| Gradient accumulation | 16 |
|
| 127 |
+
| Effective batch | 64 seqs (≈131k tokens) |
|
| 128 |
+
| Optimizer | AdamW (β₁=0.9, β₂=0.95) |
|
| 129 |
+
| Learning rate | 3e‑4 → 3e‑5 (cosine decay)|
|
| 130 |
+
| Warmup steps | 1,000 |
|
| 131 |
+
| Weight decay | 0.1 |
|
| 132 |
+
| Gradient clipping | 1.0 |
|
| 133 |
+
| Mixed precision | bfloat16 |
|
| 134 |
|
| 135 |
+
### Instruction Fine‑tuning
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 136 |
|
| 137 |
+
The base model was fine‑tuned on a curated set of instruction‑following data (details to be released).
|
| 138 |
+
The fine‑tuning used **LoRA** with the same sequence length and a lower learning rate (1e‑4) for a few thousand steps.
|