sriksven commited on
Commit
c6435ab
·
verified ·
1 Parent(s): 2e75e97

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +221 -0
README.md CHANGED
@@ -1,3 +1,224 @@
1
  ---
2
  license: mit
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: mit
3
  ---
4
+ # SVEN-175M
5
+
6
+ **A 175M parameter language model trained from scratch for ~$7.**
7
+
8
+ SVEN-175M is the full-scale model in the SVEN family, built entirely from scratch - custom tokenizer, custom architecture, custom training loop. No fine-tuning. No LoRA. Trained on 1.2 billion tokens of real English text, math, code, and instruction data on a single RTX 3090 GPU.
9
+
10
+ ---
11
+
12
+ ## Model Details
13
+
14
+ | | |
15
+ |---|---|
16
+ | **Architecture** | Decoder-only transformer (LLaMA-style) |
17
+ | **Parameters** | 175,215,488 (~175M) |
18
+ | **Context length** | 1,024 tokens |
19
+ | **Vocabulary** | 32,000 (BPE, trained on training corpus) |
20
+ | **Layers** | 16 |
21
+ | **Hidden size** | 896 |
22
+ | **Attention heads** | 16 Q heads, 4 KV heads (GQA) |
23
+ | **FFN hidden size** | 2,660 |
24
+ | **Activation** | SwiGLU |
25
+ | **Positional encoding** | RoPE |
26
+ | **Normalization** | RMSNorm |
27
+ | **Training steps** | 10,000 |
28
+ | **Training tokens** | 1,219,641,241 (~1.2B) |
29
+ | **Final loss** | ~3.0 |
30
+ | **Precision** | bfloat16 |
31
+ | **GPU** | 1x NVIDIA RTX 3090 (24GB) |
32
+ | **Training time** | ~13 hours |
33
+ | **Training cost** | ~$7 |
34
+
35
+ ---
36
+
37
+ ## Training Data
38
+
39
+ Trained on a curated English-only mix of 1.36M documents from 6 public sources:
40
+
41
+ | Source | Documents | Content | Mix |
42
+ |---|---|---|---|
43
+ | FineWeb-Edu | 599,878 | High-quality educational web text | 44% |
44
+ | Wikipedia EN | 199,708 | English Wikipedia articles | 15% |
45
+ | OpenWebMath | 149,098 | Mathematical reasoning and problems | 11% |
46
+ | OpenHermes 2.5 | 149,139 | GPT-4 generated instruction data | 11% |
47
+ | SlimOrca | 98,058 | Curated reasoning and Q&A | 7% |
48
+ | Python codes | 46,376 | Python programming examples | 3% |
49
+ | Code instructions | 118,842 | Code instruction-response pairs | 9% |
50
+ | **Total** | **1,361,099** | **1.2B tokens** | **100%** |
51
+
52
+ All data filtered for English (ASCII ratio + common word detection), quality-filtered for minimum length and content density, and deduplicated before training.
53
+
54
+ **Tokenizer:** Custom BPE tokenizer trained on the full 1.36M document corpus using SentencePiece. 32,000 vocab size. Trained specifically for this model - not borrowed from another project.
55
+
56
+ ---
57
+
58
+ ## Architecture Notes
59
+
60
+ SVEN-175M uses a modern LLaMA-style architecture:
61
+
62
+ - **RoPE** - Rotary positional embeddings applied to Q and K in every attention layer. Better extrapolation than learned positions.
63
+ - **RMSNorm** - Root Mean Square Layer Normalization. No mean subtraction, no bias. Faster than standard LayerNorm.
64
+ - **SwiGLU** - Swish-gated linear unit feed-forward network. Better gradient flow than GELU.
65
+ - **Grouped Query Attention** - 16 query heads, 4 KV heads. 4x memory saving on KV cache with minimal quality loss.
66
+ - **Weight-tied embeddings** - Input token embeddings and output projection share weights. Reduces parameter count without hurting quality.
67
+ - **No bias in linear layers** - Standard for modern LLMs.
68
+ - **Flash Attention 2** - Used during training for faster attention computation.
69
+
70
+ ---
71
+
72
+ ## Training Details
73
+
74
+ ```
75
+ Optimizer: AdamW
76
+ Learning rate: 3e-4 peak, cosine decay to 3e-5
77
+ Warmup steps: 2,000
78
+ Weight decay: 0.1
79
+ Gradient clip: 1.0
80
+ Batch size: 4
81
+ Gradient accumulation steps: 32
82
+ Effective batch size: 128 sequences
83
+ Sequence length: 1,024 tokens
84
+ Training steps: 10,000
85
+ ```
86
+
87
+ Loss curve:
88
+ ```
89
+ step 0: 10.41 (random init, expected log(32000) = 10.37)
90
+ step 1,000: 6.90 (fast early learning)
91
+ step 2,000: 4.05 (warmup complete)
92
+ step 3,000: 3.62 (solid progress)
93
+ step 5,000: 3.37 (checkpoint)
94
+ step 10,000: 3.00 (final)
95
+ ```
96
+
97
+ ---
98
+
99
+ ## Intended Use
100
+
101
+ SVEN-175M is an **English general-purpose language model** trained from scratch as a learning and research project.
102
+
103
+ It is intended for:
104
+ - Text generation and completion in English
105
+ - General question answering on common topics
106
+ - Basic reasoning and instruction following
107
+ - Experimentation and research at small model scale
108
+ - Educational reference for from-scratch LLM training
109
+
110
+ It is **not** intended for:
111
+ - Production use cases requiring reliability
112
+ - Tasks requiring factual accuracy or up-to-date knowledge
113
+ - Safety-critical applications
114
+ - Replacing larger, properly aligned models
115
+
116
+ ---
117
+
118
+ ## Limitations
119
+
120
+ - **No instruction tuning** - this is a base pretrained model, not a chat model. It completes text, it does not follow instructions reliably.
121
+ - **No alignment** - no RLHF, no DPO, no safety training of any kind.
122
+ - **Knowledge cutoff** - trained on a static dataset with no real-time knowledge.
123
+ - **Scale** - 175M parameters is small by modern standards. It cannot match the reasoning or knowledge depth of 7B+ models.
124
+ - **Undertrained** - 1.2B tokens is far below the Chinchilla-optimal ~3.5T tokens for this model size. The model has significant room to improve with more training.
125
+ - **Not benchmarked** - formal ARC, HellaSwag, and PIQA evals have not been run yet.
126
+
127
+ ---
128
+
129
+ ## What's Different About This Model
130
+
131
+ Most models on HuggingFace are fine-tunes or quantizations of existing models. SVEN-175M is trained from random initialization on real data with a custom tokenizer.
132
+
133
+ ```
134
+ Random weights
135
+ +
136
+ Custom 32k BPE tokenizer (trained on this corpus)
137
+ +
138
+ 1.2B tokens of real English data
139
+ +
140
+ LLaMA-style architecture built from scratch
141
+ +
142
+ Single RTX 3090, 13 hours, ~$7
143
+ =
144
+ SVEN-175M
145
+ ```
146
+
147
+ ---
148
+
149
+ ## Model Family
150
+
151
+ | Model | Parameters | Loss | HuggingFace |
152
+ |---|---|---|---|
153
+ | SVEN-10M | 11.5M | 6.90 | sriksven/sven-10m |
154
+ | **SVEN-175M** | **175M** | **3.00** | **sriksven/sven-175m** |
155
+
156
+ ---
157
+
158
+ ## Files
159
+
160
+ | File | Description |
161
+ |---|---|
162
+ | `model.pt` | Full model checkpoint (weights + optimizer state) |
163
+ | `tokenizer.model` | SentencePiece BPE tokenizer model |
164
+ | `tokenizer.vocab` | Tokenizer vocabulary file |
165
+ | `config.yaml` | Model architecture configuration |
166
+
167
+ ---
168
+
169
+ ## Quick Start
170
+
171
+ ```python
172
+ import sentencepiece as spm
173
+ import torch
174
+ from huggingface_hub import hf_hub_download
175
+
176
+ # download files
177
+ model_path = hf_hub_download("sriksven/sven-175m", "model.pt")
178
+ tok_path = hf_hub_download("sriksven/sven-175m", "tokenizer.model")
179
+
180
+ # load tokenizer
181
+ sp = spm.SentencePieceProcessor()
182
+ sp.load(tok_path)
183
+
184
+ # load model (requires sven-175m repo cloned)
185
+ # see github.com/sriksven/sven-175m for full inference code
186
+ ```
187
+
188
+ ---
189
+
190
+ ## Training Infrastructure
191
+
192
+ ```
193
+ Platform: RunPod (cloud GPU rental)
194
+ GPU: NVIDIA RTX 3090 24GB
195
+ Instance type: On-demand
196
+ Cost: $0.46/hr
197
+ Total runtime: ~13 hours
198
+ Total cost: ~$7
199
+ Data stored: RunPod ephemeral disk (deleted after training)
200
+ Weights: HuggingFace Hub (permanent)
201
+ Monitoring: Weights & Biases
202
+ ```
203
+
204
+ ---
205
+
206
+ ## Citation
207
+
208
+ ```
209
+ @misc{sven-175m,
210
+ author = {Sri Krishna Venkatesh},
211
+ title = {SVEN-175M: A 175M Parameter LLM Trained from Scratch},
212
+ year = {2025},
213
+ publisher = {Hugging Face},
214
+ url = {https://huggingface.co/sriksven/sven-175m}
215
+ }
216
+ ```
217
+
218
+ ---
219
+
220
+ ## About
221
+
222
+ SVEN stands for **S**ri Krishna **V**enkat**e**sh — hidden in plain sight.
223
+
224
+ Built from scratch. No shortcuts. ~$7.