ApexDevelopment commited on
Commit
bad775e
·
verified ·
1 Parent(s): ccb203b

Publish corrected 4.96M-parameter Muon checkpoint

Browse files
.gitattributes CHANGED
@@ -1,35 +1,4 @@
1
- *.7z filter=lfs diff=lfs merge=lfs -text
2
- *.arrow filter=lfs diff=lfs merge=lfs -text
3
- *.bin filter=lfs diff=lfs merge=lfs -text
4
- *.bz2 filter=lfs diff=lfs merge=lfs -text
5
- *.ckpt filter=lfs diff=lfs merge=lfs -text
6
- *.ftz filter=lfs diff=lfs merge=lfs -text
7
- *.gz filter=lfs diff=lfs merge=lfs -text
8
- *.h5 filter=lfs diff=lfs merge=lfs -text
9
- *.joblib filter=lfs diff=lfs merge=lfs -text
10
- *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
- *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
- *.model filter=lfs diff=lfs merge=lfs -text
13
- *.msgpack filter=lfs diff=lfs merge=lfs -text
14
- *.npy filter=lfs diff=lfs merge=lfs -text
15
- *.npz filter=lfs diff=lfs merge=lfs -text
16
- *.onnx filter=lfs diff=lfs merge=lfs -text
17
- *.ot filter=lfs diff=lfs merge=lfs -text
18
- *.parquet filter=lfs diff=lfs merge=lfs -text
19
- *.pb filter=lfs diff=lfs merge=lfs -text
20
- *.pickle filter=lfs diff=lfs merge=lfs -text
21
- *.pkl filter=lfs diff=lfs merge=lfs -text
22
- *.pt filter=lfs diff=lfs merge=lfs -text
23
- *.pth filter=lfs diff=lfs merge=lfs -text
24
- *.rar filter=lfs diff=lfs merge=lfs -text
25
- *.safetensors filter=lfs diff=lfs merge=lfs -text
26
- saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
- *.tar.* filter=lfs diff=lfs merge=lfs -text
28
- *.tar filter=lfs diff=lfs merge=lfs -text
29
- *.tflite filter=lfs diff=lfs merge=lfs -text
30
- *.tgz filter=lfs diff=lfs merge=lfs -text
31
- *.wasm filter=lfs diff=lfs merge=lfs -text
32
- *.xz filter=lfs diff=lfs merge=lfs -text
33
- *.zip filter=lfs diff=lfs merge=lfs -text
34
- *.zst filter=lfs diff=lfs merge=lfs -text
35
- *tfevents* filter=lfs diff=lfs merge=lfs -text
 
1
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
2
+ *.bin filter=lfs diff=lfs merge=lfs -text
3
+ *.pt filter=lfs diff=lfs merge=lfs -text
4
+ *.pth filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
LICENSE ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ISC License
2
+
3
+ Copyright 2026 ApexDevelopment
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for any purpose
6
+ with or without fee is hereby granted, provided that the above copyright notice
7
+ and this permission notice appear in all copies.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
10
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
11
+ FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
12
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
13
+ OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
14
+ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
15
+ THIS SOFTWARE.
README.md ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: isc
3
+ language:
4
+ - en
5
+ library_name: transformers
6
+ pipeline_tag: text-generation
7
+ datasets:
8
+ - roneneldan/TinyStories
9
+ tags:
10
+ - gemma4
11
+ - text-generation
12
+ - tiny-llm
13
+ - tinystories
14
+ - experimental
15
+ model-index:
16
+ - name: tinygemma4
17
+ results:
18
+ - task:
19
+ type: text-generation
20
+ name: Text Generation
21
+ dataset:
22
+ type: roneneldan/TinyStories
23
+ name: TinyStories validation
24
+ metrics:
25
+ - type: loss
26
+ name: validation loss
27
+ value: 1.3825
28
+ - type: perplexity
29
+ name: validation perplexity
30
+ value: 3.98
31
+ ---
32
+
33
+ # tinygemma4
34
+
35
+ tinygemma4 is a deliberately tiny, text-only Gemma 4 model trained from scratch on [TinyStories](https://huggingface.co/datasets/roneneldan/TinyStories). It is intended for architecture compatibility checks, inference-engine testing, and small-scale language-model experiments.
36
+
37
+ This is not a useful assistant model. It was trained on simple synthetic stories and should be expected to produce short, child-story-like completions with limited coherence.
38
+
39
+ ## Model Details
40
+
41
+ - Architecture: `Gemma4ForCausalLM`
42
+ - Parameters: 4,964,752
43
+ - Vocabulary: 8192-token byte-level BPE
44
+ - Context length in config: 2048
45
+ - Training block size: 256
46
+ - Hidden size: 128
47
+ - Per-layer input hidden size: 16
48
+ - Layers: 12
49
+ - Attention heads: 4
50
+ - KV heads: 1
51
+ - Head dimension: 32
52
+ - MLP intermediate size: 384
53
+ - Sliding window: 128
54
+ - Full attention layers: 4, 8, 12
55
+ - Embeddings: tied
56
+ - MoE: disabled
57
+ - Multimodal components: none
58
+ - Weight dtype: float32
59
+ - Tensor format: safetensors
60
+
61
+ The checkpoint is saved in ordinary Hugging Face Transformers format. Any runtime with a correct Gemma 4 text implementation and support for these small dimensions should be able to load it.
62
+
63
+ ## Training
64
+
65
+ - Dataset: `roneneldan/TinyStories`
66
+ - Training file: `TinyStoriesV2-GPT4-train.txt`
67
+ - Validation file: `TinyStoriesV2-GPT4-valid.txt`
68
+ - Final training step: 300000
69
+ - Optimizer: Muon + AdamW (Muon for non-embedding matrix parameters; AdamW for embeddings, norms, and scalar parameters)
70
+ - Learning-rate schedule: cosine decay from `3.5e-4` to `3.5e-5`, with 1,000 warmup steps
71
+ - Batch size: 32
72
+ - Random seed: 1337
73
+ - Hardware: AMD Radeon RX 9070 XT, ROCm PyTorch for Windows
74
+ - Training dtype: bf16 autocast where available
75
+
76
+ ## Evaluation
77
+
78
+ Validation was measured during training on held-out TinyStories text with the local training script:
79
+
80
+ - Validation loss: 1.3825
81
+ - Validation perplexity: 3.98
82
+
83
+ These numbers are only for this training setup. Evaluation used 50 shuffled validation batches of 32 sequences at a 256-token block size. They are not general language-understanding benchmarks.
84
+
85
+ The final checkpoint's best tested sampling settings were temperature `0.45`, top-p `0.90`, top-k `50`, and repetition penalty `1.03`. On a small fixed sampling suite, the model remained fluent but still showed repetition, contradictions, pronoun errors, and weak long-range causality.
86
+
87
+ ## Usage
88
+
89
+ ```python
90
+ import torch
91
+ from transformers import AutoModelForCausalLM, AutoTokenizer
92
+
93
+ model_id = "ApexDevelopment/tinygemma4"
94
+
95
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
96
+ model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype="auto")
97
+
98
+ inputs = tokenizer("Once upon a time,", return_tensors="pt")
99
+ outputs = model.generate(
100
+ **inputs,
101
+ max_new_tokens=80,
102
+ do_sample=True,
103
+ temperature=0.45,
104
+ top_p=0.90,
105
+ top_k=50,
106
+ repetition_penalty=1.03,
107
+ pad_token_id=tokenizer.pad_token_id,
108
+ )
109
+
110
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
111
+ ```
112
+
113
+ ## Limitations
114
+
115
+ - The model is tiny and heavily capacity-limited.
116
+ - It is trained only on synthetic TinyStories text.
117
+ - It is not instruction tuned.
118
+ - It is not safety tuned.
119
+ - It can repeat, contradict itself, confuse characters or objects, and produce malformed story fragments.
120
+ - Its coherent range is usually much shorter than the configured 2,048-token context length.
121
+ - It should be used for experimentation and testing, not production.
122
+
123
+ ## Data and License Notes
124
+
125
+ The training dataset card lists TinyStories under `cdla-sharing-1.0`. This model was trained from scratch; it does not contain Gemma weights from Google or weights from TinyLLama-v0.
126
+
127
+ Weights are released under the license declared in the metadata above. Users are responsible for checking whether their intended use is compatible with the dataset license and applicable law.
128
+
129
+ ## Inspiration
130
+
131
+ This project was inspired by [`Maykeye/TinyLLama-v0`](https://huggingface.co/Maykeye/TinyLLama-v0), but uses a Gemma 4 text configuration instead of Llama.
config.json ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Gemma4ForCausalLM"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "attention_k_eq_v": false,
8
+ "bos_token_id": 2,
9
+ "dtype": "float32",
10
+ "enable_moe_block": false,
11
+ "eos_token_id": 1,
12
+ "final_logit_softcapping": null,
13
+ "global_head_dim": 32,
14
+ "head_dim": 32,
15
+ "hidden_activation": "gelu_pytorch_tanh",
16
+ "hidden_size": 128,
17
+ "hidden_size_per_layer_input": 16,
18
+ "initializer_range": 0.02,
19
+ "intermediate_size": 384,
20
+ "layer_types": [
21
+ "sliding_attention",
22
+ "sliding_attention",
23
+ "sliding_attention",
24
+ "full_attention",
25
+ "sliding_attention",
26
+ "sliding_attention",
27
+ "sliding_attention",
28
+ "full_attention",
29
+ "sliding_attention",
30
+ "sliding_attention",
31
+ "sliding_attention",
32
+ "full_attention"
33
+ ],
34
+ "max_position_embeddings": 2048,
35
+ "model_type": "gemma4_text",
36
+ "moe_intermediate_size": null,
37
+ "num_attention_heads": 4,
38
+ "num_experts": 0,
39
+ "num_global_key_value_heads": 1,
40
+ "num_hidden_layers": 12,
41
+ "num_key_value_heads": 1,
42
+ "num_kv_shared_layers": 0,
43
+ "pad_token_id": 0,
44
+ "rms_norm_eps": 1e-06,
45
+ "rope_parameters": {
46
+ "full_attention": {
47
+ "partial_rotary_factor": 1.0,
48
+ "rope_theta": 1000000.0,
49
+ "rope_type": "default"
50
+ },
51
+ "sliding_attention": {
52
+ "rope_theta": 10000.0,
53
+ "rope_type": "default"
54
+ }
55
+ },
56
+ "sliding_window": 128,
57
+ "tie_word_embeddings": true,
58
+ "top_k_experts": null,
59
+ "transformers_version": "5.13.0",
60
+ "use_bidirectional_attention": null,
61
+ "use_cache": true,
62
+ "use_double_wide_mlp": false,
63
+ "vocab_size": 8192,
64
+ "vocab_size_per_layer_input": 8192
65
+ }
generation_config.json ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 2,
3
+ "do_sample": true,
4
+ "eos_token_id": 1,
5
+ "pad_token_id": 0,
6
+ "repetition_penalty": 1.03,
7
+ "temperature": 0.45,
8
+ "top_p": 0.9,
9
+ "transformers_version": "5.13.0",
10
+ "top_k": 50
11
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4fc7d322c15ee9d8817e006b377d13fd4c8fc9a2e7a2e250924b35178b849339
3
+ size 19881840
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "backend": "tokenizers",
3
+ "bos_token": "<bos>",
4
+ "eos_token": "<|endoftext|>",
5
+ "is_local": true,
6
+ "local_files_only": false,
7
+ "model_max_length": 2048,
8
+ "pad_token": "<pad>",
9
+ "tokenizer_class": "TokenizersBackend",
10
+ "unk_token": "<unk>"
11
+ }
training_state.json ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "step": 300000,
3
+ "recipe": {
4
+ "vocab_size": 8192,
5
+ "num_hidden_layers": 12,
6
+ "hidden_size": 128,
7
+ "hidden_size_per_layer_input": 16,
8
+ "intermediate_size": 384,
9
+ "num_attention_heads": 4,
10
+ "num_key_value_heads": 1,
11
+ "head_dim": 32,
12
+ "global_head_dim": 32,
13
+ "sliding_window": 128,
14
+ "max_position_embeddings": 2048,
15
+ "full_attention_every": 4
16
+ },
17
+ "args": {
18
+ "output_dir": "runs\\tiny-gemma4-v3-muon-corrected",
19
+ "cache_dir": "runs\\tiny-gemma4-v3\\cache",
20
+ "init_from": null,
21
+ "data_dir": "data",
22
+ "tokenizer_dir": "runs\\tiny-gemma4-v3\\tokenizer",
23
+ "recipe": "v3",
24
+ "data_mode": null,
25
+ "max_steps": 300000,
26
+ "batch_size": 32,
27
+ "block_size": 256,
28
+ "gradient_accumulation_steps": 1,
29
+ "learning_rate": 0.00035,
30
+ "min_learning_rate": 3.5e-05,
31
+ "warmup_steps": 1000,
32
+ "schedule_start_step": 0,
33
+ "optimizer": "muon",
34
+ "weight_decay": 0.1,
35
+ "grad_clip": 1.0,
36
+ "save_every": 10000,
37
+ "eval_every": 1000,
38
+ "eval_batches": 50,
39
+ "train_char_limit": null,
40
+ "valid_char_limit": null,
41
+ "num_workers": 0,
42
+ "seed": 1337,
43
+ "resume": false,
44
+ "compile": false
45
+ },
46
+ "time": "2026-07-22 21:53:23"
47
+ }