gulding commited on
Commit
c4acedd
Β·
verified Β·
1 Parent(s): 94675b8

Update Model Card for Hugging Face audience

Browse files
Files changed (1) hide show
  1. README.md +23 -34
README.md CHANGED
@@ -12,26 +12,28 @@ tags:
12
  - pytorch
13
  ---
14
 
15
- # EmsyAI 🧠
16
 
17
  EmsyAI is a small, decoder-only transformer language model built entirely from scratch in pure PyTorch β€” no `transformers` library, no pre-built blocks. It's an educational project: the goal is to demystify how models like Llama 3, Qwen 2.5, and DeepSeek work internally by actually building every piece β€” tokenizer, attention, RoPE, KV cache, LoRA β€” by hand.
18
 
19
  Full training code, data pipeline, and developer docs live on [GitHub](https://github.com/gulding/EmsyAI). This page is about the model artifact itself: what it is, how to run it, and what to expect.
20
 
21
  > [!WARNING]
22
- > **Read this before you run it:** EmsyAI is a small model (88M active parameters, hosted here) trained on a small, narrow dataset. It is not a general-purpose assistant and won't behave like one β€” treat it as a working demonstration of a from-scratch LLM pipeline, not a production model. See [Limitations](#limitations).
23
 
24
  ### Built from scratch:
25
- - βœ‚οΈ **Hand-rolled byte-pair encoding (BPE)** tokenizer
26
  - πŸ”„ **Rotary position embeddings (RoPE)** via complex tensor rotation
27
- - ⚑ **Grouped-query attention (GQA)**, fused via `F.scaled_dot_product_attention`
28
- - πŸšͺ **SwiGLU** feed-forward layers
29
- - βš–οΈ **RMSNorm** pre-normalization
30
  - πŸ’Ύ **KV caching** for autoregressive inference
31
- - 🎯 **LoRA fine-tuning** across all seven linear projections per block
32
 
33
  ## Quickstart
34
 
 
 
35
  ```bash
36
  ollama run hf.co/gulding/EmsyAI
37
  ```
@@ -41,7 +43,7 @@ or with `llama.cpp`:
41
  llama-cli -hf gulding/EmsyAI:F32
42
  ```
43
 
44
- > **Note:** This currently pulls EmsyAI-v2 (88M params, 1,024-token context, LoRA-instruction-tuned). EmsyAI-v3 "Titan" (178M params, 4,096-token context) is still training and will replace it here once training and instruction-tuning are finished β€” see [Project Status](#project-status) for where that stands right now.
45
 
46
  ## Prompt format
47
 
@@ -55,7 +57,8 @@ Write a Python function to check if a number is prime.
55
 
56
  | File | What it is | Do you need it? |
57
  |---|---|---|
58
- | `emsyai-v3-titan-instruct-f32.gguf` | v3 base model + LoRA adapter, merged and exported to GGUF | **Yes.** This is what Ollama / llama.cpp actually run |
 
59
  | `base_model_154M_step_5000.pt` | Raw PyTorch inference weights | Only if loading it back into the [training code](https://github.com/gulding/EmsyAI) |
60
  | `tokenizer.json` | The trained 16k-vocab BPE tokenizer | Only needed for the PyTorch path, not GGUF |
61
  | `Modelfile` | Ollama configuration β€” prompt template, stop token, temperature | Used automatically by `ollama run` |
@@ -64,40 +67,26 @@ Write a Python function to check if a number is prime.
64
 
65
  ## Model Details
66
 
67
- | Specification | EmsyAI-v2 (hosted here) | EmsyAI-v3 "Titan" (training, not yet published) |
68
  |---|---|---|
69
- | Parameters | 88.1M (tied embeddings) | 153.8M (tied embeddings) |
70
- | Layers | 12 | 16 |
71
- | Hidden dim | 768 | 896 |
72
- | Attention heads | 12 Query / 4 KV (GQA 3:1) | 14 Query / 2 KV (GQA 7:1) |
73
- | FFN dim | 2,048 (SwiGLU) | 2,560 (SwiGLU) |
74
- | Context window | 1,024 tokens | 4,096 tokens |
75
  | Vocab size | 16,000 (custom BPE) | 16,000 (custom BPE) |
76
  | Position encoding | RoPE | RoPE |
77
 
78
- **Training data (v2):** a ~100k-sample hybrid of Cosmopedia v2 (synthetic educational text) and a Python code subset, tokenized with the project's own BPE tokenizer. Instruction-tuned with LoRA (rank 8, alpha 16) on ~20k CodeAlpaca examples.
79
 
80
  ## Project status
81
 
82
- v3 "Titan" is training now, on a ~150M-token decontaminated corpus (checked against HumanEval/MBPP so benchmark problems aren't memorized). In the interest of being upfront about where a from-scratch model actually is mid-training, here's the real trajectory so far β€” perplexity is measured against a 16,000-word vocabulary, so ~16,000 is what random guessing would score:
83
-
84
- | Step | Validation perplexity | What the sample completions look like |
85
- |---|---|---|
86
- | 500 | 36,987 | Empty β€” too early to produce anything |
87
- | 1,000 | 780 | Empty β€” still too early |
88
- | 1,500 | 485 | Fluent-sounding prose, not yet coherent |
89
- | 2,000 | 272 | Python-shaped syntax, not yet logically correct |
90
-
91
- For example, at step 2,000, prompting with `def calculate_fibonacci(n):` produced:
92
- ```python
93
- for j in range(nums) return -1[i] # Return the total += list2.56, 9:4 = 0 for i in arr: x // 2 == 1
94
- ```
95
- Recognizably Python-flavored β€” indentation, keywords, a comment β€” but not yet logically sound. That's the expected order for a small model early in training: surface fluency and syntax arrive before semantic correctness. This card will be updated with the v3 GGUF and real samples once training and instruction-tuning are complete.
96
 
97
  ## Limitations
98
 
99
- - **Small model, small data.** 88.1M active parameters trained on ~100k documents β€” closer in scale to early GPT-2-class experiments than to a modern assistant model.
100
- - **Short context.** 1,024 tokens for the hosted v2 model.
101
  - **No RLHF or preference tuning** β€” only supervised LoRA fine-tuning on instruction-following examples. Expect repetitive, sometimes factually wrong, or off-topic output, especially past a few sentences.
102
  - **Code it writes may not run.** This project's own benchmark only checks that generated Python parses, not that it's logically correct β€” don't assume otherwise.
103
  - **English only**, and narrow in domain (educational text and Python code).
@@ -107,4 +96,4 @@ MIT β€” see [LICENSE](https://github.com/gulding/EmsyAI/blob/main/LICENSE).
107
 
108
  ## Links
109
  - πŸ’» [Source code, training pipeline, and full docs](https://github.com/gulding/EmsyAI)
110
- - πŸ› [Issues / discussions](https://github.com/gulding/EmsyAI/issues)
 
12
  - pytorch
13
  ---
14
 
15
+ # EmsyAI πŸš€
16
 
17
  EmsyAI is a small, decoder-only transformer language model built entirely from scratch in pure PyTorch β€” no `transformers` library, no pre-built blocks. It's an educational project: the goal is to demystify how models like Llama 3, Qwen 2.5, and DeepSeek work internally by actually building every piece β€” tokenizer, attention, RoPE, KV cache, LoRA β€” by hand.
18
 
19
  Full training code, data pipeline, and developer docs live on [GitHub](https://github.com/gulding/EmsyAI). This page is about the model artifact itself: what it is, how to run it, and what to expect.
20
 
21
  > [!WARNING]
22
+ > **Read this before you run it:** EmsyAI is a small model (V3 Titan is 154M parameters) trained on a small, narrow dataset. It is not a general-purpose assistant and won't behave like one β€” treat it as a working demonstration of a from-scratch LLM pipeline, not a production model. See [Limitations](#limitations).
23
 
24
  ### Built from scratch:
25
+ - 🧩 **Hand-rolled byte-pair encoding (BPE)** tokenizer
26
  - πŸ”„ **Rotary position embeddings (RoPE)** via complex tensor rotation
27
+ - 🎯 **Grouped-query attention (GQA)**, fused via `F.scaled_dot_product_attention`
28
+ - 🧠 **SwiGLU** feed-forward layers
29
+ - πŸ“ **RMSNorm** pre-normalization
30
  - πŸ’Ύ **KV caching** for autoregressive inference
31
+ - 🎨 **LoRA fine-tuning** across all seven linear projections per block
32
 
33
  ## Quickstart
34
 
35
+ By default, we serve the latest **V3 Titan** architecture (154M parameters, 4,096-token context window).
36
+
37
  ```bash
38
  ollama run hf.co/gulding/EmsyAI
39
  ```
 
43
  llama-cli -hf gulding/EmsyAI:F32
44
  ```
45
 
46
+ > **Note:** If you are looking for the older **V2** architecture (88M params, 1,024-token context), the `emsyai-v2-instruct-f32.gguf` file is still available in the Files tab.
47
 
48
  ## Prompt format
49
 
 
57
 
58
  | File | What it is | Do you need it? |
59
  |---|---|---|
60
+ | `emsyai-v3-titan-instruct-f32.gguf` | **v3 Titan** base model + LoRA adapter, merged and exported to GGUF | **Yes.** This is what Ollama / llama.cpp actually run by default |
61
+ | `emsyai-v2-instruct-f32.gguf` | **v2** base model + LoRA adapter, merged and exported to GGUF | Optional. Legacy 88M architecture |
62
  | `base_model_154M_step_5000.pt` | Raw PyTorch inference weights | Only if loading it back into the [training code](https://github.com/gulding/EmsyAI) |
63
  | `tokenizer.json` | The trained 16k-vocab BPE tokenizer | Only needed for the PyTorch path, not GGUF |
64
  | `Modelfile` | Ollama configuration β€” prompt template, stop token, temperature | Used automatically by `ollama run` |
 
67
 
68
  ## Model Details
69
 
70
+ | Specification | EmsyAI-v3 "Titan" (Latest) | EmsyAI-v2 (Legacy) |
71
  |---|---|---|
72
+ | Parameters | 153.8M (tied embeddings) | 88.1M (tied embeddings) |
73
+ | Layers | 16 | 12 |
74
+ | Hidden dim | 896 | 768 |
75
+ | Attention heads | 14 Query / 2 KV (GQA 7:1) | 12 Query / 4 KV (GQA 3:1) |
76
+ | FFN dim | 2,560 (SwiGLU) | 2,048 (SwiGLU) |
77
+ | Context window | 4,096 tokens | 1,024 tokens |
78
  | Vocab size | 16,000 (custom BPE) | 16,000 (custom BPE) |
79
  | Position encoding | RoPE | RoPE |
80
 
81
+ **Training data (V3 Titan):** a ~150M-token hybrid of Cosmopedia v2 (synthetic educational text) and a Python code subset, tokenized with the project's own BPE tokenizer. Strict 10-gram decontamination was run against HumanEval and MBPP. Instruction-tuned with LoRA (rank 8, alpha 16) on ~20k CodeAlpaca examples with masked prompt loss.
82
 
83
  ## Project status
84
 
85
+ **V3 Titan is complete.** The model successfully converged during 5,000 steps of pretraining on the 150M-token corpus, followed by 10,000 steps of LoRA instruction tuning. Prompt loss masking (-100) successfully eliminated base-model "topic drift", resulting in a model that strictly outputs the desired python format.
 
 
 
 
 
 
 
 
 
 
 
 
 
86
 
87
  ## Limitations
88
 
89
+ - **Small model, small data.** 154M active parameters trained on ~150M tokens β€” closer in scale to early GPT-2-class experiments than to a modern assistant model.
 
90
  - **No RLHF or preference tuning** β€” only supervised LoRA fine-tuning on instruction-following examples. Expect repetitive, sometimes factually wrong, or off-topic output, especially past a few sentences.
91
  - **Code it writes may not run.** This project's own benchmark only checks that generated Python parses, not that it's logically correct β€” don't assume otherwise.
92
  - **English only**, and narrow in domain (educational text and Python code).
 
96
 
97
  ## Links
98
  - πŸ’» [Source code, training pipeline, and full docs](https://github.com/gulding/EmsyAI)
99
+ - πŸ’¬ [Issues / discussions](https://github.com/gulding/EmsyAI/issues)