File size: 4,386 Bytes
cd197e3
 
537b7d7
 
 
 
 
 
 
 
 
 
 
 
 
 
50b2df0
7ab6dc3
50b2df0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71c55a8
cd197e3
537b7d7
 
08a6bea
537b7d7
fc97bbd
efe8b1a
 
 
 
 
 
 
 
 
 
 
 
fc97bbd
8c2a88a
fc97bbd
537b7d7
 
 
 
fc97bbd
 
 
 
 
537b7d7
 
fc97bbd
 
537b7d7
fc97bbd
 
537b7d7
fc97bbd
 
537b7d7
 
 
 
a6f51b1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5864993
537b7d7
 
08a6bea
 
 
 
 
 
 
 
 
 
 
 
537b7d7
 
ba1bd8f
537b7d7
 
ff7c5fb
 
 
537b7d7
 
 
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
27
28
29
30
31
32
33
34
35
36
37
38
39
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
---
license: apache-2.0
datasets:
- HuggingFaceFW/fineweb-edu
language:
- en
pipeline_tag: text-generation
library_name: transformers
tags:
- small
- cpu
- supra
- tiny
- mini
- open
- open-source
metrics: null
model-index:
- name: WikiText
  results:
  - task:
      type: text-generation
    dataset:
      name: wikipedia
      type: wikitext
    metrics:
    - name: WikiText
      type: WikiText
      value: 25.16(2500%)
    source:
      name: Self-eval
      url: https://huggingface.co/SupraLabs/Supra-Mini-0.1M
- name: Blimp
  results:
  - task:
      type: text-generation
    dataset:
      name: Blimp
      type: BLiMP
    metrics:
    - name: BLIMP
      type: BLIMP
      value: 0.5(50%)
    source:
      name: Self-eval
      url: https://huggingface.co/SupraLabs/Supra-Mini-0.1M
new_version: SupraLabs/Supra-Mini-v4-2M
---

# 🦅 Supra Mini 0.1M
Supra Mini 0.1M is a very small, yes, very small base model trained on 500 million tokens of Fineweb-Edu for 2 epochs to prove how well very tiny models can perform on world knowledge.

## Model Config

- Parameters: 117,648 (0.1M)
- Architecture: Llama
- Vocab size with custom BPE tokenizer: 250
- Hidden Size: 48
- Intermediate Size: 96
- Hidden Layers: 4
- Attention Heads: 4
- Max Position Embeddings: 256
- Learning rate: 6e-4
- Weight Decay: 0.01

## Final Loss
This model reached a final train loss after 2 epochs of **1.819**.

## Benchmarks

All benchmarks were executed using `lm-eval`.

| Task          | Value        | Random level |
| :------------ | :----------: | -----------: |
| Arc_Easy      | 0.2639       | 0.25 (25%)   |
| Wikitext      | 25.1691      | -            |
| BLiMP         | 0.5177       | 0.5 (50%)    |

## Examples
**Prompt:** "Artificial intelligence is "<br>
**Output:**: "Artificial intelligence is power by the leading the community, the book of the bring and in the made to the production of the back of an installing and consider in the several c"
<br><br>
**Prompt:** "The main concept of physics is "<br>
**Output:**: "The main concept of physics is a struggle of the development of the company of the solution of the work of the first can be some of the supply a part of the state of the management,"
<br><br>
**Prompt:** "Once upon a time, "<br>
**Output:**: "Once upon a time, so that he survey which is a self-described by the series of the surgery of the really a policy of the process of the southern of the material the stu"

## Usage
To use our model, just run this code using HF Transformers to execute the model:
```python3
from transformers import pipeline
import torch

print("[*] Loading model from Hugging Face Hub...")
pipe = pipeline(
    "text-generation", 
    model="SupraLabs/Supra-Mini-0.1M",
    device_map="auto",
    torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32
)

def generate_text(prompt, max_length=50):
    result = pipe(
        prompt, 
        max_new_tokens=max_length,
        do_sample=True,
        temperature=0.5,
        top_k=25,
        top_p=0.9,
        repetition_penalty=1.2,
        pad_token_id=pipe.tokenizer.pad_token_id,
        eos_token_id=pipe.tokenizer.eos_token_id
    )
    return result[0]['generated_text']

test_prompt = "The importance of education is"
print(f"\nPrompt: {test_prompt}")
print("-" * 30)
print("\nOutput:\n" + generate_text(test_prompt))
```

## Use cases

1. Educational research
2. deployment or testing/fine-tuning on edge environments
3. Or more simply, for fun

## Limitations

1. Cannot reason, chat, or code
2. Incoherent more often than not
3. Mostly unfactual

## Training guide
We trained Supra Mini 0.1M on a single T4 GPU in ~45 minutes for 2 epochs.<br>
The full training code can be found in this repo as `run.sh` (easily run the complete pipeline), `train_tokenizer.py` (train costum BPE tokenizer with vocab size of 250), `train.py` (train the model) and `inference.py` (test the model).<br>
The model was trained on the first 500 million tokens of Sample-10BT from Fineweb-Edu using streaming tokenization.

## Overtraining
Yes, this model is heavily overtrained! With about ~212x more data than needed (20 tokens per parameter is chinchilla-optimum - we used ~4250).

## Final thoughts
As the new founded organization **SupraLabs**, we are proud the introduce our first Tiny-LLM to prove that our pipeline is running.<br>
More models will release soon...