aethertp commited on
Commit
54e18af
Β·
verified Β·
1 Parent(s): e610569

Upload folder using huggingface_hub

Browse files
Files changed (6) hide show
  1. README.md +102 -0
  2. chat_template.jinja +4 -0
  3. config.json +17 -0
  4. model.safetensors +3 -0
  5. tokenizer.json +0 -0
  6. tokenizer_config.json +8 -0
README.md ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ license: apache-2.0
5
+ tags:
6
+ - text-generation
7
+ - conversational
8
+ - pytorch
9
+ - safetensors
10
+ - causal-lm
11
+ - slm
12
+ - on-device
13
+ pipeline_tag: text-generation
14
+ widget:
15
+ - text: "<|im_start|>user\nWhat is the capital of France?<|im_end|>\n<|im_start|>assistant\n"
16
+ ---
17
+
18
+ # PicoLM-80M-Instruct πŸš€
19
+
20
+ **PicoLM-80M-Instruct** is an ultra-compact, 80.24-million parameter causal language model designed for extreme efficiency, fast inference, and on-device deployment.
21
+
22
+ Trained completely from scratch on Kaggle dual Tesla T4 GPUs with zero budget, PicoLM-80M proves what can be achieved through strict modern architecture optimizations (SwiGLU, Grouped-Query Attention, RMSNorm, QK-Norm, and Tied Embeddings) paired with dense educational synthetic data.
23
+
24
+ ---
25
+
26
+ ## πŸ“Œ Model Overview
27
+
28
+ - **Developer:** Emre Polat
29
+ - **Parameters:** 80,242,240 (~80.2M)
30
+ - **Context Window:** 2,048 tokens
31
+ - **Vocabulary:** 16,384 (Single-digit regex split, Byte-level BPE)
32
+ - **Format:** Safetensors (FP16)
33
+ - **Primary Language:** English + Python Code
34
+ - **License:** Apache 2.0
35
+
36
+ ---
37
+
38
+ ## πŸ“Š Empirical Benchmark Results (Verified)
39
+
40
+ Unlike models with estimated metrics, all scores below were **empirically measured** directly on the model weights using standard log-likelihood evaluations:
41
+
42
+ | Benchmark / Task | Random Baseline | SmolLM2-135M (HF) | Gemma 3 270M (Google) | PicoLM-80M-Instruct (Ours) |
43
+ | :--- | :--- | :--- | :--- | :--- |
44
+ | **HellaSwag (Commonsense)** | 25.00% | 42.10% | 37.70% | **31.20%** *(+6.2% above random)* |
45
+ | **ARC-Easy (Science QA)** | 25.00% | 58.50% | 57.70% | **25.60%** *(Floor effect)* |
46
+ | **Validation Perplexity** | ~16,384 | β€” | β€” | **14.65** |
47
+ | **Factual QA ("Capital of France")** | Hallucination | Factual | Factual | **"The capital of France is Paris."** |
48
+ | **Stop Token Discipline** | Loops | Strict | Strict | **100% strict `<|im_end|>` termination** |
49
+
50
+ ---
51
+
52
+ ## πŸ—οΈ Architecture Specifications
53
+
54
+ - **Layers:** 20 Transformer blocks (Deep & Thin)
55
+ - **Hidden Dimension ($d_{model}$):** 576
56
+ - **Attention Heads (Q):** 9 (Head dim = 64)
57
+ - **KV Heads (GQA):** 3 (3:1 Grouped-Query Attention)
58
+ - **Intermediate Dimension:** 1536 (SwiGLU)
59
+ - **Normalization:** Pre-RMSNorm with **QK-Norm** (prevents attention logit blowup)
60
+ - **Positional Encoding:** RoPE ($ heta = 10000$)
61
+ - **Weights Tying:** Input embeddings and LM Head weights are shared (Zero parameter waste)
62
+
63
+ ---
64
+
65
+ ## πŸ“š Training Curriculum
66
+
67
+ 1. **Pre-Training (Stage 1 - ~307M Tokens):**
68
+ - 54% Cosmopedia v2 (Textbooks & reasoning)
69
+ - 23% FineWeb-Edu Dedup (Educational web articles)
70
+ - 12% Python-Edu (Algorithms and code syntax)
71
+ - 11% SmolTalk Dialogues
72
+ - Optimization: WSD (Warmup-Stable-Decay) across 2x Tesla T4 GPUs.
73
+ 2. **Chat Alignment (Stage 2 - SFT):**
74
+ - 15,000 curated dialogues from SmolTalk.
75
+ - Strict Prompt-Masking (`ignore_index = -100`) applied so only assistant responses receive loss updates.
76
+
77
+ ---
78
+
79
+ ## πŸ’» Quickstart Inference
80
+
81
+ ```python
82
+ import torch
83
+ from transformers import PreTrainedTokenizerFast
84
+
85
+ # Load tokenizer
86
+ tokenizer = PreTrainedTokenizerFast.from_pretrained("aethertp/PicoLM-80M-Instruct")
87
+
88
+ # Format prompt using ChatML
89
+ user_prompt = "What is the capital of France?"
90
+ formatted = f"<|im_start|>user\n{user_prompt}<|im_end|>\n<|im_start|>assistant\n"
91
+ input_ids = torch.tensor([tokenizer.encode(formatted, add_special_tokens=False)])
92
+
93
+ # Generate response
94
+ # (Model weights available in model.safetensors)
95
+ ```
96
+
97
+ ---
98
+
99
+ ## ⚠️ Limitations
100
+
101
+ - **Factual Depth:** With 80M parameters, the model cannot serve as a reliable encyclopedia for obscure facts. Factual queries should be supported by RAG.
102
+ - **Multi-step Math:** Elementary arithmetic works, but multi-variable algebra requires external verification.
chat_template.jinja ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {% for message in messages %}{{'<|im_start|>' + message['role'] + '
2
+ ' + message['content'] + '<|im_end|>' + '
3
+ '}}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant
4
+ ' }}{% endif %}
config.json ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "PicoLMForCausalLM"
4
+ ],
5
+ "model_type": "picolm",
6
+ "vocab_size": 16384,
7
+ "hidden_size": 576,
8
+ "num_hidden_layers": 20,
9
+ "num_attention_heads": 9,
10
+ "num_key_value_heads": 3,
11
+ "intermediate_size": 1536,
12
+ "max_position_embeddings": 2048,
13
+ "rms_norm_eps": 1e-05,
14
+ "rope_theta": 10000.0,
15
+ "torch_dtype": "float16",
16
+ "transformers_version": "4.45.0"
17
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b5761e07f8e7fe770c67db71dc0189272d188a728a00596d78018334640372a7
3
+ size 179380816
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "backend": "tokenizers",
3
+ "bos_token": "<|endoftext|>",
4
+ "eos_token": "<|endoftext|>",
5
+ "model_max_length": 1000000000000000019884624838656,
6
+ "pad_token": "<|pad|>",
7
+ "tokenizer_class": "TokenizersBackend"
8
+ }