N8Programs commited on
Commit
ae597ef
·
verified ·
1 Parent(s): 6a2f157

Upload BF16 final Lil Bard step-25485 model

Browse files
README.md ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: transformers
3
+ pipeline_tag: text-generation
4
+ language:
5
+ - en
6
+ tags:
7
+ - spark-gpt
8
+ - qwen3-moe
9
+ - from-scratch
10
+ - stories
11
+ ---
12
+
13
+ # Lil Bard 172M MoE
14
+
15
+ Lil Bard is a small English story language model pretrained from scratch. It is
16
+ a base model, not an instruction-tuned or chat model.
17
+
18
+ The model has 172,052,992 total parameters and 58,806,784 active parameters per
19
+ token. It uses 16 transformer layers, width 512, 8 feed-forward experts with
20
+ top-2 routing, and a maximum exported context length of 32,768 tokens.
21
+
22
+ ## Usage
23
+
24
+ ```python
25
+ import torch
26
+ from transformers import AutoModelForCausalLM, AutoTokenizer
27
+
28
+ model_id = "N8Programs/lil-bard"
29
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
30
+ model = AutoModelForCausalLM.from_pretrained(
31
+ model_id,
32
+ dtype=torch.bfloat16,
33
+ device_map="auto",
34
+ )
35
+
36
+ inputs = tokenizer("Once upon a time", return_tensors="pt").to(model.device)
37
+ with torch.inference_mode():
38
+ output = model.generate(
39
+ **inputs,
40
+ max_new_tokens=200,
41
+ do_sample=True,
42
+ temperature=0.8,
43
+ top_p=0.95,
44
+ pad_token_id=tokenizer.pad_token_id,
45
+ )
46
+ print(tokenizer.decode(output[0], skip_special_tokens=True))
47
+ ```
48
+
49
+ The tokenizer automatically prepends BOS. Its special-token IDs are EOS 0,
50
+ BOS 8190, and PAD 8191.
51
+
52
+ ## Architecture
53
+
54
+ | Property | Value |
55
+ |---|---:|
56
+ | Total parameters | 172,052,992 |
57
+ | Active parameters/token | 58,806,784 |
58
+ | Layers | 16 |
59
+ | Hidden size | 512 |
60
+ | Attention heads / KV heads | 4 / 2 |
61
+ | Head dimension | 128 |
62
+ | Experts / selected experts | 8 / 2 |
63
+ | Dense MLP size | 1,536 |
64
+ | Expert MLP size | 768 |
65
+ | Vocabulary | 8,192 |
66
+ | Maximum exported context | 32,768 |
67
+ | Published weight dtype | BF16 |
68
+
69
+ The checkpoint uses the stock Transformers `Qwen3MoeForCausalLM` layout.
70
+
71
+ ## Tokenizer
72
+
73
+ The 8,192-entry tokenizer is a byte-level BPE tokenizer trained on a balanced
74
+ 1.5-million-document sample of the corpus. It does not use regex, whitespace,
75
+ or word pretokenization. BOS, EOS, PAD, and UNK are distinct tokens.
76
+
77
+ ## Training data
78
+
79
+ The corpus contained 8,732,634 documents drawn from:
80
+
81
+ - [`klusai/ds-tf1-en-3m`](https://huggingface.co/datasets/klusai/ds-tf1-en-3m)
82
+ - [`karpathy/tinystories-gpt4-clean`](https://huggingface.co/datasets/karpathy/tinystories-gpt4-clean)
83
+ - A deterministic 3-million-row sample of
84
+ [`littlelearner/LittleCurriculum`](https://huggingface.co/datasets/littlelearner/LittleCurriculum)
85
+
86
+ A canonical validation set excluded 1,000 DS-TF1 test rows and 1,000
87
+ TinyStories test rows from training.
88
+
89
+ The model trained for exactly 2,492,032,616 real loss tokens over 25,485
90
+ distributed steps on two NVIDIA GB10 systems. Whole-document packing achieved
91
+ 99.4713% utilization. Training used a local adaptation of
92
+ [`N8python/spark-gpt`](https://github.com/N8python/spark-gpt).
93
+
94
+ The complete training trace is available in the
95
+ [`lil_bard_moe_8x2_full` W&B run](https://wandb.ai/n8programs/sparkgpt/runs/mxk8gln1).
96
+
97
+ ## Evaluation
98
+
99
+ | Evaluation | Result |
100
+ |---|---:|
101
+ | Canonical validation loss | 1.42228 nats/token |
102
+ | ARC-Easy zero-shot accuracy | 32.15% |
103
+ | ARC-Easy zero-shot normalized accuracy | 32.79% |
104
+
105
+ ARC-Easy was evaluated on all 2,376 test questions with lm-eval 0.4.12 in
106
+ BF16, using the base-model prompt format and an explicit BOS token.
107
+
108
+ ## Historical checkpoints
109
+
110
+ To keep ordinary downloads of this repository small, the 25 periodic
111
+ checkpoints are published separately in
112
+ [`N8Programs/lil-bard-checkpts`](https://huggingface.co/N8Programs/lil-bard-checkpts).
113
+ They span step 1,000 through step 25,000 in increments of 1,000.
114
+
115
+ ## Limitations
116
+
117
+ This model was trained primarily on simple synthetic stories. It has limited
118
+ world knowledge and reasoning ability, may produce repetitive or incoherent
119
+ text, and has not been safety-tuned. Do not use it for factual, medical, legal,
120
+ financial, or other high-stakes decisions.
config.json ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Qwen3MoeForCausalLM"
4
+ ],
5
+ "model_type": "qwen3_moe",
6
+ "vocab_size": 8192,
7
+ "hidden_size": 512,
8
+ "num_hidden_layers": 16,
9
+ "intermediate_size": 1536,
10
+ "num_attention_heads": 4,
11
+ "num_key_value_heads": 2,
12
+ "head_dim": 128,
13
+ "hidden_act": "silu",
14
+ "rms_norm_eps": 1e-06,
15
+ "max_position_embeddings": 32768,
16
+ "rope_theta": 1000000.0,
17
+ "rope_scaling": null,
18
+ "attention_bias": false,
19
+ "attention_dropout": 0.0,
20
+ "tie_word_embeddings": false,
21
+ "use_cache": true,
22
+ "bos_token_id": 8190,
23
+ "eos_token_id": 0,
24
+ "pad_token_id": 8191,
25
+ "torch_dtype": "bfloat16",
26
+ "decoder_sparse_step": 1,
27
+ "moe_intermediate_size": 768,
28
+ "num_experts": 8,
29
+ "num_experts_per_tok": 2,
30
+ "norm_topk_prob": true,
31
+ "output_router_logits": false,
32
+ "router_aux_loss_coef": 0.001,
33
+ "mlp_only_layers": [],
34
+ "use_sliding_window": false,
35
+ "sliding_window": null
36
+ }
generation_config.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 8190,
3
+ "eos_token_id": 0,
4
+ "pad_token_id": 8191
5
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d6127bc3df898c2e30efee0cf9f01e13035c895af6f618e4830fea589ca30d91
3
+ size 344125920
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "tokenizer_class": "PreTrainedTokenizerFast",
3
+ "bos_token": "<|beginoftext|>",
4
+ "eos_token": "<|endoftext|>",
5
+ "pad_token": "<|pad|>",
6
+ "model_max_length": 32768,
7
+ "clean_up_tokenization_spaces": false,
8
+ "unk_token": "<|unk|>"
9
+ }